@@ -230,11 +230,11 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
return RX_HANDLER_PASS;
}
- if (port->passthru)
+ vlan = macvlan_hash_lookup(port, eth->h_dest);
+
+ if (vlan == NULL && port->passthru)
vlan = list_first_or_null_rcu(&port->vlans,
struct macvlan_dev, list);
- else
- vlan = macvlan_hash_lookup(port, eth->h_dest);
if (vlan == NULL)
return RX_HANDLER_PASS;
@@ -843,10 +843,6 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
}
port = macvlan_port_get_rtnl(lowerdev);
- /* Only 1 macvlan device can be created in passthru mode */
- if (port->passthru)
- return -EINVAL;
-
vlan->lowerdev = lowerdev;
vlan->dev = dev;
vlan->port = port;
@@ -862,7 +858,8 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
vlan->flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]);
if (vlan->mode == MACVLAN_MODE_PASSTHRU) {
- if (port->count)
+ /* Only a single passthru interface is allowed */
+ if (port->passthru)
return -EINVAL;
port->passthru = true;
eth_hw_addr_inherit(dev, lowerdev);
This allows a passthru macvlan to coexist with other macvlans. For example the passthru macvlan can be put into a bridge while concurrently using a private macvlan. The passthru interface will not get frames destined for other macvlan interfaces but everything else. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> --- drivers/net/macvlan.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)