]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: allow retrieving ethtool features when unprivileged
authorLaine Stump <laine@laine.org>
Fri, 17 Mar 2017 21:49:45 +0000 (17:49 -0400)
committerLaine Stump <laine@laine.org>
Wed, 22 Mar 2017 16:10:09 +0000 (12:10 -0400)
The only reason that the ethtool features weren't being retrieved in
an unprivileged libvirtd was because they required ioctl(), and the
ioctl was using an AF_PACKET socket, which requires root. Now that we
are using AF_UNIX for ioctl(), this restriction can be removed.

src/util/virnetdev.c

index acc6c2ea7e9775df112aab23d30444fd5e4fd793..9e52a1f725f47e8b8012016885f127a9ee84b3d5 100644 (file)
@@ -2583,12 +2583,6 @@ virNetDevGetFeatures(const char *ifname,
     if (!(*out = virBitmapNew(VIR_NET_DEV_FEAT_LAST)))
         return -1;
 
-    /* Only fetch features if we're privileged, but no need to fail */
-    if (geteuid() != 0) {
-        VIR_DEBUG("ETHTOOL feature bits not available in session mode");
-        return 0;
-    }
-
     if ((fd = virNetDevSetupControl(ifname, &ifr)) < 0)
         goto cleanup;