unix: add constants for raw CAN sockets

Fixes golang/go#41091

Change-Id: Icae9ad639599474144b286510f744f4a283aba06
GitHub-Last-Rev: 541bdb97bb22a8179534244dbc2f75a91ef6bab4
GitHub-Pull-Request: golang/sys#83
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251357
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/unix/linux/types.go b/unix/linux/types.go
index 1f9176b..f3c2396 100644
--- a/unix/linux/types.go
+++ b/unix/linux/types.go
@@ -81,6 +81,7 @@
 #include <linux/blkpg.h>
 #include <linux/bpf.h>
 #include <linux/can.h>
+#include <linux/can/raw.h>
 #include <linux/capability.h>
 #include <linux/cgroupstats.h>
 #include <linux/cryptouser.h>
@@ -2481,3 +2482,14 @@
 	NHA_GROUPS     = C.NHA_GROUPS
 	NHA_MASTER     = C.NHA_MASTER
 )
+
+// raw CAN sockets
+
+const (
+	CAN_RAW_FILTER        = C.CAN_RAW_FILTER
+	CAN_RAW_ERR_FILTER    = C.CAN_RAW_ERR_FILTER
+	CAN_RAW_LOOPBACK      = C.CAN_RAW_LOOPBACK
+	CAN_RAW_RECV_OWN_MSGS = C.CAN_RAW_RECV_OWN_MSGS
+	CAN_RAW_FD_FRAMES     = C.CAN_RAW_FD_FRAMES
+	CAN_RAW_JOIN_FILTERS  = C.CAN_RAW_JOIN_FILTERS
+)
diff --git a/unix/mkerrors.sh b/unix/mkerrors.sh
index d46fb8a..cab4560 100755
--- a/unix/mkerrors.sh
+++ b/unix/mkerrors.sh
@@ -194,6 +194,7 @@
 #include <linux/bpf.h>
 #include <linux/can.h>
 #include <linux/can/error.h>
+#include <linux/can/raw.h>
 #include <linux/capability.h>
 #include <linux/cryptouser.h>
 #include <linux/devlink.h>
diff --git a/unix/zerrors_linux.go b/unix/zerrors_linux.go
index a274da7..388050a 100644
--- a/unix/zerrors_linux.go
+++ b/unix/zerrors_linux.go
@@ -2043,6 +2043,7 @@
 	SOL_ATM                                     = 0x108
 	SOL_CAIF                                    = 0x116
 	SOL_CAN_BASE                                = 0x64
+	SOL_CAN_RAW                                 = 0x65
 	SOL_DCCP                                    = 0x10d
 	SOL_DECNET                                  = 0x105
 	SOL_ICMPV6                                  = 0x3a
diff --git a/unix/ztypes_linux.go b/unix/ztypes_linux.go
index 953166c..1879d57 100644
--- a/unix/ztypes_linux.go
+++ b/unix/ztypes_linux.go
@@ -2527,3 +2527,12 @@
 	NHA_GROUPS     = 0x9
 	NHA_MASTER     = 0xa
 )
+
+const (
+	CAN_RAW_FILTER        = 0x1
+	CAN_RAW_ERR_FILTER    = 0x2
+	CAN_RAW_LOOPBACK      = 0x3
+	CAN_RAW_RECV_OWN_MSGS = 0x4
+	CAN_RAW_FD_FRAMES     = 0x5
+	CAN_RAW_JOIN_FILTERS  = 0x6
+)