netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: netdev@vger.kernel.org, Mark McLoughlin <markmc@redhat.com>
Subject: Re: tun: add tun_flags, owner, group attributes in sysfs
Date: Tue, 05 May 2009 23:18:33 +0100	[thread overview]
Message-ID: <1241561913.20057.40.camel@macbook.infradead.org> (raw)
In-Reply-To: <49FEC52E.6070501@msgid.tls.msk.ru>

On Mon, 2009-05-04 at 14:36 +0400, Michael Tokarev wrote:
> David Woodhouse wrote:
> > This patch adds three attribute files in /sys/class/net/$dev/ for tun
> > devices; allowing userspace to obtain the information which TUNGETIFF
> > offers, and more, but without having to attach to the device in question
> > (which may not be possible if it's in use).
> > 
> []
> > +static DEVICE_ATTR(tun_flags, 0444, tun_show_flags, NULL);
> > +static DEVICE_ATTR(owner, 0444, tun_show_owner, NULL);
> > +static DEVICE_ATTR(group, 0444, tun_show_group, NULL);
> 
> Is there any reason why those files are not writable?
> 
> I understand flags one, sorta (but it is still useful to
> be able to change some flags, like persistent, while it's
> running), but for owner/group - it's just an integer that's
> used to check permissions for ioctl, and can be set in sysfs
> just fine.  I think anyway.

I did think about it, but didn't see the point. There's little benefit
in being able to write owner/group through sysfs, and it's non-trivial
to get the permissions right.

You can currently change owner/group if you can attach to the device...
and you can attach to the device if you're _already_ the appropriate
uid/gid, or if you have CAP_NET_ADMIN. 

We can't make opens for write fail, as far as I'm aware -- the best we
could do is to reproduce the permissions check in the sysfs set
function, and return -EPERM to the _write_, which doesn't really fill me
with joy.

Being able to mark a device as non-persistent through sysfs while it's
open would be cute, I suppose -- but not cute enough that it's worth
having to deal with the case of marking it non-persistent that way while
it's _not_ open, which means it needs to disappear as soon as you write
the flags variable...

On the whole, it seemed better just to have them read-only. That's all
we really need, after all.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


  reply	other threads:[~2009-05-05 22:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-04 10:32 tun: add tun_flags, owner, group attributes in sysfs David Woodhouse
2009-05-04 10:36 ` Michael Tokarev
2009-05-05 22:18   ` David Woodhouse [this message]
2009-05-04 10:42 ` [iproute2 patch]: Add 'ip tuntap' facility for managing tun/tap devices David Woodhouse
2009-05-04 14:38   ` Stephen Hemminger
2009-05-04 14:49     ` David Woodhouse
2009-05-27 16:32       ` David Woodhouse
2009-05-27 16:38         ` Stephen Hemminger
2009-05-27 16:49           ` David Woodhouse
2009-05-27 17:06             ` Stephen Hemminger
2009-05-27 20:44               ` David Miller
2009-05-27 20:43             ` David Miller
2009-05-28  4:58   ` Stephen Hemminger
2009-05-28  8:12     ` David Woodhouse
2009-06-13  8:55       ` David Woodhouse
2009-07-20 23:44         ` David Woodhouse
2009-05-04 14:47 ` tun: add tun_flags, owner, group attributes in sysfs Stephen Hemminger
2009-05-04 14:58   ` David Woodhouse
2009-05-09 20:27 ` David Miller
2009-05-09 22:27   ` David Woodhouse
2009-05-09 22:55     ` David Woodhouse
2009-05-09 22:56     ` David Miller
2009-05-10  5:54 ` David Miller

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=1241561913.20057.40.camel@macbook.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=markmc@redhat.com \
    --cc=mjt@tls.msk.ru \
    --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;
as well as URLs for NNTP newsgroup(s).