110 Commits

Author SHA1 Message Date
Ivan Tsvetkov 4e69fae463 openvswitch: add OpenvSwitch and OpenvSwitchSlave link models
Signed-off-by: Ivan Tsvetkov <ivanfromearth@gmail.com>
2026-03-09 18:08:59 -07:00
Patryk Diak ab2b1904dc Add support for VXLAN VNI filtering
Implement bridge VNI filtering operations (add/delete/list) for VXLAN
devices with VniFilter enabled. This allows managing VNI filters via
RTM_NEWTUNNEL/RTM_DELTUNNEL/RTM_GETTUNNEL netlink messages.

Equivalent to iproute2 bridge commands:
- bridge vni add dev DEV vni VNI[-VNIEND]
- bridge vni del dev DEV vni VNI[-VNIEND]
- bridge vni show

Reference implementation:
https://github.com/iproute2/iproute2/blob/main/bridge/vni.c

Signed-off-by: Patryk Diak <pdiak@redhat.com>
2026-02-06 08:17:44 -08:00
Alasdair McWilliam cd3cb2e12c link_linux: Add generic Headroom and Tailroom attributes.
Introduce generic IFLA_HEADROOM and IFLA_TAILROOM values that are appropriately
deserialised when querying link details via RTNL.

Netkit-specific variables that allow setting of driver-specific attributes have
been renamed to avoid ambiguity.

Signed-off-by: Alasdair McWilliam <alasdair.mcwilliam@isovalent.com>
2025-09-26 08:50:43 -07:00
Giuseppe Ognibene 481da0d6a4 Add support for ignore-df flag in gretap links
Signed-off-by: Giuseppe Ognibene <ognibenegiuseppe8@gmail.com>
2025-09-04 12:31:30 -07:00
Alasdair McWilliam cf66e1d224 link: netkit: Add support for Headroom and Tailroom attributes.
IFLA_NETKIT_HEADROOM and IFLA_NETKIT_TAILROOM attributes were added to
upstream kernel 6.14, allowing Netkit devices to be configured with
appropriate headroom/tailroom space to accommodate additional headers,
packet length changes and so forth.

Signed-off-by: Alasdair McWilliam <alasdair.mcwilliam@isovalent.com>
2025-08-29 15:42:34 -07:00
Gwendolyn 17daef607c vlan: add support for flags and qos maps
Signed-off-by: Gwendolyn <me@gwendolyn.dev>
2025-05-09 11:59:25 -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
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
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
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]: https://github.com/torvalds/linux/commit/00e77ed8e64d5f271c1f015c7153545980d48a76

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2025-01-27 16:21:08 -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
Etienne Champetier 65a253d375 link_linux: add support for IFLA_MACVLAN_BC_QUEUE_LEN(_USED)
Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
2024-08-15 09:19:21 -07:00
Hu Jun b7b7ca8632 add group_fwd_mask support for bridge and bridge port 2024-07-03 13:06:37 -07:00
Lorenz Brun dd7e3f1b2a Add missing bond hash policy VLAN_SRCMAC
Linux added a new bond transmit hashing policy, VLAN_SRCMAC in [1],
available since Linux 5.12. Add this hashing policy into the respective
data structures.

[1] https://github.com/torvalds/linux/commit/7b8fc0103bb51d1d3e1fb5fd67958612e709f883
2024-07-03 12:49:13 -07:00
Lorenz Brun 306ce7b5b2 Add field for permanent hardware address
Linux 5.6 and higher support IFLA_PERM_ADDRESS, which contains the
permanent hardware address of the interface if an interface has such an
address. This can be used to identify interfaces even when the normal
hardware address has been changed.

Signed-off-by: Lorenz Brun <lorenz@monogon.tech>
2024-03-29 14:43:07 -07:00
konradh 0e685ffcfc link: add don't fragment support to Geneve 2024-03-20 14:21:27 -07:00
konradh 9453b0562a link: add INNER_PROTO_INHERIT support for Geneve 2024-03-20 14:21:27 -07:00
Sebastian Sch a008cbde48 Add support for alternative names
This commit add the support for alternative names.

