mirror of
https://github.com/rancher/plugins.git
synced 2025-09-17 14:52:32 +00:00
committed by
Casey Callendrello
parent
35831f3d23
commit
dcf43557ef
13
vendor/github.com/vishvananda/netlink/protinfo_linux.go
generated
vendored
13
vendor/github.com/vishvananda/netlink/protinfo_linux.go
generated
vendored
@@ -1,6 +1,7 @@
|
||||
package netlink
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"syscall"
|
||||
|
||||
@@ -8,10 +9,14 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// If the returned error is [ErrDumpInterrupted], results may be inconsistent
|
||||
// or incomplete.
|
||||
func LinkGetProtinfo(link Link) (Protinfo, error) {
|
||||
return pkgHandle.LinkGetProtinfo(link)
|
||||
}
|
||||
|
||||
// If the returned error is [ErrDumpInterrupted], results may be inconsistent
|
||||
// or incomplete.
|
||||
func (h *Handle) LinkGetProtinfo(link Link) (Protinfo, error) {
|
||||
base := link.Attrs()
|
||||
h.ensureIndex(base)
|
||||
@@ -19,9 +24,9 @@ func (h *Handle) LinkGetProtinfo(link Link) (Protinfo, error) {
|
||||
req := h.newNetlinkRequest(unix.RTM_GETLINK, unix.NLM_F_DUMP)
|
||||
msg := nl.NewIfInfomsg(unix.AF_BRIDGE)
|
||||
req.AddData(msg)
|
||||
msgs, err := req.Execute(unix.NETLINK_ROUTE, 0)
|
||||
if err != nil {
|
||||
return pi, err
|
||||
msgs, executeErr := req.Execute(unix.NETLINK_ROUTE, 0)
|
||||
if executeErr != nil && !errors.Is(executeErr, ErrDumpInterrupted) {
|
||||
return pi, executeErr
|
||||
}
|
||||
|
||||
for _, m := range msgs {
|
||||
@@ -43,7 +48,7 @@ func (h *Handle) LinkGetProtinfo(link Link) (Protinfo, error) {
|
||||
}
|
||||
pi = parseProtinfo(infos)
|
||||
|
||||
return pi, nil
|
||||
return pi, executeErr
|
||||
}
|
||||
}
|
||||
return pi, fmt.Errorf("Device with index %d not found", base.Index)
|
||||
|
Reference in New Issue
Block a user