Commit 0c924584 authored by Mikio Hara's avatar Mikio Hara

go.net/ipv6: restore use of syscall

This CL restores use of syscall functions and constants that
doesn't break the build on Go 1.1 and beyond.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/92320046
parent 38dcae40
...@@ -8,6 +8,7 @@ package ipv6 ...@@ -8,6 +8,7 @@ package ipv6
import ( import (
"os" "os"
"syscall"
"unsafe" "unsafe"
) )
...@@ -20,31 +21,27 @@ func setIPv6ReceiveTrafficClass(fd int, v bool) error { ...@@ -20,31 +21,27 @@ func setIPv6ReceiveTrafficClass(fd int, v bool) error {
} }
func ipv6ReceiveHopLimit(fd int) (bool, error) { func ipv6ReceiveHopLimit(fd int) (bool, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockopt2292HopLimit)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockopt2292HopLimit, unsafe.Pointer(&v), &l); err != nil {
return false, os.NewSyscallError("getsockopt", err) return false, os.NewSyscallError("getsockopt", err)
} }
return v == 1, nil return v == 1, nil
} }
func setIPv6ReceiveHopLimit(fd int, v bool) error { func setIPv6ReceiveHopLimit(fd int, v bool) error {
vv := int32(boolint(v)) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockopt2292HopLimit, boolint(v)))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockopt2292HopLimit, unsafe.Pointer(&vv), 4))
} }
func ipv6ReceivePacketInfo(fd int) (bool, error) { func ipv6ReceivePacketInfo(fd int) (bool, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockopt2292PacketInfo)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockopt2292PacketInfo, unsafe.Pointer(&v), &l); err != nil {
return false, os.NewSyscallError("getsockopt", err) return false, os.NewSyscallError("getsockopt", err)
} }
return v == 1, nil return v == 1, nil
} }
func setIPv6ReceivePacketInfo(fd int, v bool) error { func setIPv6ReceivePacketInfo(fd int, v bool) error {
vv := int32(boolint(v)) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockopt2292PacketInfo, boolint(v)))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockopt2292PacketInfo, unsafe.Pointer(&vv), 4))
} }
func ipv6PathMTU(fd int) (int, error) { func ipv6PathMTU(fd int) (int, error) {
......
...@@ -8,13 +8,12 @@ package ipv6 ...@@ -8,13 +8,12 @@ package ipv6
import ( import (
"os" "os"
"unsafe" "syscall"
) )
func setIPv6Checksum(fd int, on bool, offset int) error { func setIPv6Checksum(fd int, on bool, offset int) error {
if !on { if !on {
offset = -1 offset = -1
} }
v := int32(offset) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockoptChecksum, offset))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockoptChecksum, unsafe.Pointer(&v), 4))
} }
...@@ -6,13 +6,12 @@ package ipv6 ...@@ -6,13 +6,12 @@ package ipv6
import ( import (
"os" "os"
"unsafe" "syscall"
) )
func setIPv6Checksum(fd int, on bool, offset int) error { func setIPv6Checksum(fd int, on bool, offset int) error {
if !on { if !on {
offset = -1 offset = -1
} }
v := int32(offset) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolReserved, sysSockoptChecksum, offset))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolReserved, sysSockoptChecksum, unsafe.Pointer(&v), 4))
} }
...@@ -9,74 +9,67 @@ package ipv6 ...@@ -9,74 +9,67 @@ package ipv6
import ( import (
"net" "net"
"os" "os"
"syscall"
"unsafe" "unsafe"
) )
func ipv6TrafficClass(fd int) (int, error) { func ipv6TrafficClass(fd int) (int, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockoptTrafficClass)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockoptTrafficClass, unsafe.Pointer(&v), &l); err != nil {
return 0, os.NewSyscallError("getsockopt", err) return 0, os.NewSyscallError("getsockopt", err)
} }
return int(v), nil return v, nil
} }
func setIPv6TrafficClass(fd, v int) error { func setIPv6TrafficClass(fd, v int) error {
vv := int32(v) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockoptTrafficClass, v))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockoptTrafficClass, unsafe.Pointer(&vv), 4))
} }
func ipv6HopLimit(fd int) (int, error) { func ipv6HopLimit(fd int) (int, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockoptUnicastHopLimit)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockoptUnicastHopLimit, unsafe.Pointer(&v), &l); err != nil {
return 0, os.NewSyscallError("getsockopt", err) return 0, os.NewSyscallError("getsockopt", err)
} }
return int(v), nil return v, nil
} }
func setIPv6HopLimit(fd, v int) error { func setIPv6HopLimit(fd, v int) error {
vv := int32(v) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockoptUnicastHopLimit, v))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockoptUnicastHopLimit, unsafe.Pointer(&vv), 4))
} }
func ipv6Checksum(fd int) (bool, int, error) { func ipv6Checksum(fd int) (bool, int, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockoptChecksum)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockoptChecksum, unsafe.Pointer(&v), &l); err != nil {
return false, 0, os.NewSyscallError("getsockopt", err) return false, 0, os.NewSyscallError("getsockopt", err)
} }
on := true on := true
if v == -1 { if v == -1 {
on = false on = false
} }
return on, int(v), nil return on, v, nil
} }
func ipv6MulticastHopLimit(fd int) (int, error) { func ipv6MulticastHopLimit(fd int) (int, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockoptMulticastHopLimit)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockoptMulticastHopLimit, unsafe.Pointer(&v), &l); err != nil {
return 0, os.NewSyscallError("getsockopt", err) return 0, os.NewSyscallError("getsockopt", err)
} }
return int(v), nil return v, nil
} }
func setIPv6MulticastHopLimit(fd, v int) error { func setIPv6MulticastHopLimit(fd, v int) error {
vv := int32(v) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockoptMulticastHopLimit, v))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockoptMulticastHopLimit, unsafe.Pointer(&vv), 4))
} }
func ipv6MulticastInterface(fd int) (*net.Interface, error) { func ipv6MulticastInterface(fd int) (*net.Interface, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockoptMulticastInterface)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockoptMulticastInterface, unsafe.Pointer(&v), &l); err != nil {
return nil, os.NewSyscallError("getsockopt", err) return nil, os.NewSyscallError("getsockopt", err)
} }
if v == 0 { if v == 0 {
return nil, nil return nil, nil
} }
ifi, err := net.InterfaceByIndex(int(v)) ifi, err := net.InterfaceByIndex(v)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -84,25 +77,23 @@ func ipv6MulticastInterface(fd int) (*net.Interface, error) { ...@@ -84,25 +77,23 @@ func ipv6MulticastInterface(fd int) (*net.Interface, error) {
} }
func setIPv6MulticastInterface(fd int, ifi *net.Interface) error { func setIPv6MulticastInterface(fd int, ifi *net.Interface) error {
var v int32 var v int
if ifi != nil { if ifi != nil {
v = int32(ifi.Index) v = ifi.Index
} }
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockoptMulticastInterface, unsafe.Pointer(&v), 4)) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockoptMulticastInterface, v))
} }
func ipv6MulticastLoopback(fd int) (bool, error) { func ipv6MulticastLoopback(fd int) (bool, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockoptMulticastLoopback)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockoptMulticastLoopback, unsafe.Pointer(&v), &l); err != nil {
return false, os.NewSyscallError("getsockopt", err) return false, os.NewSyscallError("getsockopt", err)
} }
return v == 1, nil return v == 1, nil
} }
func setIPv6MulticastLoopback(fd int, v bool) error { func setIPv6MulticastLoopback(fd int, v bool) error {
vv := int32(boolint(v)) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockoptMulticastLoopback, boolint(v)))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockoptMulticastLoopback, unsafe.Pointer(&vv), 4))
} }
func joinIPv6Group(fd int, ifi *net.Interface, grp net.IP) error { func joinIPv6Group(fd int, ifi *net.Interface, grp net.IP) error {
......
...@@ -8,49 +8,44 @@ package ipv6 ...@@ -8,49 +8,44 @@ package ipv6
import ( import (
"os" "os"
"syscall"
"unsafe" "unsafe"
) )
func ipv6ReceiveTrafficClass(fd int) (bool, error) { func ipv6ReceiveTrafficClass(fd int) (bool, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockoptReceiveTrafficClass)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockoptReceiveTrafficClass, unsafe.Pointer(&v), &l); err != nil {
return false, os.NewSyscallError("getsockopt", err) return false, os.NewSyscallError("getsockopt", err)
} }
return v == 1, nil return v == 1, nil
} }
func setIPv6ReceiveTrafficClass(fd int, v bool) error { func setIPv6ReceiveTrafficClass(fd int, v bool) error {
vv := int32(boolint(v)) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockoptReceiveTrafficClass, boolint(v)))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockoptReceiveTrafficClass, unsafe.Pointer(&vv), 4))
} }
func ipv6ReceiveHopLimit(fd int) (bool, error) { func ipv6ReceiveHopLimit(fd int) (bool, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockoptReceiveHopLimit)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockoptReceiveHopLimit, unsafe.Pointer(&v), &l); err != nil {
return false, os.NewSyscallError("getsockopt", err) return false, os.NewSyscallError("getsockopt", err)
} }
return v == 1, nil return v == 1, nil
} }
func setIPv6ReceiveHopLimit(fd int, v bool) error { func setIPv6ReceiveHopLimit(fd int, v bool) error {
vv := int32(boolint(v)) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockoptReceiveHopLimit, boolint(v)))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockoptReceiveHopLimit, unsafe.Pointer(&vv), 4))
} }
func ipv6ReceivePacketInfo(fd int) (bool, error) { func ipv6ReceivePacketInfo(fd int) (bool, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockoptReceivePacketInfo)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockoptReceivePacketInfo, unsafe.Pointer(&v), &l); err != nil {
return false, os.NewSyscallError("getsockopt", err) return false, os.NewSyscallError("getsockopt", err)
} }
return v == 1, nil return v == 1, nil
} }
func setIPv6ReceivePacketInfo(fd int, v bool) error { func setIPv6ReceivePacketInfo(fd int, v bool) error {
vv := int32(boolint(v)) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockoptReceivePacketInfo, boolint(v)))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockoptReceivePacketInfo, unsafe.Pointer(&vv), 4))
} }
func ipv6PathMTU(fd int) (int, error) { func ipv6PathMTU(fd int) (int, error) {
...@@ -63,17 +58,15 @@ func ipv6PathMTU(fd int) (int, error) { ...@@ -63,17 +58,15 @@ func ipv6PathMTU(fd int) (int, error) {
} }
func ipv6ReceivePathMTU(fd int) (bool, error) { func ipv6ReceivePathMTU(fd int) (bool, error) {
var v int32 v, err := syscall.GetsockoptInt(fd, ianaProtocolIPv6, sysSockoptReceivePathMTU)
l := sysSockoptLen(4) if err != nil {
if err := getsockopt(fd, ianaProtocolIPv6, sysSockoptReceivePathMTU, unsafe.Pointer(&v), &l); err != nil {
return false, os.NewSyscallError("getsockopt", err) return false, os.NewSyscallError("getsockopt", err)
} }
return v == 1, nil return v == 1, nil
} }
func setIPv6ReceivePathMTU(fd int, v bool) error { func setIPv6ReceivePathMTU(fd int, v bool) error {
vv := int32(boolint(v)) return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd, ianaProtocolIPv6, sysSockoptReceivePathMTU, boolint(v)))
return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockoptReceivePathMTU, unsafe.Pointer(&vv), 4))
} }
func ipv6ICMPFilter(fd int) (*ICMPFilter, error) { func ipv6ICMPFilter(fd int) (*ICMPFilter, error) {
......
...@@ -11,33 +11,22 @@ import ( ...@@ -11,33 +11,22 @@ import (
"syscall" "syscall"
) )
// RFC 3493 options
const (
// See /usr/include/netinet6/in6.h.
sysSockoptUnicastHopLimit = 0x4
sysSockoptMulticastHopLimit = 0xa
sysSockoptMulticastInterface = 0x9
sysSockoptMulticastLoopback = 0xb
sysSockoptJoinGroup = 0xc
sysSockoptLeaveGroup = 0xd
)
// RFC 3542 options // RFC 3542 options
const ( const (
// See /usr/include/netinet6/in6.h. // See /usr/include/netinet6/in6.h.
sysSockoptReceiveTrafficClass = 0x39 sysSockoptReceiveTrafficClass = syscall.IPV6_RECVTCLASS
sysSockoptTrafficClass = 0x3d sysSockoptTrafficClass = syscall.IPV6_TCLASS
sysSockoptReceiveHopLimit = 0x25 sysSockoptReceiveHopLimit = syscall.IPV6_RECVHOPLIMIT
sysSockoptHopLimit = 0x2f sysSockoptHopLimit = syscall.IPV6_HOPLIMIT
sysSockoptReceivePacketInfo = 0x24 sysSockoptReceivePacketInfo = syscall.IPV6_RECVPKTINFO
sysSockoptPacketInfo = 0x2e sysSockoptPacketInfo = syscall.IPV6_PKTINFO
sysSockoptReceivePathMTU = 0x2b sysSockoptReceivePathMTU = syscall.IPV6_RECVPATHMTU
sysSockoptPathMTU = 0x2c sysSockoptPathMTU = syscall.IPV6_PATHMTU
sysSockoptNextHop = 0x30 sysSockoptNextHop = syscall.IPV6_NEXTHOP
sysSockoptChecksum = 0x1a sysSockoptChecksum = syscall.IPV6_CHECKSUM
// See /usr/include/netinet6/in6.h. // See /usr/include/netinet6/in6.h.
sysSockoptICMPFilter = 0x12 sysSockoptICMPFilter = 0x12 // syscall.ICMP6_FILTER
) )
func setSockaddr(sa *syscall.RawSockaddrInet6, ip net.IP, ifindex int) { func setSockaddr(sa *syscall.RawSockaddrInet6, ip net.IP, ifindex int) {
......
...@@ -12,38 +12,27 @@ import ( ...@@ -12,38 +12,27 @@ import (
// RFC 2292 options // RFC 2292 options
const ( const (
// See /usr/include/netinet6/in6.h. // See /usr/include/netinet6/in6.h.
sysSockopt2292HopLimit = 0x14 sysSockopt2292HopLimit = syscall.IPV6_2292HOPLIMIT
sysSockopt2292PacketInfo = 0x13 sysSockopt2292PacketInfo = syscall.IPV6_2292PKTINFO
sysSockopt2292NextHop = 0x15 sysSockopt2292NextHop = syscall.IPV6_2292NEXTHOP
)
// RFC 3493 options
const (
// See /usr/include/netinet6/in6.h.
sysSockoptUnicastHopLimit = 0x4
sysSockoptMulticastHopLimit = 0xa
sysSockoptMulticastInterface = 0x9
sysSockoptMulticastLoopback = 0xb
sysSockoptJoinGroup = 0xc
sysSockoptLeaveGroup = 0xd
) )
// RFC 3542 options // RFC 3542 options
const ( const (
// See /usr/include/netinet6/in6.h. // See /usr/include/netinet6/in6.h.
sysSockoptReceiveTrafficClass = 0x23 sysSockoptReceiveTrafficClass = 0x23 // IPV6_RECVTCLASS
sysSockoptTrafficClass = 0x24 sysSockoptTrafficClass = 0x24 // IPV6_TCLASS
sysSockoptReceiveHopLimit = 0x25 sysSockoptReceiveHopLimit = 0x25 // IPV6_RECVHOPLIMIT
sysSockoptHopLimit = 0x2f sysSockoptHopLimit = 0x2f // IPV6_HOPLIMIT
sysSockoptReceivePacketInfo = 0x3d sysSockoptReceivePacketInfo = 0x3d // IPV6_RECVPKTINFO
sysSockoptPacketInfo = 0x2e sysSockoptPacketInfo = 0x2e // IPV6_PKTINFO
sysSockoptReceivePathMTU = 0x2b sysSockoptReceivePathMTU = 0x2b // IPV6_RECVPATHMTU
sysSockoptPathMTU = 0x2c sysSockoptPathMTU = 0x2c // IPV6_PATHMTU
sysSockoptNextHop = 0x30 sysSockoptNextHop = 0x30 // IPV6_NEXTHOP
sysSockoptChecksum = 0x1a sysSockoptChecksum = 0x1a // IPV6_CHECKSUM
// See /usr/include/netinet6/in6.h. // See /usr/include/netinet6/in6.h.
sysSockoptICMPFilter = 0x12 sysSockoptICMPFilter = 0x12 // ICMP6_FILTER
) )
func setSockaddr(sa *syscall.RawSockaddrInet6, ip net.IP, ifindex int) { func setSockaddr(sa *syscall.RawSockaddrInet6, ip net.IP, ifindex int) {
......
...@@ -9,33 +9,22 @@ import ( ...@@ -9,33 +9,22 @@ import (
"syscall" "syscall"
) )
// RFC 3493 options
const (
// See /usr/include/linux/in6.h.
sysSockoptUnicastHopLimit = 0x10
sysSockoptMulticastHopLimit = 0x12
sysSockoptMulticastInterface = 0x11
sysSockoptMulticastLoopback = 0x13
sysSockoptJoinGroup = 0x14
sysSockoptLeaveGroup = 0x15
)
// RFC 3542 options // RFC 3542 options
const ( const (
// See /usr/include/linux/ipv6.h,in6.h. // See /usr/include/linux/ipv6.h,in6.h.
sysSockoptReceiveTrafficClass = 0x42 sysSockoptReceiveTrafficClass = syscall.IPV6_RECVTCLASS
sysSockoptTrafficClass = 0x43 sysSockoptTrafficClass = syscall.IPV6_TCLASS
sysSockoptReceiveHopLimit = 0x33 sysSockoptReceiveHopLimit = syscall.IPV6_RECVHOPLIMIT
sysSockoptHopLimit = 0x34 sysSockoptHopLimit = syscall.IPV6_HOPLIMIT
sysSockoptReceivePacketInfo = 0x31 sysSockoptReceivePacketInfo = syscall.IPV6_RECVPKTINFO
sysSockoptPacketInfo = 0x32 sysSockoptPacketInfo = syscall.IPV6_PKTINFO
sysSockoptReceivePathMTU = 0x3c sysSockoptReceivePathMTU = 0x3c // IPV6_RECVPATHMTU
sysSockoptPathMTU = 0x3d sysSockoptPathMTU = 0x3d // IPV6_PATHMTU
sysSockoptNextHop = 0x9 sysSockoptNextHop = syscall.IPV6_NEXTHOP
sysSockoptChecksum = 0x7 sysSockoptChecksum = syscall.IPV6_CHECKSUM
// See /usr/include/linux/icmpv6.h. // See /usr/include/linux/icmpv6.h.
sysSockoptICMPFilter = 0x1 sysSockoptICMPFilter = 0x1 // syscall.ICMPV6_FILTER
) )
func setSockaddr(sa *syscall.RawSockaddrInet6, ip net.IP, ifindex int) { func setSockaddr(sa *syscall.RawSockaddrInet6, ip net.IP, ifindex int) {
......
...@@ -8,6 +8,16 @@ package ipv6 ...@@ -8,6 +8,16 @@ package ipv6
import "syscall" import "syscall"
// RFC 3493 options
const (
sysSockoptUnicastHopLimit = syscall.IPV6_UNICAST_HOPS
sysSockoptMulticastHopLimit = syscall.IPV6_MULTICAST_HOPS
sysSockoptMulticastInterface = syscall.IPV6_MULTICAST_IF
sysSockoptMulticastLoopback = syscall.IPV6_MULTICAST_LOOP
sysSockoptJoinGroup = syscall.IPV6_JOIN_GROUP
sysSockoptLeaveGroup = syscall.IPV6_LEAVE_GROUP
)
const sysSizeofMTUInfo = 0x20 const sysSizeofMTUInfo = 0x20
type sysMTUInfo struct { type sysMTUInfo struct {
......
...@@ -12,18 +12,18 @@ import ( ...@@ -12,18 +12,18 @@ import (
// RFC 3493 options // RFC 3493 options
const ( const (
// See ws2tcpip.h. // See ws2tcpip.h.
sysSockoptUnicastHopLimit = 0x4 sysSockoptUnicastHopLimit = syscall.IPV6_UNICAST_HOPS
sysSockoptMulticastHopLimit = 0xa sysSockoptMulticastHopLimit = syscall.IPV6_MULTICAST_HOPS
sysSockoptMulticastInterface = 0x9 sysSockoptMulticastInterface = syscall.IPV6_MULTICAST_IF
sysSockoptMulticastLoopback = 0xb sysSockoptMulticastLoopback = syscall.IPV6_MULTICAST_LOOP
sysSockoptJoinGroup = 0xc sysSockoptJoinGroup = syscall.IPV6_JOIN_GROUP
sysSockoptLeaveGroup = 0xd sysSockoptLeaveGroup = syscall.IPV6_LEAVE_GROUP
) )
// RFC 3542 options // RFC 3542 options
const ( const (
// See ws2tcpip.h. // See ws2tcpip.h.
sysSockoptPacketInfo = 0x13 sysSockoptPacketInfo = 0x13 // IPV6_PKTINFO
) )
func setSockaddr(sa *syscall.RawSockaddrInet6, ip net.IP, ifindex int) { func setSockaddr(sa *syscall.RawSockaddrInet6, ip net.IP, ifindex int) {
......
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