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