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