Jianwei Hu
2014-May-27 06:07 UTC
[libvirt-users] [netcf]IFF_RUNNING flag on a bridge device
Hi All, I have one netcf question, please help me to resolve it, thanks. I can set a IFF_RUNNING flag to a bridge device which are no interface device attached. What status of a flag on a bridge device in current kernel?(w/o interface), is this a new change in kernel or other component? In netcf, but there is a patch to fix that flag issue, I can't understand it. fix wrong status of bridge devices The IFF_RUNNING flag is not set on a bridge device if there are no devices attached to it. So bridges without attached devices are reported as inactive. Destroying inactive devices leads to an error and thus the device can't be removed (easily) from the operating system. This patch checks if the device is a bridge and if so ignores the IFF_RUNNING flag. https://git.fedorahosted.org/cgit/netcf.git/commit/?id=7fa5fa5a1e43e6e2afec68c58b5f43bc916703a6 My testing results of IFF_RUNNING on non-device bridge: Version: [root@rhel6 boot]# rpm -q kernel netcf kernel-2.6.32-468.el6.x86_64 netcf-0.2.4-1.el6.x86_64 [root@rhel6 ~]# brctl show br0 bridge name bridge id STP enabled interfaces br0 8000.000000000000 no [root@rhel6 ~]# ifconfig br0 br0 Link encap:Ethernet HWaddr 6A:3B:6F:DF:17:A9 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:468 (468.0 b) [root@rhel6 ~]# ifconfig br0 up [root@rhel6 ~]# brctl show br0 bridge name bridge id STP enabled interfaces br0 8000.000000000000 no [root@rhel6 ~]# ifconfig br0 br0 Link encap:Ethernet HWaddr 6A:3B:6F:DF:17:A9 inet6 addr: fe80::683b:6fff:fedf:17a9/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:11 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:866 (866.0 b)
Laine Stump
2014-May-28 13:27 UTC
Re: [libvirt-users] [netcf]IFF_RUNNING flag on a bridge device
On 05/27/2014 09:07 AM, Jianwei Hu wrote:> Hi All, > > I have one netcf question, please help me to resolve it, thanks. > > I can set a IFF_RUNNING flag to a bridge device which are no interface device attached. What status of a flag on a bridge device in current kernel?(w/o interface), is this a new change in kernel or other component? In netcf, but there is a patch to fix that flag issue, I can't understand it. > > fix wrong status of bridge devices > The IFF_RUNNING flag is not set on a bridge device if there are no devices attached to it. So bridges without attached devices are reported as inactive. Destroying inactive devices leads to an error and thus the device can't be removed (easily) from the operating system. This patch checks if the device is a bridge and if so ignores the IFF_RUNNING flag.Well, I took the patch submitter (Hendrik Schwartke <hendrik@os-t.de>) at his word about the brokenness, and the patch didn't *hurt* anything, so I pushed it. But now that I try it out I see that, at least on the kernel version in Fedora 20 (and RHEL6.6) IFF_RUNNING *is* set when a bridge device is ifconfiged up. So I'm not sure what had caused the original problem, maybe Hendrik can eluminate us on that, but it makes sense (since the whole reason for adding the check of IFF_RUNNING in the first place was to notice when an ethernet is unplugged, but a bridge is *never* plugged or unplugged in the sense that we're looking for) and doesn't harm anything (and apparently does fix something for Hendrik). BTW, when you have netcf-specific questions of patches, you can send them to netcf-devel@lists.fedorahosted.org
Hendrik Schwartke
2014-Jun-23 11:32 UTC
Re: [libvirt-users] [netcf]IFF_RUNNING flag on a bridge device
On 28.05.2014 15:27, Laine Stump wrote:> On 05/27/2014 09:07 AM, Jianwei Hu wrote: >> Hi All, >> >> I have one netcf question, please help me to resolve it, thanks. >> >> I can set a IFF_RUNNING flag to a bridge device which are no interface device attached. What status of a flag on a bridge device in current kernel?(w/o interface), is this a new change in kernel or other component? In netcf, but there is a patch to fix that flag issue, I can't understand it. >> >> fix wrong status of bridge devices >> The IFF_RUNNING flag is not set on a bridge device if there are no devices attached to it. So bridges without attached devices are reported as inactive. Destroying inactive devices leads to an error and thus the device can't be removed (easily) from the operating system. This patch checks if the device is a bridge and if so ignores the IFF_RUNNING flag. > Well, I took the patch submitter (Hendrik Schwartke <hendrik@os-t.de>) > at his word about the brokenness, and the patch didn't *hurt* anything, > so I pushed it. But now that I try it out I see that, at least on the > kernel version in Fedora 20 (and RHEL6.6) IFF_RUNNING *is* set when a > bridge device is ifconfiged up.Sorry for my late reply. I was on vacation. I saw this behaviour on Ubuntu 14.04. I think the kernel version was 3.13.0, but I'm not quite sure. The IFF_RUNNING flag is not set on bridges without attached interfaces even if the bridge is up.> > So I'm not sure what had caused the original problem, maybe Hendrik can > eluminate us on that, but it makes sense (since the whole reason forThe problem is that my application create bridge devices which are connected to virtual machines. If all vms are destroyed then there are no devices attached to the bridge anymore. Now I can't destroy the bridge device because it seems already to be down. If I undefine the bridge device netcf removes it from /etc/network/interfaces but doesn't remove the actual device because netcf thinks it's already removed.> adding the check of IFF_RUNNING in the first place was to notice when an > ethernet is unplugged, but a bridge is *never* plugged or unplugged in > the sense that we're looking for) and doesn't harm anything (and > apparently does fix something for Hendrik).Yes, that's right. It doesn't make any sense to check for IFF_RUNNING on *bridges*. So I'm pretty sure that this patch doesn't harm anything.> > BTW, when you have netcf-specific questions of patches, you can send > them to netcf-devel@lists.fedorahosted.org > >-- Hendrik Schwartke OpenSource Security Ralf Spenneberg http://www.os-t.de Am Bahnhof 3-5 48565 Steinfurt Germany Fon: +49(0)2552 638 755 Fax: +49(0)2552 638 757
Apparently Analagous Threads
- Re: [netcf]IFF_RUNNING flag on a bridge device
- Re: [netcf]IFF_RUNNING flag on a bridge device
- [netcf] Why netcf can not rename a existing physical interface dynamically by itself?
- Re: [netcf] Why netcf can not rename a existing physical interface dynamically by itself?
- Re: [netcf] Why netcf can not rename a existing physical interface dynamically by itself?