1324714Scy/* 2324714Scy * hostapd / VLAN definition 3324714Scy * Copyright (c) 2016, Jouni Malinen <j@w1.fi> 4324714Scy * 5324714Scy * This software may be distributed under the terms of the BSD license. 6324714Scy * See README for more details. 7324714Scy */ 8324714Scy 9324714Scy#include "utils/includes.h" 10324714Scy 11324714Scy#include "utils/common.h" 12324714Scy#include "ap/vlan.h" 13324714Scy 14324714Scy/* compare the two arguments, NULL is treated as empty 15324714Scy * return zero iff they are equal 16324714Scy */ 17324714Scyint vlan_compare(struct vlan_description *a, struct vlan_description *b) 18324714Scy{ 19324714Scy int i; 20324714Scy const int a_empty = !a || !a->notempty; 21324714Scy const int b_empty = !b || !b->notempty; 22324714Scy 23324714Scy if (a_empty && b_empty) 24324714Scy return 0; 25324714Scy if (a_empty || b_empty) 26324714Scy return 1; 27324714Scy if (a->untagged != b->untagged) 28324714Scy return 1; 29324714Scy for (i = 0; i < MAX_NUM_TAGGED_VLAN; i++) { 30324714Scy if (a->tagged[i] != b->tagged[i]) 31324714Scy return 1; 32324714Scy } 33324714Scy return 0; 34324714Scy} 35