@@ -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);
}
@@ -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.
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": {} } ] Signed-off-by: Ido Schimmel <idosch@nvidia.com> --- bridge/mdb.c | 18 ++++++++++++++++-- man/man8/bridge.8 | 10 +++++++++- 2 files changed, 25 insertions(+), 3 deletions(-)