Message ID | 20210509194509.10849-3-linus.luessing@c0d3.blue (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: bridge: split IPv4/v6 mc router state and export for batman-adv | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 6 of 6 maintainers |
netdev/source_inline | fail | Was 0 now: 2 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 14 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 33 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 14 this patch: 0 |
netdev/header_inline | success | Link |
On 09/05/2021 22:45, Linus Lüssing wrote: > In preparation for the upcoming split of multicast router state into > their IPv4 and IPv6 variants and to avoid IPv6 #ifdef clutter later add > two wrapper functions for router node retrieval in the payload > forwarding code. > > Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue> > --- > net/bridge/br_forward.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c > index 3b67184..b5ec4f9 100644 > --- a/net/bridge/br_forward.c > +++ b/net/bridge/br_forward.c > @@ -264,6 +264,16 @@ static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb, > __br_forward(p, skb, local_orig); > } > > +static inline struct hlist_node * > +br_multicast_get_first_rport_node(struct net_bridge *b, struct sk_buff *skb) { > + return rcu_dereference(hlist_first_rcu(&b->ip4_mc_router_list)); > +} > + > +static inline struct net_bridge_port * > +br_multicast_rport_from_node(struct hlist_node *rp, struct sk_buff *skb) { > + return hlist_entry_safe(rp, struct net_bridge_port, ip4_rlist); > +} > + Inline functions in .c files are not allowed, please move these to br_private.h > /* called with rcu_read_lock */ > void br_multicast_flood(struct net_bridge_mdb_entry *mdst, > struct sk_buff *skb, > @@ -276,7 +286,8 @@ void br_multicast_flood(struct net_bridge_mdb_entry *mdst, > bool allow_mode_include = true; > struct hlist_node *rp; > > - rp = rcu_dereference(hlist_first_rcu(&br->router_list)); > + rp = br_multicast_get_first_rport_node(br, skb); > + > if (mdst) { > p = rcu_dereference(mdst->ports); > if (br_multicast_should_handle_mode(br, mdst->addr.proto) && > @@ -290,7 +301,7 @@ void br_multicast_flood(struct net_bridge_mdb_entry *mdst, > struct net_bridge_port *port, *lport, *rport; > > lport = p ? p->key.port : NULL; > - rport = hlist_entry_safe(rp, struct net_bridge_port, ip4_rlist); > + rport = br_multicast_rport_from_node(rp, skb); > > if ((unsigned long)lport > (unsigned long)rport) { > port = lport; >
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 3b67184..b5ec4f9 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c @@ -264,6 +264,16 @@ static void maybe_deliver_addr(struct net_bridge_port *p, struct sk_buff *skb, __br_forward(p, skb, local_orig); } +static inline struct hlist_node * +br_multicast_get_first_rport_node(struct net_bridge *b, struct sk_buff *skb) { + return rcu_dereference(hlist_first_rcu(&b->ip4_mc_router_list)); +} + +static inline struct net_bridge_port * +br_multicast_rport_from_node(struct hlist_node *rp, struct sk_buff *skb) { + return hlist_entry_safe(rp, struct net_bridge_port, ip4_rlist); +} + /* called with rcu_read_lock */ void br_multicast_flood(struct net_bridge_mdb_entry *mdst, struct sk_buff *skb, @@ -276,7 +286,8 @@ void br_multicast_flood(struct net_bridge_mdb_entry *mdst, bool allow_mode_include = true; struct hlist_node *rp; - rp = rcu_dereference(hlist_first_rcu(&br->router_list)); + rp = br_multicast_get_first_rport_node(br, skb); + if (mdst) { p = rcu_dereference(mdst->ports); if (br_multicast_should_handle_mode(br, mdst->addr.proto) && @@ -290,7 +301,7 @@ void br_multicast_flood(struct net_bridge_mdb_entry *mdst, struct net_bridge_port *port, *lport, *rport; lport = p ? p->key.port : NULL; - rport = hlist_entry_safe(rp, struct net_bridge_port, ip4_rlist); + rport = br_multicast_rport_from_node(rp, skb); if ((unsigned long)lport > (unsigned long)rport) { port = lport;
In preparation for the upcoming split of multicast router state into their IPv4 and IPv6 variants and to avoid IPv6 #ifdef clutter later add two wrapper functions for router node retrieval in the payload forwarding code. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue> --- net/bridge/br_forward.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)