aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_stp_bpdu.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-03-21 17:22:44 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:28:48 -0400
commit9cde070874b822d4677f4f01fe146991785813b1 (patch)
tree2e3a444ad82e026237ce99a4f8cad201f6ca807d /net/bridge/br_stp_bpdu.c
parent9cf637473c8535b5abe27fee79254c2d552e042a (diff)
bridge: add support for user mode STP
This patchset based on work by Aji_Srinivas@emc.com provides allows spanning tree to be controled from userspace. Like hotplug, it uses call_usermodehelper when spanning tree is enabled so there is no visible API change. If call to start usermode STP fails it falls back to existing kernel STP. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Diffstat (limited to 'net/bridge/br_stp_bpdu.c')
-rw-r--r--net/bridge/br_stp_bpdu.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index b9fb0dc4ab12..60112bce6698 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -33,9 +33,6 @@ static void br_send_bpdu(struct net_bridge_port *p,
33{ 33{
34 struct sk_buff *skb; 34 struct sk_buff *skb;
35 35
36 if (!p->br->stp_enabled)
37 return;
38
39 skb = dev_alloc_skb(length+LLC_RESERVE); 36 skb = dev_alloc_skb(length+LLC_RESERVE);
40 if (!skb) 37 if (!skb)
41 return; 38 return;
@@ -75,6 +72,9 @@ void br_send_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *bpdu)
75{ 72{
76 unsigned char buf[35]; 73 unsigned char buf[35];
77 74
75 if (p->br->stp_enabled != BR_KERNEL_STP)
76 return;
77
78 buf[0] = 0; 78 buf[0] = 0;
79 buf[1] = 0; 79 buf[1] = 0;
80 buf[2] = 0; 80 buf[2] = 0;
@@ -117,6 +117,9 @@ void br_send_tcn_bpdu(struct net_bridge_port *p)
117{ 117{
118 unsigned char buf[4]; 118 unsigned char buf[4];
119 119
120 if (p->br->stp_enabled != BR_KERNEL_STP)
121 return;
122
120 buf[0] = 0; 123 buf[0] = 0;
121 buf[1] = 0; 124 buf[1] = 0;
122 buf[2] = 0; 125 buf[2] = 0;
@@ -157,9 +160,13 @@ int br_stp_rcv(struct sk_buff *skb, struct net_device *dev,
157 br = p->br; 160 br = p->br;
158 spin_lock(&br->lock); 161 spin_lock(&br->lock);
159 162
160 if (p->state == BR_STATE_DISABLED 163 if (br->stp_enabled != BR_KERNEL_STP)
161 || !br->stp_enabled 164 goto out;
162 || !(br->dev->flags & IFF_UP)) 165
166 if (!(br->dev->flags & IFF_UP))
167 goto out;
168
169 if (p->state == BR_STATE_DISABLED)
163 goto out; 170 goto out;
164 171
165 if (compare_ether_addr(dest, br->group_addr) != 0) 172 if (compare_ether_addr(dest, br->group_addr) != 0)