aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_multicast.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bridge/br_multicast.c')
-rw-r--r--net/bridge/br_multicast.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index a5f4e5769809..568d5bf17534 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -24,7 +24,7 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <net/ip.h> 26#include <net/ip.h>
27#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 27#if IS_ENABLED(CONFIG_IPV6)
28#include <net/ipv6.h> 28#include <net/ipv6.h>
29#include <net/mld.h> 29#include <net/mld.h>
30#include <net/addrconf.h> 30#include <net/addrconf.h>
@@ -36,7 +36,7 @@
36#define mlock_dereference(X, br) \ 36#define mlock_dereference(X, br) \
37 rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock)) 37 rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock))
38 38
39#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 39#if IS_ENABLED(CONFIG_IPV6)
40static inline int ipv6_is_transient_multicast(const struct in6_addr *addr) 40static inline int ipv6_is_transient_multicast(const struct in6_addr *addr)
41{ 41{
42 if (ipv6_addr_is_multicast(addr) && IPV6_ADDR_MC_FLAG_TRANSIENT(addr)) 42 if (ipv6_addr_is_multicast(addr) && IPV6_ADDR_MC_FLAG_TRANSIENT(addr))
@@ -52,7 +52,7 @@ static inline int br_ip_equal(const struct br_ip *a, const struct br_ip *b)
52 switch (a->proto) { 52 switch (a->proto) {
53 case htons(ETH_P_IP): 53 case htons(ETH_P_IP):
54 return a->u.ip4 == b->u.ip4; 54 return a->u.ip4 == b->u.ip4;
55#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 55#if IS_ENABLED(CONFIG_IPV6)
56 case htons(ETH_P_IPV6): 56 case htons(ETH_P_IPV6):
57 return ipv6_addr_equal(&a->u.ip6, &b->u.ip6); 57 return ipv6_addr_equal(&a->u.ip6, &b->u.ip6);
58#endif 58#endif
@@ -65,7 +65,7 @@ static inline int __br_ip4_hash(struct net_bridge_mdb_htable *mdb, __be32 ip)
65 return jhash_1word(mdb->secret, (__force u32)ip) & (mdb->max - 1); 65 return jhash_1word(mdb->secret, (__force u32)ip) & (mdb->max - 1);
66} 66}
67 67
68#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 68#if IS_ENABLED(CONFIG_IPV6)
69static inline int __br_ip6_hash(struct net_bridge_mdb_htable *mdb, 69static inline int __br_ip6_hash(struct net_bridge_mdb_htable *mdb,
70 const struct in6_addr *ip) 70 const struct in6_addr *ip)
71{ 71{
@@ -79,7 +79,7 @@ static inline int br_ip_hash(struct net_bridge_mdb_htable *mdb,
79 switch (ip->proto) { 79 switch (ip->proto) {
80 case htons(ETH_P_IP): 80 case htons(ETH_P_IP):
81 return __br_ip4_hash(mdb, ip->u.ip4); 81 return __br_ip4_hash(mdb, ip->u.ip4);
82#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 82#if IS_ENABLED(CONFIG_IPV6)
83 case htons(ETH_P_IPV6): 83 case htons(ETH_P_IPV6):
84 return __br_ip6_hash(mdb, &ip->u.ip6); 84 return __br_ip6_hash(mdb, &ip->u.ip6);
85#endif 85#endif
@@ -121,13 +121,13 @@ static struct net_bridge_mdb_entry *br_mdb_ip4_get(
121 return br_mdb_ip_get(mdb, &br_dst); 121 return br_mdb_ip_get(mdb, &br_dst);
122} 122}
123 123
124#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 124#if IS_ENABLED(CONFIG_IPV6)
125static struct net_bridge_mdb_entry *br_mdb_ip6_get( 125static struct net_bridge_mdb_entry *br_mdb_ip6_get(
126 struct net_bridge_mdb_htable *mdb, const struct in6_addr *dst) 126 struct net_bridge_mdb_htable *mdb, const struct in6_addr *dst)
127{ 127{
128 struct br_ip br_dst; 128 struct br_ip br_dst;
129 129
130 ipv6_addr_copy(&br_dst.u.ip6, dst); 130 br_dst.u.ip6 = *dst;
131 br_dst.proto = htons(ETH_P_IPV6); 131 br_dst.proto = htons(ETH_P_IPV6);
132 132
133 return br_mdb_ip_get(mdb, &br_dst); 133 return br_mdb_ip_get(mdb, &br_dst);
@@ -152,9 +152,9 @@ struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br,
152 case htons(ETH_P_IP): 152 case htons(ETH_P_IP):
153 ip.u.ip4 = ip_hdr(skb)->daddr; 153 ip.u.ip4 = ip_hdr(skb)->daddr;
154 break; 154 break;
155#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 155#if IS_ENABLED(CONFIG_IPV6)
156 case htons(ETH_P_IPV6): 156 case htons(ETH_P_IPV6):
157 ipv6_addr_copy(&ip.u.ip6, &ipv6_hdr(skb)->daddr); 157 ip.u.ip6 = ipv6_hdr(skb)->daddr;
158 break; 158 break;
159#endif 159#endif
160 default: 160 default:
@@ -411,7 +411,7 @@ out:
411 return skb; 411 return skb;
412} 412}
413 413
414#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 414#if IS_ENABLED(CONFIG_IPV6)
415static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br, 415static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br,
416 const struct in6_addr *group) 416 const struct in6_addr *group)
417{ 417{
@@ -474,7 +474,7 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br,
474 mldq->mld_cksum = 0; 474 mldq->mld_cksum = 0;
475 mldq->mld_maxdelay = htons((u16)jiffies_to_msecs(interval)); 475 mldq->mld_maxdelay = htons((u16)jiffies_to_msecs(interval));
476 mldq->mld_reserved = 0; 476 mldq->mld_reserved = 0;
477 ipv6_addr_copy(&mldq->mld_mca, group); 477 mldq->mld_mca = *group;
478 478
479 /* checksum */ 479 /* checksum */
480 mldq->mld_cksum = csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, 480 mldq->mld_cksum = csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
@@ -496,7 +496,7 @@ static struct sk_buff *br_multicast_alloc_query(struct net_bridge *br,
496 switch (addr->proto) { 496 switch (addr->proto) {
497 case htons(ETH_P_IP): 497 case htons(ETH_P_IP):
498 return br_ip4_multicast_alloc_query(br, addr->u.ip4); 498 return br_ip4_multicast_alloc_query(br, addr->u.ip4);
499#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 499#if IS_ENABLED(CONFIG_IPV6)
500 case htons(ETH_P_IPV6): 500 case htons(ETH_P_IPV6):
501 return br_ip6_multicast_alloc_query(br, &addr->u.ip6); 501 return br_ip6_multicast_alloc_query(br, &addr->u.ip6);
502#endif 502#endif
@@ -773,7 +773,7 @@ static int br_ip4_multicast_add_group(struct net_bridge *br,
773 return br_multicast_add_group(br, port, &br_group); 773 return br_multicast_add_group(br, port, &br_group);
774} 774}
775 775
776#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 776#if IS_ENABLED(CONFIG_IPV6)
777static int br_ip6_multicast_add_group(struct net_bridge *br, 777static int br_ip6_multicast_add_group(struct net_bridge *br,
778 struct net_bridge_port *port, 778 struct net_bridge_port *port,
779 const struct in6_addr *group) 779 const struct in6_addr *group)
@@ -783,7 +783,7 @@ static int br_ip6_multicast_add_group(struct net_bridge *br,
783 if (!ipv6_is_transient_multicast(group)) 783 if (!ipv6_is_transient_multicast(group))
784 return 0; 784 return 0;
785 785
786 ipv6_addr_copy(&br_group.u.ip6, group); 786 br_group.u.ip6 = *group;
787 br_group.proto = htons(ETH_P_IPV6); 787 br_group.proto = htons(ETH_P_IPV6);
788 788
789 return br_multicast_add_group(br, port, &br_group); 789 return br_multicast_add_group(br, port, &br_group);
@@ -845,7 +845,7 @@ static void br_multicast_send_query(struct net_bridge *br,
845 br_group.proto = htons(ETH_P_IP); 845 br_group.proto = htons(ETH_P_IP);
846 __br_multicast_send_query(br, port, &br_group); 846 __br_multicast_send_query(br, port, &br_group);
847 847
848#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 848#if IS_ENABLED(CONFIG_IPV6)
849 br_group.proto = htons(ETH_P_IPV6); 849 br_group.proto = htons(ETH_P_IPV6);
850 __br_multicast_send_query(br, port, &br_group); 850 __br_multicast_send_query(br, port, &br_group);
851#endif 851#endif
@@ -989,7 +989,7 @@ static int br_ip4_multicast_igmp3_report(struct net_bridge *br,
989 return err; 989 return err;
990} 990}
991 991
992#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 992#if IS_ENABLED(CONFIG_IPV6)
993static int br_ip6_multicast_mld2_report(struct net_bridge *br, 993static int br_ip6_multicast_mld2_report(struct net_bridge *br,
994 struct net_bridge_port *port, 994 struct net_bridge_port *port,
995 struct sk_buff *skb) 995 struct sk_buff *skb)
@@ -1185,7 +1185,7 @@ out:
1185 return err; 1185 return err;
1186} 1186}
1187 1187
1188#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 1188#if IS_ENABLED(CONFIG_IPV6)
1189static int br_ip6_multicast_query(struct net_bridge *br, 1189static int br_ip6_multicast_query(struct net_bridge *br,
1190 struct net_bridge_port *port, 1190 struct net_bridge_port *port,
1191 struct sk_buff *skb) 1191 struct sk_buff *skb)
@@ -1334,7 +1334,7 @@ static void br_ip4_multicast_leave_group(struct net_bridge *br,
1334 br_multicast_leave_group(br, port, &br_group); 1334 br_multicast_leave_group(br, port, &br_group);
1335} 1335}
1336 1336
1337#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 1337#if IS_ENABLED(CONFIG_IPV6)
1338static void br_ip6_multicast_leave_group(struct net_bridge *br, 1338static void br_ip6_multicast_leave_group(struct net_bridge *br,
1339 struct net_bridge_port *port, 1339 struct net_bridge_port *port,
1340 const struct in6_addr *group) 1340 const struct in6_addr *group)
@@ -1344,7 +1344,7 @@ static void br_ip6_multicast_leave_group(struct net_bridge *br,
1344 if (!ipv6_is_transient_multicast(group)) 1344 if (!ipv6_is_transient_multicast(group))
1345 return; 1345 return;
1346 1346
1347 ipv6_addr_copy(&br_group.u.ip6, group); 1347 br_group.u.ip6 = *group;
1348 br_group.proto = htons(ETH_P_IPV6); 1348 br_group.proto = htons(ETH_P_IPV6);
1349 1349
1350 br_multicast_leave_group(br, port, &br_group); 1350 br_multicast_leave_group(br, port, &br_group);
@@ -1449,7 +1449,7 @@ err_out:
1449 return err; 1449 return err;
1450} 1450}
1451 1451
1452#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 1452#if IS_ENABLED(CONFIG_IPV6)
1453static int br_multicast_ipv6_rcv(struct net_bridge *br, 1453static int br_multicast_ipv6_rcv(struct net_bridge *br,
1454 struct net_bridge_port *port, 1454 struct net_bridge_port *port,
1455 struct sk_buff *skb) 1455 struct sk_buff *skb)
@@ -1458,6 +1458,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
1458 const struct ipv6hdr *ip6h; 1458 const struct ipv6hdr *ip6h;
1459 u8 icmp6_type; 1459 u8 icmp6_type;
1460 u8 nexthdr; 1460 u8 nexthdr;
1461 __be16 frag_off;
1461 unsigned len; 1462 unsigned len;
1462 int offset; 1463 int offset;
1463 int err; 1464 int err;
@@ -1483,7 +1484,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
1483 return -EINVAL; 1484 return -EINVAL;
1484 1485
1485 nexthdr = ip6h->nexthdr; 1486 nexthdr = ip6h->nexthdr;
1486 offset = ipv6_skip_exthdr(skb, sizeof(*ip6h), &nexthdr); 1487 offset = ipv6_skip_exthdr(skb, sizeof(*ip6h), &nexthdr, &frag_off);
1487 1488
1488 if (offset < 0 || nexthdr != IPPROTO_ICMPV6) 1489 if (offset < 0 || nexthdr != IPPROTO_ICMPV6)
1489 return 0; 1490 return 0;
@@ -1595,7 +1596,7 @@ int br_multicast_rcv(struct net_bridge *br, struct net_bridge_port *port,
1595 switch (skb->protocol) { 1596 switch (skb->protocol) {
1596 case htons(ETH_P_IP): 1597 case htons(ETH_P_IP):
1597 return br_multicast_ipv4_rcv(br, port, skb); 1598 return br_multicast_ipv4_rcv(br, port, skb);
1598#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 1599#if IS_ENABLED(CONFIG_IPV6)
1599 case htons(ETH_P_IPV6): 1600 case htons(ETH_P_IPV6):
1600 return br_multicast_ipv6_rcv(br, port, skb); 1601 return br_multicast_ipv6_rcv(br, port, skb);
1601#endif 1602#endif