|
|
4aca6e |
From 8dab50579927df9b7dacd82480bbefc1cc231547 Mon Sep 17 00:00:00 2001
|
|
|
4aca6e |
From: Phil Sutter <psutter@redhat.com>
|
|
|
4aca6e |
Date: Tue, 28 Feb 2017 16:11:51 +0100
|
|
|
4aca6e |
Subject: [PATCH] bridge: mdb: add support for vlans
|
|
|
4aca6e |
|
|
|
4aca6e |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289
|
|
|
4aca6e |
Upstream Status: iproute2.git commit 6aac8617139a9
|
|
|
4aca6e |
|
|
|
4aca6e |
commit 6aac8617139a96a124d63aeae843b73c38f88fc5
|
|
|
4aca6e |
Author: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
|
|
|
4aca6e |
Date: Wed Jul 15 08:45:20 2015 -0700
|
|
|
4aca6e |
|
|
|
4aca6e |
bridge: mdb: add support for vlans
|
|
|
4aca6e |
|
|
|
4aca6e |
This patch allows the user to specify the vlan of the mdb group being
|
|
|
4aca6e |
added or deleted and adds support for displaying the vlan when
|
|
|
4aca6e |
dumping mdb information or monitoring it. It also updates the man page
|
|
|
4aca6e |
to reflect the new "vid" argument for mdb.
|
|
|
4aca6e |
|
|
|
4aca6e |
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
|
|
|
4aca6e |
---
|
|
|
4aca6e |
bridge/mdb.c | 31 +++++++++++++++++++------------
|
|
|
4aca6e |
man/man8/bridge.8 | 8 +++++++-
|
|
|
4aca6e |
2 files changed, 26 insertions(+), 13 deletions(-)
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/bridge/mdb.c b/bridge/mdb.c
|
|
|
4aca6e |
index 680ec30..1b34f69 100644
|
|
|
4aca6e |
--- a/bridge/mdb.c
|
|
|
4aca6e |
+++ b/bridge/mdb.c
|
|
|
4aca6e |
@@ -28,7 +28,7 @@ static unsigned int filter_index;
|
|
|
4aca6e |
|
|
|
4aca6e |
static void usage(void)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
- fprintf(stderr, "Usage: bridge mdb { add | del } dev DEV port PORT grp GROUP [permanent | temp]\n");
|
|
|
4aca6e |
+ fprintf(stderr, "Usage: bridge mdb { add | del } dev DEV port PORT grp GROUP [permanent | temp] [vid VID]\n");
|
|
|
4aca6e |
fprintf(stderr, " bridge mdb {show} [ dev DEV ]\n");
|
|
|
4aca6e |
exit(-1);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
@@ -51,17 +51,19 @@ static void br_print_router_ports(FILE *f, struct rtattr *attr)
|
|
|
4aca6e |
static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
SPRINT_BUF(abuf);
|
|
|
4aca6e |
-
|
|
|
4aca6e |
- if (e->addr.proto == htons(ETH_P_IP))
|
|
|
4aca6e |
- fprintf(f, "dev %s port %s grp %s %s\n", ll_index_to_name(ifindex),
|
|
|
4aca6e |
- ll_index_to_name(e->ifindex),
|
|
|
4aca6e |
- inet_ntop(AF_INET, &e->addr.u.ip4, abuf, sizeof(abuf)),
|
|
|
4aca6e |
- (e->state & MDB_PERMANENT) ? "permanent" : "temp");
|
|
|
4aca6e |
- else
|
|
|
4aca6e |
- fprintf(f, "dev %s port %s grp %s %s\n", ll_index_to_name(ifindex),
|
|
|
4aca6e |
- ll_index_to_name(e->ifindex),
|
|
|
4aca6e |
- inet_ntop(AF_INET6, &e->addr.u.ip6, abuf, sizeof(abuf)),
|
|
|
4aca6e |
- (e->state & MDB_PERMANENT) ? "permanent" : "temp");
|
|
|
4aca6e |
+ const void *src;
|
|
|
4aca6e |
+ int af;
|
|
|
4aca6e |
+
|
|
|
4aca6e |
+ af = e->addr.proto == htons(ETH_P_IP) ? AF_INET : AF_INET6;
|
|
|
4aca6e |
+ src = af == AF_INET ? (const void *)&e->addr.u.ip4 :
|
|
|
4aca6e |
+ (const void *)&e->addr.u.ip6;
|
|
|
4aca6e |
+ fprintf(f, "dev %s port %s grp %s %s", ll_index_to_name(ifindex),
|
|
|
4aca6e |
+ ll_index_to_name(e->ifindex),
|
|
|
4aca6e |
+ inet_ntop(af, src, abuf, sizeof(abuf)),
|
|
|
4aca6e |
+ (e->state & MDB_PERMANENT) ? "permanent" : "temp");
|
|
|
4aca6e |
+ if (e->vid)
|
|
|
4aca6e |
+ fprintf(f, " vid %hu", e->vid);
|
|
|
4aca6e |
+ fprintf(f, "\n");
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr)
|
|
|
4aca6e |
@@ -177,6 +179,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)
|
|
|
4aca6e |
} req;
|
|
|
4aca6e |
struct br_mdb_entry entry;
|
|
|
4aca6e |
char *d = NULL, *p = NULL, *grp = NULL;
|
|
|
4aca6e |
+ short vid = 0;
|
|
|
4aca6e |
|
|
|
4aca6e |
memset(&req, 0, sizeof(req));
|
|
|
4aca6e |
memset(&entry, 0, sizeof(entry));
|
|
|
4aca6e |
@@ -201,6 +204,9 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)
|
|
|
4aca6e |
entry.state |= MDB_PERMANENT;
|
|
|
4aca6e |
} else if (strcmp(*argv, "temp") == 0) {
|
|
|
4aca6e |
;/* nothing */
|
|
|
4aca6e |
+ } else if (strcmp(*argv, "vid") == 0) {
|
|
|
4aca6e |
+ NEXT_ARG();
|
|
|
4aca6e |
+ vid = atoi(*argv);
|
|
|
4aca6e |
} else {
|
|
|
4aca6e |
if (matches(*argv, "help") == 0)
|
|
|
4aca6e |
usage();
|
|
|
4aca6e |
@@ -234,6 +240,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)
|
|
|
4aca6e |
} else
|
|
|
4aca6e |
entry.addr.proto = htons(ETH_P_IP);
|
|
|
4aca6e |
|
|
|
4aca6e |
+ entry.vid = vid;
|
|
|
4aca6e |
addattr_l(&req.n, sizeof(req), MDBA_SET_ENTRY, &entry, sizeof(entry));
|
|
|
4aca6e |
|
|
|
4aca6e |
if (rtnl_talk(&rth, &req.n, NULL, 0) < 0)
|
|
|
4aca6e |
diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
|
|
|
4aca6e |
index 8fae74b..210a3ee 100644
|
|
|
4aca6e |
--- a/man/man8/bridge.8
|
|
|
4aca6e |
+++ b/man/man8/bridge.8
|
|
|
4aca6e |
@@ -77,7 +77,9 @@ bridge \- show / manipulate bridge addresses and devices
|
|
|
4aca6e |
.IR PORT
|
|
|
4aca6e |
.B grp
|
|
|
4aca6e |
.IR GROUP " [ "
|
|
|
4aca6e |
-.BR permanent " | " temp " ]"
|
|
|
4aca6e |
+.BR permanent " | " temp " ] [ "
|
|
|
4aca6e |
+.B vid
|
|
|
4aca6e |
+.IR VID " ] "
|
|
|
4aca6e |
|
|
|
4aca6e |
.ti -8
|
|
|
4aca6e |
.BR "bridge mdb show " [ "
|
|
|
4aca6e |
@@ -435,6 +437,10 @@ the port.
|
|
|
4aca6e |
- the mdb entry is temporary (default)
|
|
|
4aca6e |
.sp
|
|
|
4aca6e |
|
|
|
4aca6e |
+.TP
|
|
|
4aca6e |
+.BI vid " VID"
|
|
|
4aca6e |
+the VLAN ID which is known to have members of this multicast group.
|
|
|
4aca6e |
+
|
|
|
4aca6e |
.in -8
|
|
|
4aca6e |
.SS bridge mdb delete - delete a multicast group database entry
|
|
|
4aca6e |
This command removes an existing mdb entry.
|
|
|
4aca6e |
--
|
|
|
4aca6e |
1.8.3.1
|
|
|
4aca6e |
|