Commit Graph

792 Commits

Author SHA1 Message Date
Vishvananda Abrams
d79d27a836 remove testify deps 2025-08-27 20:37:11 +00:00
adrianc
398598b704 feat: add additional devlink port attributes
Add the following devlink port attributes:

PortNumber: the physical port number
PfNumber: the PF number
VfNumber: the VF number (index)
SfNumber: the SF number (index)
ControllerNumber: the controller number
External: if set, indicates external controller

Signed-off-by: adrianc <adrianc@nvidia.com>
2025-08-18 13:32:37 +03:00
pasteley
7af87bcf82 feat: option to disable VF polling
Introduces a configuration flag to disable Virtual Function polling,
providing users with control over polling behavior for performance
optimization scenarios.

Fixes: #1097

Signed-off-by: pasteley <ceasebeing@gmail.com>
2025-07-29 08:58:21 -07:00
Tobias Klauser
efd156c058 Skip TestSocketXDPGetInfo on EPERM
Skip TestSocketXDPGetInfo rather than failing it when the user lacks
permissions to create AF_XDP sockets.

This allows to run the full test suite as an unprivileged user again.
2025-07-23 09:24:30 -07:00
Tobias Klauser
20a4b9a571 Clean logging up socket tests
Remove a stray fmt.Println in TestUnixSocketDiagInfo and convert any
log.Fatal lines to testing.(*T).Fatal to properly fail tests.
2025-07-22 09:50:59 -07:00
Tobias Klauser
3d9b64dc8d Remove always-nil deserializeFouMsg error return value
The error is always nil. Remove it to simplify the callers.
2025-07-22 09:50:59 -07:00
Tobias Klauser
7a3403a870 Don't log on unknown fou or ipset attributes
The library doesn't log anywhere else for (yet) unknown attributes.
These may appear any time a new kernel is used which adds new attributes.
2025-07-22 09:50:59 -07:00
Nitin Kumar
9f36d6654a fix: Pass TestXfrmStateWithPcpunumWithoutSADir on higher kernels 2025-07-20 09:23:12 -07:00
Radek Zajic
212ea54671 socket: add functions for unspecified platforms 2025-07-20 09:22:13 -07:00
Nitin Kumar
81eeb7146f fix: Allow TCA_OPTIONS with NLA_F_NESTED and NLA_F_NET_BYTEORDER flag 2025-07-19 12:24:47 -07:00
Dimitar Schkodrov
e1e2602148 Implement the Temporary() method on errDumpInterrupted
This is minimal, non-breaking, and preserves compatibility with older retry detection patterns.
2025-06-24 10:39:38 -07:00
Wolfgang Nagele
78aca1ace5 Add SRv6 support for End.DT46 2025-06-22 15:20:46 -07:00
peterk-akamai
7adcc3735c Fix bug in modify U32 filter, correct the number of Keys in Sel
When `func (h *Handle) filterModify(...)` handles an `U32` filter, it also corrects the endiannes for the `Mask` and `Val` in the filter's `Sel.Keys`. For this it creates a new Keys slice and copies the values from the old one. This new slice is created with an incorrect size, likely the intention was to specify its capacity, but instead the size is specified.

The old code happens to work correctly in practice when the number of keys is a power of 2. Otherwise empty (match all) keys are added to the end to make the number a power of 2.

This commit fixes the issue. It was well tested, here's an excerpt:

- Create a U32 filter with 5 Keys. The content of keys is irrelevant, only the number matters.
- Print the filter back with `tc filter show ...`.

The old behaviour:

```
filter parent ffff: protocol all pref 49150 u32 chain 0 fh 800::601 order 1537 key ht 800 bkt 0 *flowid :1 not_in_hw
  match 40000000/60000000 at 0
  match 07010723/ffffffff at 24
  match 07450767/ffffffff at 28
  match 07890733/ffffffff at 32
  match 07420801/ffe00000 at 36
  match 00000000/00000000 at 0
  match 00000000/00000000 at 0
  match 00000000/00000000 at 0
```
The last 3 entries were added by netlink.

