Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09d7cf7

Browse files
Vlad Yasevichdavem330
authored andcommitted
bridge: Correctly encode addresses when dumping mdb entries
When dumping mdb table, set the addresses the kernel returns based on the address protocol type. Signed-off-by: Vlad Yasevich <[email protected]> Acked-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6323315 commit 09d7cf7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/bridge/br_mdb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb,
8484
struct br_mdb_entry e;
8585
e.ifindex = port->dev->ifindex;
8686
e.state = p->state;
87-
e.addr.u.ip4 = p->addr.u.ip4;
87+
if (p->addr.proto == htons(ETH_P_IP))
88+
e.addr.u.ip4 = p->addr.u.ip4;
8889
#if IS_ENABLED(CONFIG_IPV6)
89-
e.addr.u.ip6 = p->addr.u.ip6;
90+
if (p->addr.proto == htons(ETH_P_IPV6))
91+
e.addr.u.ip6 = p->addr.u.ip6;
9092
#endif
9193
e.addr.proto = p->addr.proto;
9294
if (nla_put(skb, MDBA_MDB_ENTRY_INFO, sizeof(e), &e)) {

0 commit comments

Comments
 (0)