Patchwork bridge: Correctly encode addresses when dumping mdb entries

login
register
mail settings
Submitter Vlad Yasevich
Date Dec. 18, 2012, 9:54 p.m.
Message ID <1355867648-17316-1-git-send-email-vyasevic@redhat.com>
Download mbox | patch
Permalink /patch/207221/
State Accepted
Delegated to: David Miller
Headers show

Comments

Vlad Yasevich - Dec. 18, 2012, 9:54 p.m.
When dumping mdb table, set the addresses the kernel returns
based on the address protocol type.

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
 net/bridge/br_mdb.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
WANG Cong - Dec. 19, 2012, 7:11 a.m.
On Tue, 18 Dec 2012 at 21:54 GMT, Vlad Yasevich <vyasevic@redhat.com> wrote:
> When dumping mdb table, set the addresses the kernel returns
> based on the address protocol type.
>
> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>

Looks good.

Acked-by: Cong Wang <amwang@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Dec. 19, 2012, 8:50 p.m.
From: Vlad Yasevich <vyasevic@redhat.com>
Date: Tue, 18 Dec 2012 16:54:08 -0500

> When dumping mdb table, set the addresses the kernel returns
> based on the address protocol type.
> 
> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index 9cf5d2b..ac22bb2 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -84,9 +84,11 @@  static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb,
 					struct br_mdb_entry e;
 					e.ifindex = port->dev->ifindex;
 					e.state = p->state;
-					e.addr.u.ip4 = p->addr.u.ip4;
+					if (p->addr.proto == htons(ETH_P_IP))
+						e.addr.u.ip4 = p->addr.u.ip4;
 #if IS_ENABLED(CONFIG_IPV6)
-					e.addr.u.ip6 = p->addr.u.ip6;
+					if (p->addr.proto == htons(ETH_P_IPV6))
+						e.addr.u.ip6 = p->addr.u.ip6;
 #endif
 					e.addr.proto = p->addr.proto;
 					if (nla_put(skb, MDBA_MDB_ENTRY_INFO, sizeof(e), &e)) {