Commit 37db164d authored by Mikio Hara's avatar Mikio Hara

ipv4: remove unnecessary sysSockoptLen type

Change-Id: I367d38bca99ede07aa0cf697547c5cb43ce4e164
Reviewed-on: https://go-review.googlesource.com/21353Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 31df19d6
......@@ -24,7 +24,7 @@ func setsockoptIPMreq(fd, name int, ifi *net.Interface, grp net.IP) error {
func getsockoptInterface(fd, name int) (*net.Interface, error) {
var b [4]byte
l := sysSockoptLen(4)
l := uint32(4)
if err := getsockopt(fd, iana.ProtocolIP, name, unsafe.Pointer(&b[0]), &l); err != nil {
return nil, os.NewSyscallError("getsockopt", err)
}
......@@ -42,5 +42,5 @@ func setsockoptInterface(fd, name int, ifi *net.Interface) error {
}
var b [4]byte
copy(b[:], ip)
return os.NewSyscallError("setsockopt", setsockopt(fd, iana.ProtocolIP, name, unsafe.Pointer(&b[0]), sysSockoptLen(4)))
return os.NewSyscallError("setsockopt", setsockopt(fd, iana.ProtocolIP, name, unsafe.Pointer(&b[0]), uint32(4)))
}
......@@ -16,7 +16,7 @@ import (
func getsockoptIPMreqn(fd, name int) (*net.Interface, error) {
var mreqn sysIPMreqn
l := sysSockoptLen(sysSizeofIPMreqn)
l := uint32(sysSizeofIPMreqn)
if err := getsockopt(fd, iana.ProtocolIP, name, unsafe.Pointer(&mreqn), &l); err != nil {
return nil, os.NewSyscallError("getsockopt", err)
}
......
......@@ -23,7 +23,7 @@ func setsockoptGroupReq(fd, name int, ifi *net.Interface, grp net.IP) error {
}
gr.setGroup(grp)
var p unsafe.Pointer
var l sysSockoptLen
var l uint32
if freebsd32o64 {
var d [sysSizeofGroupReq + 4]byte
s := (*[sysSizeofGroupReq]byte)(unsafe.Pointer(&gr))
......@@ -45,7 +45,7 @@ func setsockoptGroupSourceReq(fd, name int, ifi *net.Interface, grp, src net.IP)
}
gsr.setSourceGroup(grp, src)
var p unsafe.Pointer
var l sysSockoptLen
var l uint32
if freebsd32o64 {
var d [sysSizeofGroupSourceReq + 4]byte
s := (*[sysSizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr))
......
......@@ -21,10 +21,10 @@ func getInt(fd int, opt *sockOpt) (int, error) {
var i int32
var b byte
p := unsafe.Pointer(&i)
l := sysSockoptLen(4)
l := uint32(4)
if opt.typ == ssoTypeByte {
p = unsafe.Pointer(&b)
l = sysSockoptLen(1)
l = 1
}
if err := getsockopt(fd, iana.ProtocolIP, opt.name, p, &l); err != nil {
return 0, os.NewSyscallError("getsockopt", err)
......@@ -42,11 +42,11 @@ func setInt(fd int, opt *sockOpt, v int) error {
i := int32(v)
var b byte
p := unsafe.Pointer(&i)
l := sysSockoptLen(4)
l := uint32(4)
if opt.typ == ssoTypeByte {
b = byte(v)
p = unsafe.Pointer(&b)
l = sysSockoptLen(1)
l = 1
}
return os.NewSyscallError("setsockopt", setsockopt(fd, iana.ProtocolIP, opt.name, p, l))
}
......@@ -84,7 +84,7 @@ func getICMPFilter(fd int, opt *sockOpt) (*ICMPFilter, error) {
return nil, errOpNoSupport
}
var f ICMPFilter
l := sysSockoptLen(sysSizeofICMPFilter)
l := uint32(sysSizeofICMPFilter)
if err := getsockopt(fd, iana.ProtocolReserved, opt.name, unsafe.Pointer(&f.sysICMPFilter), &l); err != nil {
return nil, os.NewSyscallError("getsockopt", err)
}
......
......@@ -11,8 +11,6 @@ import (
"syscall"
)
type sysSockoptLen int32
var (
ctlOpts = [ctlMax]ctlOpt{
ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL},
......
......@@ -10,8 +10,6 @@ import (
"unsafe"
)
type sysSockoptLen int32
var (
ctlOpts = [ctlMax]ctlOpt{
ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL},
......
......@@ -12,8 +12,6 @@ import (
"unsafe"
)
type sysSockoptLen int32
var (
ctlOpts = [ctlMax]ctlOpt{
ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL},
......
......@@ -10,8 +10,6 @@ import (
"unsafe"
)
type sysSockoptLen int32
var (
ctlOpts = [ctlMax]ctlOpt{
ctlTTL: {sysIP_TTL, 1, marshalTTL, parseTTL},
......
......@@ -9,8 +9,6 @@ import (
"syscall"
)
type sysSockoptLen int32
var (
ctlOpts = [ctlMax]ctlOpt{
ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL},
......
......@@ -6,8 +6,6 @@
package ipv4
type sysSockoptLen int32
var (
ctlOpts = [ctlMax]ctlOpt{}
......
......@@ -16,14 +16,14 @@ const (
func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno)
func getsockopt(fd, level, name int, v unsafe.Pointer, l *sysSockoptLen) error {
func getsockopt(fd, level, name int, v unsafe.Pointer, l *uint32) error {
if _, errno := socketcall(sysGETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0); errno != 0 {
return error(errno)
}
return nil
}
func setsockopt(fd, level, name int, v unsafe.Pointer, l sysSockoptLen) error {
func setsockopt(fd, level, name int, v unsafe.Pointer, l uint32) error {
if _, errno := socketcall(sysSETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(l), 0); errno != 0 {
return error(errno)
}
......
......@@ -11,14 +11,14 @@ import (
"unsafe"
)
func getsockopt(fd, level, name int, v unsafe.Pointer, l *sysSockoptLen) error {
func getsockopt(fd, level, name int, v unsafe.Pointer, l *uint32) error {
if _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0); errno != 0 {
return error(errno)
}
return nil
}
func setsockopt(fd, level, name int, v unsafe.Pointer, l sysSockoptLen) error {
func setsockopt(fd, level, name int, v unsafe.Pointer, l uint32) error {
if _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(l), 0); errno != 0 {
return error(errno)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment