summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2014-03-28 11:04:48 +0100
committerJakob Borg <jakob@nym.se>2014-03-28 11:04:48 +0100
commit3700eb1e61166eb9f95d1a2a6c7d606be5cbb614 (patch)
tree091e29eae03607876058a319dbd478d1d99e8d90
parent17a21102b34cab69216d7c7dedf76511bc082dfe (diff)
Use IPv4 multicast discoveryv0.6
-rw-r--r--Godeps/Godeps.json7
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control.go83
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc2292_unix.go151
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_stub.go27
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_unix.go210
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_windows.go27
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/dgramopt_posix.go178
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/dgramopt_stub.go95
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/doc.go193
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/endpoint.go119
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/gen.go241
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/genericopt_posix.go60
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/genericopt_stub.go34
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/gentest.go195
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/helper.go33
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/helper_stub.go22
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/helper_unix.go46
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/helper_windows.go45
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/iana.go224
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/iana_test.go38
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/icmp.go47
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/icmp_bsd.go33
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/icmp_linux.go31
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/icmp_stub.go24
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/icmp_test.go102
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/icmp_windows.go22
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/mockicmp_test.go130
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/mocktransponder_test.go88
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/multicast_test.go205
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/multicastlistener_test.go243
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/multicastsockopt_test.go76
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/payload.go15
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/payload_cmsg.go70
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/payload_noncmsg.go41
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/readwrite_test.go168
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sockopt_rfc2292_unix.go73
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sockopt_rfc3493_bsd.go20
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sockopt_rfc3493_linux.go18
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sockopt_rfc3493_unix.go124
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sockopt_rfc3493_windows.go116
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sockopt_rfc3542_stub.go12
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sockopt_rfc3542_unix.go90
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sockopt_rfc3542_windows.go62
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sockopt_test.go136
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sys.go23
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sys_bsd.go48
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sys_darwin.go54
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sys_linux.go45
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sys_unix.go16
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/sys_windows.go33
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/syscall_linux_386.go42
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/syscall_linux_386.s56
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/syscall_nosplit4_linux_386.go15
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/syscall_nosplit7_linux_386.go15
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/syscall_unix.go26
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/unicast_test.go172
-rw-r--r--Godeps/_workspace/src/code.google.com/p/go.net/ipv6/unicastsockopt_test.go101
-rw-r--r--discover/discover.go95
-rw-r--r--mc/beacon.go91
-rw-r--r--mc/debug.go12
60 files changed, 120 insertions, 4698 deletions
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index a8e9902b6..fdb729751 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -1,16 +1,11 @@
{
"ImportPath": "github.com/calmh/syncthing",
- "GoVersion": "devel +3ca54dd30864 Sat Mar 22 11:05:40 2014 -0700",
+ "GoVersion": "go1.2.1",
"Packages": [
"./cmd/syncthing"
],
"Deps": [
{
- "ImportPath": "code.google.com/p/go.net/ipv6",
- "Comment": "null-117",
- "Rev": "c17ad62118ea511e1051721b429779fa40bddc74"
- },
- {
"ImportPath": "code.google.com/p/go.text/transform",
"Comment": "null-81",
"Rev": "9cbe983aed9b0dfc73954433fead5e00866342ac"
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control.go b/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control.go
deleted file mode 100644
index e2101903b..000000000
--- a/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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 (
- "errors"
- "fmt"
- "net"
- "sync"
-)
-
-var (
- errMissingAddress = errors.New("missing address")
- errInvalidConnType = errors.New("invalid conn type")
- errNoSuchInterface = errors.New("no such interface")
-)
-
-// References:
-//
-// RFC 2292 Advanced Sockets API for IPv6
-// http://tools.ietf.org/html/rfc2292
-// RFC 2460 Internet Protocol, Version 6 (IPv6) Specification
-// http://tools.ietf.org/html/rfc2460
-// RFC 3493 Basic Socket Interface Extensions for IPv6
-// http://tools.ietf.org/html/rfc3493.html
-// RFC 3542 Advanced Sockets Application Program Interface (API) for IPv6
-// http://tools.ietf.org/html/rfc3542
-//
-// Note that RFC 3542 obsoltes RFC 2292 but OS X Snow Leopard and the
-// former still support RFC 2292 only. Please be aware that almost
-// all protocol implementations prohibit using a combination of RFC
-// 2292 and RFC 3542 for some practical reasons.
-
-type rawOpt struct {
- sync.Mutex
- cflags ControlFlags
-}
-
-func (c *rawOpt) set(f ControlFlags) { c.cflags |= f }
-func (c *rawOpt) clear(f ControlFlags) { c.cflags &^= f }
-func (c *rawOpt) isset(f ControlFlags) bool { return c.cflags&f != 0 }
-
-// A ControlFlags reprensents per packet basis IP-level socket option
-// control flags.
-type ControlFlags uint
-
-const (
- FlagTrafficClass ControlFlags = 1 << iota // pass the traffic class on the received packet
- FlagHopLimit // pass the hop limit on the received packet
- FlagSrc // pass the source address on the received packet
- FlagDst // pass the destination address on the received packet
- FlagInterface // pass the interface index on the received packet
- FlagPathMTU // pass the path MTU on the received packet path
-)
-
-// A ControlMessage represents per packet basis IP-level socket
-// options.
-type ControlMessage struct {
- // Receiving socket options: SetControlMessage allows to
- // receive the options from the protocol stack using ReadFrom
- // method of PacketConn.
- //
- // Specifying socket options: ControlMessage for WriteTo
- // method of PacketConn allows to send the options to the
- // protocol stack.
- //
- TrafficClass int // traffic class, must be 1 <= value <= 255 when specifying
- HopLimit int // hop limit, must be 1 <= value <= 255 when specifying
- Src net.IP // source address, specifying only
- Dst net.IP // destination address, receiving only
- IfIndex int // interface index, must be 1 <= value when specifying
- NextHop net.IP // next hop address, specifying only
- MTU int // path MTU, receiving only
-}
-
-func (cm *ControlMessage) String() string {
- if cm == nil {
- return "<nil>"
- }
- return fmt.Sprintf("tclass: %#x, hoplim: %v, src: %v, dst: %v, ifindex: %v, nexthop: %v, mtu: %v", cm.TrafficClass, cm.HopLimit, cm.Src, cm.Dst, cm.IfIndex, cm.NextHop, cm.MTU)
-}
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc2292_unix.go b/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc2292_unix.go
deleted file mode 100644
index 47196c58f..000000000
--- a/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc2292_unix.go
+++ /dev/null
@@ -1,151 +0,0 @@
-// 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.
-
-// +build darwin
-
-package ipv6
-
-import (
- "net"
- "os"
- "syscall"
- "unsafe"
-)
-
-const pktinfo = FlagDst | FlagInterface
-
-func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
- opt.Lock()
- defer opt.Unlock()
- if cf&FlagHopLimit != 0 {
- if err := setIPv6ReceiveHopLimit(fd, on); err != nil {
- return err
- }
- if on {
- opt.set(FlagHopLimit)
- } else {
- opt.clear(FlagHopLimit)
- }
- }
- if cf&pktinfo != 0 {
- if err := setIPv6ReceivePacketInfo(fd, on); err != nil {
- return err
- }
- if on {
- opt.set(cf & pktinfo)
- } else {
- opt.clear(cf & pktinfo)
- }
- }
- return nil
-}
-
-func newControlMessage(opt *rawOpt) (oob []byte) {
- opt.Lock()
- defer opt.Unlock()
- l, off := 0, 0
- if opt.isset(FlagHopLimit) {
- l += syscall.CmsgSpace(4)
- }
- if opt.isset(pktinfo) {
- l += syscall.CmsgSpace(sysSizeofPacketInfo)
- }
- if l > 0 {
- oob = make([]byte, l)
- if opt.isset(FlagHopLimit) {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockopt2292HopLimit
- m.SetLen(syscall.CmsgLen(4))
- off += syscall.CmsgSpace(4)
- }
- if opt.isset(pktinfo) {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockopt2292PacketInfo
- m.SetLen(syscall.CmsgLen(sysSizeofPacketInfo))
- off += syscall.CmsgSpace(sysSizeofPacketInfo)
- }
- }
- return
-}
-
-func parseControlMessage(b []byte) (*ControlMessage, error) {
- if len(b) == 0 {
- return nil, nil
- }
- cmsgs, err := syscall.ParseSocketControlMessage(b)
- if err != nil {
- return nil, os.NewSyscallError("parse socket control message", err)
- }
- cm := &ControlMessage{}
- for _, m := range cmsgs {
- if m.Header.Level != ianaProtocolIPv6 {
- continue
- }
- switch m.Header.Type {
- case sysSockopt2292HopLimit:
- cm.HopLimit = int(*(*byte)(unsafe.Pointer(&m.Data[:1][0])))
- case sysSockopt2292PacketInfo:
- pi := (*sysPacketInfo)(unsafe.Pointer(&m.Data[0]))
- cm.IfIndex = int(pi.IfIndex)
- cm.Dst = pi.IP[:]
- }
- }
- return cm, nil
-}
-
-func marshalControlMessage(cm *ControlMessage) (oob []byte) {
- if cm == nil {
- return
- }
- l, off := 0, 0
- if cm.HopLimit > 0 {
- l += syscall.CmsgSpace(4)
- }
- pion := false
- if cm.Src.To4() == nil && cm.Src.To16() != nil || cm.IfIndex != 0 {
- pion = true
- l += syscall.CmsgSpace(sysSizeofPacketInfo)
- }
- if len(cm.NextHop) == net.IPv6len {
- l += syscall.CmsgSpace(syscall.SizeofSockaddrInet6)
- }
- if l > 0 {
- oob = make([]byte, l)
- if cm.HopLimit > 0 {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockopt2292HopLimit
- m.SetLen(syscall.CmsgLen(4))
- data := oob[off+syscall.CmsgLen(0):]
- *(*byte)(unsafe.Pointer(&data[:1][0])) = byte(cm.HopLimit)
- off += syscall.CmsgSpace(4)
- }
- if pion {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockopt2292PacketInfo
- m.SetLen(syscall.CmsgLen(sysSizeofPacketInfo))
- pi := (*sysPacketInfo)(unsafe.Pointer(&oob[off+syscall.CmsgLen(0)]))
- if ip := cm.Src.To16(); ip != nil && ip.To4() == nil {
- copy(pi.IP[:], ip)
- }
- if cm.IfIndex != 0 {
- pi.IfIndex = uint32(cm.IfIndex)
- }
- off += syscall.CmsgSpace(sysSizeofPacketInfo)
- }
- if len(cm.NextHop) == net.IPv6len {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockopt2292NextHop
- m.SetLen(syscall.CmsgLen(syscall.SizeofSockaddrInet6))
- sa := (*syscall.RawSockaddrInet6)(unsafe.Pointer(&oob[off+syscall.CmsgLen(0)]))
- setSockaddr(sa, cm.NextHop, cm.IfIndex)
- off += syscall.CmsgSpace(syscall.SizeofSockaddrInet6)
- }
- }
- return
-}
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_stub.go b/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_stub.go
deleted file mode 100644
index 4419bf518..000000000
--- a/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_stub.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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.
-
-// +build dragonfly plan9 solaris
-
-package ipv6
-
-func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
- // TODO(mikio): Implement this
- return errOpNoSupport
-}
-
-func newControlMessage(opt *rawOpt) (oob []byte) {
- // TODO(mikio): Implement this
- return nil
-}
-
-func parseControlMessage(b []byte) (*ControlMessage, error) {
- // TODO(mikio): Implement this
- return nil, errOpNoSupport
-}
-
-func marshalControlMessage(cm *ControlMessage) (oob []byte) {
- // TODO(mikio): Implement this
- return nil
-}
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_unix.go b/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_unix.go
deleted file mode 100644
index 882a77be3..000000000
--- a/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_unix.go
+++ /dev/null
@@ -1,210 +0,0 @@
-// 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.
-
-// +build freebsd linux netbsd openbsd
-
-package ipv6
-
-import (
- "net"
- "os"
- "syscall"
- "unsafe"
-)
-
-const pktinfo = FlagDst | FlagInterface
-
-func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
- opt.Lock()
- defer opt.Unlock()
- if cf&FlagTrafficClass != 0 {
- if err := setIPv6ReceiveTrafficClass(fd, on); err != nil {
- return err
- }
- if on {
- opt.set(FlagTrafficClass)
- } else {
- opt.clear(FlagTrafficClass)
- }
- }
- if cf&FlagHopLimit != 0 {
- if err := setIPv6ReceiveHopLimit(fd, on); err != nil {
- return err
- }
- if on {
- opt.set(FlagHopLimit)
- } else {
- opt.clear(FlagHopLimit)
- }
- }
- if cf&pktinfo != 0 {
- if err := setIPv6ReceivePacketInfo(fd, on); err != nil {
- return err
- }
- if on {
- opt.set(cf & pktinfo)
- } else {
- opt.clear(cf & pktinfo)
- }
- }
- if cf&FlagPathMTU != 0 {
- if err := setIPv6ReceivePathMTU(fd, on); err != nil {
- return err
- }
- if on {
- opt.set(FlagPathMTU)
- } else {
- opt.clear(FlagPathMTU)
- }
- }
- return nil
-}
-
-func newControlMessage(opt *rawOpt) (oob []byte) {
- opt.Lock()
- defer opt.Unlock()
- l, off := 0, 0
- if opt.isset(FlagTrafficClass) {
- l += syscall.CmsgSpace(4)
- }
- if opt.isset(FlagHopLimit) {
- l += syscall.CmsgSpace(4)
- }
- if opt.isset(pktinfo) {
- l += syscall.CmsgSpace(sysSizeofPacketInfo)
- }
- if opt.isset(FlagPathMTU) {
- l += syscall.CmsgSpace(sysSizeofMTUInfo)
- }
- if l > 0 {
- oob = make([]byte, l)
- if opt.isset(FlagTrafficClass) {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockoptReceiveTrafficClass
- m.SetLen(syscall.CmsgLen(4))
- off += syscall.CmsgSpace(4)
- }
- if opt.isset(FlagHopLimit) {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockoptReceiveHopLimit
- m.SetLen(syscall.CmsgLen(4))
- off += syscall.CmsgSpace(4)
- }
- if opt.isset(pktinfo) {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockoptReceivePacketInfo
- m.SetLen(syscall.CmsgLen(sysSizeofPacketInfo))
- off += syscall.CmsgSpace(sysSizeofPacketInfo)
- }
- if opt.isset(FlagPathMTU) {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockoptReceivePathMTU
- m.SetLen(syscall.CmsgLen(sysSizeofMTUInfo))
- off += syscall.CmsgSpace(sysSizeofMTUInfo)
- }
- }
- return
-}
-
-func parseControlMessage(b []byte) (*ControlMessage, error) {
- if len(b) == 0 {
- return nil, nil
- }
- cmsgs, err := syscall.ParseSocketControlMessage(b)
- if err != nil {
- return nil, os.NewSyscallError("parse socket control message", err)
- }
- cm := &ControlMessage{}
- for _, m := range cmsgs {
- if m.Header.Level != ianaProtocolIPv6 {
- continue
- }
- switch m.Header.Type {
- case sysSockoptTrafficClass:
- cm.TrafficClass = int(*(*byte)(unsafe.Pointer(&m.Data[:1][0])))
- case sysSockoptHopLimit:
- cm.HopLimit = int(*(*byte)(unsafe.Pointer(&m.Data[:1][0])))
- case sysSockoptPacketInfo:
- pi := (*sysPacketInfo)(unsafe.Pointer(&m.Data[0]))
- cm.Dst = pi.IP[:]
- cm.IfIndex = int(pi.IfIndex)
- case sysSockoptPathMTU:
- mi := (*sysMTUInfo)(unsafe.Pointer(&m.Data[0]))
- cm.Dst = mi.Addr.Addr[:]
- cm.IfIndex = int(mi.Addr.Scope_id)
- cm.MTU = int(mi.MTU)
- }
- }
- return cm, nil
-}
-
-func marshalControlMessage(cm *ControlMessage) (oob []byte) {
- if cm == nil {
- return
- }
- l, off := 0, 0
- if cm.TrafficClass > 0 {
- l += syscall.CmsgSpace(4)
- }
- if cm.HopLimit > 0 {
- l += syscall.CmsgSpace(4)
- }
- pion := false
- if cm.Src.To4() == nil && cm.Src.To16() != nil || cm.IfIndex != 0 {
- pion = true
- l += syscall.CmsgSpace(sysSizeofPacketInfo)
- }
- if len(cm.NextHop) == net.IPv6len {
- l += syscall.CmsgSpace(syscall.SizeofSockaddrInet6)
- }
- if l > 0 {
- oob = make([]byte, l)
- if cm.TrafficClass > 0 {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockoptTrafficClass
- m.SetLen(syscall.CmsgLen(4))
- data := oob[off+syscall.CmsgLen(0):]
- *(*byte)(unsafe.Pointer(&data[:1][0])) = byte(cm.TrafficClass)
- off += syscall.CmsgSpace(4)
- }
- if cm.HopLimit > 0 {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockoptHopLimit
- m.SetLen(syscall.CmsgLen(4))
- data := oob[off+syscall.CmsgLen(0):]
- *(*byte)(unsafe.Pointer(&data[:1][0])) = byte(cm.HopLimit)
- off += syscall.CmsgSpace(4)
- }
- if pion {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockoptPacketInfo
- m.SetLen(syscall.CmsgLen(sysSizeofPacketInfo))
- pi := (*sysPacketInfo)(unsafe.Pointer(&oob[off+syscall.CmsgLen(0)]))
- if ip := cm.Src.To16(); ip != nil && ip.To4() == nil {
- copy(pi.IP[:], ip)
- }
- if cm.IfIndex != 0 {
- pi.IfIndex = uint32(cm.IfIndex)
- }
- off += syscall.CmsgSpace(sysSizeofPacketInfo)
- }
- if len(cm.NextHop) == net.IPv6len {
- m := (*syscall.Cmsghdr)(unsafe.Pointer(&oob[off]))
- m.Level = ianaProtocolIPv6
- m.Type = sysSockoptNextHop
- m.SetLen(syscall.CmsgLen(syscall.SizeofSockaddrInet6))
- sa := (*syscall.RawSockaddrInet6)(unsafe.Pointer(&oob[off+syscall.CmsgLen(0)]))
- setSockaddr(sa, cm.NextHop, cm.IfIndex)
- off += syscall.CmsgSpace(syscall.SizeofSockaddrInet6)
- }
- }
- return
-}
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_windows.go b/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_windows.go
deleted file mode 100644
index b4d53fb65..000000000
--- a/Godeps/_workspace/src/code.google.com/p/go.net/ipv6/control_rfc3542_windows.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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 "syscall"
-
-func setControlMessage(fd syscall.Handle, opt *rawOpt, cf ControlFlags, on bool) error {
- // TODO(mikio): Implement this
- return syscall.EWINDOWS
-}
-
-func newControlMessage(opt *rawOpt) (oob []byte) {