mirror of
https://github.com/containers/podman.git
synced 2025-10-19 04:03:23 +08:00
vendor latest c/{buildah,common,image,storage}
Make sure everything passes for rc2. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
53
vendor/github.com/vishvananda/netlink/link_linux.go
generated
vendored
53
vendor/github.com/vishvananda/netlink/link_linux.go
generated
vendored
@ -3,6 +3,7 @@ package netlink
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
@ -1807,20 +1808,20 @@ func (h *Handle) LinkDel(link Link) error {
|
||||
}
|
||||
|
||||
func (h *Handle) linkByNameDump(name string) (Link, error) {
|
||||
links, err := h.LinkList()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
links, executeErr := h.LinkList()
|
||||
if executeErr != nil && !errors.Is(executeErr, ErrDumpInterrupted) {
|
||||
return nil, executeErr
|
||||
}
|
||||
|
||||
for _, link := range links {
|
||||
if link.Attrs().Name == name {
|
||||
return link, nil
|
||||
return link, executeErr
|
||||
}
|
||||
|
||||
// support finding interfaces also via altnames
|
||||
for _, altName := range link.Attrs().AltNames {
|
||||
if altName == name {
|
||||
return link, nil
|
||||
return link, executeErr
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1828,25 +1829,33 @@ func (h *Handle) linkByNameDump(name string) (Link, error) {
|
||||
}
|
||||
|
||||
func (h *Handle) linkByAliasDump(alias string) (Link, error) {
|
||||
links, err := h.LinkList()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
links, executeErr := h.LinkList()
|
||||
if executeErr != nil && !errors.Is(executeErr, ErrDumpInterrupted) {
|
||||
return nil, executeErr
|
||||
}
|
||||
|
||||
for _, link := range links {
|
||||
if link.Attrs().Alias == alias {
|
||||
return link, nil
|
||||
return link, executeErr
|
||||
}
|
||||
}
|
||||
return nil, LinkNotFoundError{fmt.Errorf("Link alias %s not found", alias)}
|
||||
}
|
||||
|
||||
// LinkByName finds a link by name and returns a pointer to the object.
|
||||
//
|
||||
// If the kernel doesn't support IFLA_IFNAME, this method will fall back to
|
||||
// filtering a dump of all link names. In this case, if the returned error is
|
||||
// [ErrDumpInterrupted] the result may be missing or outdated.
|
||||
func LinkByName(name string) (Link, error) {
|
||||
return pkgHandle.LinkByName(name)
|
||||
}
|
||||
|
||||
// LinkByName finds a link by name and returns a pointer to the object.
|
||||
//
|
||||
// If the kernel doesn't support IFLA_IFNAME, this method will fall back to
|
||||
// filtering a dump of all link names. In this case, if the returned error is
|
||||
// [ErrDumpInterrupted] the result may be missing or outdated.
|
||||
func (h *Handle) LinkByName(name string) (Link, error) {
|
||||
if h.lookupByDump {
|
||||
return h.linkByNameDump(name)
|
||||
@ -1879,12 +1888,20 @@ func (h *Handle) LinkByName(name string) (Link, error) {
|
||||
|
||||
// LinkByAlias finds a link by its alias and returns a pointer to the object.
|
||||
// If there are multiple links with the alias it returns the first one
|
||||
//
|
||||
// If the kernel doesn't support IFLA_IFALIAS, this method will fall back to
|
||||
// filtering a dump of all link names. In this case, if the returned error is
|
||||
// [ErrDumpInterrupted] the result may be missing or outdated.
|
||||
func LinkByAlias(alias string) (Link, error) {
|
||||
return pkgHandle.LinkByAlias(alias)
|
||||
}
|
||||
|
||||
// LinkByAlias finds a link by its alias and returns a pointer to the object.
|
||||
// If there are multiple links with the alias it returns the first one
|
||||
//
|
||||
// If the kernel doesn't support IFLA_IFALIAS, this method will fall back to
|
||||
// filtering a dump of all link names. In this case, if the returned error is
|
||||
// [ErrDumpInterrupted] the result may be missing or outdated.
|
||||
func (h *Handle) LinkByAlias(alias string) (Link, error) {
|
||||
if h.lookupByDump {
|
||||
return h.linkByAliasDump(alias)
|
||||
@ -2321,6 +2338,9 @@ func LinkList() ([]Link, error) {
|
||||
|
||||
// LinkList gets a list of link devices.
|
||||
// Equivalent to: `ip link show`
|
||||
//
|
||||
// If the returned error is [ErrDumpInterrupted], results may be inconsistent
|
||||
// or incomplete.
|
||||
func (h *Handle) LinkList() ([]Link, error) {
|
||||
// NOTE(vish): This duplicates functionality in net/iface_linux.go, but we need
|
||||
// to get the message ourselves to parse link type.
|
||||
@ -2331,9 +2351,9 @@ func (h *Handle) LinkList() ([]Link, error) {
|
||||
attr := nl.NewRtAttr(unix.IFLA_EXT_MASK, nl.Uint32Attr(nl.RTEXT_FILTER_VF))
|
||||
req.AddData(attr)
|
||||
|
||||
msgs, err := req.Execute(unix.NETLINK_ROUTE, unix.RTM_NEWLINK)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
msgs, executeErr := req.Execute(unix.NETLINK_ROUTE, unix.RTM_NEWLINK)
|
||||
if executeErr != nil && !errors.Is(executeErr, ErrDumpInterrupted) {
|
||||
return nil, executeErr
|
||||
}
|
||||
|
||||
var res []Link
|
||||
@ -2345,7 +2365,7 @@ func (h *Handle) LinkList() ([]Link, error) {
|
||||
res = append(res, link)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
return res, executeErr
|
||||
}
|
||||
|
||||
// LinkUpdate is used to pass information back from LinkSubscribe()
|
||||
@ -2381,6 +2401,10 @@ type LinkSubscribeOptions struct {
|
||||
// LinkSubscribeWithOptions work like LinkSubscribe but enable to
|
||||
// provide additional options to modify the behavior. Currently, the
|
||||
// namespace can be provided as well as an error callback.
|
||||
//
|
||||
// When options.ListExisting is true, options.ErrorCallback may be
|
||||
// called with [ErrDumpInterrupted] to indicate that results from
|
||||
// the initial dump of links may be inconsistent or incomplete.
|
||||
func LinkSubscribeWithOptions(ch chan<- LinkUpdate, done <-chan struct{}, options LinkSubscribeOptions) error {
|
||||
if options.Namespace == nil {
|
||||
none := netns.None()
|
||||
@ -2440,6 +2464,9 @@ func linkSubscribeAt(newNs, curNs netns.NsHandle, ch chan<- LinkUpdate, done <-c
|
||||
continue
|
||||
}
|
||||
for _, m := range msgs {
|
||||
if m.Header.Flags&unix.NLM_F_DUMP_INTR != 0 && cberr != nil {
|
||||
cberr(ErrDumpInterrupted)
|
||||
}
|
||||
if m.Header.Type == unix.NLMSG_DONE {
|
||||
continue
|
||||
}
|
||||
|
Reference in New Issue
Block a user