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