OpenWrt – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From: Stephen Hemminger <stephen@networkplumber.org> |
2 | Subject: bridge: allow receiption on disabled port |
||
3 | |||
4 | When an ethernet device is enslaved to a bridge, and the bridge STP |
||
5 | detects loss of carrier (or operational state down), then normally |
||
6 | packet receiption is blocked. |
||
7 | |||
8 | This breaks control applications like WPA which maybe expecting to |
||
9 | receive packets to negotiate to bring link up. The bridge needs to |
||
10 | block forwarding packets from these disabled ports, but there is no |
||
11 | hard requirement to not allow local packet delivery. |
||
12 | |||
13 | Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> |
||
14 | Signed-off-by: Felix Fietkau <nbd@nbd.name> |
||
15 | |||
16 | --- a/net/bridge/br_input.c |
||
17 | +++ b/net/bridge/br_input.c |
||
18 | @@ -146,11 +146,13 @@ EXPORT_SYMBOL_GPL(br_handle_frame_finish |
||
19 | static int br_handle_local_finish(struct sk_buff *skb) |
||
20 | { |
||
21 | struct net_bridge_port *p = br_port_get_rcu(skb->dev); |
||
22 | - u16 vid = 0; |
||
23 | + if (p->state != BR_STATE_DISABLED) { |
||
24 | + u16 vid = 0; |
||
25 | |||
26 | - /* check if vlan is allowed, to avoid spoofing */ |
||
27 | - if (p->flags & BR_LEARNING && br_should_learn(p, skb, &vid)) |
||
28 | - br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, false); |
||
29 | + /* check if vlan is allowed, to avoid spoofing */ |
||
30 | + if (p->flags & BR_LEARNING && br_should_learn(p, skb, &vid)) |
||
31 | + br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, false); |
||
32 | + } |
||
33 | return 0; /* process further */ |
||
34 | } |
||
35 | |||
36 | @@ -224,6 +226,18 @@ rx_handler_result_t br_handle_frame(stru |
||
37 | |||
38 | forward: |
||
39 | switch (p->state) { |
||
40 | + case BR_STATE_DISABLED: |
||
41 | + if (ether_addr_equal(p->br->dev->dev_addr, dest)) |
||
42 | + skb->pkt_type = PACKET_HOST; |
||
43 | + |
||
44 | + if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, |
||
45 | + br_handle_local_finish)) |
||
46 | + break; |
||
47 | + |
||
48 | + BR_INPUT_SKB_CB(skb)->brdev = p->br->dev; |
||
49 | + br_pass_frame_up(skb); |
||
50 | + break; |
||
51 | + |
||
52 | case BR_STATE_FORWARDING: |
||
53 | rhook = rcu_dereference(br_should_route_hook); |
||
54 | if (rhook) { |