New behaviour:
```
filter parent ffff: protocol all pref 49150 u32 chain 0 fh 800::801 order 2049 key ht 800 bkt 0 flowid :1 not_in_hw
  match 60000000/f0000000 at 0
  match 07010723/ffffffff at 24
  match 07450767/ffffffff at 28
  match 07890733/ffffffff at 32
  match 07400000/ffe00000 at 36
```
2025-06-20 09:58:53 -07:00
Gwendolyn
17daef607c vlan: add support for flags and qos maps
Signed-off-by: Gwendolyn <me@gwendolyn.dev>
v1.3.1
2025-05-09 11:59:25 -07:00
lwintermelon
b929916209 filter: add classid and port range support for flower 2025-05-09 11:58:54 -07:00
zlava
06c2c01f6a feat: add vlanid - tunnelid mapping support 2025-05-09 11:52:33 -07:00
bingshen.wbs
c4bb4f91d6 rdma: support rdma metrics: resource and statistic
Signed-off-by: bingshen.wbs <bingshen.wbs@alibaba-inc.com>
2025-05-09 11:48:52 -07:00
charlie
e9f11f77b9 bugfix: parse ipv4 src/dst error 2025-05-09 11:41:09 -07:00
Benjamin Leggett
1f4f72c917 Mimic ipset C code for determining correct default ipset revision
Signed-off-by: Benjamin Leggett <benjamin.leggett@solo.io>
2025-05-09 11:39:54 -07:00
lwintermelon
2426b0576c qdisc: fix wrong type info of tc_sfq_qopt 2025-05-09 11:29:26 -07:00
Gwendolyn
a2e4b9a6ec veth: allow configuring peer attributes beyond namespace and address
Signed-off-by: Gwendolyn <me@gwendolyn.dev>
2025-05-09 11:11:58 -07:00
gongguan
9d88d8385b feat: add support for RtoMin lock 2025-04-25 12:38:46 -07:00
Daniel Borkmann
6b5dd30007 geneve: Support setting/getting source port range
Add support for geneve feature to specify source port range, see
kernel commits:

- e1f95b1992b8 ("geneve: Allow users to specify source port range")
- 5a41a00cd5d5 ("geneve, specs: Add port range to rt_link specification")

This is exactly equivalent on what is done in case of vxlan today.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2025-04-25 12:02:59 -07:00
zlava
d85a66b0d8 feat: add IFLA_INET6_ADDR_GEN_MODE support 2025-04-14 15:15:50 -07:00
Julian Wiedmann
5a4ec4bea5 addr_linux: don't require label to be prefixed with interface name
This requirement limits the usefulness of labels (given the total label
length can only be 15 characters).

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
2025-04-09 10:21:29 -07:00
kayos@tcp.direct
38b12299c1 tests: Improve address unit test infrastructure
Signed-off-by: kayos@tcp.direct <kayos@tcp.direct>
2025-04-03 08:32:13 +03:00
Andrey Smirnov
cb48698f25 fix: add missing CLOEXEC flag
Some calls were already using it, some were not, but fix the remaining
ones.

Without this flag, the file descriptor would to the child process after
fork/exec.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
2025-03-27 22:15:54 -07:00
Junhuang Hong
5d6ad2bde7 add SRv6 support for END.DT4 2025-03-27 22:09:14 -07:00
Ivan Tsvetkov
14e2f0a5ba tuntap: add support for dynamically managing multi-queue FDs
Introduce AddQueues and RemoveQueues methods for attaching and detaching
queue file descriptors to an existing TUN/TAP interface in multi-queue mode.
This enables controlled testing of disabled queues and fine-grained queue
management without relying on interface recreation.

Signed-off-by: Ivan Tsvetkov <ivanfromearth@gmail.com>
2025-03-27 21:30:11 -07:00
Ivan Tsvetkov
298a362432 tuntap: parse additional netlink attributes for flags and queues
Signed-off-by: Ivan Tsvetkov <ivanfromearth@gmail.com>
2025-03-27 21:30:11 -07:00
James Lamanna
7740709424 Add support for ARP/ND Timestamps when retriving neighbors
On Linux, Netlink provides NDA_CACHEINFO which carries timestamps about
when ARP/ND was updated, used, and confirmed.

Expose these fields in the Neigh type
2025-03-26 11:54:52 -07:00
ChinmayaSharma-hue
8b05c6bd4c Added PCPU and SA fields to XfrmState 2025-03-26 11:31:48 -07:00
Mateusz Zalega
1f910b7a22 Support "sample" filter action
This change adds support for packet sampling using "psample" kernel
module.
2025-03-26 11:10:41 -07:00
Dylan Reimerink
dc4f225935 Add OifIndex option for RouteGetWithOptions
The `RouteGetWithOptions` function currently has a `Oif` option which
gets translated from link name to link index via a `LinkByName` call.
This adds unnecessary overhead when the link index is already known.

