diff --git a/link_linux.go b/link_linux.go index 62b7578..7d48a70 100644 --- a/link_linux.go +++ b/link_linux.go @@ -175,10 +175,10 @@ func boolAttr(val bool) []byte { } type vxlanPortRange struct { - Lo, Hi uint16 - } + Lo, Hi uint16 +} -func addVxlanAttrs(vxlan* Vxlan, linkInfo *nl.RtAttr) { +func addVxlanAttrs(vxlan *Vxlan, linkInfo *nl.RtAttr) { data := nl.NewRtAttrChild(linkInfo, nl.IFLA_INFO_DATA, nil) nl.NewRtAttrChild(data, nl.IFLA_VXLAN_ID, nl.Uint32Attr(uint32(vxlan.VxlanId))) if vxlan.VtepDevIndex != 0 { @@ -227,7 +227,7 @@ func addVxlanAttrs(vxlan* Vxlan, linkInfo *nl.RtAttr) { nl.NewRtAttrChild(data, nl.IFLA_VXLAN_PORT, nl.Uint16Attr(uint16(vxlan.Port))) } if vxlan.PortLow > 0 || vxlan.PortHigh > 0 { - pr := vxlanPortRange{ uint16(vxlan.PortLow), uint16(vxlan.PortHigh) } + pr := vxlanPortRange{uint16(vxlan.PortLow), uint16(vxlan.PortHigh)} buf := new(bytes.Buffer) binary.Write(buf, binary.BigEndian, &pr) diff --git a/link_test.go b/link_test.go index 7c718bb..2469688 100644 --- a/link_test.go +++ b/link_test.go @@ -349,7 +349,7 @@ func TestLinkAddDelVxlan(t *testing.T) { LinkAttrs: LinkAttrs{ Name: "bar", }, - VxlanId: 10, + VxlanId: 10, VtepDevIndex: parent.Index, Learning: true, L2miss: true, diff --git a/neigh_linux.go b/neigh_linux.go index 1212406..4a59582 100644 --- a/neigh_linux.go +++ b/neigh_linux.go @@ -47,7 +47,7 @@ type Ndmsg struct { Family uint8 Index uint32 State uint16 - Flags uint8 + Flags uint8 Type uint8 } @@ -171,7 +171,6 @@ func NeighDeserialize(m []byte) (*Neigh, error) { Flags: int(msg.Flags), } - attrs, err := nl.ParseRouteAttr(m[msg.Len():]) if err != nil { return nil, err diff --git a/neigh_test.go b/neigh_test.go index 510f012..caf38ed 100644 --- a/neigh_test.go +++ b/neigh_test.go @@ -20,7 +20,7 @@ func parseMAC(s string) net.HardwareAddr { func dumpContains(dump []Neigh, e arpEntry) bool { for _, n := range dump { - if n.IP.Equal(e.ip) && (n.State & NUD_INCOMPLETE) == 0 { + if n.IP.Equal(e.ip) && (n.State&NUD_INCOMPLETE) == 0 { return true } } @@ -36,11 +36,11 @@ func TestNeighAddDel(t *testing.T) { ensureIndex(dummy.Attrs()) arpTable := []arpEntry{ - { net.ParseIP("10.99.0.1"), parseMAC("aa:bb:cc:dd:00:01") }, - { net.ParseIP("10.99.0.2"), parseMAC("aa:bb:cc:dd:00:02") }, - { net.ParseIP("10.99.0.3"), parseMAC("aa:bb:cc:dd:00:03") }, - { net.ParseIP("10.99.0.4"), parseMAC("aa:bb:cc:dd:00:04") }, - { net.ParseIP("10.99.0.5"), parseMAC("aa:bb:cc:dd:00:05") }, + {net.ParseIP("10.99.0.1"), parseMAC("aa:bb:cc:dd:00:01")}, + {net.ParseIP("10.99.0.2"), parseMAC("aa:bb:cc:dd:00:02")}, + {net.ParseIP("10.99.0.3"), parseMAC("aa:bb:cc:dd:00:03")}, + {net.ParseIP("10.99.0.4"), parseMAC("aa:bb:cc:dd:00:04")}, + {net.ParseIP("10.99.0.5"), parseMAC("aa:bb:cc:dd:00:05")}, } // Add the arpTable diff --git a/nl/addr_linux.go b/nl/addr_linux.go index 1287042..17088fa 100644 --- a/nl/addr_linux.go +++ b/nl/addr_linux.go @@ -45,4 +45,3 @@ func (msg *IfAddrmsg) Serialize() []byte { func (msg *IfAddrmsg) Len() int { return syscall.SizeofIfAddrmsg } - diff --git a/nl/nl_linux.go b/nl/nl_linux.go index ee2533b..9c2499e 100644 --- a/nl/nl_linux.go +++ b/nl/nl_linux.go @@ -4,8 +4,8 @@ package nl import ( "bytes" "encoding/binary" - "net" "fmt" + "net" "sync/atomic" "syscall" "unsafe" @@ -304,7 +304,7 @@ func Subscribe(protocol int, groups ...uint) (*NetlinkSocket, error) { s.lsa.Family = syscall.AF_NETLINK for _, g := range groups { - s.lsa.Groups |= (1 << (g-1)) + s.lsa.Groups |= (1 << (g - 1)) } if err := syscall.Bind(fd, &s.lsa); err != nil { diff --git a/nl/route_linux.go b/nl/route_linux.go index de54609..5dde998 100644 --- a/nl/route_linux.go +++ b/nl/route_linux.go @@ -31,4 +31,3 @@ func DeserializeRtMsg(b []byte) *RtMsg { func (msg *RtMsg) Serialize() []byte { return (*(*[syscall.SizeofRtMsg]byte)(unsafe.Pointer(msg)))[:] } - diff --git a/nl/xfrm_policy_linux.go b/nl/xfrm_policy_linux.go index e1d186b..66f7e03 100644 --- a/nl/xfrm_policy_linux.go +++ b/nl/xfrm_policy_linux.go @@ -117,4 +117,3 @@ func DeserializeXfrmUserTmpl(b []byte) *XfrmUserTmpl { func (msg *XfrmUserTmpl) Serialize() []byte { return (*(*[SizeofXfrmUserTmpl]byte)(unsafe.Pointer(msg)))[:] } - diff --git a/nl/xfrm_state_linux.go b/nl/xfrm_state_linux.go index 74da332..4876ce4 100644 --- a/nl/xfrm_state_linux.go +++ b/nl/xfrm_state_linux.go @@ -219,4 +219,3 @@ func DeserializeXfrmEncapTmpl(b []byte) *XfrmEncapTmpl { func (msg *XfrmEncapTmpl) Serialize() []byte { return (*(*[SizeofXfrmEncapTmpl]byte)(unsafe.Pointer(msg)))[:] } -