Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 64066
b: refs/heads/master
c: 1712088
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Aug 14, 2007
1 parent 2b9fd7d commit ee2ff83
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 45241a7a07537266eec363593ef377a1e6b7db7f
refs/heads/master: 17120889b0706b69ae24cba3ef0a340dc3fb7edc
24 changes: 15 additions & 9 deletions trunk/net/bridge/br_sysfs_br.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,26 @@ static ssize_t show_stp_state(struct device *d,
return sprintf(buf, "%d\n", br->stp_enabled);
}

static void set_stp_state(struct net_bridge *br, unsigned long val)
{
rtnl_lock();
spin_unlock_bh(&br->lock);
br_stp_set_enabled(br, val);
spin_lock_bh(&br->lock);
rtnl_unlock();
}

static ssize_t store_stp_state(struct device *d,
struct device_attribute *attr, const char *buf,
size_t len)
{
return store_bridge_parm(d, buf, len, set_stp_state);
struct net_bridge *br = to_bridge(d);
char *endp;
unsigned long val;

if (!capable(CAP_NET_ADMIN))
return -EPERM;

val = simple_strtoul(buf, &endp, 0);
if (endp == buf)
return -EINVAL;

rtnl_lock();
br_stp_set_enabled(br, val);
rtnl_unlock();

}
static DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state,
store_stp_state);
Expand Down

0 comments on commit ee2ff83

Please sign in to comment.