OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From 6ae4ae8e512bd229f806c22f8a2cd751e4f987c2 Mon Sep 17 00:00:00 2001 |
2 | From: =?UTF-8?q?Linus=20L=C3=BCssing?= <linus.luessing@c0d3.blue> |
||
3 | Date: Sat, 23 May 2015 03:12:34 +0200 |
||
4 | Subject: [PATCH] bridge: allow setting hash_max + multicast_router if |
||
5 | interface is down |
||
6 | MIME-Version: 1.0 |
||
7 | Content-Type: text/plain; charset=UTF-8 |
||
8 | Content-Transfer-Encoding: 8bit |
||
9 | |||
10 | Network managers like netifd (used in OpenWRT for instance) try to |
||
11 | configure interface options after creation but before setting the |
||
12 | interface up. |
||
13 | |||
14 | Unfortunately the sysfs / bridge currently only allows to configure the |
||
15 | hash_max and multicast_router options when the bridge interface is up. |
||
16 | But since br_multicast_init() doesn't start any timers and only sets |
||
17 | default values and initializes timers it should be save to reconfigure |
||
18 | the default values after that, before things actually get active after |
||
19 | the bridge is set up. |
||
20 | |||
21 | Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue> |
||
22 | Signed-off-by: David S. Miller <davem@davemloft.net> |
||
23 | --- |
||
24 | net/bridge/br_multicast.c | 24 +++--------------------- |
||
25 | 1 file changed, 3 insertions(+), 21 deletions(-) |
||
26 | |||
27 | --- a/net/bridge/br_multicast.c |
||
28 | +++ b/net/bridge/br_multicast.c |
||
29 | @@ -1948,11 +1948,9 @@ out: |
||
30 | |||
31 | int br_multicast_set_router(struct net_bridge *br, unsigned long val) |
||
32 | { |
||
33 | - int err = -ENOENT; |
||
34 | + int err = -EINVAL; |
||
35 | |||
36 | spin_lock_bh(&br->multicast_lock); |
||
37 | - if (!netif_running(br->dev)) |
||
38 | - goto unlock; |
||
39 | |||
40 | switch (val) { |
||
41 | case 0: |
||
42 | @@ -1963,13 +1961,8 @@ int br_multicast_set_router(struct net_b |
||
43 | br->multicast_router = val; |
||
44 | err = 0; |
||
45 | break; |
||
46 | - |
||
47 | - default: |
||
48 | - err = -EINVAL; |
||
49 | - break; |
||
50 | } |
||
51 | |||
52 | -unlock: |
||
53 | spin_unlock_bh(&br->multicast_lock); |
||
54 | |||
55 | return err; |
||
56 | @@ -1978,11 +1971,9 @@ unlock: |
||
57 | int br_multicast_set_port_router(struct net_bridge_port *p, unsigned long val) |
||
58 | { |
||
59 | struct net_bridge *br = p->br; |
||
60 | - int err = -ENOENT; |
||
61 | + int err = -EINVAL; |
||
62 | |||
63 | spin_lock(&br->multicast_lock); |
||
64 | - if (!netif_running(br->dev) || p->state == BR_STATE_DISABLED) |
||
65 | - goto unlock; |
||
66 | |||
67 | switch (val) { |
||
68 | case 0: |
||
69 | @@ -2004,13 +1995,8 @@ int br_multicast_set_port_router(struct |
||
70 | |||
71 | br_multicast_add_router(br, p); |
||
72 | break; |
||
73 | - |
||
74 | - default: |
||
75 | - err = -EINVAL; |
||
76 | - break; |
||
77 | } |
||
78 | |||
79 | -unlock: |
||
80 | spin_unlock(&br->multicast_lock); |
||
81 | |||
82 | return err; |
||
83 | @@ -2115,15 +2101,11 @@ unlock: |
||
84 | |||
85 | int br_multicast_set_hash_max(struct net_bridge *br, unsigned long val) |
||
86 | { |
||
87 | - int err = -ENOENT; |
||
88 | + int err = -EINVAL; |
||
89 | u32 old; |
||
90 | struct net_bridge_mdb_htable *mdb; |
||
91 | |||
92 | spin_lock_bh(&br->multicast_lock); |
||
93 | - if (!netif_running(br->dev)) |
||
94 | - goto unlock; |
||
95 | - |
||
96 | - err = -EINVAL; |
||
97 | if (!is_power_of_2(val)) |
||
98 | goto unlock; |
||
99 |