linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Alexander Stein <alexander.stein@systec-electronic.com>
Cc: linux-can@vger.kernel.org
Subject: Re: exclusive access to can interface
Date: Mon, 07 Jan 2013 19:37:44 +0100	[thread overview]
Message-ID: <50EB15F8.4090700@hartkopp.net> (raw)
In-Reply-To: <2412937.XVpYjfC7zz@ws-stein>

On 07.01.2013 17:52, Alexander Stein wrote:

> is there a way to get exclusive (write) access to a CAN interface, so that only one bound socket can write CAN frames on the bus?
> 


Not really.

In a very early SocketCAN implementation we had the possibility to define the capabilities to access CAN sockets. See

http://svn.berlios.de/wsvn/socketcan/trunk/kernel/2.6/net/can/raw.c?op=log&op=log&peg=1258&page=2

We removed it in:

http://svn.berlios.de/wsvn/socketcan/trunk/kernel/2.6/net/can/raw.c?op=revision&rev=489&peg=1258

http://svn.berlios.de/wsvn/socketcan/trunk/kernel/2.6/net/can/raw.c?op=revision&rev=490&peg=1258

You might think about re-introducing some capability checking, e.g. that only root or some other special user may write on CAN RAW sockets.

E.g. see "if (!capable(CAP_NET_RAW))"

http://lxr.linux.no/#linux+v3.7.1/net/packet/af_packet.c#L2480

in packet_create() ...

Regards,
Oliver

      parent reply	other threads:[~2013-01-07 18:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07 16:52 exclusive access to can interface Alexander Stein
2013-01-07 18:16 ` Marc Kleine-Budde
2013-01-08  9:23   ` Alexander Stein
2013-01-08  9:32     ` Marc Kleine-Budde
2013-01-08  9:48       ` Alexander Stein
2013-01-08 10:09         ` Oliver Hartkopp
2013-01-08 10:18           ` Heinz-Jürgen Oertel
2013-01-08 10:08     ` Wolfgang Grandegger
2013-01-08 10:15       ` Heinz-Jürgen Oertel
2013-01-22  9:41   ` Alexander Stein
2013-01-22 12:53     ` Kurt Van Dijck
2013-01-22 13:36       ` Alexander Stein
2013-01-07 18:37 ` Oliver Hartkopp [this message]

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=50EB15F8.4090700@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=alexander.stein@systec-electronic.com \
    --cc=linux-can@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).