aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>2015-07-10 11:02:08 -0400
committerDavid S. Miller <davem@davemloft.net>2015-07-13 17:41:26 -0400
commit74fe61f17e999a458d5f64ca2aa9a0282ca32198 (patch)
treede60cdbdc6df04a7605ff527cb54f8d76af9cfc2 /net/bridge
parentc4675f935399cbdd3ba3869b0bf6c60528c8111a (diff)
bridge: mdb: add vlan support for user entries
Until now all user mdb entries were added in vlan 0, this patch adds support to allow the user to specify the vlan for the entry. About the uapi change a hole in struct br_mdb_entry is used so the size and offsets are kept the same (verified with pahole and tested with older iproute2). Example: $ bridge mdb dev br0 port eth1 grp 239.0.0.1 permanent vlan 2000 dev br0 port eth1 grp 239.0.0.1 permanent vlan 200 dev br0 port eth1 grp 239.0.0.1 permanent Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_mdb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index 1fb7d076f15c..a8d0e93d43f2 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -85,6 +85,7 @@ static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb,
85 memset(&e, 0, sizeof(e)); 85 memset(&e, 0, sizeof(e));
86 e.ifindex = port->dev->ifindex; 86 e.ifindex = port->dev->ifindex;
87 e.state = p->state; 87 e.state = p->state;
88 e.vid = p->addr.vid;
88 if (p->addr.proto == htons(ETH_P_IP)) 89 if (p->addr.proto == htons(ETH_P_IP))
89 e.addr.u.ip4 = p->addr.u.ip4; 90 e.addr.u.ip4 = p->addr.u.ip4;
90#if IS_ENABLED(CONFIG_IPV6) 91#if IS_ENABLED(CONFIG_IPV6)
@@ -242,6 +243,7 @@ void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port,
242 entry.addr.u.ip6 = group->u.ip6; 243 entry.addr.u.ip6 = group->u.ip6;
243#endif 244#endif
244 entry.state = state; 245 entry.state = state;
246 entry.vid = group->vid;
245 __br_mdb_notify(dev, &entry, type); 247 __br_mdb_notify(dev, &entry, type);
246} 248}
247 249
@@ -264,6 +266,8 @@ static bool is_valid_mdb_entry(struct br_mdb_entry *entry)
264 return false; 266 return false;
265 if (entry->state != MDB_PERMANENT && entry->state != MDB_TEMPORARY) 267 if (entry->state != MDB_PERMANENT && entry->state != MDB_TEMPORARY)
266 return false; 268 return false;
269 if (entry->vid >= VLAN_VID_MASK)
270 return false;
267 271
268 return true; 272 return true;
269} 273}
@@ -372,6 +376,7 @@ static int __br_mdb_add(struct net *net, struct net_bridge *br,
372 if (!p || p->br != br || p->state == BR_STATE_DISABLED) 376 if (!p || p->br != br || p->state == BR_STATE_DISABLED)
373 return -EINVAL; 377 return -EINVAL;
374 378
379 ip.vid = entry->vid;
375 ip.proto = entry->addr.proto; 380 ip.proto = entry->addr.proto;
376 if (ip.proto == htons(ETH_P_IP)) 381 if (ip.proto == htons(ETH_P_IP))
377 ip.u.ip4 = entry->addr.u.ip4; 382 ip.u.ip4 = entry->addr.u.ip4;
@@ -418,6 +423,7 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry)
418 if (!netif_running(br->dev) || br->multicast_disabled) 423 if (!netif_running(br->dev) || br->multicast_disabled)
419 return -EINVAL; 424 return -EINVAL;
420 425
426 ip.vid = entry->vid;
421 ip.proto = entry->addr.proto; 427 ip.proto = entry->addr.proto;
422 if (ip.proto == htons(ETH_P_IP)) { 428 if (ip.proto == htons(ETH_P_IP)) {
423 if (timer_pending(&br->ip4_other_query.timer)) 429 if (timer_pending(&br->ip4_other_query.timer))