Commit 2a824cf9 authored by Mikio Hara's avatar Mikio Hara

ipv6: don't refer to cgo-generated union field

The size of sockaddr_storage is fixed for interoperability on each
platform. There is no need to depend on changable cgo-generated
offset values.

Change-Id: I54b775b2a8c86d969a6da0398a335075f0cbe3df
Reviewed-on: https://go-review.googlesource.com/30178
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 534e1870
......@@ -87,18 +87,18 @@ func (mreq *sysIPv6Mreq) setIfindex(i int) {
}
func (gr *sysGroupReq) setGroup(grp net.IP) {
sa := (*sysSockaddrInet6)(unsafe.Pointer(&gr.Pad_cgo_0[0]))
sa := (*sysSockaddrInet6)(unsafe.Pointer(uintptr(unsafe.Pointer(gr)) + 4))
sa.Len = sysSizeofSockaddrInet6
sa.Family = syscall.AF_INET6
copy(sa.Addr[:], grp)
}
func (gsr *sysGroupSourceReq) setSourceGroup(grp, src net.IP) {
sa := (*sysSockaddrInet6)(unsafe.Pointer(&gsr.Pad_cgo_0[0]))
sa := (*sysSockaddrInet6)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 4))
sa.Len = sysSizeofSockaddrInet6
sa.Family = syscall.AF_INET6
copy(sa.Addr[:], grp)
sa = (*sysSockaddrInet6)(unsafe.Pointer(&gsr.Pad_cgo_1[0]))
sa = (*sysSockaddrInet6)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 132))
sa.Len = sysSizeofSockaddrInet6
sa.Family = syscall.AF_INET6
copy(sa.Addr[:], src)
......
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