mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-08-14 15:10:16 +00:00
bridge: fdb: add support for src_vni option
We already print src_vni for a fdb entry when present. This patch adds the ability to set src_vni on a fdb entry. When not specified, kernel will use vni specified on the vxlan device. This can be used on a vxlan fdb entry when the vxlan device is in external or collect metadata mode. Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
83a8b8d9f1
commit
c5b176e5ba
10
bridge/fdb.c
10
bridge/fdb.c
@ -39,6 +39,7 @@ static void usage(void)
|
|||||||
" [ self ] [ master ] [ use ] [ router ] [ extern_learn ]\n"
|
" [ self ] [ master ] [ use ] [ router ] [ extern_learn ]\n"
|
||||||
" [ sticky ] [ local | static | dynamic ] [ dst IPADDR ]\n"
|
" [ sticky ] [ local | static | dynamic ] [ dst IPADDR ]\n"
|
||||||
" [ vlan VID ] [ port PORT] [ vni VNI ] [ via DEV ]\n"
|
" [ vlan VID ] [ port PORT] [ vni VNI ] [ via DEV ]\n"
|
||||||
|
" [ src_vni VNI ]\n"
|
||||||
" bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] [ state STATE ] ]\n");
|
" bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] [ state STATE ] ]\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
@ -383,6 +384,7 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv)
|
|||||||
inet_prefix dst;
|
inet_prefix dst;
|
||||||
unsigned long port = 0;
|
unsigned long port = 0;
|
||||||
unsigned long vni = ~0;
|
unsigned long vni = ~0;
|
||||||
|
unsigned long src_vni = ~0;
|
||||||
unsigned int via = 0;
|
unsigned int via = 0;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
short vid = -1;
|
short vid = -1;
|
||||||
@ -416,6 +418,12 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv)
|
|||||||
if ((endptr && *endptr) ||
|
if ((endptr && *endptr) ||
|
||||||
(vni >> 24) || vni == ULONG_MAX)
|
(vni >> 24) || vni == ULONG_MAX)
|
||||||
invarg("invalid VNI\n", *argv);
|
invarg("invalid VNI\n", *argv);
|
||||||
|
} else if (strcmp(*argv, "src_vni") == 0) {
|
||||||
|
NEXT_ARG();
|
||||||
|
src_vni = strtoul(*argv, &endptr, 0);
|
||||||
|
if ((endptr && *endptr) ||
|
||||||
|
(src_vni >> 24) || src_vni == ULONG_MAX)
|
||||||
|
invarg("invalid src VNI\n", *argv);
|
||||||
} else if (strcmp(*argv, "via") == 0) {
|
} else if (strcmp(*argv, "via") == 0) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
via = ll_name_to_index(*argv);
|
via = ll_name_to_index(*argv);
|
||||||
@ -495,6 +503,8 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (vni != ~0)
|
if (vni != ~0)
|
||||||
addattr32(&req.n, sizeof(req), NDA_VNI, vni);
|
addattr32(&req.n, sizeof(req), NDA_VNI, vni);
|
||||||
|
if (src_vni != ~0)
|
||||||
|
addattr32(&req.n, sizeof(req), NDA_SRC_VNI, src_vni);
|
||||||
if (via)
|
if (via)
|
||||||
addattr32(&req.n, sizeof(req), NDA_IFINDEX, via);
|
addattr32(&req.n, sizeof(req), NDA_IFINDEX, via);
|
||||||
|
|
||||||
|
@ -69,6 +69,8 @@ bridge \- show / manipulate bridge addresses and devices
|
|||||||
.BR self " ] [ " master " ] [ " router " ] [ " use " ] [ " extern_learn " ] [ " sticky " ] [ "
|
.BR self " ] [ " master " ] [ " router " ] [ " use " ] [ " extern_learn " ] [ " sticky " ] [ "
|
||||||
.B dst
|
.B dst
|
||||||
.IR IPADDR " ] [ "
|
.IR IPADDR " ] [ "
|
||||||
|
.B src_vni
|
||||||
|
.IR SRC_VNI " ] ["
|
||||||
.B vni
|
.B vni
|
||||||
.IR VNI " ] ["
|
.IR VNI " ] ["
|
||||||
.B port
|
.B port
|
||||||
@ -473,6 +475,13 @@ is of type VXLAN.
|
|||||||
the IP address of the destination
|
the IP address of the destination
|
||||||
VXLAN tunnel endpoint where the Ethernet MAC ADDRESS resides.
|
VXLAN tunnel endpoint where the Ethernet MAC ADDRESS resides.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.BI src_vni " SRC VNI"
|
||||||
|
the src VNI Network Identifier (or VXLAN Segment ID)
|
||||||
|
this entry belongs to. Used only when the vxlan device is in
|
||||||
|
external or collect metadata mode. If omitted the value specified at
|
||||||
|
vxlan device creation will be used.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI vni " VNI"
|
.BI vni " VNI"
|
||||||
the VXLAN VNI Network Identifier (or VXLAN Segment ID)
|
the VXLAN VNI Network Identifier (or VXLAN Segment ID)
|
||||||
|
Loading…
Reference in New Issue
Block a user