* drivers/net/tun.c: CAP_NET_ADMIN conditional not reached
@ 2011-07-28 22:00 Petar Bogdanovic
0 siblings, 0 replies; only message in thread
From: Petar Bogdanovic @ 2011-07-28 22:00 UTC (permalink / raw)
To: netdev
Hi,
drivers/net/tun.c says:
1004 if (((tun->owner != -1 && cred->euid != tun->owner) ||
1005 (tun->group != -1 && !in_egroup_p(tun->group))) &&
1006 !capable(CAP_NET_ADMIN))
1007 return -EPERM;
this will skip !capable(CAP_NET_ADMIN) if tun->owner and tun->group are
both -1, which seems to be their default value (see lines 854,855).
ip(8) from iproute2 won't do any TUNSETOWNER/TUNSETGROUP ioctl() if no
uid and/or gid is supplied so when using `ip tuntap' as an unprivileged
user, you'll be unable to create a new tun(4) but won't have any
problems attaching to an existing device created without both user and
group options.
I'm not sure whether this is intentional since it has been around for
years.. although triggering it with tunctl(8) was not possible---tunctl
without `-u' seems to use 0 as the default value for TUNSETOWNER.
Petar Bogdanovic
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-07-28 22:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-28 22:00 drivers/net/tun.c: CAP_NET_ADMIN conditional not reached Petar Bogdanovic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox