Skip to contentSkip to conversation

Add basic VLAN support to bridges

RFC PATCH In review Vlad Yasevich 5 participants 20 messages Sep 19, 2012 – Sep 24, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Add basic VLAN support to bridges

This series of patches provides an ability to add VLAN IDs to the bridge ports. This is similar to what can be found in most switches. The bridge port may have any number of VLANs added to it including vlan 0 for untagged traffic. When vlans are added to the port, only traffic tagged with particular vlan will forwarded over this port. Additionally, vlan ids are added to FDB entries and become part of the lookup. This way we correctly identify the FDB entry.

The default behavior ofthe bridge is unchanged if no vlans have been configured.

Changes since v1:
- Comments addressed regarding formatting and RCU usage
- iocts have been removed and changed over the netlink interface.
- Added support of user added ndb entries.
- changed sysfs interface to export a bitmap. Also added a write interface. I am not sure how much I like it, but it made my testing easier/faster. I might change the write interface to take text instead of binary.

Vlad Yasevich (7):
bridge: Add vlan check to forwarding path
bridge: Add vlan to unicast fdb entries
bridge: Add vlan id to multicast groups
bridge: Add netlink interface to configure vlans on bridge ports
bridge: Add vlan support to static neighbors
bridge: Add sysfs interface to display VLANS
bridge: Add the ability to show dump the vlan map from a bridge port

 include/linux/if_bridge.h |    3 +-
 include/linux/if_link.h   |   23 ++++++
 include/linux/neighbour.h |    2 +-
 net/bridge/br_device.c    |    2 +-
 net/bridge/br_fdb.c       |   77 +++++++++++--------
 net/bridge/br_forward.c   |   15 ++++-
 net/bridge/br_if.c        |   74 +++++++++++++++++
 net/bridge/br_input.c     |   19 ++++-
 net/bridge/br_multicast.c |   64 +++++++++++-----
 net/bridge/br_netlink.c   |  190 ++++++++++++++++++++++++++++++++++++++------
 net/bridge/br_private.h   |   29 +++++++-
 net/bridge/br_sysfs_if.c  |   70 +++++++++++++++++
 12 files changed, 481 insertions(+), 87 deletions(-)
Signature · 1 line
1.7.7.6
#1 lore raw

RFC PATCH v2 1/7 bridge: Add vlan check to forwarding path

When forwarding packets make sure vlan matches any configured vlan for the port.

---
 net/bridge/br_forward.c |   15 ++++++++++++++-
 net/bridge/br_input.c   |   12 ++++++++++++
 net/bridge/br_private.h |   17 +++++++++++++++++
 3 files changed, 43 insertions(+), 1 deletions(-)
net/bridge/br_forward.c +14 -1
index 02015a5..f917cb8 100644
@@ -26,11 +26,24 @@ static int deliver_clone(const struct net_bridge_port *prev,
 			 void (*__packet_hook)(const struct net_bridge_port *p,
 					       struct sk_buff *skb));
 
-/* Don't forward packets to originating port or forwarding diasabled */
+/* check to see that the vlan is allowed to be forwarded on this interface */
+static inline int vlan_match(const struct net_bridge_port *p,
+			     const struct sk_buff *skb)
+{
+	unsigned long *vlan_map = rcu_dereference(p->vlan_map);
+	unsigned short vid = br_get_vlan(skb);
+
+	/* The map keeps the vlans off by 1 so adjust for that */
+	return vlan_map && test_bit(br_vid(vid), vlan_map);
+}
+
+/* Don't forward packets to originating port or forwarding diasabled.
+ */
 static inline int should_deliver(const struct net_bridge_port *p,
 				 const struct sk_buff *skb)
 {
 	return (((p->flags & BR_HAIRPIN_MODE) || skb->dev != p->dev) &&
+		vlan_match(p, skb) &&
 		p->state == BR_STATE_FORWARDING);
 }
 
net/bridge/br_input.c +12 -0
index 76f15fd..44f352d 100644
@@ -53,10 +53,22 @@ int br_handle_frame_finish(struct sk_buff *skb)
 	struct net_bridge_fdb_entry *dst;
 	struct net_bridge_mdb_entry *mdst;
 	struct sk_buff *skb2;
+	unsigned long *vlan_map;
+	u16 vid = 0;
 
 	if (!p || p->state == BR_STATE_DISABLED)
 		goto drop;
 
+	/* If VLAN filter is configured on the port, make sure we accept
+	 * only traffic matching the VLAN filter.
+	 */
+	vlan_map = rcu_dereference(p->vlan_map);
+	if (vlan_map) {
+		vid = br_get_vlan(skb);
+		if (!test_bit(br_vid(vid), vlan_map))
+			goto drop;
+	}
+
 	/* insert into forwarding database after filtering to avoid spoofing */
 	br = p->br;
 	br_fdb_update(br, p, eth_hdr(skb)->h_source);
net/bridge/br_private.h +17 -0
index f507d2a..baf1835 100644
@@ -18,6 +18,7 @@
 #include <linux/netpoll.h>
 #include <linux/u64_stats_sync.h>
 #include <net/route.h>
+#include <linux/if_vlan.h>
 
 #define BR_HASH_BITS 8
 #define BR_HASH_SIZE (1 << BR_HASH_BITS)
@@ -152,10 +153,17 @@ struct net_bridge_port
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	struct netpoll			*np;
 #endif
+	/* VLAN map of all vlans allowed on this port.  Stored off by 1,
+	 * such at VLAN 0 (untagged) is stored in bit 1.
+	 */
+	unsigned long __rcu		*vlan_map;
 };
 
 #define br_port_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT)
 
+/* Use this macro to get the correct VLAN id */
+#define br_vid(vid)		((vid) + 1)
+
 static inline struct net_bridge_port *br_port_get_rcu(const struct net_device *dev)
 {
 	struct net_bridge_port *port = rcu_dereference(dev->rx_handler_data);
@@ -168,6 +176,15 @@ static inline struct net_bridge_port *br_port_get_rtnl(struct net_device *dev)
 		rtnl_dereference(dev->rx_handler_data) : NULL;
 }
 
