]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
linux: make ethtool stuff run as root again feature/ethtool-linksettings 212/head
authorVincent Bernat <vincent@bernat.im>
Sun, 25 Dec 2016 07:46:56 +0000 (08:46 +0100)
committerVincent Bernat <vincent@bernat.im>
Sun, 25 Dec 2016 08:33:42 +0000 (09:33 +0100)
This is needed for ETHTOOL_GLINKSETTINGS.

src/daemon/lldpd.h
src/daemon/priv-linux.c
src/daemon/priv.c

index 762e83b74d62010c7f4863c414e405c43274ea94..5c475f40b529a93b53d53f1951eaae245a52e8ea 100644 (file)
@@ -227,9 +227,7 @@ struct ethtool_link_usettings {
 int             priv_open(char*);
 void    asroot_open(void);
 int             priv_ethtool(char*, struct ethtool_link_usettings*);
-# ifdef ENABLE_OLDIES
 void    asroot_ethtool(void);
-# endif
 #endif
 int             priv_iface_init(int, char *);
 int     asroot_iface_init_os(int, char *, int *);
index a24051ec86c328e5bb6768250802417c2f50ebb3..20263df10984933f8402a9ab0276ae21868548e1 100644 (file)
@@ -134,12 +134,12 @@ end:
 }
 
 /* Proxy for ethtool ioctl (GSET/GLINKSETTINGS only). Not needed since
- * 0fdc100bdc4b7ab61ed632962c76dfe539047296 (2.6.37). */
+ * 0fdc100bdc4b7ab61ed632962c76dfe539047296 (2.6.37). But needed until
+ * 8006f6bf5e39f11c697f48df20382b81d2f2f8b8 (4.9). */
 int
 priv_ethtool(char *ifname, struct ethtool_link_usettings *uset)
 {
        int rc;
-#ifdef ENABLE_OLDIES
        int len;
        enum priv_cmd cmd = PRIV_ETHTOOL;
        must_write(PRIV_UNPRIVILEGED, &cmd, sizeof(enum priv_cmd));
@@ -151,9 +151,6 @@ priv_ethtool(char *ifname, struct ethtool_link_usettings *uset)
        if (rc != 0)
                return rc;
        must_read(PRIV_UNPRIVILEGED, uset, sizeof(struct ethtool_link_usettings));
-#else
-       rc = asroot_ethtool_real(ifname, uset);
-#endif
        return rc;
 }
 
@@ -217,7 +214,6 @@ asroot_open()
        close(fd);
 }
 
-#ifdef ENABLE_OLDIES
 void
 asroot_ethtool()
 {
@@ -236,7 +232,6 @@ asroot_ethtool()
        if (rc == -1) return;
        must_write(PRIV_PRIVILEGED, &uset, sizeof(struct ethtool_link_usettings));
 }
-#endif
 
 int
 asroot_iface_init_os(int ifindex, char *name, int *fd)
index 1c37f32655ae5182af52eab11f8d913c703aeccd..f03c90aa1e30834ff6d03decbd7b940b64df1f23 100644 (file)
@@ -387,9 +387,7 @@ static struct dispatch_actions actions[] = {
        {PRIV_GET_HOSTNAME, asroot_gethostname},
 #ifdef HOST_OS_LINUX
        {PRIV_OPEN, asroot_open},
-# ifdef ENABLE_OLDIES
        {PRIV_ETHTOOL, asroot_ethtool},
-# endif
 #endif
        {PRIV_IFACE_INIT, asroot_iface_init},
        {PRIV_IFACE_MULTICAST, asroot_iface_multicast},