Skip to content

Commit 3c963a3

Browse files
msoltyspldavem330
authored andcommitted
bonding: fix PACKET_ORIGDEV regression
This patch fixes a subtle PACKET_ORIGDEV regression which was a side effect of fixes introduced by: 6a9e461 bonding: pass link-local packets to bonding master also. ... to: b89f04c bonding: deliver link-local packets with skb->dev set to link that packets arrived on While 6a9e461 restored pre-b89f04c61efe 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: 6a9e461 (bonding: pass link-local packets to bonding master also.) Reported-by: Vincent Bernat <vincent@bernat.ch> Signed-off-by: Michal Soltys <soltys@ziu.info> Signed-off-by: Maciej Żenczykowski <maze@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ad49bc6 commit 3c963a3

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,29 +1183,22 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
11831183
}
11841184
}
11851185

1186-
/* Link-local multicast packets should be passed to the
1187-
* stack on the link they arrive as well as pass them to the
1188-
* bond-master device. These packets are mostly usable when
1189-
* stack receives it with the link on which they arrive
1190-
* (e.g. LLDP) they also must be available on master. Some of
1191-
* the use cases include (but are not limited to): LLDP agents
1192-
* that must be able to operate both on enslaved interfaces as
1193-
* well as on bonds themselves; linux bridges that must be able
1194-
* to process/pass BPDUs from attached bonds when any kind of
1195-
* STP version is enabled on the network.
1186+
/*
1187+
* For packets determined by bond_should_deliver_exact_match() call to
1188+
* be suppressed we want to make an exception for link-local packets.
1189+
* This is necessary for e.g. LLDP daemons to be able to monitor
1190+
* inactive slave links without being forced to bind to them
1191+
* explicitly.
1192+
*
1193+
* At the same time, packets that are passed to the bonding master
1194+
* (including link-local ones) can have their originating interface
1195+
* determined via PACKET_ORIGDEV socket option.
11961196
*/
1197-
if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) {
1198-
struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
1199-
1200-
if (nskb) {
1201-
nskb->dev = bond->dev;
1202-
nskb->queue_mapping = 0;
1203-
netif_rx(nskb);
1204-
}
1205-
return RX_HANDLER_PASS;
1206-
}
1207-
if (bond_should_deliver_exact_match(skb, slave, bond))
1197+
if (bond_should_deliver_exact_match(skb, slave, bond)) {
1198+
if (is_link_local_ether_addr(eth_hdr(skb)->h_dest))
1199+
return RX_HANDLER_PASS;
12081200
return RX_HANDLER_EXACT;
1201+
}
12091202

12101203
skb->dev = bond->dev;
12111204

0 commit comments

Comments
 (0)