diff options
author | Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> | 2012-10-15 16:38:04 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-11-21 06:34:48 -0500 |
commit | c76d15253aeaf8ee3beee932d1950296431bec96 (patch) | |
tree | b4321a31fd8967510ead28ba157da8ee3182d7c2 /net/batman-adv | |
parent | 981d8900291108eebf187fd77736f751e99b6ffd (diff) |
batman-adv: fix bla compare function
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_marek@yahoo.de>
Reported-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv')
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index bda8b1710806..7ffef8b2d4cd 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -77,8 +77,15 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node, | |||
77 | { | 77 | { |
78 | const void *data1 = container_of(node, struct batadv_backbone_gw, | 78 | const void *data1 = container_of(node, struct batadv_backbone_gw, |
79 | hash_entry); | 79 | hash_entry); |
80 | const struct batadv_backbone_gw *gw1 = data1, *gw2 = data2; | ||
80 | 81 | ||
81 | return (memcmp(data1, data2, ETH_ALEN + sizeof(short)) == 0 ? 1 : 0); | 82 | if (!batadv_compare_eth(gw1->orig, gw2->orig)) |
83 | return 0; | ||
84 | |||
85 | if (gw1->vid != gw2->vid) | ||
86 | return 0; | ||
87 | |||
88 | return 1; | ||
82 | } | 89 | } |
83 | 90 | ||
84 | /* compares address and vid of two claims */ | 91 | /* compares address and vid of two claims */ |
@@ -87,8 +94,15 @@ static int batadv_compare_claim(const struct hlist_node *node, | |||
87 | { | 94 | { |
88 | const void *data1 = container_of(node, struct batadv_claim, | 95 | const void *data1 = container_of(node, struct batadv_claim, |
89 | hash_entry); | 96 | hash_entry); |
97 | const struct batadv_claim *cl1 = data1, *cl2 = data2; | ||
90 | 98 | ||
91 | return (memcmp(data1, data2, ETH_ALEN + sizeof(short)) == 0 ? 1 : 0); | 99 | if (!batadv_compare_eth(cl1->addr, cl2->addr)) |
100 | return 0; | ||
101 | |||
102 | if (cl1->vid != cl2->vid) | ||
103 | return 0; | ||
104 | |||
105 | return 1; | ||
92 | } | 106 | } |
93 | 107 | ||
94 | /* free a backbone gw */ | 108 | /* free a backbone gw */ |