diff options
author | Oliver Hartkopp <socketcan@hartkopp.net> | 2010-10-19 05:32:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-21 07:27:03 -0400 |
commit | 1e55659ce6ddb5247cee0b1f720d77a799902b85 (patch) | |
tree | 335e43324d5ad5e0979fb30e333cb1a4e1a47085 /Documentation/networking | |
parent | 32a875adcdcf5f470bf967250cfd01722e23844f (diff) |
can-raw: add msg_flags to distinguish local traffic
CAN has no addressing scheme. It is currently impossible for userspace
to tell is a received CAN frame comes from another process on the local
host, or from a remote CAN device.
This patch add support for userspace applications to distinguish between
'own', 'local' and 'remote' CAN traffic. The distinction is made by returning
flags in msg->msg_flags in the call to recvmsg().
The added documentation explains the introduced flags.
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation/networking')
-rw-r--r-- | Documentation/networking/can.txt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Documentation/networking/can.txt b/Documentation/networking/can.txt index cd79735013f9..5b04b67ddca2 100644 --- a/Documentation/networking/can.txt +++ b/Documentation/networking/can.txt | |||
@@ -22,6 +22,7 @@ This file contains | |||
22 | 4.1.2 RAW socket option CAN_RAW_ERR_FILTER | 22 | 4.1.2 RAW socket option CAN_RAW_ERR_FILTER |
23 | 4.1.3 RAW socket option CAN_RAW_LOOPBACK | 23 | 4.1.3 RAW socket option CAN_RAW_LOOPBACK |
24 | 4.1.4 RAW socket option CAN_RAW_RECV_OWN_MSGS | 24 | 4.1.4 RAW socket option CAN_RAW_RECV_OWN_MSGS |
25 | 4.1.5 RAW socket returned message flags | ||
25 | 4.2 Broadcast Manager protocol sockets (SOCK_DGRAM) | 26 | 4.2 Broadcast Manager protocol sockets (SOCK_DGRAM) |
26 | 4.3 connected transport protocols (SOCK_SEQPACKET) | 27 | 4.3 connected transport protocols (SOCK_SEQPACKET) |
27 | 4.4 unconnected transport protocols (SOCK_DGRAM) | 28 | 4.4 unconnected transport protocols (SOCK_DGRAM) |
@@ -471,6 +472,17 @@ solution for a couple of reasons: | |||
471 | setsockopt(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS, | 472 | setsockopt(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS, |
472 | &recv_own_msgs, sizeof(recv_own_msgs)); | 473 | &recv_own_msgs, sizeof(recv_own_msgs)); |
473 | 474 | ||
475 | 4.1.5 RAW socket returned message flags | ||
476 | |||
477 | When using recvmsg() call, the msg->msg_flags may contain following flags: | ||
478 | |||
479 | MSG_DONTROUTE: set when the received frame was created on the local host. | ||
480 | |||
481 | MSG_CONFIRM: set when the frame was sent via the socket it is received on. | ||
482 | This flag can be interpreted as a 'transmission confirmation' when the | ||
483 | CAN driver supports the echo of frames on driver level, see 3.2 and 6.2. | ||
484 | In order to receive such messages, CAN_RAW_RECV_OWN_MSGS must be set. | ||
485 | |||
474 | 4.2 Broadcast Manager protocol sockets (SOCK_DGRAM) | 486 | 4.2 Broadcast Manager protocol sockets (SOCK_DGRAM) |
475 | 4.3 connected transport protocols (SOCK_SEQPACKET) | 487 | 4.3 connected transport protocols (SOCK_SEQPACKET) |
476 | 4.4 unconnected transport protocols (SOCK_DGRAM) | 488 | 4.4 unconnected transport protocols (SOCK_DGRAM) |