blob: 4a08217fee6a978a841875d6e4cb96b6a8f748ea [file] [log] [blame]
Mikio Harad3003be2013-11-05 10:09:42 +09001// Copyright 2013 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build freebsd netbsd openbsd
6
7package ipv6
8
9import (
10 "net"
11 "syscall"
12)
13
14// RFC 3493 options
15const (
16 // See /usr/include/netinet6/in6.h.
17 sysSockoptUnicastHopLimit = 0x4
18 sysSockoptMulticastHopLimit = 0xa
19 sysSockoptMulticastInterface = 0x9
20 sysSockoptMulticastLoopback = 0xb
21 sysSockoptJoinGroup = 0xc
22 sysSockoptLeaveGroup = 0xd
23)
24
25// RFC 3542 options
26const (
27 // See /usr/include/netinet6/in6.h.
28 sysSockoptReceiveTrafficClass = 0x39
29 sysSockoptTrafficClass = 0x3d
30 sysSockoptReceiveHopLimit = 0x25
31 sysSockoptHopLimit = 0x2f
32 sysSockoptReceivePacketInfo = 0x24
33 sysSockoptPacketInfo = 0x2e
34 sysSockoptReceivePathMTU = 0x2b
35 sysSockoptPathMTU = 0x2c
36 sysSockoptNextHop = 0x30
37 sysSockoptChecksum = 0x1a
38
39 // See /usr/include/netinet6/in6.h.
40 sysSockoptICMPFilter = 0x12
41)
42
43func setSockaddr(sa *syscall.RawSockaddrInet6, ip net.IP, ifindex int) {
44 sa.Len = syscall.SizeofSockaddrInet6
45 sa.Family = syscall.AF_INET6
46 copy(sa.Addr[:], ip)
47 sa.Scope_id = uint32(ifindex)
48}