* [PATCH iproute2 net-next] bridge: mdb: add support for vlans
@ 2015-07-15 15:45 Nikolay Aleksandrov
2015-07-28 11:17 ` Nikolay Aleksandrov
0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Aleksandrov @ 2015-07-15 15:45 UTC (permalink / raw)
To: netdev; +Cc: stephen, davem, Nikolay Aleksandrov
This patch allows the user to specify the vlan of the mdb group being
added or deleted and adds support for displaying the vlan when
dumping mdb information or monitoring it. It also updates the man page
to reflect the new "vid" argument for mdb.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
note: the cast in print_mdb_entry() was necessary to shut the compiler
bridge/mdb.c | 31 +++++++++++++++++++------------
include/linux/if_bridge.h | 1 +
man/man8/bridge.8 | 8 +++++++-
3 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/bridge/mdb.c b/bridge/mdb.c
index 9a8ed540ce64..ea169b9c2e4d 100644
--- a/bridge/mdb.c
+++ b/bridge/mdb.c
@@ -28,7 +28,7 @@ static unsigned int filter_index;
static void usage(void)
{
- fprintf(stderr, "Usage: bridge mdb { add | del } dev DEV port PORT grp GROUP [permanent | temp]\n");
+ fprintf(stderr, "Usage: bridge mdb { add | del } dev DEV port PORT grp GROUP [permanent | temp] [vid VID]\n");
fprintf(stderr, " bridge mdb {show} [ dev DEV ]\n");
exit(-1);
}
@@ -51,17 +51,19 @@ static void br_print_router_ports(FILE *f, struct rtattr *attr)
static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e)
{
SPRINT_BUF(abuf);
-
- if (e->addr.proto == htons(ETH_P_IP))
- fprintf(f, "dev %s port %s grp %s %s\n", ll_index_to_name(ifindex),
- ll_index_to_name(e->ifindex),
- inet_ntop(AF_INET, &e->addr.u.ip4, abuf, sizeof(abuf)),
- (e->state & MDB_PERMANENT) ? "permanent" : "temp");
- else
- fprintf(f, "dev %s port %s grp %s %s\n", ll_index_to_name(ifindex),
- ll_index_to_name(e->ifindex),
- inet_ntop(AF_INET6, &e->addr.u.ip6, abuf, sizeof(abuf)),
- (e->state & MDB_PERMANENT) ? "permanent" : "temp");
+ const void *src;
+ int af;
+
+ af = e->addr.proto == htons(ETH_P_IP) ? AF_INET : AF_INET6;
+ src = af == AF_INET ? (const void *)&e->addr.u.ip4 :
+ (const void *)&e->addr.u.ip6;
+ fprintf(f, "dev %s port %s grp %s %s", ll_index_to_name(ifindex),
+ ll_index_to_name(e->ifindex),
+ inet_ntop(af, src, abuf, sizeof(abuf)),
+ (e->state & MDB_PERMANENT) ? "permanent" : "temp");
+ if (e->vid)
+ fprintf(f, " vid %hu", e->vid);
+ fprintf(f, "\n");
}
static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr)
@@ -165,6 +167,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)
} req;
struct br_mdb_entry entry;
char *d = NULL, *p = NULL, *grp = NULL;
+ short vid = 0;
memset(&req, 0, sizeof(req));
memset(&entry, 0, sizeof(entry));
@@ -189,6 +192,9 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)
entry.state |= MDB_PERMANENT;
} else if (strcmp(*argv, "temp") == 0) {
;/* nothing */
+ } else if (strcmp(*argv, "vid") == 0) {
+ NEXT_ARG();
+ vid = atoi(*argv);
} else {
if (matches(*argv, "help") == 0)
usage();
@@ -222,6 +228,7 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)
} else
entry.addr.proto = htons(ETH_P_IP);
+ entry.vid = vid;
addattr_l(&req.n, sizeof(req), MDBA_SET_ENTRY, &entry, sizeof(entry));
if (rtnl_talk(&rth, &req.n, NULL, 0) < 0)
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 913bd8e3d406..f24050ba71bc 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -182,6 +182,7 @@ struct br_mdb_entry {
#define MDB_TEMPORARY 0
#define MDB_PERMANENT 1
__u8 state;
+ __u16 vid;
struct {
union {
__be32 ip4;
diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
index 4135d01a08bc..8922bf6f332b 100644
--- a/man/man8/bridge.8
+++ b/man/man8/bridge.8
@@ -77,7 +77,9 @@ bridge \- show / manipulate bridge addresses and devices
.IR PORT
.B grp
.IR GROUP " [ "
-.BR permanent " | " temp " ]"
+.BR permanent " | " temp " ] [ "
+.B vid
+.IR VID " ] "
.ti -8
.BR "bridge mdb show " [ "
@@ -426,6 +428,10 @@ the port.
- the mdb entry is temporary (default)
.sp
+.TP
+.BI vid " VID"
+the VLAN ID which is known to have members of this multicast group.
+
.in -8
.SS bridge mdb delete - delete a multicast group database entry
This command removes an existing mdb entry.
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2 net-next] bridge: mdb: add support for vlans
2015-07-15 15:45 [PATCH iproute2 net-next] bridge: mdb: add support for vlans Nikolay Aleksandrov
@ 2015-07-28 11:17 ` Nikolay Aleksandrov
2015-07-28 23:46 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Aleksandrov @ 2015-07-28 11:17 UTC (permalink / raw)
To: netdev; +Cc: stephen, davem
On 07/15/2015 05:45 PM, Nikolay Aleksandrov wrote:
> This patch allows the user to specify the vlan of the mdb group being
> added or deleted and adds support for displaying the vlan when
> dumping mdb information or monitoring it. It also updates the man page
> to reflect the new "vid" argument for mdb.
>
> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
> ---
> note: the cast in print_mdb_entry() was necessary to shut the compiler
>
> bridge/mdb.c | 31 +++++++++++++++++++------------
> include/linux/if_bridge.h | 1 +
> man/man8/bridge.8 | 8 +++++++-
> 3 files changed, 27 insertions(+), 13 deletions(-)
>
Hi Stephen,
Just wondering what's the state of this patch because I'd like to submit some
improvements in the same area and I'm wondering if I should do them on top
of this patch or if I need to change something in it ?
Thanks,
Nik
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2 net-next] bridge: mdb: add support for vlans
2015-07-28 11:17 ` Nikolay Aleksandrov
@ 2015-07-28 23:46 ` Stephen Hemminger
0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2015-07-28 23:46 UTC (permalink / raw)
To: Nikolay Aleksandrov; +Cc: netdev, davem
On Tue, 28 Jul 2015 13:17:35 +0200
Nikolay Aleksandrov <nikolay@cumulusnetworks.com> wrote:
> On 07/15/2015 05:45 PM, Nikolay Aleksandrov wrote:
> > This patch allows the user to specify the vlan of the mdb group being
> > added or deleted and adds support for displaying the vlan when
> > dumping mdb information or monitoring it. It also updates the man page
> > to reflect the new "vid" argument for mdb.
> >
> > Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
> > ---
> > note: the cast in print_mdb_entry() was necessary to shut the compiler
> >
> > bridge/mdb.c | 31 +++++++++++++++++++------------
> > include/linux/if_bridge.h | 1 +
> > man/man8/bridge.8 | 8 +++++++-
> > 3 files changed, 27 insertions(+), 13 deletions(-)
> >
>
> Hi Stephen,
> Just wondering what's the state of this patch because I'd like to submit some
> improvements in the same area and I'm wondering if I should do them on top
> of this patch or if I need to change something in it ?
>
> Thanks,
> Nik
>
Now on net-next branch of iproute2 since support is not in 4.2 kernel.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-28 23:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-15 15:45 [PATCH iproute2 net-next] bridge: mdb: add support for vlans Nikolay Aleksandrov
2015-07-28 11:17 ` Nikolay Aleksandrov
2015-07-28 23:46 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).