Commit 084869ab authored by Mikio Hara's avatar Mikio Hara

lif: rename internal types and constants generated by cgo

To match up with other packages that work with IP protocol stack.

Change-Id: Idc3ee5b2399c4982dbd9114aac441f6d7452aeef
Reviewed-on: https://go-review.googlesource.com/30576
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 30df40a6
......@@ -56,7 +56,7 @@ func Addrs(af int, name string) ([]Addr, error) {
}
var as []Addr
for _, ll := range lls {
var lifr sysLifreq
var lifr lifreq
for i := 0; i < len(ll.Name); i++ {
lifr.Name[i] = int8(ll.Name[i])
}
......@@ -66,7 +66,7 @@ func Addrs(af int, name string) ([]Addr, error) {
if err != nil {
continue
}
sa := (*sysSockaddrStorage)(unsafe.Pointer(&lifr.Lifru[0]))
sa := (*sockaddrStorage)(unsafe.Pointer(&lifr.Lifru[0]))
l := int(littleEndian.Uint32(lifr.Lifru1[:4]))
if l == 0 {
continue
......
......@@ -26,7 +26,7 @@ const (
sysSOCK_DGRAM = C.SOCK_DGRAM
)
type sysSockaddrStorage C.struct_sockaddr_storage
type sockaddrStorage C.struct_sockaddr_storage
const (
sysLIFC_NOXMIT = C.LIFC_NOXMIT
......@@ -77,11 +77,11 @@ const (
type sysLifnum C.struct_lifnum
type sysLifreq C.struct_lifreq
type lifreq C.struct_lifreq
type sysLifconf C.struct_lifconf
type lifconf C.struct_lifconf
type sysLifIfinfoReq C.struct_lif_ifinfo_req
type lifIfinfoReq C.struct_lif_ifinfo_req
const (
sysIFT_IPV4 = C.IFT_IPV4
......
......@@ -25,7 +25,7 @@ type Link struct {
}
func (ll *Link) fetch(s uintptr) {
var lifr sysLifreq
var lifr lifreq
for i := 0; i < len(ll.Name); i++ {
lifr.Name[i] = int8(ll.Name[i])
}
......@@ -71,7 +71,7 @@ func Links(af int, name string) ([]Link, error) {
func links(eps []endpoint, name string) ([]Link, error) {
var lls []Link
lifn := sysLifnum{Flags: sysLIFC_NOXMIT | sysLIFC_TEMPORARY | sysLIFC_ALLZONES | sysLIFC_UNDER_IPMP}
lifc := sysLifconf{Flags: sysLIFC_NOXMIT | sysLIFC_TEMPORARY | sysLIFC_ALLZONES | sysLIFC_UNDER_IPMP}
lifc := lifconf{Flags: sysLIFC_NOXMIT | sysLIFC_TEMPORARY | sysLIFC_ALLZONES | sysLIFC_UNDER_IPMP}
for _, ep := range eps {
lifn.Family = uint16(ep.af)
ioc := int64(sysSIOCGLIFNUM)
......@@ -91,7 +91,7 @@ func links(eps []endpoint, name string) ([]Link, error) {
}
nb := make([]byte, 32) // see LIFNAMSIZ in net/if.h
for i := 0; i < int(lifn.Count); i++ {
lifr := (*sysLifreq)(unsafe.Pointer(&b[i*sizeofLifreq]))
lifr := (*lifreq)(unsafe.Pointer(&b[i*sizeofLifreq]))
for i := 0; i < 32; i++ {
if lifr.Name[i] == 0 {
nb = nb[:i]
......
......@@ -11,7 +11,7 @@ const (
sysSOCK_DGRAM = 0x1
)
type sysSockaddrStorage struct {
type sockaddrStorage struct {
Family uint16
X_ss_pad1 [6]int8
X_ss_align float64
......@@ -72,14 +72,14 @@ type sysLifnum struct {
Count int32
}
type sysLifreq struct {
type lifreq struct {
Name [32]int8
Lifru1 [4]byte
Type uint32
Lifru [336]byte
}
type sysLifconf struct {
type lifconf struct {
Family uint16
Pad_cgo_0 [2]byte
Flags int32
......@@ -88,7 +88,7 @@ type sysLifconf struct {
Lifcu [8]byte
}
type sysLifIfinfoReq struct {
type lifIfinfoReq struct {
Maxhops uint8
Pad_cgo_0 [3]byte
Reachtime uint32
......
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