mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-30 05:46:45 -04:00
unix: add SetsockoptCanRawFilter for linux
Add the SetsockoptCanRawFilter func and CanFilter type to allow kernel message filtering on AF_CAN sockets. Fixes golang/go#29638 Change-Id: I4042825527ba2bc9aeb8dbe70d1960a06b15c29e Reviewed-on: https://go-review.googlesource.com/c/163318 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
ec7b60b042
commit
a9d3bda3a2
@@ -1000,6 +1000,14 @@ func SetsockoptSockFprog(fd, level, opt int, fprog *SockFprog) error {
|
||||
return setsockopt(fd, level, opt, unsafe.Pointer(fprog), unsafe.Sizeof(*fprog))
|
||||
}
|
||||
|
||||
func SetsockoptCanRawFilter(fd, level, opt int, filter []CanFilter) error {
|
||||
var p unsafe.Pointer
|
||||
if len(filter) > 0 {
|
||||
p = unsafe.Pointer(&filter[0])
|
||||
}
|
||||
return setsockopt(fd, level, opt, p, uintptr(len(filter)*SizeofCanFilter))
|
||||
}
|
||||
|
||||
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
|
||||
|
||||
// KeyctlInt calls keyctl commands in which each argument is an int.
|
||||
|
||||
Reference in New Issue
Block a user