2016-01-21 14:51:56 +01:00
|
|
|
/*
|
|
|
|
* hostapd / VLAN definition
|
|
|
|
* Copyright (c) 2016, Jouni Malinen <j@w1.fi>
|
|
|
|
*
|
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "utils/includes.h"
|
|
|
|
|
|
|
|
#include "utils/common.h"
|
|
|
|
#include "ap/vlan.h"
|
|
|
|
|
|
|
|
/* compare the two arguments, NULL is treated as empty
|
|
|
|
* return zero iff they are equal
|
|
|
|
*/
|
|
|
|
int vlan_compare(struct vlan_description *a, struct vlan_description *b)
|
|
|
|
{
|
2016-02-21 12:01:39 +01:00
|
|
|
int i;
|
2016-01-21 14:51:56 +01:00
|
|
|
const int a_empty = !a || !a->notempty;
|
|
|
|
const int b_empty = !b || !b->notempty;
|
|
|
|
|
|
|
|
if (a_empty && b_empty)
|
|
|
|
return 0;
|
|
|
|
if (a_empty || b_empty)
|
|
|
|
return 1;
|
|
|
|
if (a->untagged != b->untagged)
|
|
|
|
return 1;
|
2016-02-21 12:01:39 +01:00
|
|
|
for (i = 0; i < MAX_NUM_TAGGED_VLAN; i++) {
|
|
|
|
if (a->tagged[i] != b->tagged[i])
|
|
|
|
return 1;
|
|
|
|
}
|
2016-01-21 14:51:56 +01:00
|
|
|
return 0;
|
|
|
|
}
|