diff mbox

If bridge have no sub-interfaces, it's status may be still with 'RUNNING'

Message ID E66F6C44A7A6EA49ABFC80EA526506DF65AEAEB3@ALA-MBB.corp.ad.wrs.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

yzhu1 Feb. 17, 2015, 4:14 p.m. UTC
Hi, all

We should make it compatible. So I made a patch to turn on carrier on this bridge interface when the last sub interface is removed.

Hi, David

Please make tests with this latest patch. Thanks a lot.

Best Regards!
Zhu Yanjun

Comments

yzhu1 Feb. 25, 2015, 2:55 a.m. UTC | #1
Hi, Stephen && David

Any update?

Zhu Yanjun

On 02/18/2015 12:14 AM, Zhu, Yanjun wrote:
> Hi, all
>
> We should make it compatible. So I made a patch to turn on carrier on this bridge interface when the last sub interface is removed.
>
> Hi, David
>
> Please make tests with this latest patch. Thanks a lot.
>
> Best Regards!
> Zhu Yanjun
> ________________________________________
> From: Stephen Hemminger [stephen@networkplumber.org]
> Sent: Monday, February 16, 2015 8:51 AM
> To: David Ahern
> Cc: Zhu, Yanjun; netdev; Wu, Kuaikuai; Tao, Yue
> Subject: Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
>
> Originally bridge code would start with carrier off,
> but there were users using bridge as a form of dummy device
> and this broke them. Therefore it was decided (like 5 yrs ago),
> that bridge should start with carrier on.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Ahern Feb. 25, 2015, 4:23 a.m. UTC | #2
On 2/24/15 7:55 PM, yzhu1 wrote:
> Hi, Stephen && David
>
> Any update?

As I mentioned in my last response I see no problem with the existing 
behavior -- 3.18, 3.19 and 4.0-rc1. With all of them the bridge stays in 
the running state after all interfaces are removed.

David

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
yzhu1 Feb. 25, 2015, 5:29 a.m. UTC | #3
On 02/25/2015 12:23 PM, David Ahern wrote:
> On 2/24/15 7:55 PM, yzhu1 wrote:
>> Hi, Stephen && David
>>
>> Any update?
>
> As I mentioned in my last response I see no problem with the existing 
> behavior -- 3.18, 3.19 and 4.0-rc1. With all of them the bridge stays 
> in the running state after all interfaces are removed.
>
> David
>
>
>
Hi, David

I made tests on kernel 3.19-rc7.

1. brctl addbr br0

2. ifconfig br0 up

3. ifconfig br0 (br0's status is with 'RUNNING')

br0       Link encap:Ethernet  HWaddr 0a:70:0b:06:34:8f
           inet6 addr: fe80::870:bff:fe06:348f/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:0 (0.0 B)  TX bytes:5054 (5.0 KB)

4. brctl addif br0 eth1

5. brctl delif br0 eth1

6. ifconfig br0 (br0's status is without 'RUNNING')

br0       Link encap:Ethernet  HWaddr 00:00:00:00:00:00
           inet6 addr: fe80::870:bff:fe06:348f/64 Scope:Link
           UP BROADCAST MULTICAST  MTU:1500  Metric:1
           RX packets:328 errors:0 dropped:5 overruns:0 frame:0
           TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:39997 (39.9 KB)  TX bytes:5760 (5.7 KB)

Please compare with the outputs of step 3 and step 6, we can find the 
difference.

uname:

Linux wind-virtual-machine 3.19.0-rc7 #2 SMP Wed Jan 28 18:36:44 CST 
2015 x86_64 x86_64 x86_64 GNU/Linux

So I think we should apply the latest patch to make consistent.

Any reply is appreciated.

Zhu Yanjun
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index ed307db..f391f8c 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -565,6 +565,12 @@  int br_del_if(struct net_bridge *br, struct net_device *dev)
 
 	netdev_update_features(br->dev);
 
+	/* No sub interface in bridge, turn on carrier */
+	if (list_empty(&br->port_list)) {
+		eth_hw_addr_random(br->dev);
+		netif_carrier_on(br->dev);
+	}
+
 	return 0;
 }