diff mbox series

net-ethtool: ETHTOOL_GUFO did not and should not require CAP_NET_ADMIN

Message ID 20180922083401.12131-1-zenczykowski@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series net-ethtool: ETHTOOL_GUFO did not and should not require CAP_NET_ADMIN | expand

Commit Message

Maciej Żenczykowski Sept. 22, 2018, 8:34 a.m. UTC
From: Maciej Żenczykowski <maze@google.com>

So it should not fail with EPERM even though it is no longer implemented...

This is a fix for:
  (userns)$ egrep ^Cap /proc/self/status
  CapInh: 0000003fffffffff
  CapPrm: 0000003fffffffff
  CapEff: 0000003fffffffff
  CapBnd: 0000003fffffffff
  CapAmb: 0000003fffffffff

  (userns)$ tcpdump -i usb_rndis0
  tcpdump: WARNING: usb_rndis0: SIOCETHTOOL(ETHTOOL_GUFO) ioctl failed: Operation not permitted
  Warning: Kernel filter failed: Bad file descriptor
  tcpdump: can't remove kernel filter: Bad file descriptor

With this change it returns EOPNOTSUPP instead of EPERM.

See also https://github.com/the-tcpdump-group/libpcap/issues/689

Fixes: 08a00fea6de2 "net: Remove references to NETIF_F_UFO from ethtool."
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/core/ethtool.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Miller Sept. 23, 2018, 12:12 a.m. UTC | #1
From: "Maciej Żenczykowski" <zenczykowski@gmail.com>
Date: Sat, 22 Sep 2018 01:34:01 -0700

> From: Maciej Żenczykowski <maze@google.com>
> 
> So it should not fail with EPERM even though it is no longer implemented...
> 
> This is a fix for:
>   (userns)$ egrep ^Cap /proc/self/status
>   CapInh: 0000003fffffffff
>   CapPrm: 0000003fffffffff
>   CapEff: 0000003fffffffff
>   CapBnd: 0000003fffffffff
>   CapAmb: 0000003fffffffff
> 
>   (userns)$ tcpdump -i usb_rndis0
>   tcpdump: WARNING: usb_rndis0: SIOCETHTOOL(ETHTOOL_GUFO) ioctl failed: Operation not permitted
>   Warning: Kernel filter failed: Bad file descriptor
>   tcpdump: can't remove kernel filter: Bad file descriptor
> 
> With this change it returns EOPNOTSUPP instead of EPERM.
> 
> See also https://github.com/the-tcpdump-group/libpcap/issues/689
> 
> Fixes: 08a00fea6de2 "net: Remove references to NETIF_F_UFO from ethtool."
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Maciej Żenczykowski <maze@google.com>

Applied and queued up for -stable, thanks.
diff mbox series

Patch

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 9d4e56d97080..96afc55aa61e 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -2536,6 +2536,7 @@  int dev_ethtool(struct net *net, struct ifreq *ifr)
 	case ETHTOOL_GPHYSTATS:
 	case ETHTOOL_GTSO:
 	case ETHTOOL_GPERMADDR:
+	case ETHTOOL_GUFO:
 	case ETHTOOL_GGSO:
 	case ETHTOOL_GGRO:
 	case ETHTOOL_GFLAGS: