summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authorbouyer <bouyer@NetBSD.org>2017-05-27 21:02:54 +0000
committerbouyer <bouyer@NetBSD.org>2017-05-27 21:02:54 +0000
commit3e7aaa91a8b5dd2a6aebff25d0f9fcab4a2edb90 (patch)
treef19f0d1a6f18fcabb5481e3b1fc16611f1e3b95b /sys/kern/uipc_socket.c
parentcdd3ff897b961874efb8ed508de493f2315f541a (diff)
merge the bouyer-socketcan branch to HEAD.
CAN stands for Controller Area Network, a broadcast network used in automation and automotive fields. For example, the NMEA2000 standard developped for marine devices uses a CAN network as the link layer. This is an implementation of the linux socketcan API: https://www.kernel.org/doc/Documentation/networking/can.txt you can also see can(4). This adds a new socket family (AF_CAN) and protocol (PF_CAN), as well as the canconfig(8) utility, used to set timing parameter of CAN hardware. Also inclued is a driver for the CAN controller found in the allwinner A20 SoC (I tested it with an Olimex lime2 board, connected with PIC18-based CAN devices). There is also the canloop(4) pseudo-device, which allows to use the socketcan API without CAN hardware. At this time the CANFD part of the linux socketcan API is not implemented. Error frames are not implemented either. But I could get the cansend and canreceive utilities from the canutils package to build and run with minimal changes. tcpudmp(8) can also be used to record frames, which can be decoded with etherreal.
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 9b37147048a..bbe6d1d2418 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket.c,v 1.254 2017/05/25 20:42:36 christos Exp $ */
+/* $NetBSD: uipc_socket.c,v 1.255 2017/05/27 21:02:56 bouyer Exp $ */
/*-
* Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.254 2017/05/25 20:42:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.255 2017/05/27 21:02:56 bouyer Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -439,6 +439,7 @@ socket_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie,
case PF_ROUTE:
case PF_OROUTE:
case PF_BLUETOOTH:
+ case PF_CAN:
result = KAUTH_RESULT_ALLOW;
break;
default: