Skip to content

Commit 6250b41

Browse files
committed
ipv6: deduplicate socket option code
Change-Id: I836cdf68901dc77bc4c086cabd9d43fd033fbf1d Reviewed-on: https://go-review.googlesource.com/27736 Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Mikio Hara <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent b398290 commit 6250b41

File tree

7 files changed

+32
-114
lines changed

7 files changed

+32
-114
lines changed

ipv6/icmp_windows.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
package ipv6
66

7-
type sysICMPv6Filter struct {
8-
// TODO(mikio): implement this
9-
}
10-
117
func (f *sysICMPv6Filter) accept(typ ICMPType) {
128
// TODO(mikio): implement this
139
}

ipv6/sockopt_asmreq_unix.go renamed to ipv6/sockopt_asmreq_posix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build darwin dragonfly freebsd linux netbsd openbsd
5+
// +build darwin dragonfly freebsd linux netbsd openbsd windows
66

77
package ipv6
88

ipv6/sockopt_asmreq_windows.go

Lines changed: 0 additions & 21 deletions
This file was deleted.

ipv6/sockopt_unix.go renamed to ipv6/sockopt_posix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build darwin dragonfly freebsd linux netbsd openbsd
5+
// +build darwin dragonfly freebsd linux netbsd openbsd windows
66

77
package ipv6
88

ipv6/sockopt_windows.go

Lines changed: 0 additions & 86 deletions
This file was deleted.

ipv6/sys_windows.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ const (
2323

2424
sysSizeofSockaddrInet6 = 0x1c
2525

26-
sysSizeofIPv6Mreq = 0x14
26+
sysSizeofIPv6Mreq = 0x14
27+
sysSizeofIPv6Mtuinfo = 0x20
28+
sysSizeofICMPv6Filter = 0
2729
)
2830

2931
type sysSockaddrInet6 struct {
@@ -39,6 +41,15 @@ type sysIPv6Mreq struct {
3941
Interface uint32
4042
}
4143

44+
type sysIPv6Mtuinfo struct {
45+
Addr sysSockaddrInet6
46+
Mtu uint32
47+
}
48+
49+
type sysICMPv6Filter struct {
50+
// TODO(mikio): implement this
51+
}
52+
4253
var (
4354
ctlOpts = [ctlMax]ctlOpt{}
4455

ipv6/syscall_windows.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2016 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+
package ipv6
6+
7+
import (
8+
"syscall"
9+
"unsafe"
10+
)
11+
12+
func getsockopt(s uintptr, level, name int, v unsafe.Pointer, l *uint32) error {
13+
return syscall.Getsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(v), (*int32)(unsafe.Pointer(l)))
14+
}
15+
16+
func setsockopt(s uintptr, level, name int, v unsafe.Pointer, l uint32) error {
17+
return syscall.Setsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(v), int32(l))
18+
}

0 commit comments

Comments
 (0)