Documentation ¶
Overview ¶
Package nlwrap 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 "nlwrap.X" instead of "netlink.X".
When netlink.ErrDumpInterrupted is returned, the wrapped functions retry up to maxAttempts times. This error means NLM_F_DUMP_INTR was flagged in a netlink response, meaning something changed during the dump so results may be incomplete or inconsistent.
To avoid retrying indefinitely, if netlink.ErrDumpInterrupted is still returned after maxAttempts, the wrapped functions will discard the error, log a stack trace to make the issue visible and aid in debugging, and return the possibly inconsistent results. Returning possibly inconsistent results matches the behaviour of vishvananda/netlink versions prior to 1.2.1, in which the NLM_F_DUMP_INTR flag was ignored.
Index ¶
- func AddrList(link netlink.Link, family int) (addrs []netlink.Addr, err error)
- func ConntrackTableList(table netlink.ConntrackTableType, family netlink.InetFamily) (flows []*netlink.ConntrackFlow, err error)
- func LinkByName(name string) (link netlink.Link, err error)
- func LinkList() (links []netlink.Link, err error)
- type Handle
- func (nlh Handle) AddrList(link netlink.Link, family int) (addrs []netlink.Addr, err error)
- func (h Handle) Close()
- func (nlh Handle) ConntrackDeleteFilters(table netlink.ConntrackTableType, family netlink.InetFamily, ...) (matched uint, err error)
- func (nlh Handle) LinkByName(name string) (link netlink.Link, err error)
- func (nlh Handle) LinkList() (links []netlink.Link, err error)
- func (nlh Handle) RouteList(link netlink.Link, family int) (routes []netlink.Route, err error)
- func (nlh Handle) XfrmPolicyList(family int) (policies []netlink.XfrmPolicy, err error)
- func (nlh Handle) XfrmStateList(family int) (states []netlink.XfrmState, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConntrackTableList ¶
func ConntrackTableList( table netlink.ConntrackTableType, family netlink.InetFamily, ) (flows []*netlink.ConntrackFlow, err error)
ConntrackTableList calls netlink.ConntrackTableList, 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.
Types ¶
type Handle ¶
func (Handle) ConntrackDeleteFilters ¶
func (nlh Handle) ConntrackDeleteFilters( table netlink.ConntrackTableType, family netlink.InetFamily, filters ...netlink.CustomConntrackFilter, ) (matched uint, err error)
ConntrackDeleteFilters calls nlh.Handle.ConntrackDeleteFilters, retrying if necessary.
func (Handle) LinkByName ¶
LinkByName calls nlh.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) XfrmPolicyList ¶
func (nlh Handle) XfrmPolicyList(family int) (policies []netlink.XfrmPolicy, err error)
XfrmPolicyList calls nlh.Handle.XfrmPolicyList, retrying if necessary.