+static inline u16 br_get_vlan(const struct sk_buff *skb)
+{
+	u16 uninitialized_var(tag);
+
+	if (vlan_get_tag(skb, &tag))
+		return 0;
+	return tag & VLAN_VID_MASK;
+}
+
 struct br_cpu_netstats {
 	u64			rx_packets;
 	u64			rx_bytes;
Signature · 1 line
1.7.7.6
#2 lore raw

RFC PATCH v2 2/7 bridge: Add vlan to unicast fdb entries

In reply to Vlad Yasevich

This patch adds vlan to unicast fdb entries that are created for learned addresses (not the manually configured ones). It adds vlan id into the hash mix and uses vlan as an addditional parameter for an entry match.

---
 include/linux/if_bridge.h |    2 +-
 net/bridge/br_device.c    |    2 +-
 net/bridge/br_fdb.c       |   71 ++++++++++++++++++++++++++------------------
 net/bridge/br_input.c     |    7 ++--
 net/bridge/br_private.h   |    7 +++-
 5 files changed, 53 insertions(+), 36 deletions(-)
include/linux/if_bridge.h +1 -1
index dd3f201..8476d6f 100644
@@ -94,7 +94,7 @@ struct __fdb_entry {
 	__u32 ageing_timer_value;
 	__u8 port_hi;
 	__u8 pad0;
-	__u16 unused;
+	__u16 fdb_vid;
 };
 
 #ifdef __KERNEL__
net/bridge/br_device.c +1 -1
index 070e8a6..bf08c09 100644
@@ -67,7 +67,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
 			br_multicast_deliver(mdst, skb);
 		else
 			br_flood_deliver(br, skb);
-	} else if ((dst = __br_fdb_get(br, dest)) != NULL)
+	} else if ((dst = __br_fdb_get(br, dest, br_get_vlan(skb))) != NULL)
 		br_deliver(dst->dst, skb);
 	else
 		br_flood_deliver(br, skb);
net/bridge/br_fdb.c +42 -29

214 lines not on this page · raw message

net/bridge/br_input.c +4 -3
index 44f352d..c4f0020 100644
@@ -71,7 +71,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
 
 	/* insert into forwarding database after filtering to avoid spoofing */
 	br = p->br;
-	br_fdb_update(br, p, eth_hdr(skb)->h_source);
+	br_fdb_update(br, p, eth_hdr(skb)->h_source, vid);
 
 	if (!is_broadcast_ether_addr(dest) && is_multicast_ether_addr(dest) &&
 	    br_multicast_rcv(br, p, skb))
@@ -106,7 +106,8 @@ int br_handle_frame_finish(struct sk_buff *skb)
 			skb2 = skb;
 
 		br->dev->stats.multicast++;
-	} else if ((dst = __br_fdb_get(br, dest)) && dst->is_local) {
+	} else if ((dst = __br_fdb_get(br, dest, vid)) &&
+			dst->is_local) {
 		skb2 = skb;
 		/* Do not forward the packet since it's local. */
 		skb = NULL;
@@ -135,7 +136,7 @@ static int br_handle_local_finish(struct sk_buff *skb)
 {
 	struct net_bridge_port *p = br_port_get_rcu(skb->dev);
 
-	br_fdb_update(p->br, p, eth_hdr(skb)->h_source);
+	br_fdb_update(p->br, p, eth_hdr(skb)->h_source, br_get_vlan(skb));
 	return 0;	 /* process further */
 }
 
net/bridge/br_private.h +5 -2
index baf1835..bb382f1 100644
@@ -73,6 +73,7 @@ struct net_bridge_fdb_entry
 	unsigned long			updated;
 	unsigned long			used;
 	mac_addr			addr;
+	__u16				vlan_id;
 	unsigned char			is_local;
 	unsigned char			is_static;
 };
@@ -367,7 +368,8 @@ extern void br_fdb_cleanup(unsigned long arg);
 extern void br_fdb_delete_by_port(struct net_bridge *br,
 				  const struct net_bridge_port *p, int do_all);
 extern struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
-						 const unsigned char *addr);
+						 const unsigned char *addr,
+						 __u16 vlan_tci);
 extern int br_fdb_test_addr(struct net_device *dev, unsigned char *addr);
 extern int br_fdb_fillbuf(struct net_bridge *br, void *buf,
 			  unsigned long count, unsigned long off);
