Commit 3c963a33 authored by Michal Soltys's avatar Michal Soltys Committed by David S. Miller

bonding: fix PACKET_ORIGDEV regression

This patch fixes a subtle PACKET_ORIGDEV regression which was a side
effect of fixes introduced by:

6a9e461f bonding: pass link-local packets to bonding master also.

... to:

b89f04c6 bonding: deliver link-local packets with skb->dev set to link that packets arrived on

While 6a9e461f restored pre-b89f04c6 presence of link-local
packets on bonding masters (which is required e.g. by linux bridges
participating in spanning tree or needed for lab-like setups created
with group_fwd_mask) it also caused the originating device
information to be lost due to cloning.

Maciej Żenczykowski proposed another solution that doesn't require
packet cloning and retains original device information - instead of
returning RX_HANDLER_PASS for all link-local packets it's now limited
only to packets from inactive slaves.

At the same time, packets passed to bonding masters retain correct
information about the originating device and PACKET_ORIGDEV can be used
to determine it.

This elegantly solves all issues so far:

- link-local packets that were removed from bonding masters
- LLDP daemons being forced to explicitly bind to slave interfaces
- PACKET_ORIGDEV having no effect on bond interfaces

Fixes: 6a9e461f (bonding: pass link-local packets to bonding master also.)
Reported-by: default avatarVincent Bernat <vincent@bernat.ch>
Signed-off-by: default avatarMichal Soltys <soltys@ziu.info>
Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ad49bc63
...@@ -1183,29 +1183,22 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) ...@@ -1183,29 +1183,22 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
} }
} }
/* Link-local multicast packets should be passed to the /*
* stack on the link they arrive as well as pass them to the * For packets determined by bond_should_deliver_exact_match() call to
* bond-master device. These packets are mostly usable when * be suppressed we want to make an exception for link-local packets.
* stack receives it with the link on which they arrive * This is necessary for e.g. LLDP daemons to be able to monitor
* (e.g. LLDP) they also must be available on master. Some of * inactive slave links without being forced to bind to them
* the use cases include (but are not limited to): LLDP agents * explicitly.
* that must be able to operate both on enslaved interfaces as *
* well as on bonds themselves; linux bridges that must be able * At the same time, packets that are passed to the bonding master
* to process/pass BPDUs from attached bonds when any kind of * (including link-local ones) can have their originating interface
* STP version is enabled on the network. * determined via PACKET_ORIGDEV socket option.
*/ */
if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) { if (bond_should_deliver_exact_match(skb, slave, bond)) {
struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); if (is_link_local_ether_addr(eth_hdr(skb)->h_dest))
return RX_HANDLER_PASS;
if (nskb) {
nskb->dev = bond->dev;
nskb->queue_mapping = 0;
netif_rx(nskb);
}
return RX_HANDLER_PASS;
}
if (bond_should_deliver_exact_match(skb, slave, bond))
return RX_HANDLER_EXACT; return RX_HANDLER_EXACT;
}
skb->dev = bond->dev; skb->dev = bond->dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment