package netlinksafe
import "github.com/containernetworking/plugins/pkg/netlinksafe"
Package netlinksafe wraps vishvandanda/netlink functions that may return EINTR.
A Handle instantiated using NewHandle or NewHandleAt can be used in place of a netlink.Handle, it's a wrapper that replaces methods that need to be wrapped. Functions that use the package handle need to be called as "netlinksafe.X" instead of "netlink.X".
The wrapped functions currently return EINTR when NLM_F_DUMP_INTR flagged in a netlink response, meaning something changed during the dump so results may be incomplete or inconsistent.
At present, the possibly incomplete/inconsistent results are not returned by netlink functions along with the EINTR. So, it's not possible to do anything but retry. After maxAttempts the EINTR will be returned to the caller.
Index ¶
- func AddrList(link netlink.Link, family int) ([]netlink.Addr, error)
- func BridgeVlanList() (map[int32][]*nl.BridgeVlanInfo, error)
- func ConntrackDeleteFilters(table netlink.ConntrackTableType, family netlink.InetFamily, filters ...netlink.CustomConntrackFilter) (uint, error)
- func FilterList(link netlink.Link, parent uint32) ([]netlink.Filter, error)
- func LinkByName(name string) (netlink.Link, error)
- func LinkGetProtinfo(link netlink.Link) (netlink.Protinfo, error)
- func LinkList() ([]netlink.Link, error)
- func QdiscList(link netlink.Link) ([]netlink.Qdisc, error)
- func RouteList(link netlink.Link, family int) ([]netlink.Route, error)
- func RouteListFiltered(family int, filter *netlink.Route, filterMask uint64) ([]netlink.Route, error)
- func RuleList(family int) ([]netlink.Rule, error)
- func RuleListFiltered(family int, filter *netlink.Rule, filterMask uint64) ([]netlink.Rule, error)
- type Handle
- func NewHandle(nlFamilies ...int) (Handle, error)
- func NewHandleAt(ns netns.NsHandle, nlFamilies ...int) (Handle, error)
- func (h Handle) Close()
- func (h *Handle) ConntrackDeleteFilters(table netlink.ConntrackTableType, family netlink.InetFamily, filters ...netlink.CustomConntrackFilter) (uint, error)
- func (h *Handle) FilterList(link netlink.Link, parent uint32) ([]netlink.Filter, error)
- func (h Handle) LinkByName(name string) (netlink.Link, error)
- func (h *Handle) LinkGetProtinfo(link netlink.Link) (netlink.Protinfo, error)
- func (h Handle) LinkList() ([]netlink.Link, error)
- func (h *Handle) QdiscList(link netlink.Link) ([]netlink.Qdisc, error)
- func (h Handle) RouteList(link netlink.Link, family int) ([]netlink.Route, error)
- func (h Handle) RouteListFiltered(family int, filter *netlink.Route, filterMask uint64) ([]netlink.Route, error)
- func (h *Handle) RuleList(family int) ([]netlink.Rule, error)
- func (h *Handle) RuleListFiltered(family int, filter *netlink.Rule, filterMask uint64) ([]netlink.Rule, error)
Functions ¶
func AddrList ¶
AddrList calls netlink.AddrList, retrying if necessary.
func BridgeVlanList ¶
func BridgeVlanList() (map[int32][]*nl.BridgeVlanInfo, error)
BridgeVlanList calls netlink.BridgeVlanList, retrying if necessary.
func ConntrackDeleteFilters ¶
func ConntrackDeleteFilters(table netlink.ConntrackTableType, family netlink.InetFamily, filters ...netlink.CustomConntrackFilter) (uint, error)
ConntrackDeleteFilters calls netlink.ConntrackDeleteFilters, retrying if necessary.
func FilterList ¶
FilterList calls netlink.FilterList, retrying if necessary.
func LinkByName ¶
LinkByName calls netlink.LinkByName, retrying if necessary. The netlink function doesn't normally ask the kernel for a dump of links. But, on an old kernel, it will do as a fallback and that dump may get inconsistent results.
func LinkGetProtinfo ¶
LinkGetProtinfo calls netlink.LinkGetProtinfo, retrying if necessary.
func LinkList ¶
LinkList calls netlink.Handle.LinkList, retrying if necessary.
func QdiscList ¶
QdiscList calls netlink.QdiscList, retrying if necessary.
func RouteList ¶
RouteList calls netlink.RouteList, retrying if necessary.
func RouteListFiltered ¶
func RouteListFiltered(family int, filter *netlink.Route, filterMask uint64) ([]netlink.Route, error)
RouteListFiltered calls netlink.RouteListFiltered, retrying if necessary.
func RuleList ¶
RuleList calls netlink.RuleList, retrying if necessary.
func RuleListFiltered ¶
RuleListFiltered calls netlink.RuleListFiltered, retrying if necessary.
Types ¶
type Handle ¶
func NewHandle ¶
func NewHandleAt ¶
func (Handle) Close ¶
func (h Handle) Close()
func (*Handle) ConntrackDeleteFilters ¶
func (h *Handle) ConntrackDeleteFilters(table netlink.ConntrackTableType, family netlink.InetFamily, filters ...netlink.CustomConntrackFilter) (uint, error)
ConntrackDeleteFilters calls h.Handle.ConntrackDeleteFilters, retrying if necessary.
func (*Handle) FilterList ¶
FilterList calls h.Handle.FilterList, retrying if necessary.
func (Handle) LinkByName ¶
LinkByName calls h.Handle.LinkByName, retrying if necessary. The netlink function doesn't normally ask the kernel for a dump of links. But, on an old kernel, it will do as a fallback and that dump may get inconsistent results.
func (*Handle) LinkGetProtinfo ¶
LinkGetProtinfo calls h.Handle.LinkGetProtinfo, retrying if necessary.
func (Handle) LinkList ¶
LinkList calls h.Handle.LinkList, retrying if necessary.
func (*Handle) QdiscList ¶
QdiscList calls h.Handle.QdiscList, retrying if necessary.
func (Handle) RouteList ¶
RouteList calls h.Handle.RouteList, retrying if necessary.
func (Handle) RouteListFiltered ¶
func (h Handle) RouteListFiltered(family int, filter *netlink.Route, filterMask uint64) ([]netlink.Route, error)
RouteListFiltered calls h.Handle.RouteListFiltered, retrying if necessary.
func (*Handle) RuleList ¶
RuleList calls h.Handle.RuleList, retrying if necessary.
func (*Handle) RuleListFiltered ¶
func (h *Handle) RuleListFiltered(family int, filter *netlink.Rule, filterMask uint64) ([]netlink.Rule, error)
RuleListFiltered calls h.Handle.RuleListFiltered, retrying if necessary.
Source Files ¶
- Version
- v1.7.1 (latest)
- Published
- Apr 25, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 13 hours ago –
Tools for package owners.