Commit Graph

410 Commits

Author SHA1 Message Date
Sean Karlage 9eab419334 Netlink: Fix Darwin build
Having fou.go build only for linux breaks builds for darwin:
```
$ go build main.go
src/github.com/vishvananda/netlink/fou_unspecified.go:5:15: undefined: Fou
src/github.com/vishvananda/netlink/fou_unspecified.go:9:15: undefined: Fou
src/github.com/vishvananda/netlink/fou_unspecified.go:13:26: undefined: Fou
```

Instead, build fou.go for all platforms since it doesn't have platform-specific code:
```
$ go build main.go
$ ./main
not implemented
```
2018-07-30 08:32:48 -07:00
Div Arora 2cbcf73e3d Add a test for Vlan filtering support for bridges. 2018-07-23 11:15:57 -07:00
Div Arora 0bbc55bea9 Initial support for vlan aware bridges. 2018-07-23 11:15:57 -07:00
Casey Callendrello 3ac69fdec7 Add network namespace ID management.
Adds the ability to set and retrieve network namespace IDs. This is
useful, for example, for determining the "other side" of a veth pair.
2018-07-19 10:40:23 -07:00
Parav Pandit d68dce480e Ingress qdisc add/del Test case 2018-07-17 08:26:44 -07:00
Francis Begyn 1006cf4f24 Implementation of HFSC
Testing and functionality for the use of HFSC has been implemented.
The use of service curves is implenented closely as to how they behave
with the TC implementation.
Automated checks and testing were succesful.
2018-07-16 12:14:02 -07:00
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
James O. D. Hunt d77c86a2e2 protinfo: Check if object is nil
Avoid segfaults in certain environments by checking if the Stringer
interface pointer receiver function is `nil` and return "<nil>" in
those scenarios.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-07-06 09:00:30 -07:00
Piotr Skamruk a06dabf159 Increase size of receive buffer
Closes #354

Previous attemt to fix #354 was only hiding a true issue with too small
buffer to pick up the message from kernel.
According to https://github.com/vishvananda/netlink/issues/354#issuecomment-401559441
such situation could occur not only during dump of VF list, but also
 * statistics
 * tc rules and tc filters
 * large conn track dump
 * rdma resource details dump for debugging
or any other place where kernel can return more data than default (4kB)
sized buffer could hold.

iproute2 in this case for rtnl_dump_filter_l has buffer with size of
16kB, but we don't have distinction between different receiving funcs,
so I'm proposing to stick with original issue cause finder (kudos to
Parav Pandit aka paravmellanox) who is proposing 64kB as a buffer size.
2018-07-05 15:07:35 -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
semicomplete b1cc70dea2 fix prefixlen/local IP, incl. PtP addresses
From libnl addr.c comment:
IPv6 sends the local address as IFA_ADDRESS with no
IFA_LOCAL, IPv4 sends both IFA_LOCAL and IFA_ADDRESS
with IFA_ADDRESS being the peer address if they differ

But obviously, IPv6 sends IFA_LOCAL in case of PtP.

From iproute2 manual:
If a peer address is specified, the local address
cannot have a prefix length. The network prefix is
associated with the peer rather than with the local
address.
2018-06-17 08:27:03 -07:00
Francis Begyn 7c0b5944a3 Implemented String() for netem, fq and fq_codel in qdisc 2018-05-15 08:54:30 -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
Kentaro Ebisawa 16769db002 Support LWTUNNEL_ENCAP_SEG6_LOCAL (including tests) 2018-05-08 09:50:31 -07:00
Kentaro Ebisawa b7f066956c Add test to Add/Del IPv6 route. 2018-05-04 07:33:55 -04: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
Kentaro Ebisawa f07d9d5231 Run both Inline/Encap mode in TestSEG6RouteAddDel 2018-05-01 15:34:56 -07:00
Parav Pandit 1970aef3ab Add RDMA netlink socket for RDMA device information
This patch adds very basic support for getting information about RDMA
networking device; starting with device index, name, firmware version,
node GUID and system image GUID.
This is done through RDMA netlink socket.

RDMA devices are some what similar to Ethernet devices.
However there are few major differences between them.
RDMA devices usually have one or two ports, unlike Ethernet devices.
Each port has its own attributes, state and network addresses which are
different than Ethernet devices (Link and LinkAttrs). They almost don't
overlap with Link and LinkAttrs.

Therefore it doesn't derive Link and LinkAttrs structure; instead they
are represented using RdmaLink and RdmaLinkAttrs.

RdmaLink represents a RDMA device containing its attributes.
All Rdma device communication occurs through rdma subsystem's netlink
socket.

Signed-off-by: Parav Pandit parav@mellanox.com
2018-04-28 17:02:23 -07:00
Taku Fukushima dc00cf9d5c Add Hash to U32
This patch adds "Hash" attribute that represents the ID of the hash
table with which the filter is associated to U32 struct. If the hash
table is not created yet, a new hash table is created with the
specified ID.

Signed-off-by: Taku Fukushima <taku@soracom.jp>
2018-04-19 09:01:18 -07:00
Taku Fukushima 23a36f223d Add Divisor to U32
This patch adds "Divisor" attribute that represents the divisor of the
hash table buckets to U32 struct.

With "Divisor" attribute, only a hash table without its associated
filters can be created. This new capability allows users to construct
the more flexible filter configurations with the hash table that has
the divisor greater than 1, for instance.

Although a hash table is created through the same interfaces as the
filters, it cannot be listed or deleted though the same interfaces as
the filters at this moment. Only real filters can be listed with
FilterList and deleted with FilterDel.

Signed-off-by: Taku Fukushima <taku@soracom.jp>
2018-04-19 09:01:18 -07:00
Taku Fukushima 85aa3b74a4 Add statistics to class attributes
This patch adds ClassStatistics, a struct that represents the stats
of a class based on genric networking stats for netlink, to ClassAttrs.
The parsers for rtattrs in type of TCA_STATS and TCA_STATS2 are
introduced as well and the stats are appropriately parsed as a part
of ClassAttrs struct.

The practical tests for stats are not contained in this patch yet since
it requires the actual packet sending/receiving in the random timing,
which makes the tests complicated and flaky. Once we figure it out how
to test them in the proper way, they shall be added.

Signed-off-by: Taku Fukushima <taku@soracom.jp>
2018-03-27 21:08:57 -07: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
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