aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_device.c9
-rw-r--r--net/bridge/br_if.c12
-rw-r--r--net/bridge/br_netlink.c5
-rw-r--r--net/bridge/br_notify.c2
-rw-r--r--net/bridge/br_stp_if.c2
5 files changed, 16 insertions, 14 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 7c78e2640190..e1bc090bc00a 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -172,7 +172,6 @@ static int br_set_mac_address(struct net_device *dev, void *p)
172 172
173 spin_lock_bh(&br->lock); 173 spin_lock_bh(&br->lock);
174 if (!ether_addr_equal(dev->dev_addr, addr->sa_data)) { 174 if (!ether_addr_equal(dev->dev_addr, addr->sa_data)) {
175 dev->addr_assign_type &= ~NET_ADDR_RANDOM;
176 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 175 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
177 br_fdb_change_mac_address(br, addr->sa_data); 176 br_fdb_change_mac_address(br, addr->sa_data);
178 br_stp_change_bridge_id(br, addr->sa_data); 177 br_stp_change_bridge_id(br, addr->sa_data);
@@ -185,10 +184,10 @@ static int br_set_mac_address(struct net_device *dev, void *p)
185 184
186static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info) 185static void br_getinfo(struct net_device *dev, struct ethtool_drvinfo *info)
187{ 186{
188 strcpy(info->driver, "bridge"); 187 strlcpy(info->driver, "bridge", sizeof(info->driver));
189 strcpy(info->version, BR_VERSION); 188 strlcpy(info->version, BR_VERSION, sizeof(info->version));
190 strcpy(info->fw_version, "N/A"); 189 strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
191 strcpy(info->bus_info, "N/A"); 190 strlcpy(info->bus_info, "N/A", sizeof(info->bus_info));
192} 191}
193 192
194static netdev_features_t br_fix_features(struct net_device *dev, 193static netdev_features_t br_fix_features(struct net_device *dev,
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 37fe693471a8..2148d474a04f 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -66,14 +66,14 @@ void br_port_carrier_check(struct net_bridge_port *p)
66 struct net_device *dev = p->dev; 66 struct net_device *dev = p->dev;
67 struct net_bridge *br = p->br; 67 struct net_bridge *br = p->br;
68 68
69 if (netif_running(dev) && netif_carrier_ok(dev)) 69 if (netif_running(dev) && netif_oper_up(dev))
70 p->path_cost = port_cost(dev); 70 p->path_cost = port_cost(dev);
71 71
72 if (!netif_running(br->dev)) 72 if (!netif_running(br->dev))
73 return; 73 return;
74 74
75 spin_lock_bh(&br->lock); 75 spin_lock_bh(&br->lock);
76 if (netif_running(dev) && netif_carrier_ok(dev)) { 76 if (netif_running(dev) && netif_oper_up(dev)) {
77 if (p->state == BR_STATE_DISABLED) 77 if (p->state == BR_STATE_DISABLED)
78 br_stp_enable_port(p); 78 br_stp_enable_port(p);
79 } else { 79 } else {
@@ -148,7 +148,7 @@ static void del_nbp(struct net_bridge_port *p)
148 netdev_rx_handler_unregister(dev); 148 netdev_rx_handler_unregister(dev);
149 synchronize_net(); 149 synchronize_net();
150 150
151 netdev_set_master(dev, NULL); 151 netdev_upper_dev_unlink(dev, br->dev);
152 152
153 br_multicast_del_port(p); 153 br_multicast_del_port(p);
154 154
@@ -364,7 +364,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
364 if (br_netpoll_info(br) && ((err = br_netpoll_enable(p, GFP_KERNEL)))) 364 if (br_netpoll_info(br) && ((err = br_netpoll_enable(p, GFP_KERNEL))))
365 goto err3; 365 goto err3;
366 366
367 err = netdev_set_master(dev, br->dev); 367 err = netdev_master_upper_dev_link(dev, br->dev);
368 if (err) 368 if (err)
369 goto err4; 369 goto err4;
370 370
@@ -383,7 +383,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
383 spin_lock_bh(&br->lock); 383 spin_lock_bh(&br->lock);
384 changed_addr = br_stp_recalculate_bridge_id(br); 384 changed_addr = br_stp_recalculate_bridge_id(br);
385 385
386 if ((dev->flags & IFF_UP) && netif_carrier_ok(dev) && 386 if (netif_running(dev) && netif_oper_up(dev) &&
387 (br->dev->flags & IFF_UP)) 387 (br->dev->flags & IFF_UP))
388 br_stp_enable_port(p); 388 br_stp_enable_port(p);
389 spin_unlock_bh(&br->lock); 389 spin_unlock_bh(&br->lock);
@@ -403,7 +403,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
403 return 0; 403 return 0;
404 404
405err5: 405err5:
406 netdev_set_master(dev, NULL); 406 netdev_upper_dev_unlink(dev, br->dev);
407err4: 407err4:
408 br_netpoll_disable(p); 408 br_netpoll_disable(p);
409err3: 409err3:
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 5dc66abcc9e2..39ca9796f3f7 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -181,8 +181,11 @@ static int br_set_port_state(struct net_bridge_port *p, u8 state)
181 if (p->br->stp_enabled == BR_KERNEL_STP) 181 if (p->br->stp_enabled == BR_KERNEL_STP)
182 return -EBUSY; 182 return -EBUSY;
183 183
184 /* if device is not up, change is not allowed
185 * if link is not present, only allowable state is disabled
186 */
184 if (!netif_running(p->dev) || 187 if (!netif_running(p->dev) ||
185 (!netif_carrier_ok(p->dev) && state != BR_STATE_DISABLED)) 188 (!netif_oper_up(p->dev) && state != BR_STATE_DISABLED))
186 return -ENETDOWN; 189 return -ENETDOWN;
187 190
188 p->state = state; 191 p->state = state;
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index a76b62135558..1644b3e1f947 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -82,7 +82,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
82 break; 82 break;
83 83
84 case NETDEV_UP: 84 case NETDEV_UP:
85 if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) { 85 if (netif_running(br->dev) && netif_oper_up(dev)) {
86 spin_lock_bh(&br->lock); 86 spin_lock_bh(&br->lock);
87 br_stp_enable_port(p); 87 br_stp_enable_port(p);
88 spin_unlock_bh(&br->lock); 88 spin_unlock_bh(&br->lock);
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 9d5a414a3943..7b5197c7de13 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -54,7 +54,7 @@ void br_stp_enable_bridge(struct net_bridge *br)
54 br_config_bpdu_generation(br); 54 br_config_bpdu_generation(br);
55 55
56 list_for_each_entry(p, &br->port_list, list) { 56 list_for_each_entry(p, &br->port_list, list) {
57 if ((p->dev->flags & IFF_UP) && netif_carrier_ok(p->dev)) 57 if (netif_running(p->dev) && netif_oper_up(p->dev))
58 br_stp_enable_port(p); 58 br_stp_enable_port(p);
59 59
60 } 60 }