Commit Graph

92 Commits

Author SHA1 Message Date
Yang Guan
41009d533b Read conntrack flow statistics
This PR allows populating per-connection packet and byte counts to
ConntrackFlow object when nf_conntrack_acct is enabled.
2018-03-16 14:29:24 -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
Sargun Dhillon
a2af46a09c Add FQ Codel 2018-02-05 10:22:15 -08:00
Sargun Dhillon
465b5fef28 Add Fq Qdisc support 2018-02-05 10:22:15 -08:00
Sargun Dhillon
1882fa99fc Add Matchall filter 2018-01-05 09:42:30 -08:00
Luke Granger-Brown
016ba6f67a Add support for managing source MACVLANs 2017-11-27 22:19:10 -08:00
Vishvananda Ishaya Abrams
63ca7e48f5 Support setting and retrieving route MTU/AdvMSS 2017-11-09 14:04:31 -08:00
Kentaro Ebisawa
eb7ed874fe Support LWTUNNEL_ENCAP_SEG6 2017-11-08 03:33:01 -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
Flavio Crisciani
ef2b2c42e6 Add test to cover recv on close leak
This test spawns a go routine that subscribe for some
events while the main thread will close the socket.
The go routine will returns after 5s when the timetout
on the recv fires and the fd is actually == -1

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-10-20 10:09:56 -07:00
Flavio Crisciani
6177f17de7 Add method to set netlink recv timeout
If the socket is closed the recv that are waiting for messages
are not woken up. The result especially for Subscribe socket is
most likely a go routine leak.
This commit introduces a method to set the timeout

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-10-20 10:09:56 -07:00
Zvi "CtrlZvi" Effron
933b978eae Add support for loading XDP programs with flags 2017-09-05 23:17:00 -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
Sibi Chakravarthy
aeeae373ad constant bug fix 2017-07-18 16:23:47 -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
Chun Chen
7593cff56f Add bridge vlan support 2017-06-13 11:04:51 -07:00
Aaron Lehmann
bd6d5de5cc nl: Use atomic load/store for fd field
This allows Close to be called concurrently with Receive without
triggering a data race.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-06-06 09:06:09 -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
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
Wataru Ishida
fe2e32c2fb Add support for generic netlink
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
Toke Høiland-Jørgensen
69df5c75fb addr: Parse address lifetime information from IFA_CACHEINFO attr
This adds parsing of the preferred and valid lifetime information from the
netlink IFA_CACHEINFO attribute. They are stored as PreferedLft and ValidLft in
the Addr struct if found.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2017-04-12 11:24:37 -07:00
Flavio Crisciani
24a3a2da61 Introduce Conntrack support
- Conntrack table FLUSH
- Conntrack table DELETE with filter
    The filter is only for IP field
- Conntrack table GET
  The flow information is not complete, but the method
  returns a simplified structure with basic flow info

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-04-05 16:02:07 -07:00
Alessandro Boch
c682914b0b Set SOCK_CLOEXEC when creating netlink socket
- So that the socket is not shared across execs

Signed-off-by: Alessandro Boch <aboch@docker.com>
2017-03-29 10:46:00 -07:00
ISHIDA Wataru
fe3b5664d2 support MPLS
$ ip -M route add 100 dev eth0
$ ip -M route add 100 as to 200/300 dev eth0
$ ip -M route add 100 nexthop dev eth0 as to 200 \
                      nexthop dev eth1 as to 300
$ ip route add 10.10.0.0/24 encap mpls 200/300 dev eth0
$ ip route add 10.0.0.0/24 nexthop encap mpls 200 dev eth0 \
                           nexthop encap mpls 300 dev eth1

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2017-02-20 12:07:19 -08:00
Aithal
dedc638a06 Fix compilation errors for non linux platforms.
The go get command and make both fail when executed on
non-linux platforms. Modified it so that there are no
compilation errors when developing in such an
environment.
2017-02-20 12:00:54 -08:00
Vishvananda Ishaya Abrams
a1d6c19f19 Fix build issue on linux/s390x
Fixes issue #194
2017-02-19 15:32:03 -08:00
Sebastien Boving
a3f0be6352 Add support for tcp diags. 2017-02-04 16:48:17 -08:00
Martynas Pumputis
43948793f6 Add support of ESN 2017-02-03 08:10:37 -08:00
Martynas Pumputis
3c27c1c1e3 Add XfrmAllocSpi 2017-02-02 13:02:12 -08:00
Martynas Pumputis
9a7970b3b6 Add XfrmMonitor
The implementation subscribes only to XFRMNLGRP_EXPIRE.
2017-02-02 12:58:44 -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
Vishvananda Ishaya Abrams
c750a61f18 Set rates higher than 32bit integers 2016-12-13 18:04:10 -08:00
JC Martin
9438c6ff27 Add support for VTI and IPIP 2016-11-22 17:06:50 -08:00
Nicolas PLANEL
8b4e34d697 [link] add Link Encapsulation Type in LinkAttr
Retreive the link type from Netlink GetLink information.
Aim to return the same value as nl-link-list for example :