@@ -376,7 +378,8 @@ extern int br_fdb_insert(struct net_bridge *br,
 			 const unsigned char *addr);
 extern void br_fdb_update(struct net_bridge *br,
 			  struct net_bridge_port *source,
-			  const unsigned char *addr);
+			  const unsigned char *addr,
+			  __u16 vlan_tci);
 
 extern int br_fdb_delete(struct ndmsg *ndm,
 			 struct net_device *dev,
Signature · 1 line
1.7.7.6
#3 lore raw

Re: [RFC PATCHv2 bridge 2/7] bridge: Add vlan to unicast fdb entries

Quoted 4 lines · Vlad Yasevich

This patch adds vlan to unicast fdb entries that are created for learned addresses (not the manually configured ones). It adds vlan id into the hash mix and uses vlan as an addditional parameter for an entry match.

[...]

Quoted 4 lines
net/bridge/br_fdb.c +0 -0
index 9ce430b..e17f9f2 100644

[...]

Quoted 4 lines
net/bridge/br_fdb.c +0 -0
@@ -67,11 +68,12 @@ static inline int has_expired(const struct net_bridge *br,
                time_before_eq(fdb->updated + hold_time(br), jiffies);
 }
 

net/bridge/br_fdb.c static inline int has_expired(const struct net_bridge *br, · line 77

Quoted 10 lines
net/bridge/br_fdb.c +4 -3
-static inline int br_mac_hash(const unsigned char *mac)
+static inline int br_mac_hash(const unsigned char *mac, __u16 vlan_tci)
 {
-       /* use 1 byte of OUI cnd 3 bytes of NIC */
+       /* use 1 byte of OUI and 3 bytes of NIC */
        u32 key = get_unaligned((u32 *)(mac + 2));
-       return jhash_1word(key, fdb_salt) & (BR_HASH_SIZE - 1);
+       return jhash_2words(key, (vlan_tci & VLAN_VID_MASK),
+                               fdb_salt) & (BR_HASH_SIZE - 1);
 }

Why do you add a vlan_tci parameter to so many functions, which they then mask to get the VID? Would it not make more sense to pass only VIDs around?

[...]

Quoted 18 lines
net/bridge/br_fdb.c +3 -2
@@ -628,11 +640,12 @@ int br_fdb_add(struct ndmsg *ndm, struct net_device *dev,
 
        if (ndm->ndm_flags & NTF_USE) {
                rcu_read_lock();
-               br_fdb_update(p->br, p, addr);
+               br_fdb_update(p->br, p, addr, 0);
                rcu_read_unlock();
        } else {
                spin_lock_bh(&p->br->hash_lock);
-               err = fdb_add_entry(p, addr, ndm->ndm_state, nlh_flags);
+               err = fdb_add_entry(p, addr, ndm->ndm_state, nlh_flags,
+                               0);
                spin_unlock_bh(&p->br->hash_lock);
        }
 
@@ -642,10 +655,10 @@ int br_fdb_add(struct ndmsg *ndm, struct net_device *dev,
 static int fdb_delete_by_addr(struct net_bridge_port *p, u8 *addr)
 {

net/bridge/br_fdb.c int br_fdb_add(struct ndmsg *ndm, struct net_device *dev, · line 664

Quoted 10 lines
net/bridge/br_fdb.c +2 -2
        struct net_bridge *br = p->br;
-       struct hlist_head *head = &br->hash[br_mac_hash(addr)];
+       struct hlist_head *head = &br->hash[br_mac_hash(addr, 0)];
        struct net_bridge_fdb_entry *fdb;
 
-       fdb = fdb_find(head, addr);
+       fdb = fdb_find(head, addr, 0);
        if (!fdb)
                return -ENOENT;
 

So current tools will only be able to manipulate forwarding entries for untagged frames? Surely they should still insert and delete forwarding entries that affect all VLANs, and new tools will be able to restrict forwarding entries to specific VLANs?

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#4 lore raw

Re: [RFC PATCHv2 bridge 2/7] bridge: Add vlan to unicast fdb entries

Quoted 15 lines · Ben Hutchings
Quoted 4 lines · Vlad Yasevich

This patch adds vlan to unicast fdb entries that are created for learned addresses (not the manually configured ones). It adds vlan id into the hash mix and uses vlan as an addditional parameter for an entry match.

[...]

Quoted 4 lines
net/bridge/br_fdb.c +0 -0
index 9ce430b..e17f9f2 100644

[...]

Quoted 4 lines
net/bridge/br_fdb.c +0 -0
@@ -67,11 +68,12 @@ static inline int has_expired(const struct net_bridge *br,
                 time_before_eq(fdb->updated + hold_time(br), jiffies);
  }
 
Quoted 14 lines

net/bridge/br_fdb.c static inline int has_expired(const struct net_bridge *br, · line 77

Quoted 10 lines
net/bridge/br_fdb.c +4 -3
-static inline int br_mac_hash(const unsigned char *mac)
+static inline int br_mac_hash(const unsigned char *mac, __u16 vlan_tci)
  {
-       /* use 1 byte of OUI cnd 3 bytes of NIC */
+       /* use 1 byte of OUI and 3 bytes of NIC */
         u32 key = get_unaligned((u32 *)(mac + 2));
-       return jhash_1word(key, fdb_salt) & (BR_HASH_SIZE - 1);
+       return jhash_2words(key, (vlan_tci & VLAN_VID_MASK),
+                               fdb_salt) & (BR_HASH_SIZE - 1);
  }

Why do you add a vlan_tci parameter to so many functions, which they then mask to get the VID? Would it not make more sense to pass only VIDs around?

Its either do it in the few spots that use the value or doing in a lot of spots that call the functions. I had it the other way and the masking was in even more places as a result.

Quoted 25 lines

[...]

Quoted 23 lines
net/bridge/br_fdb.c +4 -3
@@ -628,11 +640,12 @@ int br_fdb_add(struct ndmsg *ndm, struct net_device *dev,
 
         if (ndm->ndm_flags & NTF_USE) {
                 rcu_read_lock();
-               br_fdb_update(p->br, p, addr);
+               br_fdb_update(p->br, p, addr, 0);
                 rcu_read_unlock();
         } else {
                 spin_lock_bh(&p->br->hash_lock);
-               err = fdb_add_entry(p, addr, ndm->ndm_state, nlh_flags);
+               err = fdb_add_entry(p, addr, ndm->ndm_state, nlh_flags,
+                               0);
                 spin_unlock_bh(&p->br->hash_lock);
         }
 
@@ -642,10 +655,10 @@ int br_fdb_add(struct ndmsg *ndm, struct net_device *dev,
  static int fdb_delete_by_addr(struct net_bridge_port *p, u8 *addr)
  {
         struct net_bridge *br = p->br;
-       struct hlist_head *head = &br->hash[br_mac_hash(addr)];
+       struct hlist_head *head = &br->hash[br_mac_hash(addr, 0)];
         struct net_bridge_fdb_entry *fdb;
 
Quoted 11 lines

net/bridge/br_fdb.c int br_fdb_add(struct ndmsg *ndm, struct net_device *dev, · line 664

Quoted 5 lines
net/bridge/br_fdb.c +1 -1
-       fdb = fdb_find(head, addr);
+       fdb = fdb_find(head, addr, 0);
         if (!fdb)
                 return -ENOENT;
 

So current tools will only be able to manipulate forwarding entries for untagged frames? Surely they should still insert and delete forwarding entries that affect all VLANs, and new tools will be able to restrict forwarding entries to specific VLANs?

I think that's patch5. It allows you to add an fdb to specific vlan.
I am not sure about all though, but that's a thought as well. What happens though if something like this happens:
1) Admin adds vlans on the port.
2) Admin adds fdb for _all_ vlans on the port.
3) new vlan needs to be added.

Do we now have to look at all fdbs for that port and add them for a new vlan?

I am making it explicit, so if the admin whats to add an fdb for a specific vlan, he has to do that separately (from patch which I need to resend, got really busy with something else).

-vlad

Quoted 2 lines

Ben.

#5 lore raw

RFC PATCH v2 3/7 bridge: Add vlan id to multicast groups

In reply to Vlad Yasevich

Add vlan_id to multicasts groups so that we know which vlan each group belongs to and can correctly forward to appropriate vlan.

---
 net/bridge/br_multicast.c |   64 +++++++++++++++++++++++++++++++--------------
 net/bridge/br_private.h   |    1 +
 2 files changed, 45 insertions(+), 20 deletions(-)
net/bridge/br_multicast.c +44 -20
index 2417434..888fc08 100644
@@ -51,6 +51,8 @@ static inline int br_ip_equal(const struct br_ip *a, const struct br_ip *b)
 {
 	if (a->proto != b->proto)
 		return 0;
+	if (a->vid != b->vid)
+		return 0;
 	switch (a->proto) {
 	case htons(ETH_P_IP):
 		return a->u.ip4 == b->u.ip4;
@@ -62,16 +64,19 @@ static inline int br_ip_equal(const struct br_ip *a, const struct br_ip *b)
 	return 0;
 }
 
-static inline int __br_ip4_hash(struct net_bridge_mdb_htable *mdb, __be32 ip)
+static inline int __br_ip4_hash(struct net_bridge_mdb_htable *mdb, __be32 ip,
+				__u16 vid)
 {
-	return jhash_1word(mdb->secret, (__force u32)ip) & (mdb->max - 1);
+	return jhash_2words((__force u32)ip, vid, mdb->secret) & (mdb->max - 1);
 }
 
 #if IS_ENABLED(CONFIG_IPV6)
 static inline int __br_ip6_hash(struct net_bridge_mdb_htable *mdb,
-				const struct in6_addr *ip)
+				const struct in6_addr *ip,
+				__u16 vid)
 {
-	return jhash2((__force u32 *)ip->s6_addr32, 4, mdb->secret) & (mdb->max - 1);
+	return jhash_2words(ipv6_addr_hash(ip), vid,
+			    mdb->secret) & (mdb->max - 1);
 }
 #endif
 
@@ -80,10 +85,10 @@ static inline int br_ip_hash(struct net_bridge_mdb_htable *mdb,
 {
 	switch (ip->proto) {
 	case htons(ETH_P_IP):
-		return __br_ip4_hash(mdb, ip->u.ip4);
+		return __br_ip4_hash(mdb, ip->u.ip4, ip->vid);
 #if IS_ENABLED(CONFIG_IPV6)
 	case htons(ETH_P_IPV6):
-		return __br_ip6_hash(mdb, &ip->u.ip6);
+		return __br_ip6_hash(mdb, &ip->u.ip6, ip->vid);
 #endif
 	}
 	return 0;
@@ -113,24 +118,27 @@ static struct net_bridge_mdb_entry *br_mdb_ip_get(
 }
 
 static struct net_bridge_mdb_entry *br_mdb_ip4_get(
-	struct net_bridge_mdb_htable *mdb, __be32 dst)
+	struct net_bridge_mdb_htable *mdb, __be32 dst, __u16 vlan_tci)
 {
 	struct br_ip br_dst;
 
 	br_dst.u.ip4 = dst;
 	br_dst.proto = htons(ETH_P_IP);
+	br_dst.vid = vlan_tci & VLAN_VID_MASK;
 
 	return br_mdb_ip_get(mdb, &br_dst);
 }
 
 #if IS_ENABLED(CONFIG_IPV6)
 static struct net_bridge_mdb_entry *br_mdb_ip6_get(
-	struct net_bridge_mdb_htable *mdb, const struct in6_addr *dst)
+	struct net_bridge_mdb_htable *mdb, const struct in6_addr *dst,
+	__u16 vlan_tci)
 {
 	struct br_ip br_dst;
 
 	br_dst.u.ip6 = *dst;
 	br_dst.proto = htons(ETH_P_IPV6);
+	br_dst.vid = vlan_tci & VLAN_VID_MASK;
 
 	return br_mdb_ip_get(mdb, &br_dst);
 }
@@ -692,7 +700,8 @@ err:
 
 static int br_ip4_multicast_add_group(struct net_bridge *br,
 				      struct net_bridge_port *port,
-				      __be32 group)
+				      __be32 group,
+				      __u16 vlan_tci)
 {
 	struct br_ip br_group;
 
@@ -701,6 +710,7 @@ static int br_ip4_multicast_add_group(struct net_bridge *br,
 
 	br_group.u.ip4 = group;
 	br_group.proto = htons(ETH_P_IP);
+	br_group.vid = vlan_tci & VLAN_VID_MASK;
 
 	return br_multicast_add_group(br, port, &br_group);
 }
@@ -708,7 +718,8 @@ static int br_ip4_multicast_add_group(struct net_bridge *br,
 #if IS_ENABLED(CONFIG_IPV6)
 static int br_ip6_multicast_add_group(struct net_bridge *br,
 				      struct net_bridge_port *port,
-				      const struct in6_addr *group)
+				      const struct in6_addr *group,
+				      __u16 vlan_tci)
 {
 	struct br_ip br_group;
 
@@ -717,6 +728,7 @@ static int br_ip6_multicast_add_group(struct net_bridge *br,
 
 	br_group.u.ip6 = *group;
 	br_group.proto = htons(ETH_P_IPV6);
+	br_group.vid = vlan_tci & VLAN_VID_MASK;
 
 	return br_multicast_add_group(br, port, &br_group);
 }
@@ -928,7 +940,8 @@ static int br_ip4_multicast_igmp3_report(struct net_bridge *br,
 			continue;
 		}
 
-		err = br_ip4_multicast_add_group(br, port, group);
+		err = br_ip4_multicast_add_group(br, port, group,
+						 br_get_vlan(skb));
 		if (err)
 			break;
 	}
@@ -988,7 +1001,8 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br,
 			continue;
 		}
 
-		err = br_ip6_multicast_add_group(br, port, &grec->grec_mca);
+		err = br_ip6_multicast_add_group(br, port, &grec->grec_mca,
+						 br_get_vlan(skb));
 		if (!err)
 			break;
 	}
@@ -1106,7 +1120,8 @@ static int br_ip4_multicast_query(struct net_bridge *br,
 	if (!group)
 		goto out;
 
-	mp = br_mdb_ip4_get(mlock_dereference(br->mdb, br), group);
+	mp = br_mdb_ip4_get(mlock_dereference(br->mdb, br), group,
+			    br_get_vlan(skb));
 	if (!mp)
 		goto out;
 
@@ -1178,7 +1193,8 @@ static int br_ip6_multicast_query(struct net_bridge *br,
 	if (!group)
 		goto out;
 
-	mp = br_mdb_ip6_get(mlock_dereference(br->mdb, br), group);
+	mp = br_mdb_ip6_get(mlock_dereference(br->mdb, br), group,
+			    br_get_vlan(skb));
 	if (!mp)
 		goto out;
 
@@ -1262,7 +1278,8 @@ out:
 
 static void br_ip4_multicast_leave_group(struct net_bridge *br,
 					 struct net_bridge_port *port,
-					 __be32 group)
+					 __be32 group,
+					 __u16 vlan_tci)
 {
 	struct br_ip br_group;
 
@@ -1271,6 +1288,7 @@ static void br_ip4_multicast_leave_group(struct net_bridge *br,
 
 	br_group.u.ip4 = group;
 	br_group.proto = htons(ETH_P_IP);
+	br_group.vid = vlan_tci & VLAN_VID_MASK;
 
 	br_multicast_leave_group(br, port, &br_group);
 }
@@ -1278,7 +1296,8 @@ static void br_ip4_multicast_leave_group(struct net_bridge *br,
 #if IS_ENABLED(CONFIG_IPV6)
 static void br_ip6_multicast_leave_group(struct net_bridge *br,
 					 struct net_bridge_port *port,
-					 const struct in6_addr *group)
+					 const struct in6_addr *group,
+					 __u16 vlan_tci)
 {
 	struct br_ip br_group;
 
@@ -1287,6 +1306,7 @@ static void br_ip6_multicast_leave_group(struct net_bridge *br,
 
 	br_group.u.ip6 = *group;
 	br_group.proto = htons(ETH_P_IPV6);
+	br_group.vid = vlan_tci & VLAN_VID_MASK;
 
 	br_multicast_leave_group(br, port, &br_group);
 }
@@ -1369,7 +1389,8 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br,
 	case IGMP_HOST_MEMBERSHIP_REPORT:
 	case IGMPV2_HOST_MEMBERSHIP_REPORT:
 		BR_INPUT_SKB_CB(skb)->mrouters_only = 1;
-		err = br_ip4_multicast_add_group(br, port, ih->group);
+		err = br_ip4_multicast_add_group(br, port, ih->group,
+						 br_get_vlan(skb2));
 		break;
 	case IGMPV3_HOST_MEMBERSHIP_REPORT:
 		err = br_ip4_multicast_igmp3_report(br, port, skb2);
@@ -1378,7 +1399,8 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br,
 		err = br_ip4_multicast_query(br, port, skb2);
 		break;
 	case IGMP_HOST_LEAVE_MESSAGE:
-		br_ip4_multicast_leave_group(br, port, ih->group);
+		br_ip4_multicast_leave_group(br, port, ih->group,
+					     br_get_vlan(skb2));
 		break;
 	}
 
@@ -1498,7 +1520,8 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
 		}
 		mld = (struct mld_msg *)skb_transport_header(skb2);
 		BR_INPUT_SKB_CB(skb)->mrouters_only = 1;
-		err = br_ip6_multicast_add_group(br, port, &mld->mld_mca);
+		err = br_ip6_multicast_add_group(br, port, &mld->mld_mca,
+						 br_get_vlan(skb2));
 		break;
 	    }
 	case ICMPV6_MLD2_REPORT:
@@ -1515,7 +1538,8 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
 			goto out;
 		}
 		mld = (struct mld_msg *)skb_transport_header(skb2);
-		br_ip6_multicast_leave_group(br, port, &mld->mld_mca);
+		br_ip6_multicast_leave_group(br, port, &mld->mld_mca,
+					     br_get_vlan(skb2));
 	    }
 	}
 
net/bridge/br_private.h +1 -0
index bb382f1..166dcf4 100644
@@ -62,6 +62,7 @@ struct br_ip
 #endif
 	} u;
 	__be16		proto;
+	__u16		vid;
 };
 
 struct net_bridge_fdb_entry
Signature · 1 line
1.7.7.6
#6 lore raw

RFC PATCH v2 4/7 bridge: Add netlink interface to configure vlans on bridge ports

In reply to Vlad Yasevich

Add a netlink interface to add and remove vlan configuration on bridge port. The interface uses the RTM_SETLINK message and encodes the vlan configuration inside the IFLA_AF_SPEC. It is possble to include multiple vlans to either add or remove in a single message.

---
 include/linux/if_link.h |   22 +++++++++
 net/bridge/br_if.c      |   74 +++++++++++++++++++++++++++++
 net/bridge/br_netlink.c |  117 ++++++++++++++++++++++++++++++++++++++--------
 net/bridge/br_private.h |    2 +
 4 files changed, 194 insertions(+), 21 deletions(-)
include/linux/if_link.h +22 -0
index ac173bd..38dbcff 100644
@@ -398,4 +398,26 @@ struct ifla_port_vsi {
 	__u8 pad[3];
 };
 
+/* Bridge Section
+ * [IFLA_AF_SPEC] = {
+ *   [AF_BRIDGE] = {
+ *	[IFLA_BR_VLAN_INFO] = ...
+ *   }
+ * }
+ */
+enum {
+	IFLA_BR_UNSPEC,
+	IFLA_BR_VLAN_INFO,
+	__IFLA_BR_MAX,
+};
+#define IFLA_BR_MAX (__IFLA_BR_MAX - 1)
+
+enum {
+	IFLA_BR_VLAN_UNSPEC,
+	IFLA_BR_VLAN_ADD,
+	IFLA_BR_VLAN_DEL,
+	__IFLA_BR_VLAN_MAX,
+};
+#define IFLA_BR_VLAN_MAX (__IFLA_BR_VLAN_MAX - 1)
+
 #endif /* _LINUX_IF_LINK_H */
net/bridge/br_if.c +74 -0

86 lines not on this page · raw message

net/bridge/br_netlink.c +96 -21

157 lines not on this page · raw message

net/bridge/br_private.h +2 -0
index 166dcf4..8eb3ffc 100644
@@ -417,6 +417,8 @@ extern int br_del_if(struct net_bridge *br,
 extern int br_min_mtu(const struct net_bridge *br);
 extern netdev_features_t br_features_recompute(struct net_bridge *br,
 	netdev_features_t features);
+extern int br_set_port_vlan(struct net_bridge_port *p, unsigned short vid);
+extern int br_del_port_vlan(struct net_bridge_port *p, unsigned short vid);
 
 /* br_input.c */
 extern int br_handle_frame_finish(struct sk_buff *skb);
Signature · 1 line
1.7.7.6
#7 lore raw

Re: [RFC PATCHv2 bridge 4/7] bridge: Add netlink interface to configure vlans on bridge ports

Quoted 4 lines · Vlad Yasevich

Add a netlink interface to add and remove vlan configuration on bridge port. The interface uses the RTM_SETLINK message and encodes the vlan configuration inside the IFLA_AF_SPEC. It is possble to include multiple vlans to either add or remove in a single message.

[...]

Quoted 15 lines
net/bridge/br_if.c +2 -0
@@ -23,6 +23,7 @@
 #include <linux/if_ether.h>
 #include <linux/slab.h>
 #include <net/sock.h>
+#include <linux/if_vlan.h>
 
 #include "br_private.h"
 
@@ -445,6 +446,79 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
 	return 0;
 }
 
+/* Called with RTNL */

net/bridge/br_if.c int br_del_if(struct net_bridge *br, struct net_device *dev) · line 459

Quoted 10 lines
net/bridge/br_if.c +10 -0
+int br_set_port_vlan(struct net_bridge_port *p, unsigned short vlan)
+{
+	unsigned long table_size = BITS_TO_LONGS(br_vid(VLAN_N_VID));
+	unsigned long *vid_map = NULL;
+	__u16 vid = br_vid(vlan);
+	int ret = 0;
+
+	/* The vlan map is indexed by vid+1.  This way we can store
+	 * vid 0 (untagged) into the map as well.
+	 */

So bit 1 is for untagged, bits 2-4096 are for tagged, and bit 0 is for...?

Quoted 14 lines
net/bridge/br_if.c +14 -0
+	if (!p->vlan_map) {
+		vid_map = kzalloc(table_size, GFP_KERNEL);
+		if (!vid_map) {
+			return -ENOMEM;
+		}
+
+		set_bit(vid, vid_map);
+		rcu_assign_pointer(p->vlan_map, vid_map);
+		synchronize_net();
+	} else {
+		/* Map is already allocated */
+		set_bit(vid, rcu_dereference_rtnl(p->vlan_map));
+	}
+

net/bridge/br_if.c int br_del_if(struct net_bridge *br, struct net_device *dev) · line 483

Quoted 10 lines
net/bridge/br_if.c +10 -0
+	return ret;
+}
+
+
+/* Called with RTNL */
+int br_del_port_vlan(struct net_bridge_port *p, unsigned short vlan)
+{
+	unsigned long first_bit;
+	unsigned long next_bit;
+	__u16 vid = br_vid(vlan);

Which is the bit number, not really the VID - a little confusing...

Quoted 6 lines
net/bridge/br_if.c +6 -0
+	unsigned long tbl_len = BITS_TO_LONGS(br_vid(VLAN_N_VID));
+
+	if (!p->vlan_map) {
+		return -EINVAL;
+	}
+

net/bridge/br_if.c int br_del_if(struct net_bridge *br, struct net_device *dev) · line 499

Quoted 10 lines
net/bridge/br_if.c +10 -0
+	if (!test_bit(vlan, p->vlan_map)) {
+		return -EINVAL;
+	}
+
+	/* Check to see if any other vlans are in this table.  If this
+	 * is the last vlan, delete the whole table.  If this is not the
+	 * last vlan, just clear the bit.
+	 */
+	first_bit = find_first_bit(p->vlan_map, tbl_len);
+	next_bit = find_next_bit(p->vlan_map, tbl_len, (tbl_len - vid));

[...]

Last parameter to find_next_bit is the starting offset, which should presumably be vid + 1.

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#8 lore raw

RFC PATCH v2 5/7 bridge: Add vlan support to static neighbors

In reply to Vlad Yasevich
---
 include/linux/neighbour.h |    2 +-
 net/bridge/br_fdb.c       |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
include/linux/neighbour.h +1 -1
index 275e5d6..044df8f 100644
@@ -7,7 +7,7 @@
 struct ndmsg {
 	__u8		ndm_family;
 	__u8		ndm_pad1;
-	__u16		ndm_pad2;
+	__u16		ndm_vlan;
 	__s32		ndm_ifindex;
 	__u16		ndm_state;
 	__u8		ndm_flags;
net/bridge/br_fdb.c +6 -6
index e17f9f2..3c21a3d 100644
@@ -493,7 +493,7 @@ static int fdb_fill_info(struct sk_buff *skb, const struct net_bridge *br,
 	ndm = nlmsg_data(nlh);
 	ndm->ndm_family	 = AF_BRIDGE;
 	ndm->ndm_pad1    = 0;
-	ndm->ndm_pad2    = 0;
+	ndm->ndm_vlan    = fdb->vlan_id;
 	ndm->ndm_flags	 = 0;
 	ndm->ndm_type	 = 0;
 	ndm->ndm_ifindex = fdb->dst ? fdb->dst->dev->ifindex : br->dev->ifindex;
@@ -640,25 +640,25 @@ int br_fdb_add(struct ndmsg *ndm, struct net_device *dev,
 
 	if (ndm->ndm_flags & NTF_USE) {
 		rcu_read_lock();
-		br_fdb_update(p->br, p, addr, 0);
+		br_fdb_update(p->br, p, addr, ndm->ndm_vlan);
 		rcu_read_unlock();
 	} else {
 		spin_lock_bh(&p->br->hash_lock);
 		err = fdb_add_entry(p, addr, ndm->ndm_state, nlh_flags,
-				0);
+				ndm->ndm_vlan);
 		spin_unlock_bh(&p->br->hash_lock);
 	}
 
 	return err;
 }
 
-static int fdb_delete_by_addr(struct net_bridge_port *p, u8 *addr)
+static int fdb_delete_by_addr(struct net_bridge_port *p, u8 *addr, u16 vlan)
 {
 	struct net_bridge *br = p->br;
 	struct hlist_head *head = &br->hash[br_mac_hash(addr, 0)];
 	struct net_bridge_fdb_entry *fdb;
 
-	fdb = fdb_find(head, addr, 0);
+	fdb = fdb_find(head, addr, vlan);
 	if (!fdb)
 		return -ENOENT;
 
@@ -681,7 +681,7 @@ int br_fdb_delete(struct ndmsg *ndm, struct net_device *dev,
 	}
 
 	spin_lock_bh(&p->br->hash_lock);
-	err = fdb_delete_by_addr(p, addr);
+	err = fdb_delete_by_addr(p, addr, ndm->ndm_vlan);
 	spin_unlock_bh(&p->br->hash_lock);
 
 	return err;
Signature · 1 line
1.7.7.6
#9 lore raw

Re: [RFC PATCHv2 bridge 5/7] bridge: Add vlan support to static neighbors

Quoted 10 lines · Vlad Yasevich
---
  include/linux/neighbour.h |    2 +-
  net/bridge/br_fdb.c       |   12 ++++++------
  2 files changed, 7 insertions(+), 7 deletions(-)
include/linux/neighbour.h +0 -0
index 275e5d6..044df8f 100644

include/linux/neighbour.h line 10

Quoted 5 lines
include/linux/neighbour.h +1 -1
@@ -7,7 +7,7 @@
  struct ndmsg {
  	__u8		ndm_family;
  	__u8		ndm_pad1;
-	__u16		ndm_pad2;
+	__u16		ndm_vlan;

But ndm_pad2 is also used in neighbour.c so you'll need to fix that up as well.

net/core/neighbour.c: In function âneigh_fill_infoâ:
net/core/neighbour.c:2152: error: âstruct ndmsgâ has no member named ândm_pad2â net/core/neighbour.c: In function âpneigh_fill_infoâ:
net/core/neighbour.c:2203: error: âstruct ndmsgâ has no member named ândm_pad2â make[2]: *** [net/core/neighbour.o] Error 1
make[1]: *** [net/core] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [net] Error 2
make: *** Waiting for unfinished jobs....

#10 lore raw

Re: [RFC PATCHv2 bridge 5/7] bridge: Add vlan support to static neighbors

Quoted 20 lines · John Fastabend
Quoted 10 lines · Vlad Yasevich
---
  include/linux/neighbour.h |    2 +-
  net/bridge/br_fdb.c       |   12 ++++++------
  2 files changed, 7 insertions(+), 7 deletions(-)
include/linux/neighbour.h +0 -0
index 275e5d6..044df8f 100644

include/linux/neighbour.h line 10

Quoted 5 lines
include/linux/neighbour.h +1 -1
@@ -7,7 +7,7 @@
  struct ndmsg {
      __u8        ndm_family;
      __u8        ndm_pad1;
-    __u16        ndm_pad2;
+    __u16        ndm_vlan;

But ndm_pad2 is also used in neighbour.c so you'll need to fix that up as well.

Quoted 11 lines

net/core/neighbour.c: In function âneigh_fill_infoâ:
net/core/neighbour.c:2152: error: âstruct ndmsgâ has no member named ândm_pad2â
net/core/neighbour.c: In function âpneigh_fill_infoâ:
net/core/neighbour.c:2203: error: âstruct ndmsgâ has no member named ândm_pad2â
make[2]: *** [net/core/neighbour.o] Error 1
make[1]: *** [net/core] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [net] Error 2
make: *** Waiting for unfinished jobs....

dough!!! patches from wrong branch. sorry about that.

-vlad

#11 lore raw

RFC PATCH v2 6/7 bridge: Add sysfs interface to display VLANS

In reply to Vlad Yasevich

Add a binary sysfs file that will dump out vlans currently configured on the port.

---
 include/linux/if_bridge.h |    1 +
 net/bridge/br_sysfs_if.c  |   70 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 0 deletions(-)
include/linux/if_bridge.h +1 -0
index 8476d6f..cc85739 100644
@@ -20,6 +20,7 @@
 #define SYSFS_BRIDGE_PORT_SUBDIR "brif"
 #define SYSFS_BRIDGE_PORT_ATTR	"brport"
 #define SYSFS_BRIDGE_PORT_LINK	"bridge"
+#define SYSFS_BRIDGE_PORT_VLANS "vlans"
 
 #define BRCTL_VERSION 1
 
net/bridge/br_sysfs_if.c +70 -0

82 lines not on this page · raw message

Signature · 1 line
1.7.7.6
#12 lore raw

RFC PATCH v2 7/7 bridge: Add the ability to show dump the vlan map from a bridge port

In reply to Vlad Yasevich

Using the RTM_GETLINK dump the vlan map of a given bridge port.

---
 include/linux/if_link.h |    1 +
 net/bridge/br_netlink.c |   73 +++++++++++++++++++++++++++++++++++++++++++---
 net/bridge/br_private.h |    2 +
 3 files changed, 71 insertions(+), 5 deletions(-)
include/linux/if_link.h +1 -0
index 38dbcff..6953233 100644
@@ -416,6 +416,7 @@ enum {
 	IFLA_BR_VLAN_UNSPEC,
 	IFLA_BR_VLAN_ADD,
 	IFLA_BR_VLAN_DEL,
+	IFLA_BR_VLAN_MAP,
 	__IFLA_BR_VLAN_MAX,
 };
 #define IFLA_BR_VLAN_MAX (__IFLA_BR_VLAN_MAX - 1)
net/bridge/br_netlink.c +68 -5

115 lines not on this page · raw message

net/bridge/br_private.h +2 -0
index 8eb3ffc..0575edb 100644
@@ -419,6 +419,8 @@ extern netdev_features_t br_features_recompute(struct net_bridge *br,
 	netdev_features_t features);
 extern int br_set_port_vlan(struct net_bridge_port *p, unsigned short vid);
 extern int br_del_port_vlan(struct net_bridge_port *p, unsigned short vid);
+extern size_t br_port_fill_vlans(struct net_bridge_port *p, char *buf,
+				unsigned long max, unsigned long skip);
 
 /* br_input.c */
 extern int br_handle_frame_finish(struct sk_buff *skb);
Signature · 1 line
1.7.7.6
#13 lore raw

Re: [RFC PATCHv2 bridge 7/7] bridge: Add the ability to show dump the vlan map from a bridge port

Quoted 1 line · Vlad Yasevich

Using the RTM_GETLINK dump the vlan map of a given bridge port.

[...]

This enlarges the RTM_GETLINK response quite a bit. I think perhaps this should be optional, like IFLA_VFINFO_LIST is now.

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
maintainer
#14 lore raw

Re: [RFC PATCHv2 bridge 7/7] bridge: Add the ability to show dump the vlan map from a bridge port

From: Ben Hutchings <[email protected]>
Date: Sat, 22 Sep 2012 18:15:32 +0100

Quoted 6 lines · Vlad Yasevich
Quoted 1 line

Using the RTM_GETLINK dump the vlan map of a given bridge port.

[...]

This enlarges the RTM_GETLINK response quite a bit. I think perhaps this should be optional, like IFLA_VFINFO_LIST is now.

Completely agreed.

#15 lore raw

Re: [RFC PATCHv2 bridge 7/7] bridge: Add the ability to show dump the vlan map from a bridge port

Quoted 11 lines · On Sat, 22 Sep 2012 13:27:47 -0400 (EDT) David Miller <[email protected]>…

From: Ben Hutchings <[email protected]>
Date: Sat, 22 Sep 2012 18:15:32 +0100

Quoted 6 lines · Vlad Yasevich
Quoted 1 line

Using the RTM_GETLINK dump the vlan map of a given bridge port.

[...]

This enlarges the RTM_GETLINK response quite a bit. I think perhaps this should be optional, like IFLA_VFINFO_LIST is now.

Completely agreed.

Since most users won't use it, it should be not necessary to include it if the map is blank.

#16 lore raw

Re: [RFC PATCHv2 bridge 7/7] bridge: Add the ability to show dump the vlan map from a bridge port

Quoted 10 lines · Stephen Hemminger
Quoted 7 lines · On Sat, 22 Sep 2012 13:27:47 -0400 (EDT) David Miller <[email protected]>…

From: Ben Hutchings <[email protected]>
Date: Sat, 22 Sep 2012 18:15:32 +0100

Quoted 4 lines · Vlad Yasevich
Quoted 1 line

Using the RTM_GETLINK dump the vlan map of a given bridge port.

[...]

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

This enlarges the RTM_GETLINK response quite a bit. I think perhaps this should be optional, like IFLA_VFINFO_LIST is now.

Completely agreed.

Since most users won't use it, it should be not necessary to include it if the map is blank.

Response is included only for AF_BRIDGE calls (proably used by STP implementation) and only when vlan filtering is configured.

I do see the point though and can add a filter for this.

-vlad

#17 lore raw

Re: [RFC PATCHv2 bridge 7/7] bridge: Add the ability to show dump the vlan map from a bridge port

Quoted 16 lines · Vlad Yasevich
Quoted 15 lines · Stephen Hemminger
Quoted 11 lines · On Sat, 22 Sep 2012 13:27:47 -0400 (EDT) David Miller <[email protected]>…

From: Ben Hutchings <[email protected]>
Date: Sat, 22 Sep 2012 18:15:32 +0100

Quoted 6 lines · Vlad Yasevich
Quoted 1 line

Using the RTM_GETLINK dump the vlan map of a given bridge port.

[...]

This enlarges the RTM_GETLINK response quite a bit. I think perhaps this should be optional, like IFLA_VFINFO_LIST is now.

Completely agreed.

Quoted 8 lines
Quoted 3 lines

Since most users won't use it, it should be not necessary to include it if the map is blank.

Response is included only for AF_BRIDGE calls (proably used by STP implementation) and only when vlan filtering is configured.

I do see the point though and can add a filter for this.

I thought the per-AF stuff was included by default (or at least what most clients ask for). If not then this is probably fine. IFLA_VFINFO_LIST was causing glibc's queries to fail and that must be avoided.

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#18 lore raw

Re: [RFC PATCHv2 bridge 7/7] bridge: Add the ability to show dump the vlan map from a bridge port

Quoted 24 lines · Ben Hutchings
Quoted 23 lines · Vlad Yasevich
Quoted 10 lines · Stephen Hemminger
Quoted 7 lines · On Sat, 22 Sep 2012 13:27:47 -0400 (EDT) David Miller <[email protected]>…

From: Ben Hutchings <[email protected]>
Date: Sat, 22 Sep 2012 18:15:32 +0100

Quoted 4 lines · Vlad Yasevich
Quoted 1 line

Using the RTM_GETLINK dump the vlan map of a given bridge port.

[...]

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

This enlarges the RTM_GETLINK response quite a bit. I think perhaps this should be optional, like IFLA_VFINFO_LIST is now.

Completely agreed.

Since most users won't use it, it should be not necessary to include it if the map is blank.

Response is included only for AF_BRIDGE calls (proably used by STP implementation) and only when vlan filtering is configured.

Quoted 9 lines
Quoted 1 line

I do see the point though and can add a filter for this.

I thought the per-AF stuff was included by default (or at least what most clients ask for). If not then this is probably fine. IFLA_VFINFO_LIST was causing glibc's queries to fail and that must be avoided.

Ben.

Not just that. This is a PF_BRIDGE family request. Note the

	err = __rtnl_register(PF_BRIDGE, RTM_GETLINK, NULL,
                              br_dump_ifinfo, NULL);

in br_netlink_init.

-vlad

#19 lore raw

Re: [RFC PATCHv2 bridge 7/7] bridge: Add the ability to show dump the vlan map from a bridge port

In reply to Ben Hutchings
Quoted 9 lines · Ben Hutchings
Quoted 1 line · Vlad Yasevich

Using the RTM_GETLINK dump the vlan map of a given bridge port.

[...]

This enlarges the RTM_GETLINK response quite a bit. I think perhaps this should be optional, like IFLA_VFINFO_LIST is now.

Ben.

Only for AF_BRIDGE and only if VLANs are set. I guess I could add a filter option similar to VFINFO as well, if you think that's necessary.

-vlad