Commit Graph

120 Commits

Author SHA1 Message Date
Ralph Schmieder
d85e18ed5b Allow Tuntap non-persist, allow empty tuntap name
chg: addtl comment and made minor logic optimization as disscussed in PR #296
chg: flipped Persist to NonPersist
chg: comments, only unpersist tuntap if flag is set
chg: tuntap persist optional, allow empty intfc name
chg: added conditional build
Signed-off-by: Ralph Schmieder <ralph.schmieder@gmail.com>
2018-07-16 09:40:17 -07:00
Piotr Skamruk
3e48e44812 Revert "RTEXT_FILTER_VF doesn't always work with dump request, fixes #354"
This reverts commit 028453c77c.
2018-07-05 15:07:35 -07:00
Semicomplete
028453c77c RTEXT_FILTER_VF doesn't always work with dump request, fixes #354 2018-06-23 12:29:17 -07:00
semicomplete
ee06b1df73 add vti6 support
Signed-off-by: semicomplete <example@example.com>
2018-06-19 08:48:34 -07:00
Flavio Crisciani
769bb84935 Adjust flags values
0 & something is 0, so remove the flag configuration
where it is not needed

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2018-05-10 08:45:32 -07:00
Piotr Skamruk
5f662e0500 Add info about VFs on link 2018-05-10 08:45:05 -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
Parav Pandit
aa0edbe0c9 Add support for setting InfininBand Node and Port GUID of a VF
Add support for setting InfiniBand Node and Port GUID address
configuration of a VF when InfiniBand HCA are used with SR-IOV mode.

Signed-off-by: Parav Pandit <parav@mellanox.com>
2018-03-26 21:49:05 -07:00
Tobias Klauser
5236321576 Use IFLA_* constants from x/sys/unix
The IFLA_* constants in in x/sys/unix were updated to Linux 4.15 in
golang/sys@88d2dcc510, so use these instead of locally duplicating
them.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2018-02-23 09:35:37 -08:00
Tobias Klauser
25d2c79295 Use IFF_MULTI_QUEUE from x/sys/unix to define TUNTAP_MULTI_QUEUE
Use the constant defined in the golang.org/x/sys/unix package instead of
locally open-coding it.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2018-02-13 08:20:21 -08: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
Zvi Effron
3ff4c21961 Don't overwrite the XDP file descriptor with flags 2017-12-17 10:59:09 -08:00
phob0s
54ad9e3a4c Two new functions: LinkSetBondSlave and VethPeerIndex 2017-12-14 09:34:45 -08:00
Luke Granger-Brown
016ba6f67a Add support for managing source MACVLANs 2017-11-27 22:19:10 -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
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
Sylvain Afchain
12728257a9 Fix index out of range when no metadata for gretap 2017-10-26 09:45:38 -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
Sylvain Afchain
b2de5d10e3 Add netnsid to link attrs 2017-10-20 10:18:20 -07:00
Julian Kornberger
619f36a9ae Convert if/else statements to switch 2017-09-24 11:05:26 -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
Vincent Bernat
46962a8c5d Optionally report subscription fatal errors to a callback function
When a fatal error happens in a `*Subscribe*()` function, the error
was not available to the user. We add a callback function that will be
invoked when such an error happens.

This also modifies the behavior of `AddrSubscribe*()` function to turn
parse errors into fatal errors, as it happens with the other functions.
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
Zvi "CtrlZvi" Effron
241d179eba Fix failing XDP test
On newer linux kernels (4.12), netlink rejects a request to set an XDP
program with flags set to 0. Instead, flags need to not be specified if they
are 0.
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
Parav Pandit
06ccf872a2 Corrected library function to have Vf prefix
Corrected function signature to have correct name LinkSetVfTrust
instead of LinkSetTrust.
This aligns with code comment and rest of the other VF functions.

Signed-off-by: Parav Pandit <parav@mellanox.com>
2017-08-07 21:21:46 -07:00
Parav Pandit
70cf3c74a8 Add support for setting trust state of a VF
Add support for setting trust state of a VF. This allows restricting
certain operations on VF when its untrusted such as disabling
promiscuous mode.

Signed-off-by: Parav Pandit <parav@mellanox.com>
2017-08-07 09:10:47 -07:00
Parav Pandit
a956595377 Add support to set spoof check attribute for VF
Add support to enable/disable spoof check for a VF

