aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/netlink/netlink.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/netlink/netlink.go')
-rw-r--r--internal/netlink/netlink.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/internal/netlink/netlink.go b/internal/netlink/netlink.go
index 857259f1..0a3c6688 100644
--- a/internal/netlink/netlink.go
+++ b/internal/netlink/netlink.go
@@ -232,6 +232,14 @@ func (e *InconsistentError) Error() string {
return s
}
+// checkReply checks the message header of a reply from the kernel.
+func (c *conn) checkReply(header *syscall.NlMsghdr) error {
+ if header.Seq != c.seq || header.Pid != c.port {
+ return &InconsistentError{*header, c.seq, c.port}
+ }
+ return nil
+}
+
// pending returns the valid slice of buf and initialises pos.
func (c *conn) pending() []byte {
buf := c.buf[:c.pos]
@@ -275,12 +283,6 @@ func (c *conn) receive(ctx context.Context, f HandlerFunc, flags int) error {
return err
}
- for i := range resp {
- header := &resp[i].Header
- if header.Seq != c.seq || header.Pid != c.port {
- return &InconsistentError{*header, c.seq, c.port}
- }
- }
if err = f(resp); err != nil {
if err == (Complete{}) {
return nil