bridge: Add per-{Port, VLAN} neighbor suppression
Subsystems (4)
Ido Schimmel
maintainerv2 cover bridge: Add per-{Port, VLAN} neighbor suppression
Background
==========
In order to minimize the flooding of ARP and ND messages in the VXLAN network, EVPN includes provisions [1] that allow participating VTEPs to suppress such messages in case they know the MAC-IP binding and can reply on behalf of the remote host. In Linux, the above is implemented in the bridge driver using a per-port option called "neigh_suppress" that was added in kernel version 4.15 [2].
Motivation
==========
Some applications use ARP messages as keepalives between the application nodes in the network. This works perfectly well when two nodes are connected to the same VTEP. When a node goes down it will stop responding to ARP requests and the other node will notice it immediately.
However, when the two nodes are connected to different VTEPs and neighbor suppression is enabled, the local VTEP will reply to ARP requests even after the remote node went down, until certain timers expire and the EVPN control plane decides to withdraw the MAC/IP Advertisement route for the address. Therefore, some users would like to be able to disable neighbor suppression on VLANs where such applications reside and keep it enabled on the rest.
Implementation
==============
The proposed solution is to allow user space to control neighbor suppression on a per-{Port, VLAN} basis, in a similar fashion to other per-port options that gained per-{Port, VLAN} counterparts such as "mcast_router". This allows users to benefit from the operational simplicity and scalability associated with shared VXLAN devices (i.e., external / collect-metadata mode), while still allowing for per-VLAN/VNI neighbor suppression control.
The user interface is extended with a new "neigh_vlan_suppress" bridge port option that allows user space to enable per-{Port, VLAN} neighbor suppression on the bridge port. When enabled, the existing "neigh_suppress" option has no effect and neighbor suppression is controlled using a new "neigh_suppress" VLAN option. Example usage:
# bridge link set dev vxlan0 neigh_vlan_suppress on # bridge vlan add vid 10 dev vxlan0 # bridge vlan set vid 10 dev vxlan0 neigh_suppress on
Testing
=======
Tested using existing bridge selftests. Added a dedicated selftest in the last patch.
Patchset overview
=================
Patches #1-#5 are preparations.
Patch #6 adds per-{Port, VLAN} neighbor suppression support to the bridge's data path.
Patches #7-#8 add the required netlink attributes to enable the feature.
Patch #9 adds a selftest.
iproute2 patches can be found here [3].
Changelog
=========
Since RFC [4]:
No changes.
[1] https://www.rfc-editor.org/rfc/rfc7432#section-10
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a42317785c898c0ed46db45a33b0cc71b671bf29
[3] https://github.com/idosch/iproute2/tree/submit/neigh_suppress_v1
[4] https://lore.kernel.org/netdev/[email protected]/
Ido Schimmel (9):
bridge: Reorder neighbor suppression check when flooding
bridge: Pass VLAN ID to br_flood()
bridge: Add internal flags for per-{Port, VLAN} neighbor suppression
bridge: Take per-{Port, VLAN} neighbor suppression into account
bridge: Encapsulate data path neighbor suppression logic
bridge: Add per-{Port, VLAN} neighbor suppression data path support
bridge: vlan: Allow setting VLAN neighbor suppression state
bridge: Allow setting per-{Port, VLAN} neighbor suppression state
selftests: net: Add bridge neighbor suppression test
include/linux/if_bridge.h | 1 + include/uapi/linux/if_bridge.h | 1 + include/uapi/linux/if_link.h | 1 + net/bridge/br_arp_nd_proxy.c | 33 +- net/bridge/br_device.c | 8 +- net/bridge/br_forward.c | 8 +- net/bridge/br_if.c | 2 +- net/bridge/br_input.c | 2 +- net/bridge/br_netlink.c | 8 +- net/bridge/br_private.h | 5 +- net/bridge/br_vlan.c | 1 + net/bridge/br_vlan_options.c | 20 +- net/core/rtnetlink.c | 2 +- tools/testing/selftests/net/Makefile | 1 + .../net/test_bridge_neigh_suppress.sh | 862 ++++++++++++++++++ 15 files changed, 936 insertions(+), 19 deletions(-) create mode 100755 tools/testing/selftests/net/test_bridge_neigh_suppress.sh
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH v2 1/9 bridge: Reorder neighbor suppression check when flooding
The bridge does not flood ARP / NS packets for which a reply was sent to bridge ports that have neighbor suppression enabled.
Subsequent patches are going to add per-{Port, VLAN} neighbor suppression, which is going to make it more expensive to check whether neighbor suppression is enabled since a VLAN lookup will be required.
Therefore, instead of unnecessarily performing this lookup for every packet, only perform it for ARP / NS packets for which a reply was sent.
--- net/bridge/br_forward.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/bridge/br_forward.c +2 -2
@@ -224,8 +224,8 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb,/* Do not flood to ports that enable proxy ARP */ if (p->flags &BR_PROXYARP )continue ; -if ((p->flags & (BR_PROXYARP_WIFI |BR_NEIGH_SUPPRESS )) && -BR_INPUT_SKB_CB (skb)->proxyarp_replied) +if (BR_INPUT_SKB_CB (skb)->proxyarp_replied && + (p->flags & (BR_PROXYARP_WIFI |BR_NEIGH_SUPPRESS )))continue ; prev =maybe_deliver (prev, p, skb, local_orig);
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH v2 2/9 bridge: Pass VLAN ID to br_flood()
In reply to Ido SchimmelSubsequent patches are going to add per-{Port, VLAN} neighbor suppression, which will require br_flood() to potentially suppress ARP / NS packets on a per-{Port, VLAN} basis.
As a preparation, pass the VLAN ID of the packet as another argument to br_flood().
--- net/bridge/br_device.c | 8 ++++---- net/bridge/br_forward.c | 3 ++- net/bridge/br_input.c | 2 +- net/bridge/br_private.h | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-)
net/bridge/br_device.c +4 -4
@@ -80,10 +80,10 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) dest =eth_hdr (skb)->h_dest;if (is_broadcast_ether_addr (dest)) { -br_flood (br, skb,BR_PKT_BROADCAST , false, true); +br_flood (br, skb,BR_PKT_BROADCAST , false, true, vid); }else if (is_multicast_ether_addr (dest)) {if (unlikely (netpoll_tx_running (dev))) { -br_flood (br, skb,BR_PKT_MULTICAST , false, true); +br_flood (br, skb,BR_PKT_MULTICAST , false, true, vid); goto out; }if (br_multicast_rcv (&brmctx, &pmctx_null, vlan, skb, vid)) {
@@ -96,11 +96,11 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst))br_multicast_flood (mdst, skb, brmctx, false, true); else -br_flood (br ,skb ,BR_PKT_MULTICAST ,false ,true ); +br_flood (br ,skb ,BR_PKT_MULTICAST ,false ,true ,vid ); }else if ((dst =br_fdb_find_rcu (br, dest, vid)) !=NULL ) {br_forward (dst->dst, skb, false, true); }else { -br_flood (br, skb,BR_PKT_UNICAST , false, true); +br_flood (br, skb,BR_PKT_UNICAST , false, true, vid); } out:rcu_read_unlock ();
net/bridge/br_forward.c +2 -1
@@ -197,7 +197,8 @@ static struct net_bridge_port *maybe_deliver(/* called under rcu_read_lock */ void br_flood (struct net_bridge *br,struct sk_buff *skb, -enum br_pkt_type pkt_type,bool local_rcv,bool local_orig) +enum br_pkt_type pkt_type,bool local_rcv,bool local_orig, +u16 vid) {struct net_bridge_port *prev =NULL ;struct net_bridge_port *p;
net/bridge/br_input.c +1 -1
@@ -207,7 +207,7 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skbbr_forward (dst->dst, skb, local_rcv, false); }else {if (!mcast_hit) -br_flood (br, skb, pkt_type, local_rcv, false); +br_flood (br, skb, pkt_type, local_rcv, false, vid);else br_multicast_flood (mdst, skb, brmctx, local_rcv, false); }
net/bridge/br_private.h +2 -1
@@ -849,7 +849,8 @@ void br_forward(const struct net_bridge_port *to, struct sk_buff *skb, bool local_rcv, bool local_orig);int br_forward_finish (struct net *net,struct sock *sk,struct sk_buff *skb);void br_flood (struct net_bridge *br,struct sk_buff *skb, -enum br_pkt_type pkt_type,bool local_rcv,bool local_orig); +enum br_pkt_type pkt_type,bool local_rcv,bool local_orig, +u16 vid);/* return true if both source port and dest port are isolated */ static inline bool br_skb_isolated(const struct net_bridge_port *to,
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH v2 3/9 bridge: Add internal flags for per-{Port, VLAN} neighbor suppression
In reply to Ido SchimmelAdd two internal flags that will be used to enable / disable per-{Port, VLAN} neighbor suppression:
1. 'BR_NEIGH_VLAN_SUPPRESS': A per-port flag used to indicate that per-{Port, VLAN} neighbor suppression is enabled on the bridge port. When set, 'BR_NEIGH_SUPPRESS' has no effect.
2. 'BR_VLFLAG_NEIGH_SUPPRESS_ENABLED': A per-VLAN flag used to indicate that neighbor suppression is enabled on the given VLAN.
--- include/linux/if_bridge.h | 1 + net/bridge/br_private.h | 1 + 2 files changed, 2 insertions(+)
include/linux/if_bridge.h +1 -0
@@ -60,6 +60,7 @@ struct br_ip_list {#define BR_TX_FWD_OFFLOAD BIT(20)#define BR_PORT_LOCKED BIT(21)#define BR_PORT_MAB BIT(22) +#define BR_NEIGH_VLAN_SUPPRESS BIT(23)#define BR_DEFAULT_AGEING_TIME (300 * HZ)
net/bridge/br_private.h +1 -0
@@ -178,6 +178,7 @@ enum {BR_VLFLAG_ADDED_BY_SWITCHDEV =BIT (1 ),BR_VLFLAG_MCAST_ENABLED =BIT (2 ),BR_VLFLAG_GLOBAL_MCAST_ENABLED =BIT (3 ), + BR_VLFLAG_NEIGH_SUPPRESS_ENABLED = BIT(4), };/**
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH v2 4/9 bridge: Take per-{Port, VLAN} neighbor suppression into account
In reply to Ido SchimmelThe bridge driver gates the neighbor suppression code behind an internal per-bridge flag called 'BROPT_NEIGH_SUPPRESS_ENABLED'. The flag is set when at least one bridge port has neighbor suppression enabled.
As a preparation for per-{Port, VLAN} neighbor suppression, make sure the global flag is also set if per-{Port, VLAN} neighbor suppression is enabled. That is, when the 'BR_NEIGH_VLAN_SUPPRESS' flag is set on at least one bridge port.
--- net/bridge/br_arp_nd_proxy.c | 2 +- net/bridge/br_if.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/bridge/br_arp_nd_proxy.c +1 -1
@@ -30,7 +30,7 @@ void br_recalculate_neigh_suppress_enabled(struct net_bridge *br)bool neigh_suppress = false;list_for_each_entry (p, &br->port_list, list) { -if (p->flags &BR_NEIGH_SUPPRESS ) { +if (p->flags & (BR_NEIGH_SUPPRESS |BR_NEIGH_VLAN_SUPPRESS )) { neigh_suppress = true;break ; }
net/bridge/br_if.c +1 -1
@@ -759,7 +759,7 @@ void br_port_flags_change(struct net_bridge_port *p, unsigned long mask)if (mask &BR_AUTO_MASK )nbp_update_port_count (br); -if (mask &BR_NEIGH_SUPPRESS ) +if (mask & (BR_NEIGH_SUPPRESS |BR_NEIGH_VLAN_SUPPRESS ))br_recalculate_neigh_suppress_enabled (br); }
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH v2 5/9 bridge: Encapsulate data path neighbor suppression logic
In reply to Ido SchimmelCurrently, there are various places in the bridge data path that check whether neighbor suppression is enabled on a given bridge port.
As a preparation for per-{Port, VLAN} neighbor suppression, encapsulate this logic in a function and pass the VLAN ID of the packet as an argument.
--- net/bridge/br_arp_nd_proxy.c | 15 ++++++++++----- net/bridge/br_forward.c | 3 ++- net/bridge/br_private.h | 1 + 3 files changed, 13 insertions(+), 6 deletions(-)
net/bridge/br_arp_nd_proxy.c +10 -5
@@ -158,7 +158,7 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,return ;if (br_opt_get (br,BROPT_NEIGH_SUPPRESS_ENABLED )) { -if (p && (p->flags &BR_NEIGH_SUPPRESS )) +if (br_is_neigh_suppress_enabled (p, vid))return ; if (parp->ar_op != htons(ARPOP_RREQUEST) && parp->ar_op != htons(ARPOP_RREPLY) &&
@@ -202,8 +202,8 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,bool replied = false;if ((p && (p->flags &BR_PROXYARP )) || - (f->dst && (f->dst->flags & (BR_PROXYARP_WIFI | -BR_NEIGH_SUPPRESS )))) { + (f->dst && (f->dst->flags &BR_PROXYARP_WIFI )) || +br_is_neigh_suppress_enabled (f->dst, vid)) {if (!vid)br_arp_send (br, p, skb->dev, sip, tip, sha, n->ha, sha,0 ,0 );
@@ -407,7 +407,7 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br,BR_INPUT_SKB_CB (skb)->proxyarp_replied =0 ; -if (p && (p->flags &BR_NEIGH_SUPPRESS )) +if (br_is_neigh_suppress_enabled (p, vid))return ; if (msg->icmph.icmp6_type == NDISC_NEIGHBOUR_ADVERTISEMENT &&
@@ -461,7 +461,7 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br,if (f) {bool replied = false; -if (f->dst && (f->dst->flags &BR_NEIGH_SUPPRESS )) { +if (br_is_neigh_suppress_enabled (f->dst, vid)) {if (vid !=0 ) br_nd_send(br, p, skb, n, skb->vlan_proto,
@@ -483,3 +483,8 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br, } }#endif + +bool br_is_neigh_suppress_enabled (const struct net_bridge_port *p,u16 vid) +{ +return p && (p->flags &BR_NEIGH_SUPPRESS ); +}
net/bridge/br_forward.c +2 -1
@@ -226,7 +226,8 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb,if (p->flags &BR_PROXYARP )continue ;if (BR_INPUT_SKB_CB (skb)->proxyarp_replied && - (p->flags & (BR_PROXYARP_WIFI |BR_NEIGH_SUPPRESS ))) + ((p->flags &BR_PROXYARP_WIFI ) || +br_is_neigh_suppress_enabled (p, vid)))continue ; prev =maybe_deliver (prev, p, skb, local_orig);
net/bridge/br_private.h +1 -0
@@ -2220,4 +2220,5 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,void br_do_suppress_nd (struct sk_buff *skb,struct net_bridge *br,u16 vid,struct net_bridge_port *p,struct nd_msg *msg);struct nd_msg *br_is_nd_neigh_msg (struct sk_buff *skb,struct nd_msg *m); +bool br_is_neigh_suppress_enabled (const struct net_bridge_port *p,u16 vid);#endif
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH v2 6/9 bridge: Add per-{Port, VLAN} neighbor suppression data path support
In reply to Ido SchimmelWhen the bridge is not VLAN-aware (i.e., VLAN ID is 0), determine if neighbor suppression is enabled on a given bridge port solely based on the existing 'BR_NEIGH_SUPPRESS' flag.
Otherwise, if the bridge is VLAN-aware, first check if per-{Port, VLAN} neighbor suppression is enabled on the given bridge port using the 'BR_NEIGH_VLAN_SUPPRESS' flag. If so, look up the VLAN and check whether it has neighbor suppression enabled based on the per-VLAN 'BR_VLFLAG_NEIGH_SUPPRESS_ENABLED' flag.
If the bridge is VLAN-aware, but the bridge port does not have per-{Port, VLAN} neighbor suppression enabled, then fallback to determine neighbor suppression based on the 'BR_NEIGH_SUPPRESS' flag.
--- net/bridge/br_arp_nd_proxy.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
net/bridge/br_arp_nd_proxy.c +17 -1
@@ -486,5 +486,21 @@ void br_do_suppress_nd(struct sk_buff *skb, struct net_bridge *br,bool br_is_neigh_suppress_enabled (const struct net_bridge_port *p,u16 vid) { -return p && (p->flags &BR_NEIGH_SUPPRESS ); +if (!p) +return false; + +if (!vid) +return !!(p->flags &BR_NEIGH_SUPPRESS ); + +if (p->flags &BR_NEIGH_VLAN_SUPPRESS ) { +struct net_bridge_vlan_group *vg =nbp_vlan_group_rcu (p); +struct net_bridge_vlan *v; + + v =br_vlan_find (vg, vid); +if (!v) +return false; +return !!(v->priv_flags &BR_VLFLAG_NEIGH_SUPPRESS_ENABLED ); + }else { +return !!(p->flags &BR_NEIGH_SUPPRESS ); + } }
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH v2 7/9 bridge: vlan: Allow setting VLAN neighbor suppression state
In reply to Ido SchimmelAdd a new VLAN attribute that allows user space to set the neighbor suppression state of the port VLAN. Example:
# bridge -d -j -p vlan show dev swp1 vid 10 | jq '.[]["vlans"][]["neigh_suppress"]' false # bridge vlan set vid 10 dev swp1 neigh_suppress on # bridge -d -j -p vlan show dev swp1 vid 10 | jq '.[]["vlans"][]["neigh_suppress"]' true # bridge vlan set vid 10 dev swp1 neigh_suppress off # bridge -d -j -p vlan show dev swp1 vid 10 | jq '.[]["vlans"][]["neigh_suppress"]' false
# bridge vlan set vid 10 dev br0 neigh_suppress on Error: bridge: Can't set neigh_suppress for non-port vlans.
--- include/uapi/linux/if_bridge.h | 1 + net/bridge/br_vlan.c | 1 + net/bridge/br_vlan_options.c | 20 +++++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-)
include/uapi/linux/if_bridge.h +1 -0
@@ -525,6 +525,7 @@ enum {BRIDGE_VLANDB_ENTRY_MCAST_ROUTER ,BRIDGE_VLANDB_ENTRY_MCAST_N_GROUPS ,BRIDGE_VLANDB_ENTRY_MCAST_MAX_GROUPS , +BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS , __BRIDGE_VLANDB_ENTRY_MAX, };#define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1)
net/bridge/br_vlan.c +1 -0
@@ -2134,6 +2134,7 @@ static const struct nla_policy br_vlan_db_policy[BRIDGE_VLANDB_ENTRY_MAX + 1] = [BRIDGE_VLANDB_ENTRY_MCAST_ROUTER] = { .type = NLA_U8 }, [BRIDGE_VLANDB_ENTRY_MCAST_N_GROUPS] = { .type = NLA_REJECT }, [BRIDGE_VLANDB_ENTRY_MCAST_MAX_GROUPS] = { .type = NLA_U32 }, + [BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS] = NLA_POLICY_MAX(NLA_U8, 1), }; static int br_vlan_rtm_process_one(struct net_device *dev,
net/bridge/br_vlan_options.c +19 -1
@@ -52,7 +52,9 @@ bool br_vlan_opts_fill(struct sk_buff *skb, const struct net_bridge_vlan *v, const struct net_bridge_port *p) {if (nla_put_u8 (skb,BRIDGE_VLANDB_ENTRY_STATE ,br_vlan_get_state (v)) || - !__vlan_tun_put (skb, v)) + !__vlan_tun_put (skb, v) || +nla_put_u8 (skb,BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS , + !!(v->priv_flags &BR_VLFLAG_NEIGH_SUPPRESS_ENABLED )))return false;#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
@@ -80,6 +82,7 @@ size_t br_vlan_opts_nl_size(void) +nla_total_size (sizeof (u32))/* BRIDGE_VLANDB_ENTRY_MCAST_N_GROUPS */ + nla_total_size(sizeof(u32)) /* BRIDGE_VLANDB_ENTRY_MCAST_MAX_GROUPS */#endif + +nla_total_size (sizeof (u8))/* BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS */ +0 ; }
@@ -239,6 +242,21 @@ static int br_vlan_process_one_opts(const struct net_bridge *br, }#endif +if (tb[BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS ]) { +bool enabled = v->priv_flags &BR_VLFLAG_NEIGH_SUPPRESS_ENABLED ; +bool val =nla_get_u8 (tb[BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS ]); + +if (!p) { +NL_SET_ERR_MSG_MOD (extack,"Can't set neigh_suppress for non-port vlans" ); +return -EINVAL ; + } + +if (val != enabled) { + v->priv_flags ^=BR_VLFLAG_NEIGH_SUPPRESS_ENABLED ; + *changed = true; + } + } +return 0 ; }
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH v2 8/9 bridge: Allow setting per-{Port, VLAN} neighbor suppression state
In reply to Ido SchimmelAdd a new bridge port attribute that allows user space to enable per-{Port, VLAN} neighbor suppression. Example:
# bridge -d -j -p link show dev swp1 | jq '.[]["neigh_vlan_suppress"]' false # bridge link set dev swp1 neigh_vlan_suppress on # bridge -d -j -p link show dev swp1 | jq '.[]["neigh_vlan_suppress"]' true # bridge link set dev swp1 neigh_vlan_suppress off # bridge -d -j -p link show dev swp1 | jq '.[]["neigh_vlan_suppress"]' false
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 8 +++++++- net/core/rtnetlink.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-)
include/uapi/linux/if_link.h +1 -0
@@ -569,6 +569,7 @@ enum {IFLA_BRPORT_MAB ,IFLA_BRPORT_MCAST_N_GROUPS ,IFLA_BRPORT_MCAST_MAX_GROUPS , +IFLA_BRPORT_NEIGH_VLAN_SUPPRESS , __IFLA_BRPORT_MAX };#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
net/bridge/br_netlink.c +7 -1
@@ -189,6 +189,7 @@ static inline size_t br_port_info_size(void) +nla_total_size (1 )/* IFLA_BRPORT_ISOLATED */ +nla_total_size (1 )/* IFLA_BRPORT_LOCKED */ +nla_total_size (1 )/* IFLA_BRPORT_MAB */ + +nla_total_size (1 )/* IFLA_BRPORT_NEIGH_VLAN_SUPPRESS */ +nla_total_size (sizeof (struct ifla_bridge_id ))/* IFLA_BRPORT_ROOT_ID */ +nla_total_size (sizeof (struct ifla_bridge_id ))/* IFLA_BRPORT_BRIDGE_ID */ +nla_total_size (sizeof (u16))/* IFLA_BRPORT_DESIGNATED_PORT */
@@ -278,7 +279,9 @@ static int br_port_fill_attrs(struct sk_buff *skb, !!(p->flags & BR_MRP_LOST_IN_CONT)) ||nla_put_u8 (skb,IFLA_BRPORT_ISOLATED , !!(p->flags &BR_ISOLATED )) ||nla_put_u8 (skb,IFLA_BRPORT_LOCKED , !!(p->flags &BR_PORT_LOCKED )) || - nla_put_u8(skb, IFLA_BRPORT_MAB, !!(p->flags & BR_PORT_MAB))) +nla_put_u8 (skb,IFLA_BRPORT_MAB , !!(p->flags &BR_PORT_MAB )) || +nla_put_u8 (skb,IFLA_BRPORT_NEIGH_VLAN_SUPPRESS , + !!(p->flags & BR_NEIGH_VLAN_SUPPRESS))) return -EMSGSIZE; timerval =br_timer_value (&p->message_age_timer);
@@ -891,6 +894,7 @@ static const struct nla_policy br_port_policy[IFLA_BRPORT_MAX + 1] = { [IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT] = { .type = NLA_U32 }, [IFLA_BRPORT_MCAST_N_GROUPS] = { .type = NLA_REJECT }, [IFLA_BRPORT_MCAST_MAX_GROUPS] = { .type = NLA_U32 }, + [IFLA_BRPORT_NEIGH_VLAN_SUPPRESS] = NLA_POLICY_MAX(NLA_U8, 1), };/* Change the state of the port and notify spanning tree */
@@ -957,6 +961,8 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[],br_set_port_flag (p, tb,IFLA_BRPORT_ISOLATED ,BR_ISOLATED );br_set_port_flag (p, tb,IFLA_BRPORT_LOCKED ,BR_PORT_LOCKED );br_set_port_flag (p, tb,IFLA_BRPORT_MAB ,BR_PORT_MAB ); +br_set_port_flag (p, tb,IFLA_BRPORT_NEIGH_VLAN_SUPPRESS , +BR_NEIGH_VLAN_SUPPRESS );if ((p->flags &BR_PORT_MAB ) && (!(p->flags &BR_PORT_LOCKED ) || !(p->flags &BR_LEARNING ))) {
net/core/rtnetlink.c +1 -1
@@ -61,7 +61,7 @@#include "dev.h" #define RTNL_MAX_TYPE 50 -#define RTNL_SLAVE_MAX_TYPE 42 +#define RTNL_SLAVE_MAX_TYPE 43struct rtnl_link {rtnl_doit_func doit;
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH v2 9/9 selftests: net: Add bridge neighbor suppression test
In reply to Ido SchimmelAdd test cases for bridge neighbor suppression, testing both per-port and per-{Port, VLAN} neighbor suppression with both ARP and NS packets.
Example truncated output:
# ./test_bridge_neigh_suppress.sh [...] Tests passed: 148 Tests failed: 0
--- tools/testing/selftests/net/Makefile | 1 + .../net/test_bridge_neigh_suppress.sh | 862 ++++++++++++++++++ 2 files changed, 863 insertions(+) create mode 100755 tools/testing/selftests/net/test_bridge_neigh_suppress.sh
tools/testing/selftests/net/Makefile +1 -0
@@ -83,6 +83,7 @@ TEST_GEN_FILES += nat6to4.o TEST_GEN_FILES += ip_local_port_range TEST_GEN_FILES += bind_wildcard TEST_PROGS += test_vxlan_mdb.sh +TEST_PROGS += test_bridge_neigh_suppress.sh TEST_FILES := settings
tools/testing/selftests/net/test_bridge_neigh_suppress.sh new file +862 -0
862 lines not on this page · raw message
Signature · 1 line
2.37.3
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 11 lines · On Wed, 19 Apr 2023 18:34:51 +0300 you wrote:
Background
==========In order to minimize the flooding of ARP and ND messages in the VXLAN network, EVPN includes provisions [1] that allow participating VTEPs to suppress such messages in case they know the MAC-IP binding and can reply on behalf of the remote host. In Linux, the above is implemented in the bridge driver using a per-port option called "
neigh_suppress" that was added in kernel version 4.15 [2].[...]
Here is the summary with links:
- [net-next,v2,1/9] bridge: Reorder neighbor suppression check when flooding
https://git.kernel.org/netdev/net-next/c/013a7ce81dd8 - [net-next,v2,2/9] bridge: Pass VLAN ID to br_flood() https://git.kernel.org/netdev/net-next/c/e408336a693e - [net-next,v2,3/9] bridge: Add internal flags for per-{Port, VLAN} neighbor suppression https://git.kernel.org/netdev/net-next/c/a714e3ec2308 - [net-next,v2,4/9] bridge: Take per-{Port, VLAN} neighbor suppression into account https://git.kernel.org/netdev/net-next/c/6be42ed0a5f4 - [net-next,v2,5/9] bridge: Encapsulate data path neighbor suppression logic https://git.kernel.org/netdev/net-next/c/3aca683e0654 - [net-next,v2,6/9] bridge: Add per-{Port, VLAN} neighbor suppression data path support https://git.kernel.org/netdev/net-next/c/412614b1457a - [net-next,v2,7/9] bridge: vlan: Allow setting VLAN neighbor suppression state https://git.kernel.org/netdev/net-next/c/83f6d600796c - [net-next,v2,8/9] bridge: Allow setting per-{Port, VLAN} neighbor suppression state https://git.kernel.org/netdev/net-next/c/160656d7201d - [net-next,v2,9/9] selftests: net: Add bridge neighbor suppression test https://git.kernel.org/netdev/net-next/c/7648ac72dcd7
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html