|
|
4aca6e |
From ade2d09ef2a32d65a7a389b4b76b470c782addf2 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 deleted when monitoring delmdb event
|
|
|
4aca6e |
|
|
|
4aca6e |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289
|
|
|
4aca6e |
Upstream Status: iproute2.git commit 90d73159d9a32
|
|
|
4aca6e |
|
|
|
4aca6e |
commit 90d73159d9a326fa59c5e340ae3489f63ec49b3e
|
|
|
4aca6e |
Author: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
|
|
|
4aca6e |
Date: Thu Jul 30 11:30:32 2015 +0200
|
|
|
4aca6e |
|
|
|
4aca6e |
bridge: mdb: add deleted when monitoring delmdb event
|
|
|
4aca6e |
|
|
|
4aca6e |
Before this patch both addmdb and delmdb events were printed the same,
|
|
|
4aca6e |
now we'll get a "Deleted" string in front when delmdb is received.
|
|
|
4aca6e |
Before:
|
|
|
4aca6e |
$ bridge mdb add dev br0 port eth3 grp 239.0.0.1
|
|
|
4aca6e |
(monitor) dev br0 port eth3 grp 239.0.0.1 temp
|
|
|
4aca6e |
$ bridge mdb del dev br0 port eth3 grp 239.0.0.1
|
|
|
4aca6e |
(monitor) dev br0 port eth3 grp 239.0.0.1 temp
|
|
|
4aca6e |
^^ No way to differentiate between both events.
|
|
|
4aca6e |
|
|
|
4aca6e |
After:
|
|
|
4aca6e |
$ bridge mdb add dev br0 port eth3 grp 239.0.0.1
|
|
|
4aca6e |
(monitor) dev br0 port eth3 grp 239.0.0.1 temp
|
|
|
4aca6e |
$ bridge mdb del dev br0 port eth3 grp 239.0.0.1
|
|
|
4aca6e |
(monitor) Deleted dev br0 port eth3 grp 239.0.0.1 temp
|
|
|
4aca6e |
|
|
|
4aca6e |
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
|
|
|
4aca6e |
---
|
|
|
4aca6e |
bridge/mdb.c | 12 ++++++++----
|
|
|
4aca6e |
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/bridge/mdb.c b/bridge/mdb.c
|
|
|
4aca6e |
index 1b34f69..b14bd01 100644
|
|
|
4aca6e |
--- a/bridge/mdb.c
|
|
|
4aca6e |
+++ b/bridge/mdb.c
|
|
|
4aca6e |
@@ -48,7 +48,8 @@ static void br_print_router_ports(FILE *f, struct rtattr *attr)
|
|
|
4aca6e |
fprintf(f, "\n");
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
-static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e)
|
|
|
4aca6e |
+static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e,
|
|
|
4aca6e |
+ struct nlmsghdr *n)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
SPRINT_BUF(abuf);
|
|
|
4aca6e |
const void *src;
|
|
|
4aca6e |
@@ -57,6 +58,8 @@ static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e)
|
|
|
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 |
+ if (n->nlmsg_type == RTM_DELMDB)
|
|
|
4aca6e |
+ fprintf(f, "Deleted ");
|
|
|
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 |
@@ -66,7 +69,8 @@ static void print_mdb_entry(FILE *f, int ifindex, struct br_mdb_entry *e)
|
|
|
4aca6e |
fprintf(f, "\n");
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
-static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr)
|
|
|
4aca6e |
+static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr,
|
|
|
4aca6e |
+ struct nlmsghdr *n)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
struct rtattr *i;
|
|
|
4aca6e |
int rem;
|
|
|
4aca6e |
@@ -75,7 +79,7 @@ static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr)
|
|
|
4aca6e |
rem = RTA_PAYLOAD(attr);
|
|
|
4aca6e |
for (i = RTA_DATA(attr); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) {
|
|
|
4aca6e |
e = RTA_DATA(i);
|
|
|
4aca6e |
- print_mdb_entry(f, ifindex, e);
|
|
|
4aca6e |
+ print_mdb_entry(f, ifindex, e, n);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
@@ -108,7 +112,7 @@ int print_mdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|
|
4aca6e |
int rem = RTA_PAYLOAD(tb[MDBA_MDB]);
|
|
|
4aca6e |
|
|
|
4aca6e |
for (i = RTA_DATA(tb[MDBA_MDB]); RTA_OK(i, rem); i = RTA_NEXT(i, rem))
|
|
|
4aca6e |
- br_print_mdb_entry(fp, r->ifindex, i);
|
|
|
4aca6e |
+ br_print_mdb_entry(fp, r->ifindex, i, n);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
|
|
|
4aca6e |
if (tb[MDBA_ROUTER]) {
|
|
|
4aca6e |
--
|
|
|
4aca6e |
1.8.3.1
|
|
|
4aca6e |
|