aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv')
-rw-r--r--net/batman-adv/bridge_loop_avoidance.c15
-rw-r--r--net/batman-adv/bridge_loop_avoidance.h5
-rw-r--r--net/batman-adv/soft-interface.c6
3 files changed, 19 insertions, 7 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 8bf97515a77d..c5863f499133 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1351,6 +1351,7 @@ void bla_free(struct bat_priv *bat_priv)
1351 * @bat_priv: the bat priv with all the soft interface information 1351 * @bat_priv: the bat priv with all the soft interface information
1352 * @skb: the frame to be checked 1352 * @skb: the frame to be checked
1353 * @vid: the VLAN ID of the frame 1353 * @vid: the VLAN ID of the frame
1354 * @is_bcast: the packet came in a broadcast packet type.
1354 * 1355 *
1355 * bla_rx avoidance checks if: 1356 * bla_rx avoidance checks if:
1356 * * we have to race for a claim 1357 * * we have to race for a claim
@@ -1361,7 +1362,8 @@ void bla_free(struct bat_priv *bat_priv)
1361 * process the skb. 1362 * process the skb.
1362 * 1363 *
1363 */ 1364 */
1364int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid) 1365int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid,
1366 bool is_bcast)
1365{ 1367{
1366 struct ethhdr *ethhdr; 1368 struct ethhdr *ethhdr;
1367 struct claim search_claim, *claim = NULL; 1369 struct claim search_claim, *claim = NULL;
@@ -1380,7 +1382,7 @@ int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
1380 1382
1381 if (unlikely(atomic_read(&bat_priv->bla_num_requests))) 1383 if (unlikely(atomic_read(&bat_priv->bla_num_requests)))
1382 /* don't allow broadcasts while requests are in flight */ 1384 /* don't allow broadcasts while requests are in flight */
1383 if (is_multicast_ether_addr(ethhdr->h_dest)) 1385 if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast)
1384 goto handled; 1386 goto handled;
1385 1387
1386 memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN); 1388 memcpy(search_claim.addr, ethhdr->h_source, ETH_ALEN);
@@ -1406,8 +1408,13 @@ int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid)
1406 } 1408 }
1407 1409
1408 /* if it is a broadcast ... */ 1410 /* if it is a broadcast ... */
1409 if (is_multicast_ether_addr(ethhdr->h_dest)) { 1411 if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) {
1410 /* ... drop it. the responsible gateway is in charge. */ 1412 /* ... drop it. the responsible gateway is in charge.
1413 *
1414 * We need to check is_bcast because with the gateway
1415 * feature, broadcasts (like DHCP requests) may be sent
1416 * using a unicast packet type.
1417 */
1411 goto handled; 1418 goto handled;
1412 } else { 1419 } else {
1413 /* seems the client considers us as its best gateway. 1420 /* seems the client considers us as its best gateway.
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h
index e39f93acc28f..dc5227b398d4 100644
--- a/net/batman-adv/bridge_loop_avoidance.h
+++ b/net/batman-adv/bridge_loop_avoidance.h
@@ -23,7 +23,8 @@
23#define _NET_BATMAN_ADV_BLA_H_ 23#define _NET_BATMAN_ADV_BLA_H_
24 24
25#ifdef CONFIG_BATMAN_ADV_BLA 25#ifdef CONFIG_BATMAN_ADV_BLA
26int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); 26int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid,
27 bool is_bcast);
27int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid); 28int bla_tx(struct bat_priv *bat_priv, struct sk_buff *skb, short vid);
28int bla_is_backbone_gw(struct sk_buff *skb, 29int bla_is_backbone_gw(struct sk_buff *skb,
29 struct orig_node *orig_node, int hdr_size); 30 struct orig_node *orig_node, int hdr_size);
@@ -41,7 +42,7 @@ void bla_free(struct bat_priv *bat_priv);
41#else /* ifdef CONFIG_BATMAN_ADV_BLA */ 42#else /* ifdef CONFIG_BATMAN_ADV_BLA */
42 43
43static inline int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb, 44static inline int bla_rx(struct bat_priv *bat_priv, struct sk_buff *skb,
44 short vid) 45 short vid, bool is_bcast)
45{ 46{
46 return 0; 47 return 0;
47} 48}
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 6e2530b02043..a0ec0e4ada4c 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -256,7 +256,11 @@ void interface_rx(struct net_device *soft_iface,
256 struct bat_priv *bat_priv = netdev_priv(soft_iface); 256 struct bat_priv *bat_priv = netdev_priv(soft_iface);
257 struct ethhdr *ethhdr; 257 struct ethhdr *ethhdr;
258 struct vlan_ethhdr *vhdr; 258 struct vlan_ethhdr *vhdr;
259 struct batman_header *batadv_header = (struct batman_header *)skb->data;
259 short vid __maybe_unused = -1; 260 short vid __maybe_unused = -1;
261 bool is_bcast;
262
263 is_bcast = (batadv_header->packet_type == BAT_BCAST);
260 264
261 /* check if enough space is available for pulling, and pull */ 265 /* check if enough space is available for pulling, and pull */
262 if (!pskb_may_pull(skb, hdr_size)) 266 if (!pskb_may_pull(skb, hdr_size))
@@ -302,7 +306,7 @@ void interface_rx(struct net_device *soft_iface,
302 /* Let the bridge loop avoidance check the packet. If will 306 /* Let the bridge loop avoidance check the packet. If will
303 * not handle it, we can safely push it up. 307 * not handle it, we can safely push it up.
304 */ 308 */
305 if (bla_rx(bat_priv, skb, vid)) 309 if (bla_rx(bat_priv, skb, vid, is_bcast))
306 goto out; 310 goto out;
307 311
308 netif_rx(skb); 312 netif_rx(skb);