Commit Graph

101 Commits

Author SHA1 Message Date
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
Tobias Klauser
866f5f32e3 Fix TestLinkAddDelXfrmiNoId
Adding an xfrmi link with if_id 0 results in EINVAL being returned, see
[1]. Adjust TestLinkAddDelXfrmiNoId accordingly to expect an error.

[1] 8efd0d9c31/net/xfrm/xfrm_interface.c (L645-L648)

Fixes: f7fd7af437 ("Only set IFLA_XFRM_IF_ID if not 0")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2022-05-31 09:13:25 -07:00
Vishvananda Abrams
523ee65ce3 fix the tests to run again 2022-01-12 16:05:20 -06:00
Tobias Urdin
650dca95af Export LinkModify function
When the LinkModify was merged in [1] a function
that exports it outside of pkgHandle was never
added like is available for LinkAdd, LinkDel etc.

Update testing to use exported LinkModify that
itself calls the pkgHandle.LinkModify function.

[1] https://github.com/vishvananda/netlink/pull/541
2021-11-18 08:18:26 -08:00
张祖建
b8aac10bba fix staticcheck issues 2021-09-21 09:10:48 -05:00
TheDiveO
626202eca8 Provide handle Close() and deprecate Delete() 2021-09-18 09:03:48 -07:00
bersoare
7992ad9959 add support for bareudp link type 2021-09-17 10:14:18 -07:00
dennisafa
d1e684a60b Ability to set multicast attribute on a link 2021-05-30 12:51:51 +02: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
Moshe Litvin
88079d98e6 1. Fixed endianity probem with geneve VNI (ID)
2. Parse remote IP
3. Added unit test to test geneve paramters against "ip link"
2020-12-06 12:36:32 -08:00
Stephen Hassard
d185ffdb62 Add Geneve link support
Heavily based on the existing Gretap support
2020-11-21 23:35:49 -08:00
Jaime Caamaño Ruiz
02121dbd7e Add LinkSetMacvlanMode 2020-09-24 21:35:02 -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
Miguel Duarte Barroso
7484f55b22 tuntap: use the owner / group parameters
Set the tuntap owner / group via syscall on the opened file
descriptor.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
2020-09-14 10:54:17 -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
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
Daniel Gollub
12f2829c35 Add LinkModify support
Signed-off-by: Daniel Gollub <dgollub@att.com>
2020-06-03 11:55:45 -07:00
Alex Forster
27f2b32dc6 Configure numrxqueues/numtxqueues on veth peer (fixes #536) 2020-06-03 11:23:51 -07:00
stffabi
5f2fc868c2 Add BridgeSetVlanFiltering to change VlanFiltering on an existing bridge
Signed-off-by: stffabi <stffabi@pm.me>
2020-02-18 12:46:31 -05:00
Takushi Fujiwara
2ec5bdc52b Change LinkSetMaster's master argument type. (*Bridge -> Link)
LinkSetMaster also works with Bond device.
So this PR changes the type of master argument to Link.
2019-09-30 07:54:47 -07:00
Yakushi Fujiwara
ac5f4df047 Add support for parsing IFLA_BOND_ARP_IP_TARGET 2019-09-24 13:57:46 -07: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
bingshen.wbs
14bd2e6fd2 support ipvlan flag
Signed-off-by: bingshen.wbs <bingshen.wbs@alibaba-inc.com>
2019-07-25 03:37:08 +02:00
Anton Aksola
df01369528 add support for link groups (IFLA_GROUP) 2019-07-13 20:34:27 -07:00
Martynas Pumputis
99a56c251a veth: Set peer hardware addr when creating
This commit extends LinkAdd function for Veth by allowing to specify
peer hardware addr.

Signed-off-by: Martynas Pumputis <m@lambda.lt>
2019-06-18 07:33:17 -07:00
Sargun Dhillon
d50d15ce3f Set Link TX / RX Queues on Deserialization
This deserializes the tx queue, and rx queue count on link
deserialization. We already supported it on serialization.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
2019-06-12 19:02:44 -07:00
Archana Shinde
db99c040b9 tuntap: Return TunTapLink instead of GenericLink
For tuntap interfaces, return a TunTap Interface instead of
a Generic link when retrieving the interface.
Use netlink extended attributes to populate the Link attributes
for the tuntap link.
In case of older tun driver which does not provide these
attributes, use sysfs to retrieve these attributes.

This commit also adds Owner and Group attributes for the TunTap
Link.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2019-06-03 12:01:21 -07:00
soyking
fafc1e7b60 support vlan protocol 2019-05-03 14:23:34 -07:00
Andrei Vagin
adb577d4a4 Add support for IFLA_GSO_*
IFLA_GSO_MAX_SIZE - maximum GSO segment size
IFLA_GSO_MAX_SEGS - maximum number of GSO segments

Signed-off-by: Andrei Vagin <avagin@google.com>
2019-03-17 17:31:49 -07:00
Matt Ellison
1e2e7ab670 Add Support for Virtual XFRM Interfaces
XFRM interfaces are available in Linux Kernel 4.19+

When an IF_ID is applied to a XFRM policy and state, the corresponding
traffic will be sent through the virtual interface with the same IF_ID.
2019-01-05 11:40:40 -08:00
Julian Kornberger
023a6dafdc Make go vet happier 2018-11-08 14:21:39 -08:00
Div Arora
2cbcf73e3d Add a test for Vlan filtering support for bridges. 2018-07-23 11:15:57 -07:00
semicomplete
ee06b1df73 add vti6 support
Signed-off-by: semicomplete <example@example.com>
2018-06-19 08:48:34 -07:00
Peter Morjan
985ab95d37 Add support for link flag allmulticast
Equivalent to: ip link set <link> allmulticast <on|off>

Signed-off-by: Peter Morjan <peter.morjan@de.ibm.com>
2018-05-09 08:41:37 -07:00
Reinier Schoof
55d3a806a2 Added tests for Gretap/Gretun devices
fixed parsing IKey/OKey parameters for Gretun
fixed parsing Local/Remote parameters for Gretap and Gretun
removed irrelevant PMtuDisc parameter from IPv6 Gretaptest
2018-05-04 07:32:54 -04:00
eriknordmark
5f5d5cddcf Add a 'ListExisting' option to get the existing entries in the
route/addr/link tables as part of RouteSubscribeWithOptions,
AddrSubscribeWithOptions, and LinkSubscribeWithOptions.
2018-01-23 14:25:48 -08:00
Alessandro Boch
5a988e882d Support IPv6 GRE Tun and Tap
Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2018-01-19 09:48:20 -08:00
phob0s
54ad9e3a4c Two new functions: LinkSetBondSlave and VethPeerIndex 2017-12-14 09:34:45 -08:00
Alessandro Boch
a5d066db6e Fix LinkAdd for sit tunnel on 3.10 kernel
Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2017-11-27 17:43:54 -08:00
Manohar Castelino
c2a3de3b38 tuntap: Add multiqueue support
Add multi queue support to tuntap without breaking legacy users
of tuntap.

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2017-11-13 20:19:46 -08:00
Tomofumi Hayashi
e104583c52 Support num{tx,rx}queues and udp6zerocsum{tx,rx}
Add IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES in link attribute and
IFLA_VXLAN_UDP_ZERO_CSUM6_TX and IFLA_VXLAN_UDP_ZERO_CSUM6_RX in VXLAN
attribute.
2017-11-13 20:19:27 -08:00
Alessandro Boch
a47a543cef Allow to skip tests based on min kernel version required
Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2017-11-08 03:30:16 -08:00
Reinier Schoof
c29ba20204 added encapsulation attributes to Iptun
added encapsulation attributes to Gretun
implemented Sittun struct for supporting SIT tunnels
2017-10-26 09:48:08 -07:00
Ian Bishop
0e3b74dbe2 replace syscall with golang.org/x/sys/unix 2017-10-26 09:45:08 -07:00
Manohar Castelino
b7fbf1f529 Allow index specification at link creation time
Allow the caller to specify the desired link index at link creation.

This is equivalent to
ip link add link eth0 name testmacvtap index 1000 type macvtap
ip link add dummy1 index 1001 type dummy

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2017-10-26 09:40:18 -07:00
Vincent Bernat
c684918a4f Add more variant with options to subscribe functions
For link, address, route, add a `WithOptions` variant to the
`*Subscribe()` function to specify a namespace and an error
callback. Those options can be extended in the future without adding
more functions. For example, it could be possible to subscribe only
for a given family by adding a `Family` member to the appropriate
struct.

As a minor change, the private function is always suffixed by `At`,
since it was the case for route and raw netlink functions (but not for
address and link).
2017-09-24 11:01:49 -07:00
Zvi "CtrlZvi" Effron
933b978eae Add support for loading XDP programs with flags 2017-09-05 23:17:00 -07:00
Manohar Castelino
7d0c00f02e gre tunnel: Add support for gre tunnels
Add support for creating and managing gre tunnels.
This is equivalent to

Point to Point:
ip tunnel add tun4 mode gre local 192.0.2.1 remote 203.0.113.6 key 123

Point to Multipoint:
ip tunnel add tun8 mode gre local 192.0.2.1 key 1234

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2017-09-05 23:15:55 -07:00
Dan Winship
8a610f1e24 Add LinkSetTxQLen 2017-09-05 23:13:55 -07:00