Commit 7d8da7dc authored by Mikio Hara's avatar Mikio Hara

syscall: add source-specific multicast socket options for FreeBSD

Update #8266

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/104290043
parent a712e20a
......@@ -266,7 +266,7 @@ ccflags="$@"
$2 ~ /^O[CNPFP][A-Z]+[^_][A-Z]+$/ ||
$2 ~ /^IN_/ ||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR|MCAST)_/ ||
$2 == "ICMPV6_FILTER" ||
$2 == "SOMAXCONN" ||
$2 == "NAME_MAX" ||
......
......@@ -93,14 +93,36 @@ func Pipe(p []int) (err error) {
}
func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
var value IPMreqn
vallen := _Socklen(SizeofIPMreqn)
errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
return &value, errno
var v IPMreqn
l := _Socklen(SizeofIPMreqn)
err := getsockopt(fd, level, opt, unsafe.Pointer(&v), &l)
return &v, err
}
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
func GetsockoptGroupReq(fd, level, opt int) (*GroupReq, error) {
var v GroupReq
l := _Socklen(SizeofGroupReq)
err := getsockopt(fd, level, opt, unsafe.Pointer(&v), &l)
return &v, err
}
func GetsockoptGroupSourceReq(fd, level, opt int) (*GroupSourceReq, error) {
var v GroupSourceReq
l := _Socklen(SizeofGroupSourceReq)
err := getsockopt(fd, level, opt, unsafe.Pointer(&v), &l)
return &v, err
}
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) error {
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), SizeofIPMreqn)
}
func SetsockoptGroupReq(fd, level, opt int, greq *GroupReq) error {
return setsockopt(fd, level, opt, unsafe.Pointer(greq), SizeofGroupReq)
}
func SetsockoptGroupSourceReq(fd, level, opt int, gsreq *GroupSourceReq) error {
return setsockopt(fd, level, opt, unsafe.Pointer(gsreq), SizeofGroupSourceReq)
}
func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
......
......@@ -224,6 +224,8 @@ type RawSockaddr C.struct_sockaddr
type RawSockaddrAny C.struct_sockaddr_any
type RawSockaddrStorage C.struct_sockaddr_storage
type _Socklen C.socklen_t
type Linger C.struct_linger
......@@ -236,6 +238,10 @@ type IPMreqn C.struct_ip_mreqn
type IPv6Mreq C.struct_ipv6_mreq
type GroupReq C.struct_group_req
type GroupSourceReq C.struct_group_source_req
type Msghdr C.struct_msghdr
type Cmsghdr C.struct_cmsghdr
......@@ -252,10 +258,13 @@ const (
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl
SizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
SizeofLinger = C.sizeof_struct_linger
SizeofIPMreq = C.sizeof_struct_ip_mreq
SizeofIPMreqn = C.sizeof_struct_ip_mreqn
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
SizeofGroupReq = C.sizeof_struct_group_req
SizeofGroupSourceReq = C.sizeof_struct_group_source_req
SizeofMsghdr = C.sizeof_struct_msghdr
SizeofCmsghdr = C.sizeof_struct_cmsghdr
SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
......
......@@ -1022,6 +1022,15 @@ const (
MAP_RESERVED0100 = 0x100
MAP_SHARED = 0x1
MAP_STACK = 0x400
MCAST_BLOCK_SOURCE = 0x54
MCAST_EXCLUDE = 0x2
MCAST_INCLUDE = 0x1
MCAST_JOIN_GROUP = 0x50
MCAST_JOIN_SOURCE_GROUP = 0x52
MCAST_LEAVE_GROUP = 0x51
MCAST_LEAVE_SOURCE_GROUP = 0x53
MCAST_UNBLOCK_SOURCE = 0x55
MCAST_UNDEFINED = 0x0
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MSG_CMSG_CLOEXEC = 0x40000
......
......@@ -1023,6 +1023,15 @@ const (
MAP_RESERVED0100 = 0x100
MAP_SHARED = 0x1
MAP_STACK = 0x400
MCAST_BLOCK_SOURCE = 0x54
MCAST_EXCLUDE = 0x2
MCAST_INCLUDE = 0x1
MCAST_JOIN_GROUP = 0x50
MCAST_JOIN_SOURCE_GROUP = 0x52
MCAST_LEAVE_GROUP = 0x51
MCAST_LEAVE_SOURCE_GROUP = 0x53
MCAST_UNBLOCK_SOURCE = 0x55
MCAST_UNDEFINED = 0x0
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MSG_CMSG_CLOEXEC = 0x40000
......
......@@ -1022,6 +1022,15 @@ const (
MAP_RESERVED0100 = 0x100
MAP_SHARED = 0x1
MAP_STACK = 0x400
MCAST_BLOCK_SOURCE = 0x54
MCAST_EXCLUDE = 0x2
MCAST_INCLUDE = 0x1
MCAST_JOIN_GROUP = 0x50
MCAST_JOIN_SOURCE_GROUP = 0x52
MCAST_LEAVE_GROUP = 0x51
MCAST_LEAVE_SOURCE_GROUP = 0x53
MCAST_UNBLOCK_SOURCE = 0x55
MCAST_UNDEFINED = 0x0
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MSG_CMSG_CLOEXEC = 0x40000
......
......@@ -183,6 +183,14 @@ type RawSockaddrAny struct {
Pad [92]int8
}
type RawSockaddrStorage struct {
Len uint8
Family uint8
X__ss_pad1 [6]int8
X__ss_align int64
X__ss_pad2 [112]int8
}
type _Socklen uint32
type Linger struct {
......@@ -211,6 +219,17 @@ type IPv6Mreq struct {
Interface uint32
}
type GroupReq struct {
Interface uint32
Group RawSockaddrStorage
}
type GroupSourceReq struct {
Interface uint32
Group RawSockaddrStorage
Source RawSockaddrStorage
}
type Msghdr struct {
Name *byte
Namelen uint32
......@@ -247,10 +266,13 @@ const (
SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x36
SizeofSockaddrStorage = 0x80
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
SizeofGroupReq = 0x84
SizeofGroupSourceReq = 0x104
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofInet6Pktinfo = 0x14
......
......@@ -183,6 +183,14 @@ type RawSockaddrAny struct {
Pad [92]int8
}
type RawSockaddrStorage struct {
Len uint8
Family uint8
X__ss_pad1 [6]int8
X__ss_align int64
X__ss_pad2 [112]int8
}
type _Socklen uint32
type Linger struct {
......@@ -211,6 +219,19 @@ type IPv6Mreq struct {
Interface uint32
}
type GroupReq struct {
Interface uint32
Pad_cgo_0 [4]byte
Group RawSockaddrStorage
}
type GroupSourceReq struct {
Interface uint32
Pad_cgo_0 [4]byte
Group RawSockaddrStorage
Source RawSockaddrStorage
}
type Msghdr struct {
Name *byte
Namelen uint32
......@@ -249,10 +270,13 @@ const (
SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x36
SizeofSockaddrStorage = 0x80
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
SizeofGroupReq = 0x88
SizeofGroupSourceReq = 0x108
SizeofMsghdr = 0x30
SizeofCmsghdr = 0xc
SizeofInet6Pktinfo = 0x14
......
......@@ -185,6 +185,14 @@ type RawSockaddrAny struct {
Pad [92]int8
}
type RawSockaddrStorage struct {
Len uint8
Family uint8
X__ss_pad1 [6]int8
X__ss_align int64
X__ss_pad2 [112]int8
}
type _Socklen uint32
type Linger struct {
......@@ -213,6 +221,19 @@ type IPv6Mreq struct {
Interface uint32
}
type GroupReq struct {
Interface uint32
Pad_cgo_0 [4]byte
Group RawSockaddrStorage
}
type GroupSourceReq struct {
Interface uint32
Pad_cgo_0 [4]byte
Group RawSockaddrStorage
Source RawSockaddrStorage
}
type Msghdr struct {
Name *byte
Namelen uint32
......@@ -249,10 +270,13 @@ const (
SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x36
SizeofSockaddrStorage = 0x80
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
SizeofGroupReq = 0x88
SizeofGroupSourceReq = 0x108
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofInet6Pktinfo = 0x14
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment