Skip to contentSkip to conversation

SIOCETHTOOL history ?

DISCUSSION arun 2 participants 2 messages May 6, 2003

Subsystems (2)
lore
Share & tools
lore

arun

author
#0 lore raw

Hi,

Can anyone of the veterans please help me out with a
small code curiosity

Why does the SIOCETHTOOL ioctl need
CAP_NET_ADMIN even for harmless commands like
GSET ?

Some sample drivers that I managed to download over the net that supports SIOCETHTOOL has comments like

"no need to check for CAP_NET_ADMIN since that is already present in net/core/dev.c". (And sure enough it was there)

Why would such a blanket checking be present when this ioctl is only an entry point for many sub commands ?

I have used SIOCGMIIPHY before and it seemed not to require any su rights or capabilities. What's then the difference between these 2 ioctls that require more capabilities for SIOCETHTOOL ?

arun

#1 lore raw

From: "arun" <[email protected]>
Date: Tue, 6 May 2003 18:07:48 +0530

I have used SIOCGMIIPHY before and it seemed not to require any su rights or capabilities.

Yes it does:

/*
* These ioctl calls:
* - require superuser power.
* - require strict serialization.
* - return a value
*/
case SIOCETHTOOL:
case SIOCGMIIPHY:
case SIOCGMIIREG:
if (!capable(CAP_NET_ADMIN))
return -EPERM;