* exposing the attributes in the link object.
* adding the add and delete functions
* allow LinkByName() to also find devices by altname like `ip link`

Signed-off-by: Sebastian Sch <sebassch@gmail.com>
2024-02-20 15:41:36 -08:00
tc f1333cd79a support netkit
netkit device is merged to Linux upstream:
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=22360fad5889cbefe1eca695b0cc0273ab280b56

this PR add support to manage a netkit device in Golang

authored-by: tangchen <tangchen.1@bytedance.com>
2023-11-27 10:22:01 -08:00
Marcelo Guerrero 63484bbf69 Add support to manage the vlan protocol on a vf
This allows users to get and set the vlan protocol on a vf
Signed-off-by: Marcelo Guerrero <marguerr@redhat.com>
2023-09-05 08:20:06 -07:00
Robin Gögge 88c0defd46 Add FlowBased support for Ip6tnl
Ip6tnl devices support IFLA_IPTUN_COLLECT_METADATA (collect_md/external
mode). This commit adds support for this and a respective test.

Signed-off-by: Robin Gögge <r.goegge@isovalent.com>
2023-07-14 14:08:02 +02:00
Daniel Borkmann a8a91c0504 link: add TSOMaxSize and TSOMaxSegs to link attributes
This is a read-only netlink attribute which has been added in 5.19
kernel. This is useful to query in order to probe if a given driver
supports IPv6 BIG TCP.

  [0] https://lore.kernel.org/netdev/20220513183408.686447-2-eric.dumazet@gmail.com/

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2023-06-16 08:52:39 -07:00
Daniel Borkmann 2b008399a4 link: add LinkSetGSOIPv4MaxSize and LinkSetGROIPv4MaxSize
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>
2023-06-14 23:26:06 -07:00
Marcelo Guerrero Viveros 55c8b9515a Add support for setting default vlan on a bridge
This pr allows to change the default vlan on a bridge. It is
currently set to 1 by default. A value of 0 means no default vlan.

Signed-off-by: Marcelo Guerrero Viveros <marguerr@redhat.com>
2023-04-20 10:47:44 -07:00
Eyal Birger 7e7feb220f link: Add FlowBased support to Gretun
GRE L3 devices support "FlowBased" ("collect_md"/"external") mode.
Add support for this configuration and relevant test.

Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
2022-08-02 12:16:27 +02:00
Nikolay Aleksandrov c94808a88b link: add support for IFLA_GRO_MAX_SIZE
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>
2022-06-02 16:02:03 -07:00
Tao Li f24382625b add proto field to Iptun 2022-02-17 12:20:32 -06:00
conjones 76d8bfe0aa Adds ip6tunnel encap types, encap flags, and flags 2022-01-12 19:00:49 -06:00
bersoare 7992ad9959 add support for bareudp link type 2021-09-17 10:14:18 -07:00
Dennis Afanasev 21f2c55a77 Add PHYS_SWITCH_ID attribute to LinkAttrs 2021-07-03 11:55:58 +02:00
dennisafa d1e684a60b Ability to set multicast attribute on a link 2021-05-30 12:51:51 +02:00
Riccardo Manfrin af1e63ea7b Adds vrf slave link slave data parse 2021-05-10 07:22:18 -07:00
Bjorn Svensson 6063cc66d7 Add allmulti to link attributes
Provide the status of the allmulticast option via the highlevel
link attributes instead of requiring raw flag handling.

Avoid comparing all rawflags before and after in tests due to that
the IFF_RUNNING flag might change independenly.

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
2021-05-08 09:10:00 -07:00
Wei Yang aa68aabe05 Add ipvtap link support
ipvtap is a similar link type as ipvlan with tap interface.

