Commit Graph

584 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
Alessandro Boch
a2ad57a690 Add changelog file, initial release tagging
Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2018-03-15 21:46:22 -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
Alessandro Boch
d35d6b58e1 Clarify ESN bitmap length construction logic
Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2018-02-06 12:37:32 -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
c27b7f7359 Run gofmt -s -w on the project 2018-02-01 10:46:57 -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
Anatole Denis
7291c36428 addr_linux: Implement CacheInfo installation
Currently, Validity and preference information values are ignored in
addrHandle. This adds them to the netlink message when they are passed
by the caller
2018-01-17 12:00:10 -08:00
Anatole Denis
422ffe659e addr_linux: Skip BROADCAST and LABEL for non-ipv4
The attributes IFA_BROADCAST and IFA_LABEL are only valid for ipv4: they
are not defined for ipv6 here:
http://elixir.free-electrons.com/linux/v4.6/source/net/ipv6/addrconf.c#L4231

This ignores addr.Broadcast and addr.Label for non-ipv4 addresses.
2018-01-17 12:00:10 -08:00
Sargun Dhillon
1882fa99fc Add Matchall filter 2018-01-05 09:42:30 -08:00
Sargun Dhillon
7b4c06360e Update bpf_linux.go 2018-01-05 09:30:10 -08:00
pritesh
ad19ca1a4c netlink: allow non linux builds to pass. 2017-12-23 18:05:36 -08:00
Zvi Effron
3ff4c21961 Don't overwrite the XDP file descriptor with flags 2017-12-17 10:59:09 -08:00
Christopher Koch
d4235bfaae Eliminate cgo from netlink.
Signed-off-by: Christopher Koch <chrisko@google.com>
2017-12-14 16:46:25 -08:00
phob0s
54ad9e3a4c Two new functions: LinkSetBondSlave and VethPeerIndex 2017-12-14 09:34:45 -08:00
Alessandro Boch
f67b75edbf Properly tear down netns at the end of test
Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2017-11-28 09:08:21 -08:00
Luke Granger-Brown
016ba6f67a Add support for managing source MACVLANs 2017-11-27 22:19:10 -08:00
Alessandro Boch
6e7bb56ca4 Run TestSocketGet in dedicated netns
Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2017-11-27 17:51:57 -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
Alessandro Boch
8bead6f932 Add requirements to conntrack tests
Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2017-11-27 15:51:29 -08:00
Sylvain Baubeau
9ce265f69e Retrieve VLAN and VNI when listing neighbour 2017-11-27 13:38:43 -08:00
Alessandro Boch
fad79cbcae Fix go build issue for fou code
Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2017-11-27 11:05:30 -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
bdf753e87c added support for Foo-over-UDP netlink calls
Signed-off-by: Reinier Schoof <reinier@skoef.nl>
2017-11-13 12:13:59 -08:00
yandd
aa48b8cff0 Fix CalcRtable array parameter bug 2017-11-13 09:27:51 -08:00
Vishvananda Ishaya Abrams
63ca7e48f5 Support setting and retrieving route MTU/AdvMSS 2017-11-09 14:04:31 -08:00
Vishvananda Ishaya Abrams
f7e518d6f0 add missing log import 2017-11-08 03:42:16 -08:00
Kentaro Ebisawa
eb7ed874fe Support LWTUNNEL_ENCAP_SEG6 2017-11-08 03:33:01 -08:00
Alessandro Boch
6174cd873f Support invert in ip rules
Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2017-11-08 03:31:45 -08:00
Alessandro Boch
ae21927b7c Exclude linux specific test code from running on other platforms
Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2017-11-08 03:30:50 -08:00
Alessandro Boch
09a46322b2 Properly use Skip() function, add -test.v when running tests
- No need to separately log the skip message

Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2017-11-08 03:30:16 -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
Alessandro Boch
71fa81e220 Expose xfrm state's current and window statistics
- aggregate window stats with packet counter stats

Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
2017-10-29 20:38:38 -07: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
Vincent Bernat
808afc82b2 handle: ability for force receive buffer size
This uses `SO_RCVBUFFORCE` instead of `SO_RCVBUF`. This requires to be
root and Linux 2.6.14.
2017-10-20 10:10:50 -07:00
Vincent Bernat
ef84ebb87b handle: get/set receive buffer size
When receiving a lot of route changes (10,000 routes are enough), the
default receive buffer size (value of
`/proc/sys/net/core/rmem_default`) is too small and we get a `ENOBUF`
error. A user may want to increase the buffer size up to the value of
`/proc/sys/net/core/rmem_max` (by default, this is the same value). A
`SetSocketReceiveBufferSize()` function is provided to this
destination.

Possible improvements:

 1. automatically increase receive buffer size in higher level
    functions until we hit a maximum (get an error and/or the current
    value is smaller than expected)

 2. accept a "force" argument to use `SO_RCVBUFFORCE` to increase the
    value over `rmem_max` value
2017-10-20 10:10:50 -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
Trevor Rosen
177f1ceba5 Move consts to Linux-specific file
Fixes #243
2017-09-24 11:05:54 -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