Netdev List
 help / color / mirror / Atom feed
From: Petar Bogdanovic <petar@smokva.net>
To: netdev@vger.kernel.org
Subject: drivers/net/tun.c: CAP_NET_ADMIN conditional not reached
Date: Fri, 29 Jul 2011 00:00:27 +0200	[thread overview]
Message-ID: <20110728220026.GA25322@pintail.smokva.net> (raw)

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

                 reply	other threads:[~2011-07-28 22:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110728220026.GA25322@pintail.smokva.net \
    --to=petar@smokva.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox