All of lore.kernel.org
 help / color / mirror / Atom feed
* If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
@ 2015-02-13  9:57 yzhu1
  2015-02-13 10:00 ` yzhu1
  2015-02-13 18:30 ` Stephen Hemminger
  0 siblings, 2 replies; 13+ messages in thread
From: yzhu1 @ 2015-02-13  9:57 UTC (permalink / raw)
  To: netdev, Wu, Kuaikuai, Tao, Yue

Hi, all

I made this test on ubuntu 14.04 with kernel 3,19-rc7:

1. brctl addbr br0

2. ifconfig br0 up

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

4. brctl addif br0 eth0

5. brctl delif br0 eth0

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

When there is no sub-interface, the flag "RUNNING" is missing after the 
last sub-interface is removed.

As such, should we keep "RUNNING" flag after the last sub-interface is 
removed?

Thanks a lot.
Zhu Yanjun

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-13  9:57 If bridge have no sub-interfaces, it's status may be still with 'RUNNING' yzhu1
@ 2015-02-13 10:00 ` yzhu1
  2015-02-13 18:30 ` Stephen Hemminger
  1 sibling, 0 replies; 13+ messages in thread
From: yzhu1 @ 2015-02-13 10:00 UTC (permalink / raw)
  To: netdev, Wu, Kuaikuai, Tao, Yue,
	stephen@networkplumber.org >> Stephen Hemminger

Add the maintainer of bridge.

Any reply is appreciated.

Zhu Yanjun

On 02/13/2015 05:57 PM, yzhu1 wrote:
> Hi, all
>
> I made this test on ubuntu 14.04 with kernel 3,19-rc7:
>
> 1. brctl addbr br0
>
> 2. ifconfig br0 up
>
> 3. ifconfig br0 (br0's status is with 'RUNNING')
>
> 4. brctl addif br0 eth0
>
> 5. brctl delif br0 eth0
>
> 6. ifconfig br0 (br0's status is without 'RUNNING')
>
> When there is no sub-interface, the flag "RUNNING" is missing after 
> the last sub-interface is removed.
>
> As such, should we keep "RUNNING" flag after the last sub-interface is 
> removed?
>
> Thanks a lot.
> 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
>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-13  9:57 If bridge have no sub-interfaces, it's status may be still with 'RUNNING' yzhu1
  2015-02-13 10:00 ` yzhu1
@ 2015-02-13 18:30 ` Stephen Hemminger
  2015-02-15  7:49   ` Wu, Kuaikuai
  2015-02-16  4:55   ` yzhu1
  1 sibling, 2 replies; 13+ messages in thread
From: Stephen Hemminger @ 2015-02-13 18:30 UTC (permalink / raw)
  To: yzhu1; +Cc: netdev, Wu, Kuaikuai, Tao, Yue

On Fri, 13 Feb 2015 17:57:45 +0800
yzhu1 <Yanjun.Zhu@windriver.com> wrote:

> Hi, all
> 
> I made this test on ubuntu 14.04 with kernel 3,19-rc7:
> 
> 1. brctl addbr br0
> 
> 2. ifconfig br0 up
> 
> 3. ifconfig br0 (br0's status is with 'RUNNING')
> 
> 4. brctl addif br0 eth0
> 
> 5. brctl delif br0 eth0
> 
> 6. ifconfig br0 (br0's status is without 'RUNNING')
> 
> When there is no sub-interface, the flag "RUNNING" is missing after the 
> last sub-interface is removed.
> 
> As such, should we keep "RUNNING" flag after the last sub-interface is 
> removed?

This is intentional. If there are no active ports in bridge, then
we want to tell applications that packets will go nowhere.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-13 18:30 ` Stephen Hemminger
@ 2015-02-15  7:49   ` Wu, Kuaikuai
  2015-02-16  4:55   ` yzhu1
  1 sibling, 0 replies; 13+ messages in thread
From: Wu, Kuaikuai @ 2015-02-15  7:49 UTC (permalink / raw)
  To: Stephen Hemminger, Zhu, Yanjun; +Cc: netdev, Tao, Yue

Hi Stephen,
  When we up a bridge without sub-interfaces,  it has "RUNNING" flag as below. Is it correct or not?

1. brctl addbr br0
2. ifconfig br0 up
3. ifconfig br0 
br0 Link encap:Ethernet HWaddr e6:6c:84:a6:fc:64 
          inet6 addr: fe80::e46c:84ff:fea6:fc64/64 Scope:Link 
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B) TX bytes:168 (168.0 B)

Best Regards
Kuaikuai Wu

-----Original Message-----
From: Stephen Hemminger [mailto:stephen@networkplumber.org] 
Sent: Saturday, February 14, 2015 2:31 AM
To: Zhu, Yanjun
Cc: netdev; Wu, Kuaikuai; Tao, Yue
Subject: Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'

On Fri, 13 Feb 2015 17:57:45 +0800
yzhu1 <Yanjun.Zhu@windriver.com> wrote:

> Hi, all
> 
> I made this test on ubuntu 14.04 with kernel 3,19-rc7:
> 
> 1. brctl addbr br0
> 
> 2. ifconfig br0 up
> 
> 3. ifconfig br0 (br0's status is with 'RUNNING')
> 
> 4. brctl addif br0 eth0
> 
> 5. brctl delif br0 eth0
> 
> 6. ifconfig br0 (br0's status is without 'RUNNING')
> 
> When there is no sub-interface, the flag "RUNNING" is missing after 
> the last sub-interface is removed.
> 
> As such, should we keep "RUNNING" flag after the last sub-interface is 
> removed?

This is intentional. If there are no active ports in bridge, then we want to tell applications that packets will go nowhere.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-13 18:30 ` Stephen Hemminger
  2015-02-15  7:49   ` Wu, Kuaikuai
@ 2015-02-16  4:55   ` yzhu1
  2015-02-16 15:47     ` David Ahern
                       ` (2 more replies)
  1 sibling, 3 replies; 13+ messages in thread
From: yzhu1 @ 2015-02-16  4:55 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Wu, Kuaikuai, Tao, Yue

[-- Attachment #1: Type: text/plain, Size: 934 bytes --]

Hi, Stephen

Follow your advice, I made a new patch. This patch will turn off
carrier when a new bridge interface is created. Please comment on it.

Thanks a lot.
Zhu Yanjun
On 02/14/2015 02:30 AM, Stephen Hemminger wrote:
> On Fri, 13 Feb 2015 17:57:45 +0800
> yzhu1 <Yanjun.Zhu@windriver.com> wrote:
>
>> Hi, all
>>
>> I made this test on ubuntu 14.04 with kernel 3,19-rc7:
>>
>> 1. brctl addbr br0
>>
>> 2. ifconfig br0 up
>>
>> 3. ifconfig br0 (br0's status is with 'RUNNING')
>>
>> 4. brctl addif br0 eth0
>>
>> 5. brctl delif br0 eth0
>>
>> 6. ifconfig br0 (br0's status is without 'RUNNING')
>>
>> When there is no sub-interface, the flag "RUNNING" is missing after the
>> last sub-interface is removed.
>>
>> As such, should we keep "RUNNING" flag after the last sub-interface is
>> removed?
> This is intentional. If there are no active ports in bridge, then
> we want to tell applications that packets will go nowhere.
>
>


[-- Attachment #2: 0001-bridge-turn-off-carrier-when-the-bridge-is-created.patch --]
[-- Type: text/x-patch, Size: 998 bytes --]

>From e03af5263bcaeea15442601e2a9f65c6b582352b Mon Sep 17 00:00:00 2001
From: Zhu Yanjun <Yanjun.Zhu@windriver.com>
Date: Mon, 16 Feb 2015 12:45:36 +0800
Subject: [PATCH 1/1] bridge: turn off carrier when the bridge is created

When a bridge interface is created, there is no any sub interface
in it. In this case, the packets should not go to this bridge interface.
As such, carrier is turned off.

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>
---
 net/bridge/br_device.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index ffd379d..2d60474 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -394,4 +394,9 @@ void br_dev_setup(struct net_device *dev)
 	br_netfilter_rtable_init(br);
 	br_stp_timer_init(br);
 	br_multicast_init(br);
+
+	/* Shutdown bridge to avoid packets */
+	if (netif_carrier_ok(dev)) {
+		netif_carrier_off(dev);
+	}
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-16  4:55   ` yzhu1
@ 2015-02-16 15:47     ` David Ahern
  2015-02-16 16:51       ` Stephen Hemminger
  2015-02-16 16:52     ` Stephen Hemminger
  2015-03-10  6:07     ` yzhu1
  2 siblings, 1 reply; 13+ messages in thread
From: David Ahern @ 2015-02-16 15:47 UTC (permalink / raw)
  To: yzhu1, Stephen Hemminger; +Cc: netdev, Wu, Kuaikuai, Tao, Yue

On 2/15/15 9:55 PM, yzhu1 wrote:
>>> 1. brctl addbr br0
>>>
>>> 2. ifconfig br0 up
>>>
>>> 3. ifconfig br0 (br0's status is with 'RUNNING')
>>>
>>> 4. brctl addif br0 eth0
>>>
>>> 5. brctl delif br0 eth0
>>>
>>> 6. ifconfig br0 (br0's status is without 'RUNNING')
>>>
>>> When there is no sub-interface, the flag "RUNNING" is missing after the
>>> last sub-interface is removed.

I do not see that behavior with Fedora 21 and 3.18.5-201.fc21.x86_64. 
ie., after interface is removed br0 is still in up state. Perhaps a 
regression with 3.19.

>>>
>>> As such, should we keep "RUNNING" flag after the last sub-interface is
>>> removed?
>> This is intentional. If there are no active ports in bridge, then
>> we want to tell applications that packets will go nowhere.

It changes current behavior with respect to tcpdump. Today I can launch 
tcpdump on a bridge interface before starting a VM. With this change I 
will not be able to do that.

David

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-16 15:47     ` David Ahern
@ 2015-02-16 16:51       ` Stephen Hemminger
  2015-02-17 16:14         ` Zhu, Yanjun
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Hemminger @ 2015-02-16 16:51 UTC (permalink / raw)
  To: David Ahern; +Cc: yzhu1, netdev, Wu, Kuaikuai, Tao, Yue

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-16  4:55   ` yzhu1
  2015-02-16 15:47     ` David Ahern
@ 2015-02-16 16:52     ` Stephen Hemminger
  2015-03-10  6:07     ` yzhu1
  2 siblings, 0 replies; 13+ messages in thread
From: Stephen Hemminger @ 2015-02-16 16:52 UTC (permalink / raw)
  To: yzhu1; +Cc: netdev, Wu, Kuaikuai, Tao, Yue

On Mon, 16 Feb 2015 12:55:47 +0800
yzhu1 <Yanjun.Zhu@windriver.com> wrote:

> Hi, Stephen
> 
> Follow your advice, I made a new patch. This patch will turn off
> carrier when a new bridge interface is created. Please comment on it.
> 
> Thanks a lot.
> Zhu Yanjun

NAK.
We need to keep the current behavior to not break corner case users.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-16 16:51       ` Stephen Hemminger
@ 2015-02-17 16:14         ` Zhu, Yanjun
  2015-02-25  2:55           ` yzhu1
  0 siblings, 1 reply; 13+ messages in thread
From: Zhu, Yanjun @ 2015-02-17 16:14 UTC (permalink / raw)
  To: Stephen Hemminger, David Ahern; +Cc: netdev, Wu, Kuaikuai, Tao, Yue

[-- Attachment #1: Type: text/plain, Size: 759 bytes --]

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.

[-- Attachment #2: 0001-bridge-turn-on-carrier-after-removing-the-last-sub-i.patch --]
[-- Type: text/plain, Size: 1025 bytes --]

From 0d16f302f23c9f5101f849450abc073045a193de Mon Sep 17 00:00:00 2001
From: Zhu Yanjun <Yanjun.Zhu@windriver.com>
Date: Tue, 17 Feb 2015 23:59:08 +0800
Subject: [PATCH 1/1] bridge: turn on carrier after removing the last sub
 interface

When the last sub interface is removed from the bridge, the bridge
turn off the carrier. Maybe it is not compatible with firstly created
bridge without any sub interface. At that time, the carrier of this
bridge is turned on.

Signed-off-by: Zhu Yanjun <Yanjun.Zhu@windriver.com>
---
 net/bridge/br_if.c | 6 ++++++
 1 file changed, 6 insertions(+)

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;
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-17 16:14         ` Zhu, Yanjun
@ 2015-02-25  2:55           ` yzhu1
  2015-02-25  4:23             ` David Ahern
  0 siblings, 1 reply; 13+ messages in thread
From: yzhu1 @ 2015-02-25  2:55 UTC (permalink / raw)
  To: Stephen Hemminger, David Ahern; +Cc: netdev, Wu, Kuaikuai, Tao, Yue

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-25  2:55           ` yzhu1
@ 2015-02-25  4:23             ` David Ahern
  2015-02-25  5:29               ` yzhu1
  0 siblings, 1 reply; 13+ messages in thread
From: David Ahern @ 2015-02-25  4:23 UTC (permalink / raw)
  To: yzhu1, Stephen Hemminger; +Cc: netdev, Wu, Kuaikuai, Tao, Yue

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-25  4:23             ` David Ahern
@ 2015-02-25  5:29               ` yzhu1
  0 siblings, 0 replies; 13+ messages in thread
From: yzhu1 @ 2015-02-25  5:29 UTC (permalink / raw)
  To: David Ahern, Stephen Hemminger; +Cc: netdev, Wu, Kuaikuai, Tao, Yue

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: If bridge have no sub-interfaces, it's status may be still with 'RUNNING'
  2015-02-16  4:55   ` yzhu1
  2015-02-16 15:47     ` David Ahern
  2015-02-16 16:52     ` Stephen Hemminger
@ 2015-03-10  6:07     ` yzhu1
  2 siblings, 0 replies; 13+ messages in thread
From: yzhu1 @ 2015-03-10  6:07 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: netdev, Wu, Kuaikuai, Tao, Yue, dsahern@gmail.com >> David Ahern

Hi, Stephen && David

Any update ?

Best Regards!
Zhu Yanjun
On 02/16/2015 12:55 PM, yzhu1 wrote:
> Hi, Stephen
>
> Follow your advice, I made a new patch. This patch will turn off
> carrier when a new bridge interface is created. Please comment on it.
>
> Thanks a lot.
> Zhu Yanjun
> On 02/14/2015 02:30 AM, Stephen Hemminger wrote:
>> On Fri, 13 Feb 2015 17:57:45 +0800
>> yzhu1 <Yanjun.Zhu@windriver.com> wrote:
>>
>>> Hi, all
>>>
>>> I made this test on ubuntu 14.04 with kernel 3,19-rc7:
>>>
>>> 1. brctl addbr br0
>>>
>>> 2. ifconfig br0 up
>>>
>>> 3. ifconfig br0 (br0's status is with 'RUNNING')
>>>
>>> 4. brctl addif br0 eth0
>>>
>>> 5. brctl delif br0 eth0
>>>
>>> 6. ifconfig br0 (br0's status is without 'RUNNING')
>>>
>>> When there is no sub-interface, the flag "RUNNING" is missing after the
>>> last sub-interface is removed.
>>>
>>> As such, should we keep "RUNNING" flag after the last sub-interface is
>>> removed?
>> This is intentional. If there are no active ports in bridge, then
>> we want to tell applications that packets will go nowhere.
>>
>>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-03-10  6:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-13  9:57 If bridge have no sub-interfaces, it's status may be still with 'RUNNING' yzhu1
2015-02-13 10:00 ` yzhu1
2015-02-13 18:30 ` Stephen Hemminger
2015-02-15  7:49   ` Wu, Kuaikuai
2015-02-16  4:55   ` yzhu1
2015-02-16 15:47     ` David Ahern
2015-02-16 16:51       ` Stephen Hemminger
2015-02-17 16:14         ` Zhu, Yanjun
2015-02-25  2:55           ` yzhu1
2015-02-25  4:23             ` David Ahern
2015-02-25  5:29               ` yzhu1
2015-02-16 16:52     ` Stephen Hemminger
2015-03-10  6:07     ` yzhu1

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.