4a84f5fffc78f9f7c5a90df12f24b00e9b93d176
[feed/routing.git] / batman-adv / patches / 0001-batman-adv-Fix-build-of-multicast-code-against-Linux.patch
1 From: Sven Eckelmann <sven@narfation.org>
2 Date: Fri, 14 May 2021 19:34:35 +0200
3 Subject: batman-adv: Fix build of multicast code against Linux < 5.13
4
5 Fixes: 007b4c4b031f ("batman-adv: convert ifmcaddr6 to RCU")
6 Signed-off-by: Sven Eckelmann <sven@narfation.org>
7
8 --- a/net/batman-adv/multicast.c
9 +++ b/net/batman-adv/multicast.c
10 @@ -431,9 +431,14 @@ batadv_mcast_mla_softif_get_ipv6(struct
11 return 0;
12 }
13
14 +#if LINUX_VERSION_IS_LESS(5, 13, 0)
15 + read_lock_bh(&in6_dev->lock);
16 + for (pmc6 = in6_dev->mc_list; pmc6; pmc6 = pmc6->next) {
17 +#else
18 for (pmc6 = rcu_dereference(in6_dev->mc_list);
19 pmc6;
20 pmc6 = rcu_dereference(pmc6->next)) {
21 +#endif
22 if (IPV6_ADDR_MC_SCOPE(&pmc6->mca_addr) <
23 IPV6_ADDR_SCOPE_LINKLOCAL)
24 continue;
25 @@ -462,6 +467,9 @@ batadv_mcast_mla_softif_get_ipv6(struct
26 hlist_add_head(&new->list, mcast_list);
27 ret++;
28 }
29 +#if LINUX_VERSION_IS_LESS(5, 13, 0)
30 + read_unlock_bh(&in6_dev->lock);
31 +#endif
32 rcu_read_unlock();
33
34 return ret;