Signed-off-by: Parav Pandit <parav@mellanox.com>
2017-08-01 18:23:44 -07:00
Tobias Klauser
8c5a115d79 Add support for IFLA_XDP_PROG_ID
Allow to get IFLA_XDP_PROG_ID which will be part of Linux kernel 4.13+.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-07-09 20:04:06 -07:00
Thomas Graf
4e28683688 link: Add support for IFLA_*_COLLECT_METADATA
- Implemented for VXLAN and GRE via a flag `FlowBased`
- Added unit tests to verify ability

Signed-off-by: Thomas Graf <tgraf@tgraf.ch>
2017-06-13 11:05:35 -07:00
Stuart McLaren
7bd45e5974 Add extra bond parameters
Add bond parameters corresponding to:

* IFLA_BOND_AD_ACTOR_SYS_PRIO
* IFLA_BOND_AD_USER_PORT_KEY
* IFLA_BOND_AD_ACTOR_SYSTEM
* IFLA_BOND_TLB_DYNAMIC_LB

These are available in new(ish) kernels.
2017-05-31 12:03:01 -07:00
Mohamed Elawadi
7d9b424492 link-add: support hardware address 2017-05-31 12:01:59 -07:00
Anirudh Aithal
99091d8440 add a named error when links are not found
A new error type LinkNotFoundError is returned instead
of the default error type to facilitate better error
handling by downstream consumers of this package
2017-05-24 13:54:39 -07:00
Wataru Ishida
58c32ae2d7 Add support for GPRS Tunnelling Protocol(GTP)
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2017-05-06 23:07:19 -07:00
Tobias Klauser
90380e4b76 Add support for IFLA_XDP_FLAGS
Allow to get/set IFLA_XDP_FLAGS which is part of Linux kernel >= 4.10.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-05-06 23:05:39 -07:00
Craig Furman
2632e243fb Can set some bridge flags
* Multicast snooping and hello time are the only ones supported at the
  moment
* Only pass values to kernel when user sets them, otherwise let kernel
  decide default
* Can set multicast snooping on existing bridges
* Tests disabled on Travis CI as the kernel version is too old
* All bridge flags copied from Kernel code, but only the two mentioned
  above work
  (5a7ad1146c/include/uapi/linux/if_link.h (L232-L281))

Signed-off-by: Petar Petrov <pppepito86@gmail.com>
Signed-off-by: Ed King <eking@pivotal.io>
Signed-off-by: Konstantinos Karampogias <konstantinos.karampogias@swisscom.com>
Signed-off-by: Will Martin <wmartin@pivotal.io>
2017-04-25 08:25:47 -07:00
David J. Wilder
b71e0bb214 Add support for BR_PROXYARP and BR_PROXYARP_WIFI.
Bridge ports can be set to use the proxy arp features by calling
either LinkSetBrProxyArp() or LinkSetBrProxyArpWiFi().

Signed-off-by: David Wilder <wilder@us.ibm.com>
2017-04-22 12:52:14 -07:00
Daniel Nardo
838b9b5fcb Set the change flags to IFF_PROMISC instead of IFF_UP on the SetPromiscOn/Off functions. 2017-04-22 12:51:05 -07:00
Stuart McLaren
40e43c1d63 Ensure bond settings are populated correctly
Currently a LinkByName("bondX") doesn't return the bond specific attributes.

parseBondData needs to update the link that is passed in in order for
the bond's Mode, Miimon etc to be populated correctly.
2017-04-12 10:36:44 -07:00
David McClure
6c782366d2 Add LinkSetARPOff and LinkSetARPOn
Signed-off-by: Jay Dunkelberger <ldunkelberger@pivotal.io>
2017-03-21 02:39:47 -07:00
Sebastien Boving
a3f0be6352 Add support for tcp diags. 2017-02-04 16:48:17 -08:00
Alessandro Boch
ebdfb74020 Return 64 bits link statistics
Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-01-17 08:21:17 -08:00
kishiguro
ade05d5c8f Add support for VRF. With this change we can create VRF interface.
$ sudo ip link add vrf1 type vrf table 1
2017-01-05 13:05:17 -08:00
Shaun Crampton
7a823e360e Parse the IFLA_OPERSTATE flag and recort in the link attributes. (#180)
The operstate gives the best picture of whether the interface is really up.
2016-12-09 14:08:27 -08:00