gre0 gre <noarp,up,running,lowerup> slave-of NONE group 0 ipgre : gre0
gretap0 ether <broadcast,multicast> slave-of NONE group 0 ipgre : gretap0
dummy0 ether 36:d5:87:cf:eb:35 <broadcast,noarp> group 0
tun0 none <pointopoint,multicast,noarp> group 0
tap0 ether 4e:ce:43:4a:82:c2 <broadcast,multicast> group 0

Signed-off-by: Nicolas PLANEL <nplanel@redhat.com>
2016-11-03 19:52:05 -07:00
Brenden Blanco
fadc1088f6 Add support for xdp set/get of a bpf program (#156)
* Add netlink definitions for extra IFLAs
  The relevant IFLA_* are defined in the kernel but not in the syscall
  package.
* Parameterize the return value of loadSimpleBpf
  Allow the return value of the bpf program created by loadSimpleBpf to
  be specified by the caller. Before this, the value was hardcoded to 1.
* Add support for a new IFLA that enables using a bpf program as a
  filter early in the driver path of some NICs.
* Add a test for set/get of an xdp program. Since currently, the XDP
  IFLA is optional, check that the hardware supports it before trying to
  set the field.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
2016-08-25 11:08:23 -07:00
Alessandro Boch
fea1da6ef5 Allow to subscribe to events on a specfic netns (#142)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-06-29 11:11:35 -05:00
Alessandro Boch
2b8dd8b419 Add support for Authenticated Encryption with Associated Data (AEAD) (#147)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-06-29 11:10:41 -05:00
Alessandro Boch
734d02c3e2 Allow to specify netlink families for Handle (#143)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-06-20 09:25:15 -07:00
Guy Menanteau
293adec041 key len is arch dependant (ppc64 big endian build problem)
Key length used in DeserializeSerialise XfrmAlgo tests is
endianess dependant. Correction needed to have
TestXfrmAlgoDeserializeSerialize and
TestXfrmAlgoAuthDeserializeSerialize
pass ok on ppc64 arch (big endian).
2016-06-15 10:08:51 -07:00
Wataru Ishida
01c64f1d8a Support multipath (#134)
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-06-14 22:02:24 -07:00
Joe Farrell
5fbc8a02d1 Fixed typos in README and docstrings (#132) 2016-06-14 22:00:46 -07:00
Vish Ishaya
7995ff5647 add generic actions and simplify action type (#129) 2016-05-31 13:03:47 -07:00
Brenden Blanco
2ce23437df Invalidate NetlinkSocket fd after close (#125)
An issue happens when netlink.LinkSubscribe is called back to back, even
when there is a Close() of the netlink socket (via the done chan
parameter). The issue seems to stem from the fact that after the
close/open happen together, the same fd is allocated. This lets the
s.Receive() calls succeed in more than one goroutine, which causes the
updates to issue randomly since the same fd has multiple readers and the
original Subscribe never finishes.

After a Close(), mark the Socket as invalid (-1) so that calls to
Send()/Receive() will fail going forward.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
2016-05-23 15:44:24 -07:00
Alessandro Boch
b824519a9a Serialize Handle's sockets access (#124)
- So that the same handle can be used
  by multiple threads

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-18 10:21:46 -07:00
Alessandro Boch
f9bc7a684e Support xfrm state/policy flush (#122)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-13 16:42:24 -07:00
Alessandro Boch
14f41c27fa Provide netlink handle (#104)
- Ties to a netlink socket. All client requests
  will re-use same socket. Socket released at
  handle deletion.
- Also network namespace can be specified during
  handle creation. Socket will be opened on the
  specified network namespace.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-08 11:35:49 -07:00