author | Mikio Hara
<mikioh.mikioh@gmail.com> 2016-03-30 00:15:26 UTC |
committer | Mikio Hara
<mikioh.mikioh@gmail.com> 2016-03-31 04:06:34 UTC |
parent | 31df19d69da8728e9220def59b80ee577c3e48bf |
ipv4/sockopt_asmreq_unix.go | +2 | -2 |
ipv4/sockopt_asmreqn_unix.go | +1 | -1 |
ipv4/sockopt_ssmreq_unix.go | +2 | -2 |
ipv4/sockopt_unix.go | +5 | -5 |
ipv4/sys_bsd.go | +0 | -2 |
ipv4/sys_darwin.go | +0 | -2 |
ipv4/sys_freebsd.go | +0 | -2 |
ipv4/sys_linux.go | +0 | -2 |
ipv4/sys_openbsd.go | +0 | -2 |
ipv4/sys_stub.go | +0 | -2 |
ipv4/syscall_linux_386.go | +2 | -2 |
ipv4/syscall_unix.go | +2 | -2 |
diff --git a/ipv4/sockopt_asmreq_unix.go b/ipv4/sockopt_asmreq_unix.go index fefa901..7b5c329 100644 --- a/ipv4/sockopt_asmreq_unix.go +++ b/ipv4/sockopt_asmreq_unix.go @@ -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))) } diff --git a/ipv4/sockopt_asmreqn_unix.go b/ipv4/sockopt_asmreqn_unix.go index 92c8e34..1f2b9a1 100644 --- a/ipv4/sockopt_asmreqn_unix.go +++ b/ipv4/sockopt_asmreqn_unix.go @@ -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) } diff --git a/ipv4/sockopt_ssmreq_unix.go b/ipv4/sockopt_ssmreq_unix.go index 6f647bc..0a672b6 100644 --- a/ipv4/sockopt_ssmreq_unix.go +++ b/ipv4/sockopt_ssmreq_unix.go @@ -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)) diff --git a/ipv4/sockopt_unix.go b/ipv4/sockopt_unix.go index 50cdbd8..f7acc6b 100644 --- a/ipv4/sockopt_unix.go +++ b/ipv4/sockopt_unix.go @@ -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) } diff --git a/ipv4/sys_bsd.go b/ipv4/sys_bsd.go index a669a44..203033d 100644 --- a/ipv4/sys_bsd.go +++ b/ipv4/sys_bsd.go @@ -11,8 +11,6 @@ import ( "syscall" ) -type sysSockoptLen int32 - var ( ctlOpts = [ctlMax]ctlOpt{ ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, diff --git a/ipv4/sys_darwin.go b/ipv4/sys_darwin.go index 3f34734..b5f5bd5 100644 --- a/ipv4/sys_darwin.go +++ b/ipv4/sys_darwin.go @@ -10,8 +10,6 @@ import ( "unsafe" ) -type sysSockoptLen int32 - var ( ctlOpts = [ctlMax]ctlOpt{ ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, diff --git a/ipv4/sys_freebsd.go b/ipv4/sys_freebsd.go index 09ef491..163ff9a 100644 --- a/ipv4/sys_freebsd.go +++ b/ipv4/sys_freebsd.go @@ -12,8 +12,6 @@ import ( "unsafe" ) -type sysSockoptLen int32 - var ( ctlOpts = [ctlMax]ctlOpt{ ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, diff --git a/ipv4/sys_linux.go b/ipv4/sys_linux.go index b1f3878..73e0d46 100644 --- a/ipv4/sys_linux.go +++ b/ipv4/sys_linux.go @@ -10,8 +10,6 @@ import ( "unsafe" ) -type sysSockoptLen int32 - var ( ctlOpts = [ctlMax]ctlOpt{ ctlTTL: {sysIP_TTL, 1, marshalTTL, parseTTL}, diff --git a/ipv4/sys_openbsd.go b/ipv4/sys_openbsd.go index 550f208..d78083a 100644 --- a/ipv4/sys_openbsd.go +++ b/ipv4/sys_openbsd.go @@ -9,8 +9,6 @@ import ( "syscall" ) -type sysSockoptLen int32 - var ( ctlOpts = [ctlMax]ctlOpt{ ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, diff --git a/ipv4/sys_stub.go b/ipv4/sys_stub.go index efbcc47..c8e55cb 100644 --- a/ipv4/sys_stub.go +++ b/ipv4/sys_stub.go @@ -6,8 +6,6 @@ package ipv4 -type sysSockoptLen int32 - var ( ctlOpts = [ctlMax]ctlOpt{} diff --git a/ipv4/syscall_linux_386.go b/ipv4/syscall_linux_386.go index ab4ad04..07a3a28 100644 --- a/ipv4/syscall_linux_386.go +++ b/ipv4/syscall_linux_386.go @@ -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) } diff --git a/ipv4/syscall_unix.go b/ipv4/syscall_unix.go index 5fe8e83..88a41b0 100644 --- a/ipv4/syscall_unix.go +++ b/ipv4/syscall_unix.go @@ -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) }