Line data Source code
1 : /*
2 : * hostapd / VLAN definition
3 : * Copyright (c) 2016, Jouni Malinen <j@w1.fi>
4 : *
5 : * This software may be distributed under the terms of the BSD license.
6 : * See README for more details.
7 : */
8 :
9 : #include "utils/includes.h"
10 :
11 : #include "utils/common.h"
12 : #include "ap/vlan.h"
13 :
14 : /* compare the two arguments, NULL is treated as empty
15 : * return zero iff they are equal
16 : */
17 5487 : int vlan_compare(struct vlan_description *a, struct vlan_description *b)
18 : {
19 : int i;
20 5487 : const int a_empty = !a || !a->notempty;
21 5487 : const int b_empty = !b || !b->notempty;
22 :
23 5487 : if (a_empty && b_empty)
24 5351 : return 0;
25 136 : if (a_empty || b_empty)
26 87 : return 1;
27 49 : if (a->untagged != b->untagged)
28 38 : return 1;
29 171 : for (i = 0; i < MAX_NUM_TAGGED_VLAN; i++) {
30 166 : if (a->tagged[i] != b->tagged[i])
31 6 : return 1;
32 : }
33 5 : return 0;
34 : }
|