]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: fallback to ioctl(SIOCBRADDBR) if netlink RTM_NEWLINK fails
authorLaine Stump <laine@laine.org>
Wed, 26 Aug 2015 00:48:19 +0000 (20:48 -0400)
committerLaine Stump <laine@laine.org>
Fri, 28 Aug 2015 20:19:05 +0000 (16:19 -0400)
commit66dcb4093750aabd637607a1202cb9b9c15f1298
tree11c1742228eb644178a32877bc395e5e41e27b79
parent60acb38abbee1636a9cddf8d296f700d115c8f77
util: fallback to ioctl(SIOCBRADDBR) if netlink RTM_NEWLINK fails

commit fc7b23db switched from using ioctl(SIOCBRADDBR) for bridge
creation to using a netlink RTM_NEWLINK message with IFLA_INFO_KIND =
"bridge", which is the more modern way to create a bridge. However,
although older kernels (e.g. 2.6.32, in RHEL6/CentOS6) support
creating *some* link types with RTM_NEWLINK, they don't support
creating bridges, and there is no compile-time way to figure this out
(since the "type" isn't an enum, but rather a character string).

This patch moves the body of the SIOCBRADDBR version of
virNetDevBridgeCreate() into a static function, calls the new function
from the original, and also calls the new function from the
RTM_NEWLINK version if the RTM_NEWLINK message generates an EOPNOTSUPP
error.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1252780
src/util/virnetdevbridge.c