Skip to content

Commit b4d07e8

Browse files
davesetaboch
authored andcommitted
Use ndmsg payload for neighbor subscribe requests
1 parent d3b8a16 commit b4d07e8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

neigh_linux.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,9 @@ func NeighSubscribeWithOptions(ch chan<- NeighUpdate, done <-chan struct{}, opti
370370
func neighSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- NeighUpdate, done <-chan struct{}, cberr func(error), listExisting bool) error {
371371
s, err := nl.SubscribeAt(newNs, curNs, unix.NETLINK_ROUTE, unix.RTNLGRP_NEIGH)
372372
makeRequest := func(family int) error {
373-
req := pkgHandle.newNetlinkRequest(unix.RTM_GETNEIGH,
374-
unix.NLM_F_DUMP)
375-
infmsg := nl.NewIfInfomsg(family)
376-
req.AddData(infmsg)
373+
req := pkgHandle.newNetlinkRequest(unix.RTM_GETNEIGH, unix.NLM_F_DUMP)
374+
ndmsg := &Ndmsg{Family: uint8(family)}
375+
req.AddData(ndmsg)
377376
if err := s.Send(req); err != nil {
378377
return err
379378
}
@@ -427,12 +426,12 @@ func neighSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- NeighUpdate, done <
427426
continue
428427
}
429428
if m.Header.Type == unix.NLMSG_ERROR {
430-
error := int32(native.Uint32(m.Data[0:4]))
431-
if error == 0 {
429+
nError := int32(native.Uint32(m.Data[0:4]))
430+
if nError == 0 {
432431
continue
433432
}
434433
if cberr != nil {
435-
cberr(syscall.Errno(-error))
434+
cberr(syscall.Errno(-nError))
436435
}
437436
return
438437
}

0 commit comments

Comments
 (0)