This patch enables it just like macvtap.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
2021-05-08 08:48:48 -07:00
Riccardo Manfrin ec93726159 Adds strings translation methods
RTPROT_KEEPALIVED is commented to interop with earlier go versions (1.13, 1.14)
2021-03-04 14:52:04 -08:00
Stephen Hassard d185ffdb62 Add Geneve link support
Heavily based on the existing Gretap support
2020-11-21 23:35:49 -08:00
lmbsog0 c7261bd9e0 add support for CAN 2020-11-20 12:42:29 -08:00
Riccardo Manfrin 8b655377ac Allows direct usage of String() method 2020-11-19 09:59:55 -08:00
root e30b76407c VF stats struct and deserialization method added. VfStats now reported in the VfInfo struct
Co-authored-by: PatrickKutch <patrick.kutch@gmail.com>
2020-10-19 15:29:26 -04:00
Konstantin Baranov 337442361b Allow placing veth peer into a namespace
Creating a veth pair across namespaces now is a multistep process.
Doing it in one shot with this change is clearer as current
namespace never sees peer IF. Also, moving peer into a namespace
may be rather slow, so better avoided.
2020-09-14 10:57:23 -04:00
Dennis Marttinen 9690c54307 Add support for configuring bridge ageing time
Signed-off-by: Dennis Marttinen <dennis@weave.works>
2020-09-14 10:49:43 -04:00
Julian Kornberger 01e0a49c1f Add additional fields to link.Ip6tnl
and optimize aligment of Sittun fields
2020-09-14 10:42:05 -04:00
Sylvain Baubeau fe26ba2db0 Set default values for link attributes
When deserializing a link related netlink message, if no network namespace id
attribute is specified, we need to set it to -1 otherwise it defaults to 0
which is a valid id. Using NewLinkAttrs sets the default values and allows
the user to distinguish an empty value from a missing value
2020-09-14 10:41:08 -04:00
Dmitrii Okunev dc0e1b988c feature: Add wireguard link type
Added type "Wireguard" which implements link type "wireguard".

See also https://www.wireguard.com/

Signed-off-by: Dmitrii Okunev <xaionaro@fb.com>
2020-06-04 09:01:02 -07:00
Konstantin Belyalov b2372689b9 Save XDP attach mode into LinkXdp. 2020-01-27 15:47:19 -08:00
Oleg Senin 6b3a223c53 Add ip6tnl support 2019-09-24 13:56:29 -07:00
Takushi Fujiwara 205a160d2e Add bond slave information
This PR refers to PR@lebauce and add some changes.
- Added some tests to retrieve bond slave information.
- Link.BondSlave is changed to LinkSlave interface.
- BondSlaveState.String() returns UPPER case. (same as iproute2)
- BondSlaveMiiStatus.String() returns UPPER case. (same as iproute2)
2019-09-16 08:52:39 -07:00
Adrian Chiris 46ae81cf70 Add support for IPoIB interfaces
- Add a new Link type, IPoIB, that exposes the following IPoIB attributes:
    * IFLA_IPOIB_PKEY
    * IFLA_IPOIB_MODE
    * IFLA_IPOIB_UMCAST
- Suppport Deserialize for IPoIB link attributes in LinkDeserialize()
- Support IPoIB attributes in LinkAdd()
2019-08-12 04:46:40 -07:00
Adrian Chiris 28720742a4 Add support for IFLA_VF_RATE
Today netlink package supports Get/Set of a VF's max TX rate
via IFLA_VF_TX_RATE netlink attribute.

This patch add support to Get/Set of a VFs min and max TX rate
via IFLA_VF_RATE netlink attribute.

- Add support to set min/max tx rate for VF via IFLA_VF_RATE
- Added IFLA_VF_RATE min/max tx rate attributes to netlink.VfInfo
  including parsing support in netlink.parseVfInfo()

NOTE: According to [1] IFLA_VF_RATE takes precedence over
      IFLA_VF_TX_RATE. Dealing with the co-existance of these
      netlink attributes is left for the user to handle.

[1]https://lists.openwall.net/netdev/2014/05/22/42
2019-07-25 03:38:53 +02:00
bingshen.wbs 14bd2e6fd2 support ipvlan flag
Signed-off-by: bingshen.wbs <bingshen.wbs@alibaba-inc.com>
2019-07-25 03:37:08 +02:00