09778e0 util: use netlink to delete bridge devices

Authored and Committed by Laine Stump 9 years ago
    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.
    
        
file modified
+10 -2