bridge: mdb: Add VXLAN attributes support
Subsystems (3)
Ido Schimmel
maintainercover bridge: mdb: Add VXLAN attributes support
Add support for new VXLAN MDB attributes.
See kernel merge commit abf36703d704 ("Merge branch 'vxlan-MDB-support'") for background and motivation.
Patch #1 updates the kernel headers.
Patches #2-#6 add support for the new attributes.
Patch #7 documents the catchall entries in the VXLAN MDB.
See individual commit messages for example usage and output.
Ido Schimmel (7):
Update kernel headers
bridge: mdb: Add underlay destination IP support
bridge: mdb: Add UDP destination port support
bridge: mdb: Add destination VNI support
bridge: mdb: Add source VNI support
bridge: mdb: Add outgoing interface support
bridge: mdb: Document the catchall MDB entries
bridge/mdb.c | 163 ++++++++++++++++++++++++++++++++- include/uapi/linux/if_bridge.h | 10 ++ man/man8/bridge.8 | 52 ++++++++++- 3 files changed, 222 insertions(+), 3 deletions(-)
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH 1/7 Update kernel headers
--- include/uapi/linux/if_bridge.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
include/uapi/linux/if_bridge.h +10 -0
@@ -633,6 +633,11 @@ enum {MDBA_MDB_EATTR_GROUP_MODE ,MDBA_MDB_EATTR_SOURCE ,MDBA_MDB_EATTR_RTPROT , +MDBA_MDB_EATTR_DST , +MDBA_MDB_EATTR_DST_PORT , +MDBA_MDB_EATTR_VNI , +MDBA_MDB_EATTR_IFINDEX , +MDBA_MDB_EATTR_SRC_VNI , __MDBA_MDB_EATTR_MAX };#define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1)
@@ -728,6 +733,11 @@ enum {MDBE_ATTR_SRC_LIST ,MDBE_ATTR_GROUP_MODE ,MDBE_ATTR_RTPROT , +MDBE_ATTR_DST , +MDBE_ATTR_DST_PORT , +MDBE_ATTR_VNI , +MDBE_ATTR_IFINDEX , +MDBE_ATTR_SRC_VNI , __MDBE_ATTR_MAX, };#define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1)
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH 2/7 bridge: mdb: Add underlay destination IP support
In reply to Ido SchimmelAllow user space to program and view VXLAN MDB entries. Specifically, add support for the 'MDBE_ATTR_DST' and 'MDBA_MDB_EATTR_DST' attributes in request and response messages, respectively.
The attributes encode the IP address of the destination VXLAN tunnel endpoint where multicast receivers for the specified multicast flow reside.
Multiple destinations can be added for each flow.
Example:
# bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 198.51.100.1 # bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 192.0.2.1
$ bridge -d -s mdb show dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 192.0.2.1 0.00 dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 198.51.100.1 0.00
$ bridge -d -s -j -p mdb show
[ {
"mdb": [ {
"index": 15,
"dev": "vxlan0",
"port": "vxlan0",
"grp": "239.1.1.1",
"state": "permanent",
"filter_mode": "exclude",
"protocol": "static",
"flags": [ ],
"dst": "192.0.2.1",
"timer": " 0.00"
},{
"index": 15,
"dev": "vxlan0",
"port": "vxlan0",
"grp": "239.1.1.1",
"state": "permanent",
"filter_mode": "exclude",
"protocol": "static",
"flags": [ ],
"dst": "198.51.100.1",
"timer": " 0.00"
} ],
"router": {}
} ]--- bridge/mdb.c | 51 +++++++++++++++++++++++++++++++++++++++++++++-- man/man8/bridge.8 | 15 +++++++++++++- 2 files changed, 63 insertions(+), 3 deletions(-)
bridge/mdb.c +49 -2
@@ -32,7 +32,7 @@ static void usage(void) {fprintf (stderr,"Usage: bridge mdb { add | del | replace } dev DEV port PORT grp GROUP [src SOURCE] [permanent | temp] [vid VID]\n" -" [ filter_mode { include | exclude } ] [ source_list SOURCE_LIST ] [ proto PROTO ]\n" +" [ filter_mode { include | exclude } ] [ source_list SOURCE_LIST ] [ proto PROTO ] [ dst IPADDR ]\n" " bridge mdb {show} [ dev DEV ] [ vid VID ]\n" );exit (-1 ); }
@@ -146,6 +146,21 @@ static void print_src_entry(struct rtattr *src_attr, int af, const char *sep)close_json_object (); } +static void print_dst (const struct rtattr *dst_attr) +{ +SPRINT_BUF (abuf); +int af =AF_INET ; +const void *dst; + +if (RTA_PAYLOAD (dst_attr) ==sizeof (struct in6_addr )) + af =AF_INET6 ; + + dst = (const void *)RTA_DATA (dst_attr); +print_color_string (PRINT_ANY ,ifa_family_color (af), +"dst" ," dst %s" , +inet_ntop (af, dst, abuf,sizeof (abuf))); +} +static void print_mdb_entry (FILE *f,int ifindex,const struct br_mdb_entry *e,struct nlmsghdr *n,struct rtattr **tb) {
@@ -240,6 +255,9 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,if (e->vid)print_uint (PRINT_ANY ,"vid" ," vid %u" , e->vid); +if (tb[MDBA_MDB_EATTR_DST ]) +print_dst (tb[MDBA_MDB_EATTR_DST ]); +if (show_stats && tb && tb[MDBA_MDB_EATTR_TIMER ]) {__u32 timer =rta_getattr_u32 (tb[MDBA_MDB_EATTR_TIMER ]);
@@ -570,6 +588,25 @@ static int mdb_parse_proto(struct nlmsghdr *n, int maxlen, const char *proto)return 0 ; } +static int mdb_parse_dst (struct nlmsghdr *n,int maxlen,const char *dst) +{ +struct in6_addr dst_ip6; +__be32 dst_ip4; + +if (inet_pton (AF_INET , dst, &dst_ip4)) { +addattr32 (n, maxlen,MDBE_ATTR_DST , dst_ip4); +return 0 ; + } + +if (inet_pton (AF_INET6 , dst, &dst_ip6)) { +addattr_l (n, maxlen,MDBE_ATTR_DST , &dst_ip6, +sizeof (dst_ip6)); +return 0 ; + } + +return -1 ; +} +static int mdb_modify (int cmd,int flags,int argc,char **argv) {struct {
@@ -583,7 +620,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) .bpm.family = PF_BRIDGE, };char *d =NULL , *p =NULL , *grp =NULL , *src =NULL , *mode =NULL ; -char *src_list =NULL , *proto =NULL ; +char *src_list =NULL , *proto =NULL , *dst =NULL ;struct br_mdb_entry entry = {};bool set_attrs = false;short vid =0 ;
@@ -622,6 +659,10 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)NEXT_ARG (); proto = *argv; set_attrs = true; + }else if (strcmp (*argv,"dst" ) ==0 ) { +NEXT_ARG (); + dst = *argv; + set_attrs = true; }else {if (matches (*argv,"help" ) ==0 )usage ();
@@ -675,6 +716,12 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)return -1 ; } +if (dst &&mdb_parse_dst (&req.n,sizeof (req), dst)) { +fprintf (stderr,"Invalid underlay destination address \"%s\"\n" , + dst); +return -1 ; + } +addattr_nest_end (&req.n, nest); }
man/man8/bridge.8 +14 -1
@@ -145,7 +145,9 @@ bridge \- show / manipulate bridge addresses and devices .B source_list .IR SOURCE_LIST " ] [ " .B proto -.IR PROTO " ] +.IR PROTO " ] [ " +.B dst +.IR IPADDR " ] .ti -8 .BR "bridge mdb show" " [ "
@@ -969,6 +971,17 @@ then .B static is assumed. +.in -8 +The next command line parameters apply only +when the specified device +.I DEV +is of type VXLAN. + +.TP +.BI dst " IPADDR" +the IP address of the destination +VXLAN tunnel endpoint where the multicast receivers reside. + .in -8 .SS bridge mdb delete - delete a multicast group database entry This command removes an existing mdb entry.
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH 3/7 bridge: mdb: Add UDP destination port support
In reply to Ido SchimmelIn a similar fashion to VXLAN FDB entries, allow user space to program and view the UDP destination port of VXLAN MDB entries. Specifically, add support for the 'MDBE_ATTR_DST_PORT' and 'MDBA_MDB_EATTR_DST_PORT' attributes in request and response messages, respectively.
Use the keyword "dst_port" instead of "port" as the latter is already used to specify the net device associated with the MDB entry.
Example:
# bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 198.51.100.1 dst_port 1234
$ bridge -d -s mdb show dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 198.51.100.1 dst_port 1234 0.00
$ bridge -d -s -j -p mdb show
[ {
"mdb": [ {
"index": 15,
"dev": "vxlan0",
"port": "vxlan0",
"grp": "239.1.1.1",
"state": "permanent",
"filter_mode": "exclude",
"protocol": "static",
"flags": [ ],
"dst": "198.51.100.1",
"dst_port": 1234,
"timer": " 0.00"
} ],
"router": {}
} ]--- bridge/mdb.c | 40 ++++++++++++++++++++++++++++++++++++++++ man/man8/bridge.8 | 10 +++++++++- 2 files changed, 49 insertions(+), 1 deletion(-)
bridge/mdb.c +40 -0
@@ -14,6 +14,7 @@#include <linux/if_ether.h> #include <string.h> #include <arpa/inet.h> +#include <netdb.h> #include "libnetlink.h" #include "utils.h"
@@ -33,6 +34,7 @@ static void usage(void)fprintf (stderr,"Usage: bridge mdb { add | del | replace } dev DEV port PORT grp GROUP [src SOURCE] [permanent | temp] [vid VID]\n" " [ filter_mode { include | exclude } ] [ source_list SOURCE_LIST ] [ proto PROTO ] [ dst IPADDR ]\n" +" [ dst_port DST_PORT ]\n" " bridge mdb {show} [ dev DEV ] [ vid VID ]\n" );exit (-1 ); }
@@ -258,6 +260,10 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,if (tb[MDBA_MDB_EATTR_DST ])print_dst (tb[MDBA_MDB_EATTR_DST ]); +if (tb[MDBA_MDB_EATTR_DST_PORT ]) +print_uint (PRINT_ANY ,"dst_port" ," dst_port %u" , +rta_getattr_u16 (tb[MDBA_MDB_EATTR_DST_PORT ])); +if (show_stats && tb && tb[MDBA_MDB_EATTR_TIMER ]) {__u32 timer =rta_getattr_u32 (tb[MDBA_MDB_EATTR_TIMER ]);
@@ -607,6 +613,29 @@ static int mdb_parse_dst(struct nlmsghdr *n, int maxlen, const char *dst)return -1 ; } +static int mdb_parse_dst_port (struct nlmsghdr *n,int maxlen, +const char *dst_port) +{ +unsigned long port; +char *endptr; + + port =strtoul (dst_port, &endptr,0 ); +if (endptr && *endptr) { +struct servent *pse; + + pse =getservbyname (dst_port,"udp" ); +if (!pse) +return -1 ; + port =ntohs (pse->s_port); + }else if (port >USHRT_MAX ) { +return -1 ; + } + +addattr16 (n, maxlen,MDBE_ATTR_DST_PORT , port); + +return 0 ; +} +static int mdb_modify (int cmd,int flags,int argc,char **argv) {struct {
@@ -621,6 +650,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) };char *d =NULL , *p =NULL , *grp =NULL , *src =NULL , *mode =NULL ;char *src_list =NULL , *proto =NULL , *dst =NULL ; +char *dst_port =NULL ;struct br_mdb_entry entry = {};bool set_attrs = false;short vid =0 ;
@@ -663,6 +693,10 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)NEXT_ARG (); dst = *argv; set_attrs = true; + }else if (strcmp (*argv,"dst_port" ) ==0 ) { +NEXT_ARG (); + dst_port = *argv; + set_attrs = true; }else {if (matches (*argv,"help" ) ==0 )usage ();
@@ -722,6 +756,12 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)return -1 ; } +if (dst_port &&mdb_parse_dst_port (&req.n,sizeof (req), + dst_port)) { +fprintf (stderr,"Invalid destination port \"%s\"\n" , dst_port); +return -1 ; + } +addattr_nest_end (&req.n, nest); }
man/man8/bridge.8 +9 -1
@@ -147,7 +147,9 @@ bridge \- show / manipulate bridge addresses and devices .B proto .IR PROTO " ] [ " .B dst -.IR IPADDR " ] +.IR IPADDR " ] [ " +.B dst_port +.IR DST_PORT " ] .ti -8 .BR "bridge mdb show" " [ "
@@ -982,6 +984,12 @@ is of type VXLAN. the IP address of the destination VXLAN tunnel endpoint where the multicast receivers reside. +.TP +.BI dst_port " DST_PORT" +the UDP destination port number to use to connect to the remote VXLAN tunnel +endpoint. If omitted, the value specified at VXLAN device creation will be +used. + .in -8 .SS bridge mdb delete - delete a multicast group database entry This command removes an existing mdb entry.
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH 4/7 bridge: mdb: Add destination VNI support
In reply to Ido SchimmelIn a similar fashion to VXLAN FDB entries, allow user space to program and view the destination VNI of VXLAN MDB entries. Specifically, add support for the 'MDBE_ATTR_VNI' and 'MDBA_MDB_EATTR_VNI' attributes in request and response messages, respectively.
This is useful when ingress replication (IR) is used and the destination VXLAN tunnel endpoint (VTEP) is not a member of the source broadcast domain (BD). In this case, the ingress VTEP should transmit the packet using the VNI of the Supplementary Broadcast Domain (SBD) in which all the VTEPs are member of [1].
Example:
# bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 198.51.100.1 vni 1111
$ bridge -d -s mdb show dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 198.51.100.1 vni 1111 0.00
$ bridge -d -s -j -p mdb show
[ {
"mdb": [ {
"index": 15,
"dev": "vxlan0",
"port": "vxlan0",
"grp": "239.1.1.1",
"state": "permanent",
"filter_mode": "exclude",
"protocol": "static",
"flags": [ ],
"dst": "198.51.100.1",
"vni": 1111,
"timer": " 0.00"
} ],
"router": {}
} ][1] https://datatracker.ietf.org/doc/html/draft-ietf-bess-evpn-irb-mcast#section-3.2.2
--- bridge/mdb.c | 34 ++++++++++++++++++++++++++++++++-- man/man8/bridge.8 | 10 +++++++++- 2 files changed, 41 insertions(+), 3 deletions(-)
bridge/mdb.c +32 -2
@@ -34,7 +34,7 @@ static void usage(void)fprintf (stderr,"Usage: bridge mdb { add | del | replace } dev DEV port PORT grp GROUP [src SOURCE] [permanent | temp] [vid VID]\n" " [ filter_mode { include | exclude } ] [ source_list SOURCE_LIST ] [ proto PROTO ] [ dst IPADDR ]\n" -" [ dst_port DST_PORT ]\n" +" [ dst_port DST_PORT ] [ vni VNI ]\n" " bridge mdb {show} [ dev DEV ] [ vid VID ]\n" );exit (-1 ); }
@@ -264,6 +264,10 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,print_uint (PRINT_ANY ,"dst_port" ," dst_port %u" ,rta_getattr_u16 (tb[MDBA_MDB_EATTR_DST_PORT ])); +if (tb[MDBA_MDB_EATTR_VNI ]) +print_uint (PRINT_ANY ,"vni" ," vni %u" , +rta_getattr_u32 (tb[MDBA_MDB_EATTR_VNI ])); +if (show_stats && tb && tb[MDBA_MDB_EATTR_TIMER ]) {__u32 timer =rta_getattr_u32 (tb[MDBA_MDB_EATTR_TIMER ]);
@@ -636,6 +640,21 @@ static int mdb_parse_dst_port(struct nlmsghdr *n, int maxlen,return 0 ; } +static int mdb_parse_vni (struct nlmsghdr *n,int maxlen,const char *vni, +int attr_type) +{ +unsigned long vni_num; +char *endptr; + + vni_num =strtoul (vni, &endptr,0 ); +if ((endptr && *endptr) || vni_num ==ULONG_MAX ) +return -1 ; + +addattr32 (n, maxlen, attr_type, vni_num); + +return 0 ; +} +static int mdb_modify (int cmd,int flags,int argc,char **argv) {struct {
@@ -650,7 +669,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) };char *d =NULL , *p =NULL , *grp =NULL , *src =NULL , *mode =NULL ;char *src_list =NULL , *proto =NULL , *dst =NULL ; -char *dst_port =NULL ; +char *dst_port =NULL , *vni =NULL ;struct br_mdb_entry entry = {};bool set_attrs = false;short vid =0 ;
@@ -697,6 +716,10 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)NEXT_ARG (); dst_port = *argv; set_attrs = true; + }else if (strcmp (*argv,"vni" ) ==0 ) { +NEXT_ARG (); + vni = *argv; + set_attrs = true; }else {if (matches (*argv,"help" ) ==0 )usage ();
@@ -762,6 +785,13 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)return -1 ; } +if (vni &&mdb_parse_vni (&req.n,sizeof (req), vni, +MDBE_ATTR_VNI )) { +fprintf (stderr,"Invalid destination VNI \"%s\"\n" , + vni); +return -1 ; + } +addattr_nest_end (&req.n, nest); }
man/man8/bridge.8 +9 -1
@@ -149,7 +149,9 @@ bridge \- show / manipulate bridge addresses and devices .B dst .IR IPADDR " ] [ " .B dst_port -.IR DST_PORT " ] +.IR DST_PORT " ] [ " +.B vni +.IR VNI " ] .ti -8 .BR "bridge mdb show" " [ "
@@ -990,6 +992,12 @@ the UDP destination port number to use to connect to the remote VXLAN tunnel endpoint. If omitted, the value specified at VXLAN device creation will be used. +.TP +.BI vni " VNI" +the VXLAN VNI Network Identifier to use to connect to the remote VXLAN tunnel +endpoint. If omitted, the value specified at VXLAN device creation will be used +or the source VNI when the VXLAN device is in external mode. + .in -8 .SS bridge mdb delete - delete a multicast group database entry This command removes an existing mdb entry.
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH 5/7 bridge: mdb: Add source VNI support
In reply to Ido SchimmelIn a similar fashion to VXLAN FDB entries, allow user space to program and view the source VNI of VXLAN MDB entries. Specifically, add support for the 'MDBE_ATTR_SRC_VNI' and 'MDBA_MDB_EATTR_SRC_VNI' attributes in request and response messages, respectively.
The source VNI is only relevant when the VXLAN device is in external mode, where multiple VNIs can be multiplexed over a single VXLAN device.
Example:
# bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 198.51.100.1 src_vni 2222
$ bridge -d -s mdb show dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 198.51.100.1 src_vni 2222 0.00
$ bridge -d -s -j -p mdb show
[ {
"mdb": [ {
"index": 16,
"dev": "vxlan0",
"port": "vxlan0",
"grp": "239.1.1.1",
"state": "permanent",
"filter_mode": "exclude",
"protocol": "static",
"flags": [ ],
"dst": "198.51.100.1",
"src_vni": 2222,
"timer": " 0.00"
} ],
"router": {}
} ]--- bridge/mdb.c | 18 ++++++++++++++++-- man/man8/bridge.8 | 10 +++++++++- 2 files changed, 25 insertions(+), 3 deletions(-)
bridge/mdb.c +16 -2
@@ -34,7 +34,7 @@ static void usage(void)fprintf (stderr,"Usage: bridge mdb { add | del | replace } dev DEV port PORT grp GROUP [src SOURCE] [permanent | temp] [vid VID]\n" " [ filter_mode { include | exclude } ] [ source_list SOURCE_LIST ] [ proto PROTO ] [ dst IPADDR ]\n" -" [ dst_port DST_PORT ] [ vni VNI ]\n" +" [ dst_port DST_PORT ] [ vni VNI ] [ src_vni SRC_VNI ]\n" " bridge mdb {show} [ dev DEV ] [ vid VID ]\n" );exit (-1 ); }
@@ -268,6 +268,10 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,print_uint (PRINT_ANY ,"vni" ," vni %u" ,rta_getattr_u32 (tb[MDBA_MDB_EATTR_VNI ])); +if (tb[MDBA_MDB_EATTR_SRC_VNI ]) +print_uint (PRINT_ANY ,"src_vni" ," src_vni %u" , +rta_getattr_u32 (tb[MDBA_MDB_EATTR_SRC_VNI ])); +if (show_stats && tb && tb[MDBA_MDB_EATTR_TIMER ]) {__u32 timer =rta_getattr_u32 (tb[MDBA_MDB_EATTR_TIMER ]);
@@ -668,8 +672,8 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) .bpm.family = PF_BRIDGE, };char *d =NULL , *p =NULL , *grp =NULL , *src =NULL , *mode =NULL ; +char *dst_port =NULL , *vni =NULL , *src_vni =NULL ;char *src_list =NULL , *proto =NULL , *dst =NULL ; -char *dst_port =NULL , *vni =NULL ;struct br_mdb_entry entry = {};bool set_attrs = false;short vid =0 ;
@@ -720,6 +724,10 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)NEXT_ARG (); vni = *argv; set_attrs = true; + }else if (strcmp (*argv,"src_vni" ) ==0 ) { +NEXT_ARG (); + src_vni = *argv; + set_attrs = true; }else {if (matches (*argv,"help" ) ==0 )usage ();
@@ -792,6 +800,12 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)return -1 ; } +if (src_vni &&mdb_parse_vni (&req.n,sizeof (req), src_vni, +MDBE_ATTR_SRC_VNI )) { +fprintf (stderr,"Invalid source VNI \"%s\"\n" , src_vni); +return -1 ; + } +addattr_nest_end (&req.n, nest); }
man/man8/bridge.8 +9 -1
@@ -151,7 +151,9 @@ bridge \- show / manipulate bridge addresses and devices .B dst_port .IR DST_PORT " ] [ " .B vni -.IR VNI " ] +.IR VNI " ] [ " +.B src_vni +.IR SRC_VNI " ] .ti -8 .BR "bridge mdb show" " [ "
@@ -998,6 +1000,12 @@ the VXLAN VNI Network Identifier to use to connect to the remote VXLAN tunnel endpoint. If omitted, the value specified at VXLAN device creation will be used or the source VNI when the VXLAN device is in external mode. +.TP +.BI src_vni " SRC_VNI" +the source VNI Network Identifier this entry belongs to. Used only when the +VXLAN device is in external mode. If omitted, the value specified at VXLAN +device creation will be used. + .in -8 .SS bridge mdb delete - delete a multicast group database entry This command removes an existing mdb entry.
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH 6/7 bridge: mdb: Add outgoing interface support
In reply to Ido SchimmelIn a similar fashion to VXLAN FDB entries, allow user space to program and view the outgoing interface of VXLAN MDB entries. Specifically, add support for the 'MDBE_ATTR_IFINDEX' and 'MDBA_MDB_EATTR_IFINDEX' attributes in request and response messages, respectively.
The outgoing interface will be forced during the underlay route lookup and is required when the underlay destination IP is multicast, as the multicast routing tables are not consulted.
Example:
# bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 198.51.100.1 via dummy10
$ bridge -d -s mdb show dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 198.51.100.1 via dummy10 0.00
$ bridge -d -s -j -p mdb show
[ {
"mdb": [ {
"index": 10,
"dev": "vxlan0",
"port": "vxlan0",
"grp": "239.1.1.1",
"state": "permanent",
"filter_mode": "exclude",
"protocol": "static",
"flags": [ ],
"dst": "198.51.100.1",
"via": "dummy10",
"timer": " 0.00"
} ],
"router": {}
} ]--- bridge/mdb.c | 32 ++++++++++++++++++++++++++++++-- man/man8/bridge.8 | 9 ++++++++- 2 files changed, 38 insertions(+), 3 deletions(-)
bridge/mdb.c +30 -2
@@ -34,7 +34,7 @@ static void usage(void)fprintf (stderr,"Usage: bridge mdb { add | del | replace } dev DEV port PORT grp GROUP [src SOURCE] [permanent | temp] [vid VID]\n" " [ filter_mode { include | exclude } ] [ source_list SOURCE_LIST ] [ proto PROTO ] [ dst IPADDR ]\n" -" [ dst_port DST_PORT ] [ vni VNI ] [ src_vni SRC_VNI ]\n" +" [ dst_port DST_PORT ] [ vni VNI ] [ src_vni SRC_VNI ] [ via DEV ]\n" " bridge mdb {show} [ dev DEV ] [ vid VID ]\n" );exit (-1 ); }
@@ -272,6 +272,14 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,print_uint (PRINT_ANY ,"src_vni" ," src_vni %u" ,rta_getattr_u32 (tb[MDBA_MDB_EATTR_SRC_VNI ])); +if (tb[MDBA_MDB_EATTR_IFINDEX ]) { +unsigned int ifindex; + + ifindex =rta_getattr_u32 (tb[MDBA_MDB_EATTR_IFINDEX ]); +print_string (PRINT_ANY ,"via" ," via %s" , +ll_index_to_name (ifindex)); + } +if (show_stats && tb && tb[MDBA_MDB_EATTR_TIMER ]) {__u32 timer =rta_getattr_u32 (tb[MDBA_MDB_EATTR_TIMER ]);
@@ -659,6 +667,19 @@ static int mdb_parse_vni(struct nlmsghdr *n, int maxlen, const char *vni,return 0 ; } +static int mdb_parse_dev (struct nlmsghdr *n,int maxlen,const char *dev) +{ +unsigned int ifindex; + + ifindex =ll_name_to_index (dev); +if (!ifindex) +return -1 ; + +addattr32 (n, maxlen,MDBE_ATTR_IFINDEX , ifindex); + +return 0 ; +} +static int mdb_modify (int cmd,int flags,int argc,char **argv) {struct {
@@ -672,7 +693,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv) .bpm.family = PF_BRIDGE, };char *d =NULL , *p =NULL , *grp =NULL , *src =NULL , *mode =NULL ; -char *dst_port =NULL , *vni =NULL , *src_vni =NULL ; +char *dst_port =NULL , *vni =NULL , *src_vni =NULL , *via =NULL ;char *src_list =NULL , *proto =NULL , *dst =NULL ;struct br_mdb_entry entry = {};bool set_attrs = false;
@@ -728,6 +749,10 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)NEXT_ARG (); src_vni = *argv; set_attrs = true; + }else if (strcmp (*argv,"via" ) ==0 ) { +NEXT_ARG (); + via = *argv; + set_attrs = true; }else {if (matches (*argv,"help" ) ==0 )usage ();
@@ -806,6 +831,9 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)return -1 ; } +if (via &&mdb_parse_dev (&req.n,sizeof (req), via)) +return nodev (via); +addattr_nest_end (&req.n, nest); }
man/man8/bridge.8 +8 -1
@@ -153,7 +153,9 @@ bridge \- show / manipulate bridge addresses and devices .B vni .IR VNI " ] [ " .B src_vni -.IR SRC_VNI " ] +.IR SRC_VNI " ] [ " +.B via +.IR DEV " ] .ti -8 .BR "bridge mdb show" " [ "
@@ -1006,6 +1008,11 @@ the source VNI Network Identifier this entry belongs to. Used only when the VXLAN device is in external mode. If omitted, the value specified at VXLAN device creation will be used. +.TP +.BI via " DEV" +device name of the outgoing interface for the VXLAN device to reach the remote +VXLAN tunnel endpoint. + .in -8 .SS bridge mdb delete - delete a multicast group database entry This command removes an existing mdb entry.
Signature · 1 line
2.37.3
Ido Schimmel
maintainerPATCH 7/7 bridge: mdb: Document the catchall MDB entries
In reply to Ido SchimmelDocument the catchall MDB entries used to transmit IPv4 and IPv6 unregistered multicast packets.
In deployments where inter-subnet multicast forwarding is used, not all the VTEPs in a tenant domain are members in all the broadcast domains. It is therefore advantageous to transmit BULL (broadcast, unknown unicast and link-local multicast) and unregistered IP multicast traffic on different tunnels. If the same tunnel was used, a VTEP only interested in IP multicast traffic would also pull all the BULL traffic and drop it as it is not a member in the originating broadcast domain [1].
[1] https://datatracker.ietf.org/doc/html/draft-ietf-bess-evpn-irb-mcast#section-2.6
--- man/man8/bridge.8 | 6 ++++++ 1 file changed, 6 insertions(+)
man/man8/bridge.8 +6 -0
@@ -1013,6 +1013,12 @@ device creation will be used. device name of the outgoing interface for the VXLAN device to reach the remote VXLAN tunnel endpoint. +.in -8 +The 0.0.0.0 and :: MDB entries are special catchall entries used to flood IPv4 +and IPv6 unregistered multicast packets, respectively. Therefore, when these +entries are programmed, the catchall 00:00:00:00:00:00 FDB entry will only +flood broadcast, unknown unicast and link-local multicast. + .in -8 .SS bridge mdb delete - delete a multicast group database entry This command removes an existing mdb entry.
Signature · 1 line
2.37.3
Re: [PATCH iproute2-next 1/7] Update kernel headers
In reply to Ido SchimmelQuoted 5 lines · Ido Schimmel
Signed-off-by Ido Schimmel <[email protected]>--- include/uapi/linux/if_bridge.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
Re: [PATCH iproute2-next 2/7] bridge: mdb: Add underlay destination IP support
In reply to Ido SchimmelQuoted 47 lines · Ido Schimmel
Allow user space to program and view VXLAN MDB entries. Specifically, add support for the '
MDBE_ATTR_DST' and 'MDBA_MDB_EATTR_DST' attributes in request and response messages, respectively.The attributes encode the IP address of the destination VXLAN tunnel endpoint where multicast receivers for the specified multicast flow reside.
Multiple destinations can be added for each flow.
Example:
# bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 198.51.100.1 # bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 192.0.2.1$ bridge -d -s mdb show dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 192.0.2.1 0.00 dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 198.51.100.1 0.00$ bridge -d -s -j -p mdb show [ { "mdb": [ { "index": 15, "dev": "vxlan0", "port": "vxlan0", "grp": "239.1.1.1", "state": "permanent", "filter_mode": "exclude", "protocol": "static", "flags": [ ], "dst": "192.0.2.1", "timer": " 0.00" },{ "index": 15, "dev": "vxlan0", "port": "vxlan0", "grp": "239.1.1.1", "state": "permanent", "filter_mode": "exclude", "protocol": "static", "flags": [ ], "dst": "198.51.100.1", "timer": " 0.00" } ], "router": {} } ]
Quoted 6 lines
Signed-off-by Ido Schimmel <[email protected]>--- bridge/mdb.c | 51 +++++++++++++++++++++++++++++++++++++++++++++-- man/man8/bridge.8 | 15 +++++++++++++- 2 files changed, 63 insertions(+), 3 deletions(-)
Re: [PATCH iproute2-next 3/7] bridge: mdb: Add UDP destination port support
In reply to Ido SchimmelQuoted 33 lines · Ido Schimmel
In a similar fashion to VXLAN FDB entries, allow user space to program and view the UDP destination port of VXLAN MDB entries. Specifically, add support for the '
MDBE_ATTR_DST_PORT' and 'MDBA_MDB_EATTR_DST_PORT' attributes in request and response messages, respectively.Use the keyword "
dst_port" instead of "port" as the latter is already used to specify the net device associated with the MDB entry.Example:
# bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 198.51.100.1 dst_port 1234$ bridge -d -s mdb show dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 198.51.100.1 dst_port 1234 0.00$ bridge -d -s -j -p mdb show [ { "mdb": [ { "index": 15, "dev": "vxlan0", "port": "vxlan0", "grp": "239.1.1.1", "state": "permanent", "filter_mode": "exclude", "protocol": "static", "flags": [ ], "dst": "198.51.100.1", "dst_port": 1234, "timer": " 0.00" } ], "router": {} } ]
Quoted 6 lines
Signed-off-by Ido Schimmel <[email protected]>--- bridge/mdb.c | 40 ++++++++++++++++++++++++++++++++++++++++ man/man8/bridge.8 | 10 +++++++++- 2 files changed, 49 insertions(+), 1 deletion(-)
Re: [PATCH iproute2-next 4/7] bridge: mdb: Add destination VNI support
In reply to Ido SchimmelQuoted 36 lines · Ido Schimmel
In a similar fashion to VXLAN FDB entries, allow user space to program and view the destination VNI of VXLAN MDB entries. Specifically, add support for the '
MDBE_ATTR_VNI' and 'MDBA_MDB_EATTR_VNI' attributes in request and response messages, respectively.This is useful when ingress replication (IR) is used and the destination VXLAN tunnel endpoint (VTEP) is not a member of the source broadcast domain (BD). In this case, the ingress VTEP should transmit the packet using the VNI of the Supplementary Broadcast Domain (SBD) in which all the VTEPs are member of [1].
Example:
# bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 198.51.100.1 vni 1111$ bridge -d -s mdb show dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 198.51.100.1 vni 1111 0.00$ bridge -d -s -j -p mdb show [ { "mdb": [ { "index": 15, "dev": "vxlan0", "port": "vxlan0", "grp": "239.1.1.1", "state": "permanent", "filter_mode": "exclude", "protocol": "static", "flags": [ ], "dst": "198.51.100.1", "vni": 1111, "timer": " 0.00" } ], "router": {} } ]
Quoted 8 lines
[1] https://datatracker.ietf.org/doc/html/draft-ietf-bess-evpn-irb-mcast#section-3.2.2
Signed-off-by Ido Schimmel <[email protected]>--- bridge/mdb.c | 34 ++++++++++++++++++++++++++++++++-- man/man8/bridge.8 | 10 +++++++++- 2 files changed, 41 insertions(+), 3 deletions(-)
Re: [PATCH iproute2-next 5/7] bridge: mdb: Add source VNI support
In reply to Ido SchimmelQuoted 33 lines · Ido Schimmel
In a similar fashion to VXLAN FDB entries, allow user space to program and view the source VNI of VXLAN MDB entries. Specifically, add support for the '
MDBE_ATTR_SRC_VNI' and 'MDBA_MDB_EATTR_SRC_VNI' attributes in request and response messages, respectively.The source VNI is only relevant when the VXLAN device is in external mode, where multiple VNIs can be multiplexed over a single VXLAN device.
Example:
# bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 198.51.100.1 src_vni 2222$ bridge -d -s mdb show dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 198.51.100.1 src_vni 2222 0.00$ bridge -d -s -j -p mdb show [ { "mdb": [ { "index": 16, "dev": "vxlan0", "port": "vxlan0", "grp": "239.1.1.1", "state": "permanent", "filter_mode": "exclude", "protocol": "static", "flags": [ ], "dst": "198.51.100.1", "src_vni": 2222, "timer": " 0.00" } ], "router": {} } ]
Quoted 6 lines
Signed-off-by Ido Schimmel <[email protected]>--- bridge/mdb.c | 18 ++++++++++++++++-- man/man8/bridge.8 | 10 +++++++++- 2 files changed, 25 insertions(+), 3 deletions(-)
Re: [PATCH iproute2-next 6/7] bridge: mdb: Add outgoing interface support
In reply to Ido SchimmelQuoted 34 lines · Ido Schimmel
In a similar fashion to VXLAN FDB entries, allow user space to program and view the outgoing interface of VXLAN MDB entries. Specifically, add support for the '
MDBE_ATTR_IFINDEX' and 'MDBA_MDB_EATTR_IFINDEX' attributes in request and response messages, respectively.The outgoing interface will be forced during the underlay route lookup and is required when the underlay destination IP is multicast, as the multicast routing tables are not consulted.
Example:
# bridge mdb add dev vxlan0 port vxlan0 grp 239.1.1.1 permanent dst 198.51.100.1 via dummy10$ bridge -d -s mdb show dev vxlan0 port vxlan0 grp 239.1.1.1 permanent filter_mode exclude proto static dst 198.51.100.1 via dummy10 0.00$ bridge -d -s -j -p mdb show [ { "mdb": [ { "index": 10, "dev": "vxlan0", "port": "vxlan0", "grp": "239.1.1.1", "state": "permanent", "filter_mode": "exclude", "protocol": "static", "flags": [ ], "dst": "198.51.100.1", "via": "dummy10", "timer": " 0.00" } ], "router": {} } ]
Quoted 6 lines
Signed-off-by Ido Schimmel <[email protected]>--- bridge/mdb.c | 32 ++++++++++++++++++++++++++++++-- man/man8/bridge.8 | 9 ++++++++- 2 files changed, 38 insertions(+), 3 deletions(-)
Re: [PATCH iproute2-next 7/7] bridge: mdb: Document the catchall MDB entries
In reply to Ido SchimmelQuoted 26 lines · Ido Schimmel
Document the catchall MDB entries used to transmit IPv4 and IPv6 unregistered multicast packets.
In deployments where inter-subnet multicast forwarding is used, not all the VTEPs in a tenant domain are members in all the broadcast domains. It is therefore advantageous to transmit BULL (broadcast, unknown unicast and link-local multicast) and unregistered IP multicast traffic on different tunnels. If the same tunnel was used, a VTEP only interested in IP multicast traffic would also pull all the BULL traffic and drop it as it is not a member in the originating broadcast domain [1].
[1] https://datatracker.ietf.org/doc/html/draft-ietf-bess-evpn-irb-mcast#section-2.6
Signed-off-by Ido Schimmel <[email protected]>--- man/man8/bridge.8 | 6 ++++++ 1 file changed, 6 insertions(+)man/man8/bridge.8 +0
-0@@ -1013,6 +1013,12 @@ device creation will be used. device name of the outgoing interface for the VXLAN device to reach the remote VXLAN tunnel endpoint.
man/man8/bridge.8 device creation will be used. · line 1024
Quoted 10 lines
man/man8/bridge.8 +6
-0+.in -8 +The 0.0.0.0 and :: MDB entries are special catchall entries used to flood IPv4 +and IPv6 unregistered multicast packets, respectively. Therefore, when these +entries are programmed, the catchall 00:00:00:00:00:00 FDB entry will only +flood broadcast, unknown unicast and link-local multicast. + .in -8 .SS bridge mdb delete - delete a multicast group database entry This command removes an existing mdb entry.
This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:
Hello:
This series was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:
Quoted 8 lines · On Tue, 21 Mar 2023 15:01:20 +0200 you wrote:
Add support for new VXLAN MDB attributes.
See kernel merge commit
abf36703d704("Merge branch 'vxlan-MDB-support'") for background and motivation.Patch #1 updates the kernel headers.
[...]
Here is the summary with links:
- [iproute2-next,1/7] Update kernel headers
(no matching commit)
- [iproute2-next,2/7] bridge: mdb: Add underlay destination IP support
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=d36899c2244c - [iproute2-next,3/7] bridge: mdb: Add UDP destination port support https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=42a96e81c85f - [iproute2-next,4/7] bridge: mdb: Add destination VNI support https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=c5b327e5707b - [iproute2-next,5/7] bridge: mdb: Add source VNI support https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=9e49c798540c - [iproute2-next,6/7] bridge: mdb: Add outgoing interface support https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=a3f4565e0a64 - [iproute2-next,7/7] bridge: mdb: Document the catchall MDB entries https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=be24eab05d66
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html