Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'batadv-net-pullrequest-20220103' of git://git.open-mesh.org/linux-merge

Simon Wunderlich says:

====================
Here is a batman-adv bugfix:

- avoid sending link-local multicast to multicast routers,
by Linus Lüssing

* tag 'batadv-net-pullrequest-20220103' of git://git.open-mesh.org/linux-merge:
batman-adv: mcast: don't send link-local multicast to mcast routers
====================

Link: https://lore.kernel.org/r/20220103171203.1124980-1-sw@simonwunderlich.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+21 -11
+10 -5
net/batman-adv/multicast.c
··· 1339 1339 * @bat_priv: the bat priv with all the soft interface information 1340 1340 * @skb: The multicast packet to check 1341 1341 * @orig: an originator to be set to forward the skb to 1342 + * @is_routable: stores whether the destination is routable 1342 1343 * 1343 1344 * Return: the forwarding mode as enum batadv_forw_mode and in case of 1344 1345 * BATADV_FORW_SINGLE set the orig to the single originator the skb ··· 1347 1346 */ 1348 1347 enum batadv_forw_mode 1349 1348 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, 1350 - struct batadv_orig_node **orig) 1349 + struct batadv_orig_node **orig, int *is_routable) 1351 1350 { 1352 1351 int ret, tt_count, ip_count, unsnoop_count, total_count; 1353 1352 bool is_unsnoopable = false; 1354 1353 unsigned int mcast_fanout; 1355 1354 struct ethhdr *ethhdr; 1356 - int is_routable = 0; 1357 1355 int rtr_count = 0; 1358 1356 1359 1357 ret = batadv_mcast_forw_mode_check(bat_priv, skb, &is_unsnoopable, 1360 - &is_routable); 1358 + is_routable); 1361 1359 if (ret == -ENOMEM) 1362 1360 return BATADV_FORW_NONE; 1363 1361 else if (ret < 0) ··· 1369 1369 ip_count = batadv_mcast_forw_want_all_ip_count(bat_priv, ethhdr); 1370 1370 unsnoop_count = !is_unsnoopable ? 0 : 1371 1371 atomic_read(&bat_priv->mcast.num_want_all_unsnoopables); 1372 - rtr_count = batadv_mcast_forw_rtr_count(bat_priv, is_routable); 1372 + rtr_count = batadv_mcast_forw_rtr_count(bat_priv, *is_routable); 1373 1373 1374 1374 total_count = tt_count + ip_count + unsnoop_count + rtr_count; 1375 1375 ··· 1689 1689 * @bat_priv: the bat priv with all the soft interface information 1690 1690 * @skb: the multicast packet to transmit 1691 1691 * @vid: the vlan identifier 1692 + * @is_routable: stores whether the destination is routable 1692 1693 * 1693 1694 * Sends copies of a frame with multicast destination to any node that signaled 1694 1695 * interest in it, that is either via the translation table or the according ··· 1702 1701 * is neither IPv4 nor IPv6. NET_XMIT_SUCCESS otherwise. 1703 1702 */ 1704 1703 int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, 1705 - unsigned short vid) 1704 + unsigned short vid, int is_routable) 1706 1705 { 1707 1706 int ret; 1708 1707 ··· 1718 1717 return ret; 1719 1718 } 1720 1719 1720 + if (!is_routable) 1721 + goto skip_mc_router; 1722 + 1721 1723 ret = batadv_mcast_forw_want_rtr(bat_priv, skb, vid); 1722 1724 if (ret != NET_XMIT_SUCCESS) { 1723 1725 kfree_skb(skb); 1724 1726 return ret; 1725 1727 } 1726 1728 1729 + skip_mc_router: 1727 1730 consume_skb(skb); 1728 1731 return ret; 1729 1732 }
+6 -4
net/batman-adv/multicast.h
··· 43 43 44 44 enum batadv_forw_mode 45 45 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, 46 - struct batadv_orig_node **mcast_single_orig); 46 + struct batadv_orig_node **mcast_single_orig, 47 + int *is_routable); 47 48 48 49 int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv, 49 50 struct sk_buff *skb, ··· 52 51 struct batadv_orig_node *orig_node); 53 52 54 53 int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, 55 - unsigned short vid); 54 + unsigned short vid, int is_routable); 56 55 57 56 void batadv_mcast_init(struct batadv_priv *bat_priv); 58 57 ··· 69 68 70 69 static inline enum batadv_forw_mode 71 70 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, 72 - struct batadv_orig_node **mcast_single_orig) 71 + struct batadv_orig_node **mcast_single_orig, 72 + int *is_routable) 73 73 { 74 74 return BATADV_FORW_ALL; 75 75 } ··· 87 85 88 86 static inline int 89 87 batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, 90 - unsigned short vid) 88 + unsigned short vid, int is_routable) 91 89 { 92 90 kfree_skb(skb); 93 91 return NET_XMIT_DROP;
+5 -2
net/batman-adv/soft-interface.c
··· 198 198 int gw_mode; 199 199 enum batadv_forw_mode forw_mode = BATADV_FORW_SINGLE; 200 200 struct batadv_orig_node *mcast_single_orig = NULL; 201 + int mcast_is_routable = 0; 201 202 int network_offset = ETH_HLEN; 202 203 __be16 proto; 203 204 ··· 301 300 send: 302 301 if (do_bcast && !is_broadcast_ether_addr(ethhdr->h_dest)) { 303 302 forw_mode = batadv_mcast_forw_mode(bat_priv, skb, 304 - &mcast_single_orig); 303 + &mcast_single_orig, 304 + &mcast_is_routable); 305 305 if (forw_mode == BATADV_FORW_NONE) 306 306 goto dropped; 307 307 ··· 361 359 ret = batadv_mcast_forw_send_orig(bat_priv, skb, vid, 362 360 mcast_single_orig); 363 361 } else if (forw_mode == BATADV_FORW_SOME) { 364 - ret = batadv_mcast_forw_send(bat_priv, skb, vid); 362 + ret = batadv_mcast_forw_send(bat_priv, skb, vid, 363 + mcast_is_routable); 365 364 } else { 366 365 if (batadv_dat_snoop_outgoing_arp_request(bat_priv, 367 366 skb))