[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1591835721-39497-3-git-send-email-roopa@cumulusnetworks.com>
Date: Wed, 10 Jun 2020 17:35:21 -0700
From: Roopa Prabhu <roopa@...ulusnetworks.com>
To: dsahern@...il.com
Cc: netdev@...r.kernel.org, stephen@...workplumber.org,
nikolay@...ulusnetworks.com
Subject: [PATCH iproute2 net-next v2 2/2] bridge: support for nexthop id in fdb entries
From: Roopa Prabhu <roopa@...ulusnetworks.com>
This patch adds support to assign a nexthop group
id to an fdb entry.
$bridge fdb add 02:02:00:00:00:13 dev vx10 nhid 102 self
Signed-off-by: Roopa Prabhu <roopa@...ulusnetworks.com>
---
bridge/fdb.c | 22 +++++++++++++++++++---
man/man8/bridge.8 | 13 ++++++++++---
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/bridge/fdb.c b/bridge/fdb.c
index 710dfc9..d2247e8 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -37,9 +37,9 @@ static void usage(void)
fprintf(stderr,
"Usage: bridge fdb { add | append | del | replace } ADDR dev DEV\n"
" [ self ] [ master ] [ use ] [ router ] [ extern_learn ]\n"
- " [ sticky ] [ local | static | dynamic ] [ dst IPADDR ]\n"
- " [ vlan VID ] [ port PORT] [ vni VNI ] [ via DEV ]\n"
- " [ src_vni VNI ]\n"
+ " [ sticky ] [ local | static | dynamic ] [ vlan VID ]\n"
+ " { [ dst IPADDR ] [ port PORT] [ vni VNI ] | [ nhid NHID ] }\n"
+ " [ via DEV ] [ src_vni VNI ]\n"
" bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] [ state STATE ] ]\n"
" bridge fdb get ADDR [ br BRDEV ] { brport |dev } DEV [ vlan VID ]\n"
" [ vni VNI ]\n");
@@ -237,6 +237,10 @@ int print_fdb(struct nlmsghdr *n, void *arg)
ll_index_to_name(ifindex));
}
+ if (tb[NDA_NH_ID])
+ print_uint(PRINT_ANY, "nhid", "nhid %u ",
+ rta_getattr_u32(tb[NDA_NH_ID]));
+
if (tb[NDA_LINK_NETNSID])
print_uint(PRINT_ANY,
"linkNetNsId", "link-netnsid %d ",
@@ -390,6 +394,7 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv)
unsigned int via = 0;
char *endptr;
short vid = -1;
+ __u32 nhid = 0;
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
@@ -401,6 +406,10 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv)
duparg2("dst", *argv);
get_addr(&dst, *argv, preferred_family);
dst_ok = 1;
+ } else if (strcmp(*argv, "nhid") == 0) {
+ NEXT_ARG();
+ if (get_u32(&nhid, *argv, 0))
+ invarg("\"id\" value is invalid\n", *argv);
} else if (strcmp(*argv, "port") == 0) {
NEXT_ARG();
@@ -475,6 +484,11 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv)
return -1;
}
+ if (nhid && (dst_ok || port || vni != ~0)) {
+ fprintf(stderr, "dst, port, vni are mutually exclusive with nhid\n");
+ return -1;
+ }
+
/* Assume self */
if (!(req.ndm.ndm_flags&(NTF_SELF|NTF_MASTER)))
req.ndm.ndm_flags |= NTF_SELF;
@@ -496,6 +510,8 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv)
if (vid >= 0)
addattr16(&req.n, sizeof(req), NDA_VLAN, vid);
+ if (nhid > 0)
+ addattr32(&req.n, sizeof(req), NDA_NH_ID, nhid);
if (port) {
unsigned short dport;
diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
index 71f2e89..fa8c004 100644
--- a/man/man8/bridge.8
+++ b/man/man8/bridge.8
@@ -68,16 +68,18 @@ bridge \- show / manipulate bridge addresses and devices
.IR DEV " { "
.BR local " | " static " | " dynamic " } [ "
.BR self " ] [ " master " ] [ " router " ] [ " use " ] [ " extern_learn " ] [ " sticky " ] [ "
+.B src_vni
+.IR VNI " ] { ["
.B dst
.IR IPADDR " ] [ "
-.B src_vni
-.IR VNI " ] ["
.B vni
.IR VNI " ] ["
.B port
.IR PORT " ] ["
.B via
-.IR DEVICE " ]"
+.IR DEVICE " ] | "
+.B nhid
+.IR NHID " } "
.ti -8
.BR "bridge fdb" " [ " show " ] [ "
@@ -583,6 +585,11 @@ device name of the outgoing interface for the
VXLAN device driver to reach the
remote VXLAN tunnel endpoint.
+.TP
+.BI nhid " NHID "
+ecmp nexthop group for the VXLAN device driver
+to reach remote VXLAN tunnel endpoints.
+
.SS bridge fdb append - append a forwarding database entry
This command adds a new fdb entry with an already known
.IR LLADDR .
--
2.1.4
Powered by blists - more mailing lists