Skip to content

Commit ef6c21d

Browse files
committed
syscall, net: clean up socket stub for solaris
Solaris doesn't have struct ip_mreqn, instead it uses struct ip_mreq and struct group_req with struct sockaddr_storage. Also fixes incorrect SockaddrDatalink. Update #7399 LGTM=aram, iant R=golang-codereviews, aram, gobot, iant CC=golang-codereviews https://golang.org/cl/73920043
1 parent 42da29f commit ef6c21d

File tree

4 files changed

+43
-26
lines changed

4 files changed

+43
-26
lines changed

src/pkg/net/sockoptip_bsd.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 nacl netbsd openbsd solaris
5+
// +build darwin dragonfly freebsd nacl netbsd openbsd
66

77
package net
88

src/pkg/net/sockoptip_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 nacl netbsd openbsd solaris windows
5+
// +build darwin dragonfly freebsd linux nacl netbsd openbsd windows
66

77
package net
88

src/pkg/net/sockoptip_stub.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2011 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 solaris
6+
7+
package net
8+
9+
import "syscall"
10+
11+
func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error {
12+
// See golang.org/issue/7399.
13+
return syscall.EINVAL
14+
}
15+
16+
func setIPv4MulticastLoopback(fd *netFD, v bool) error {
17+
// See golang.org/issue/7399.
18+
return syscall.EINVAL
19+
}
20+
21+
func joinIPv4Group(fd *netFD, ifi *Interface, ip IP) error {
22+
// See golang.org/issue/7399.
23+
return syscall.EINVAL
24+
}
25+
26+
func setIPv6MulticastInterface(fd *netFD, ifi *Interface) error {
27+
// See golang.org/issue/7399.
28+
return syscall.EINVAL
29+
}
30+
31+
func setIPv6MulticastLoopback(fd *netFD, v bool) error {
32+
// See golang.org/issue/7399.
33+
return syscall.EINVAL
34+
}
35+
36+
func joinIPv6Group(fd *netFD, ifi *Interface, ip IP) error {
37+
// See golang.org/issue/7399.
38+
return syscall.EINVAL
39+
}

src/pkg/syscall/syscall_solaris.go

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ package syscall
1515
import "unsafe"
1616

1717
type SockaddrDatalink struct {
18-
Len uint8
19-
Family uint8
18+
Family uint16
2019
Index uint16
2120
Type uint8
2221
Nlen uint8
2322
Alen uint8
2423
Slen uint8
25-
Data [46]int8
24+
Data [244]int8
2625
raw RawSockaddrDatalink
2726
}
2827

@@ -77,12 +76,6 @@ func Pipe(p []int) (err error) {
7776
return
7877
}
7978

80-
type IPMreqn struct {
81-
Multiaddr [4]byte /* in_addr */
82-
Address [4]byte /* in_addr */
83-
Ifindex int32
84-
}
85-
8679
func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
8780
if sa.Port < 0 || sa.Port > 0xFFFF {
8881
return nil, 0, EINVAL
@@ -145,21 +138,6 @@ func Getsockname(fd int) (sa Sockaddr, err error) {
145138
return anyToSockaddr(&rsa)
146139
}
147140

148-
func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, err error) {
149-
vallen := _Socklen(4)
150-
err = getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
151-
return value, err
152-
}
153-
154-
func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
155-
// TODO(dfc)
156-
return nil, EINVAL
157-
}
158-
159-
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
160-
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
161-
}
162-
163141
// The const provides a compile-time constant so clients
164142
// can adjust to whether there is a working Getwd and avoid
165143
// even linking this function into the binary. See ../os/getwd.go.

0 commit comments

Comments
 (0)