* [PATCH 1/3] iproute2: distinguish permanent and temporary mdb entries
@ 2012-12-20 14:31 Cong Wang
2012-12-20 14:31 ` [PATCH 2/3] iproute2: update help info of bridge command Cong Wang
2012-12-20 14:31 ` [PATCH 3/3] iproute2: make `bridge mdb` output consistent with input Cong Wang
0 siblings, 2 replies; 4+ messages in thread
From: Cong Wang @ 2012-12-20 14:31 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, bridge, Cong Wang
This patch adds a flag to mdb entries so that we can distinguish
permanent entries with temporary ones.
Cc: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
bridge/mdb.c | 24 +++++++++++++++---------
include/linux/if_bridge.h | 3 +++
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/bridge/mdb.c b/bridge/mdb.c
index 121ce9c..6217c5f 100644
--- a/bridge/mdb.c
+++ b/bridge/mdb.c
@@ -28,7 +28,7 @@ int filter_index;
static void usage(void)
{
- fprintf(stderr, "Usage: bridge mdb { add | del } dev DEV port PORT grp GROUP\n");
+ fprintf(stderr, "Usage: bridge mdb { add | del } dev DEV port PORT grp GROUP [permanent | temp]\n");
fprintf(stderr, " bridge mdb {show} [ dev DEV ]\n");
exit(-1);
}
@@ -53,13 +53,15 @@ 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, "bridge %s port %s group %s\n", ll_index_to_name(ifindex),
+ fprintf(f, "bridge %s port %s group %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)));
+ inet_ntop(AF_INET, &e->addr.u.ip4, abuf, sizeof(abuf)),
+ (e->state & MDB_PERMANENT) ? "permanent" : "temp");
else
- fprintf(f, "bridge %s port %s group %s\n", ll_index_to_name(ifindex),
+ fprintf(f, "bridge %s port %s group %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)));
+ inet_ntop(AF_INET6, &e->addr.u.ip6, abuf, sizeof(abuf)),
+ (e->state & MDB_PERMANENT) ? "permanent" : "temp");
}
static void br_print_mdb_entry(FILE *f, int ifindex, struct rtattr *attr)
@@ -179,11 +181,15 @@ static int mdb_modify(int cmd, int flags, int argc, char **argv)
} else if (strcmp(*argv, "grp") == 0) {
NEXT_ARG();
grp = *argv;
+ } else if (strcmp(*argv, "port") == 0) {
+ NEXT_ARG();
+ p = *argv;
+ } else if (strcmp(*argv, "permanent") == 0) {
+ if (cmd == RTM_NEWMDB)
+ entry.state |= MDB_PERMANENT;
+ } else if (strcmp(*argv, "temp") == 0) {
+ ;/* nothing */
} else {
- if (strcmp(*argv, "port") == 0) {
- NEXT_ARG();
- p = *argv;
- }
if (matches(*argv, "help") == 0)
usage();
}
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index b3b6a67..aac8b8c 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -163,6 +163,9 @@ struct br_port_msg {
struct br_mdb_entry {
__u32 ifindex;
+#define MDB_TEMPORARY 0
+#define MDB_PERMANENT 1
+ __u8 state;
struct {
union {
__be32 ip4;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] iproute2: update help info of bridge command
2012-12-20 14:31 [PATCH 1/3] iproute2: distinguish permanent and temporary mdb entries Cong Wang
@ 2012-12-20 14:31 ` Cong Wang
2012-12-20 14:31 ` [PATCH 3/3] iproute2: make `bridge mdb` output consistent with input Cong Wang
1 sibling, 0 replies; 4+ messages in thread
From: Cong Wang @ 2012-12-20 14:31 UTC (permalink / raw)
To: netdev; +Cc: bridge, Cong Wang, Stephen Hemminger
Cc: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
bridge/bridge.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bridge/bridge.c b/bridge/bridge.c
index 1fcd365..1d59a1e 100644
--- a/bridge/bridge.c
+++ b/bridge/bridge.c
@@ -27,7 +27,7 @@ static void usage(void)
{
fprintf(stderr,
"Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n"
-"where OBJECT := { fdb | monitor }\n"
+"where OBJECT := { fdb | mdb | monitor }\n"
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails]\n" );
exit(-1);
}
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] iproute2: make `bridge mdb` output consistent with input
2012-12-20 14:31 [PATCH 1/3] iproute2: distinguish permanent and temporary mdb entries Cong Wang
2012-12-20 14:31 ` [PATCH 2/3] iproute2: update help info of bridge command Cong Wang
@ 2012-12-20 14:31 ` Cong Wang
2012-12-20 18:58 ` Stephen Hemminger
1 sibling, 1 reply; 4+ messages in thread
From: Cong Wang @ 2012-12-20 14:31 UTC (permalink / raw)
To: netdev; +Cc: bridge, Cong Wang, Stephen Hemminger
bridge -> dev
group -> grp
Cc: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
bridge/mdb.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bridge/mdb.c b/bridge/mdb.c
index 6217c5f..81d479b 100644
--- a/bridge/mdb.c
+++ b/bridge/mdb.c
@@ -53,12 +53,12 @@ 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, "bridge %s port %s group %s %s\n", ll_index_to_name(ifindex),
+ 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, "bridge %s port %s group %s %s\n", ll_index_to_name(ifindex),
+ 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");
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-20 18:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20 14:31 [PATCH 1/3] iproute2: distinguish permanent and temporary mdb entries Cong Wang
2012-12-20 14:31 ` [PATCH 2/3] iproute2: update help info of bridge command Cong Wang
2012-12-20 14:31 ` [PATCH 3/3] iproute2: make `bridge mdb` output consistent with input Cong Wang
2012-12-20 18:58 ` 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).