When there are a large number of existing results for the link, neighbor, and
address subscribe functions with ListExisting are likely to fail with ENOBUFS.
This takes the AddrSubscribeOptions ReceiveBufferSize, already applied
to LinkSubscribeOptions, and applies it to NeighSubscribeOptions and
RouteSubscribeOptions. The ReceiveTimeout option was also added to each.
Added a SetReceiveBufferSize to the nl_linux socket API.
The existing addr_linux subscribe function was modified so instead of setting
the ReceiveBufferSize on the netlink pkghandle, it is set on the socket
associated with the subscription. The new implementations also only change the
receive buffer size on the socket.
Lastly, a new ReceiveBufferForceSize option was applied to all four of the
modified Subscribe functions.
This is the equivalent of:
bridge link set dev <foo> isolated on|off
Add more bridge port netlink attributes Imported from
include/uapi/linux/if_link.h in Linux v6.3.
Signed-off-by: Robin Jarry <rjarry@redhat.com>
Commit 2b008399a4 ("link: add LinkSetGSOIPv4MaxSize and
LinkSetGROIPv4MaxSize") introduced the use of these constants, but they
were added only recently to the golang.org/x/sys/unix package. Update
its version in go.mod and use the pre-defined constants instead of
duplicating them.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Add two new methods to allow setting GSO and GRO max size attributes only.
They make it much easier to enable IPv4 BIG TCP [0].
The equivalent iproute2 commands are:
$ ip link set $link gso_ipv4_max_size $maxSize
$ ip link set $link gro_ipv4_max_size $maxSize
Also add tests for them. We already do support the IPv6 counterpart via
543bb1cade ("link: add LinkSetGSOMaxSize and LinkSetGROMaxSize").
[0] https://lore.kernel.org/netdev/cover.1674921359.git.lucien.xin@gmail.com/
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
- changes: 1. set userTmpl.Family to correct family 2. add Selector to XfrmState which is corresponding to XfrmUsersaInfo.Sel
- update *XfrmAddress.ToIPNet method to support 0.0.0.0/0 and ::/0 correctly
- update xfrmStateFromXfrmUsersaInfo to get XfrmState.Selector
- extend TestXfrmStateAddGetDel for v6ov4 and v4ov6 cases
This PR adds support for filtering flows
based on conntrack labels. It adds two
filters `ConntrackMatchLabels` &&
`ConntackUnmatchLabels` through which user can
provide a list of labels as type "bytes" which
will then be compared to flow.Labels to see if
any matches were found.
ConntrackMatchLabels: Every label passed should
be contained in flow.Labels for a match to be true
ConntrackUmmatchLabels: Every label passed should
not be contained in the flow.Labels for a match to
be true
Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
Use the constants provided in the golang.org/x/sys/unix package instead
of locally defining them, as done in commit c94808a88b ("link: add
support for IFLA_GRO_MAX_SIZE").
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Return a full created nl.RtNexthop ptr to avoid the
"converted pointer straddles multiple allocations".
UT by fasaxc.
Co-authored-by: fasaxc
Signed-off-by: Javier Garcia <javier.martin.garcia@ibm.com>
Add two attributes to fq: Horizon and HorizonDrop (which correspond to the
TCA_FQ_HORIZON and TCA_FQ_HORIZON_DROP attributes). The HorizonDrop attribute
specifies which policy to apply: drop (1, kernel default), cap delivery time to
horizon (0), and the Horizon attribute specifies the number of useconds before
applying the policy.
Add a new test TestFqHorizon to test the changes and as an example of usage.
Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
Add support of XFRMA_SA_EXTRA_FLAGS attribute of XFRM State interface.
The attribute is a 32bit flag and currently two flags
(XFRM_SA_XFLAG_DONT_ENCAP_DSCP and XFRM_SA_XFLAG_OSEQ_MAY_WRAP) are
defined. Two boolean flags added to XfrmState struct are correspoinding
to those flags. Naming of the flags are taken from iproute2's options
(extra-flag dont-encap-dscp | oseq-may-wrap).
Add support for the new IFLA_GRO_MAX_SIZE attribute which is needed to
enable BIG TCP[1] properly. Define the attribute in the local link
attributes (nl/link_linux.go) because it isn't yet present in Go's
x/sys/unix package. Also add a test for it.
[1] https://patchwork.kernel.org/project/netdevbpf/cover/20220513183408.686447-1-eric.dumazet@gmail.com/
Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
This patch makes two changes:
- setsockopt NETLINK_EXT_ACK, if EnableErrorMessageReporting is
configured. (defaults to false for compatibility with existing code)
- NetlinkRequest.Execute is modified to parse the nlmsgerr attributes
if they are present on the response message.
- After this patch, when the request results in NLMSG_ERROR and the
response contains a netlink error message (NLMSGERR_ATTR_MSG),
NetlinkRequest.Execute will return an error with the message that
wraps syscall.Errno.
Add APIs to add and delete a devlink port of specified flavour for a
given devlink device.
Extended test to accept devlink device and sf number parameters from the
test command line.
Signed-off-by: Parav Pandit <parav@nvidia.com>
struct xfrm_usersa_flush contains a single u8, thus sizeof(struct
xfrm_usersa_flush) == 1 as can be verified by running the following
code through go tool cgo -godefs:
package xfrm_test
// #include <linux/xfrm.h>
import "C"
const SizeofXfrmUsersaFlush = C.sizeof_struct_xfrm_usersa_flush
which results in
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs foo.go
package xfrm_test
const SizeofXfrmUsersaFlush = 0x1
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>