The address and the VLAN VID may not be packed in the respective structs. Fix this by comparing the elements individually.
Reported-by: Marek Lindner <lindner_ma...@yahoo.de> Reported-by: Sven Eckelmann <s...@narfation.org> Signed-off-by: Simon Wunderlich <s...@hrz.tu-chemnitz.de> --- bridge_loop_avoidance.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c index 758d921..8313322 100644 --- a/bridge_loop_avoidance.c +++ b/bridge_loop_avoidance.c @@ -77,8 +77,10 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node, { const void *data1 = container_of(node, struct batadv_backbone_gw, hash_entry); + const struct batadv_backbone_gw *gw1 = data1, *gw2 = data2; - return (memcmp(data1, data2, ETH_ALEN + sizeof(short)) == 0 ? 1 : 0); + return (((memcmp(gw1->orig, gw2->orig, ETH_ALEN) == 0) && + (gw1->vid == gw2->vid)) ? 1 : 0); } /* compares address and vid of two claims */ @@ -87,8 +89,10 @@ static int batadv_compare_claim(const struct hlist_node *node, { const void *data1 = container_of(node, struct batadv_claim, hash_entry); + const struct batadv_claim *cl1 = data1, *cl2 = data2; - return (memcmp(data1, data2, ETH_ALEN + sizeof(short)) == 0 ? 1 : 0); + return (((memcmp(cl1->addr, cl2->addr, ETH_ALEN) == 0) && + (cl1->vid == cl2->vid)) ? 1 : 0); } /* free a backbone gw */ -- 1.7.10