summaryrefslogtreecommitdiffstats
path: root/net/bridge/br_netlink.c
diff options
context:
space:
mode:
authorVlad Yasevich <vyasevic@redhat.com>2013-02-13 12:00:15 +0000
committerDavid S. Miller <davem@davemloft.net>2013-02-13 19:42:15 -0500
commit552406c488ec2cf1aaf8b5bd24d1750c9fd6d8cc (patch)
treea107b251cc39ce383b1fad2dff97f0c088b3c172 /net/bridge/br_netlink.c
parent7885198861fc9a3dfdc6bb90dc0ba12689d6cd57 (diff)
downloadlinux-552406c488ec2cf1aaf8b5bd24d1750c9fd6d8cc.tar.bz2
bridge: Add the ability to configure pvid
A user may designate a certain vlan as PVID. This means that any ingress frame that does not contain a vlan tag is assigned to this vlan and any forwarding decisions are made with this vlan in mind. Signed-off-by: Vlad Yasevich <vyasevic@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_netlink.c')
-rw-r--r--net/bridge/br_netlink.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index fe1980d5a7e4..e044cc0b5650 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -120,6 +120,7 @@ static int br_fill_ifinfo(struct sk_buff *skb,
const struct net_port_vlans *pv;
struct bridge_vlan_info vinfo;
u16 vid;
+ u16 pvid;
if (port)
pv = nbp_get_vlan_info(port);
@@ -133,12 +134,15 @@ static int br_fill_ifinfo(struct sk_buff *skb,
if (!af)
goto nla_put_failure;
+ pvid = br_get_pvid(pv);
for (vid = find_first_bit(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN);
vid < BR_VLAN_BITMAP_LEN;
vid = find_next_bit(pv->vlan_bitmap,
BR_VLAN_BITMAP_LEN, vid+1)) {
vinfo.vid = vid;
vinfo.flags = 0;
+ if (vid == pvid)
+ vinfo.flags |= BRIDGE_VLAN_INFO_PVID;
if (nla_put(skb, IFLA_BRIDGE_VLAN_INFO,
sizeof(vinfo), &vinfo))
goto nla_put_failure;
@@ -239,14 +243,15 @@ static int br_afspec(struct net_bridge *br,
switch (cmd) {
case RTM_SETLINK:
if (p) {
- err = nbp_vlan_add(p, vinfo->vid);
+ err = nbp_vlan_add(p, vinfo->vid, vinfo->flags);
if (err)
break;
if (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)
- err = br_vlan_add(p->br, vinfo->vid);
+ err = br_vlan_add(p->br, vinfo->vid,
+ vinfo->flags);
} else
- err = br_vlan_add(br, vinfo->vid);
+ err = br_vlan_add(br, vinfo->vid, vinfo->flags);
if (err)
break;