This commit adds a new `OifIndex` option to `RouteGetWithOptions` which
can be specified instead of `Oif` to skip the internal link index
translation.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
2025-03-26 11:00:25 -07:00
Sebastiaan van Stijn
6f000f5d02 go.mod: github.com/vishvananda/netns v0.0.5
- Adding file path for nerdctl and finch

full diff: https://github.com/vishvananda/netns/compare/v0.0.4...v0.0.5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-26 10:54:39 -07:00
tc
31feb1b4c7 pedit: Fix EncodeActions to add TcGen for pedit action
TcGen was missing in pedit action and the kernel cannont correctly process pedit action.

Signed-off-by: Chen Tang <tangchen.1@bytedance.com>
2025-03-26 10:53:47 -07:00
Tim Rozet
9b61d26766 Add support for MTU Lock
When adding a route with "mtu lock <mtu>" path MTU discovery (PMTUD)
will not be tried and packets will be sent without DF bit set. Upon
receiving an ICMP needs frag due to PMTUD, the kernel will not install a
cached route and lower the MTU.

Signed-off-by: Tim Rozet <trozet@redhat.com>
2025-03-26 10:48:12 -07:00
Jordan Rife
0e7078ed04 netkit: Allow setting MAC address in L2 mode
Signed-off-by: Jordan Rife <jrife@google.com>
2025-03-03 14:47:20 -08:00
Daniel Borkmann
0af32151e7 vxlan: Fix parseVxlanData for source port range
binary.Read() != nil check means error case, so the vxlan.Port{Low,High}
are never populated. Fix the check.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2025-02-21 11:44:27 -08:00
Sven Rebhan
9f534ef909 fix: Use correct offset for unix socket diagnosis
Signed-off-by: Sven Rebhan <srebhan@influxdata.com>
2025-02-20 11:25:08 -08:00
Leon Hwang
655392bc77 Fix parsing 4-bytes attribute
What if the data length of attribute is 4? The attribute will be ignored,
because `i+4 < len(data)`.

Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
2025-02-09 08:26:17 -08:00
Daman Arora
62fb240731 conntrack: prevent potential memory leak
Currently, the ConntrackDeleteFilters captures all flow entries
it fails to delete and reports them as errors. This behavior
can potentially lead to memory leaks in high-traffic systems,
where thousands of conntrack flow entries are cleared in a single
batch. With this commit, instead of returning all the un-deleted
flow entries, we now return a single error message for all of them.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-02-06 09:46:18 -08:00
Albin Kerouanton
7c2350bd14 Add IFLA_PARENT_DEV_NAME / IFLA_PARENT_DEV_BUS_NAME to links
These attributes are supported since kernel v5.14 (see [1]). Here's
what iproute2 shows:

```
$ ip -d link show eth0
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65535 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    ... parentbus virtio parentdev virtio0
```

[1]: 00e77ed8e6

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-01-27 16:21:08 -08:00
Adrian Moisey
3642538757 Preserve results when NLM_F_DUMP_INTR is set
Similar to https://github.com/vishvananda/netlink/pull/1018, but for
ConntrackDeleteFilters()

Relates to https://github.com/kubernetes/kubernetes/issues/129562
2025-01-20 22:11:48 -08:00
Dylan Reimerink
86d2f69adc link_linux: Add deserialization of IFF_RUNNING flag
Add deserialization of the `IFF_RUNNING` link flag which translates to
`net.FlagRunning`.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
2025-01-20 22:07:01 -08:00
wangling94
68cf136ebe 1. filter match support vlanId and srcMac, dstMac.
2. filter action support vlan pop/push.
2025-01-16 11:56:41 -08:00
Dylan Reimerink
56a588b0cd .github/workflows: Bump CI Go version to v1.22
Update the Go version we test against to Go v1.22 which is currently the
oldest version still receiving security updates.

Signed-off-by: Dylan Reimerink <dylan.reimerink@isovalent.com>
2025-01-16 10:04:49 -08:00
WeidiDeng
391c850512 disable broadcast if broadcast is set to net.IPv4zero
remove comments about broadcast when deleting address

remove another comment about broadcast auto calculation
2025-01-09 19:51:00 -08:00
wangling142
26ee0e2abe 1. fix rule test failed when rule add slow. 2024-12-27 11:12:53 -08:00
Jordan Rife
976bd8de7d Add support for IFLA_NETKIT_SCRUB and IFLA_NETKIT_PEER_SCRUB
Link: https://lore.kernel.org/bpf/20241004101335.117711-1-daniel@iogearbox.net/T/#u
2024-10-21 20:13:24 -07:00