]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
util: use netlink to delete bridge devices
authorLaine Stump <laine@laine.org>
Tue, 17 Mar 2015 19:45:01 +0000 (15:45 -0400)
committerLaine Stump <laine@laine.org>
Thu, 26 Mar 2015 19:31:34 +0000 (15:31 -0400)
commit09778e0908822e9bf57a8b55e0150ad80e64e01f
treea04d6513c40eb9f93d914f15bb0838787de70202
parente849062a64f4baf62ea26b2ed17b1b9ab6d51786
util: use netlink to delete bridge devices

https://bugzilla.redhat.com/show_bug.cgi?id=1125755

reported that a stray bridge device was left on the system when a
libvirt network failed to start due to an illegal iptables rule caused
by bad config. Apparently the reason this was happening was that
NetworkManager was noticing immediately when the bridge device was
created and automatically setting it IFF_UP. libvirt would then try to
setup the iptables rules, get an error back, and since libvirt had
never IFF_UPed the bridge, it didn't expect that it needed to set it
~IFF_UP before deleting it during the cleanup process. But the
ioctl(SIOCBRDELBR) ioctl will fail to delete a bridge if it is IFF_UP.

Since that bug was reported, NetworkManager has gotten a bit more
polite in this respect, but just in case something similar happens in
the future, this patch switches to using the netlink RTM_DELLINK
message to delete the bridge - unlike SIOCBRDELBR, it will delete the
requested bridge no matter what the setting of IFF_UP.
src/util/virnetdevbridge.c