diff options
author | 2019-02-20 14:35:39 -0800 | |
---|---|---|
committer | 2019-02-22 11:53:32 -0800 | |
commit | 061f6a505ac33659eab007731c0f6374df39ab55 (patch) | |
tree | eaa11fe77005b43a576b173c4bf9a54ae2135f35 /net/dsa/port.c | |
parent | net: dsa: Deny enslaving VLAN devices into VLAN aware bridge (diff) | |
download | linux-061f6a505ac33659eab007731c0f6374df39ab55.tar.gz linux-061f6a505ac33659eab007731c0f6374df39ab55.tar.bz2 linux-061f6a505ac33659eab007731c0f6374df39ab55.zip |
net: dsa: Add ndo_vlan_rx_{add, kill}_vid implementation
In order to properly support VLAN filtering being enabled/disabled on a
bridge, while having other ports being non bridge port members, we need
to support the ndo_vlan_rx_{add,kill}_vid callbacks in order to make
sure the non-bridge ports can continue receiving VLAN tags, even when
the switch is globally configured to do ingress/egress VID checking.
Since we can call dsa_port_vlan_{add,del} with a bridge_dev pointer
NULL, we now need to check that in these two functions.
We specifically deal with two possibly problematic cases:
- creating a bridge VLAN entry while there is an existing VLAN device
claiming that same VID
- creating a VLAN device while there is an existing bridge VLAN entry
with that VID
Those are both resolved with returning -EBUSY back to user-space.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/port.c')
-rw-r--r-- | net/dsa/port.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/net/dsa/port.c b/net/dsa/port.c index e9b5b50f8cf1..c011dff523d0 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -291,7 +291,10 @@ int dsa_port_vlan_add(struct dsa_port *dp, .vlan = vlan, }; - if (br_vlan_enabled(dp->bridge_dev)) + /* Can be called from dsa_slave_port_obj_add() or + * dsa_slave_vlan_rx_add_vid() + */ + if (!dp->bridge_dev || br_vlan_enabled(dp->bridge_dev)) return dsa_port_notify(dp, DSA_NOTIFIER_VLAN_ADD, &info); return 0; @@ -306,10 +309,13 @@ int dsa_port_vlan_del(struct dsa_port *dp, .vlan = vlan, }; - if (netif_is_bridge_master(vlan->obj.orig_dev)) + if (vlan->obj.orig_dev && netif_is_bridge_master(vlan->obj.orig_dev)) return -EOPNOTSUPP; - if (br_vlan_enabled(dp->bridge_dev)) + /* Can be called from dsa_slave_port_obj_del() or + * dsa_slave_vlan_rx_kill_vid() + */ + if (!dp->bridge_dev || br_vlan_enabled(dp->bridge_dev)) return dsa_port_notify(dp, DSA_NOTIFIER_VLAN_DEL, &info); return 0; |