-
Notifications
You must be signed in to change notification settings - Fork 0
/
sys_linux.go
34 lines (29 loc) · 1.06 KB
/
sys_linux.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ipv6
import (
"net"
"syscall"
)
// RFC 3542 options
const (
// See /usr/include/linux/ipv6.h,in6.h.
sysSockoptReceiveTrafficClass = syscall.IPV6_RECVTCLASS
sysSockoptTrafficClass = syscall.IPV6_TCLASS
sysSockoptReceiveHopLimit = syscall.IPV6_RECVHOPLIMIT
sysSockoptHopLimit = syscall.IPV6_HOPLIMIT
sysSockoptReceivePacketInfo = syscall.IPV6_RECVPKTINFO
sysSockoptPacketInfo = syscall.IPV6_PKTINFO
sysSockoptReceivePathMTU = 0x3c // IPV6_RECVPATHMTU
sysSockoptPathMTU = 0x3d // IPV6_PATHMTU
sysSockoptNextHop = syscall.IPV6_NEXTHOP
sysSockoptChecksum = syscall.IPV6_CHECKSUM
// See /usr/include/linux/icmpv6.h.
sysSockoptICMPFilter = 0x1 // syscall.ICMPV6_FILTER
)
func setSockaddr(sa *syscall.RawSockaddrInet6, ip net.IP, ifindex int) {
sa.Family = syscall.AF_INET6
copy(sa.Addr[:], ip)
sa.Scope_id = uint32(ifindex)
}