Commit Graph

557 Commits

Author SHA1 Message Date
Parav Pandit 22c099edb4 Add devlink port add delete APIs
Add APIs to add and delete a devlink port of specified flavour for a
given devlink device.

Extended test to accept devlink device and sf number parameters from the
test command line.

Signed-off-by: Parav Pandit <parav@nvidia.com>
2021-05-08 09:00:34 -07:00
Parav Pandit 83b6143251 Extend devlink port for function attributes
Extend devlink port for optional port function attributes.

Signed-off-by: Parav Pandit <parav@nvidia.com>
2021-05-08 09:00:34 -07:00
Wei Yang aa68aabe05 Add ipvtap link support
ipvtap is a similar link type as ipvlan with tap interface.

This patch enables it just like macvtap.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
2021-05-08 08:48:48 -07:00
Hasan Mahmood 66ddd91f7d Add route get iif option 2021-05-08 08:48:35 -07:00
Vishvananda Abrams e838b0f0e0 Update travis and fix formatting errors 2021-04-21 13:45:44 -05:00
Michael Cambria f5de75959a Remove "=======" characters left over from merge
Signed-off-by: Michael Cambria <mcambria@redhat.com>
2021-03-30 08:40:13 -07:00
Michael Cambria 0a32cffaf5 New RouteAddEcmp() call to allow a prefix to be added when one
already exists via a different interface.

Fixes https://github.com/vishvananda/netlink/issues/620

Signed-off-by: Michael Cambria <mcambria@redhat.com>
2021-03-27 13:26:27 -07:00
Anonymous 3b8f3fd48d Make IPSet actually support IPs, and fix protocol errors for newer kernels 2021-03-27 13:25:07 -07:00
John Fastabend 66fce01bfa netlink: xfrm, add optional field to XfrmPolicyTmpl
Add optional field in XfrmPolicyTmpl to template code so users can
configure template optional values.

Tested via:

    $ go test -exec sudo . -run XfrmPolicyWithOptional
    ok      github.com/vishvananda/netlink  0.009s

Co-authored-by: Joe Stringer <joe@cilium.io>
Signed-off-by: Joe Stringer <joe@cilium.io>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
2021-03-24 16:00:33 -07:00
Joe Stringer c21bda41e9 Fix non-linux build
Commit ec93726159 ("Adds strings translation methods") broke non-Linux
builds by relying on unix constants that are only declared on the linux
platform in the upstream x/sys/unix package.

Other platforms report undefined variables, such as the following:

  $ GOOS=darwin go build .
  # github.com/vishvananda/netlink
  ./route.go:17:7: undefined: SCOPE_UNIVERSE
  ./route.go:19:7: undefined: SCOPE_SITE
  ./route.go:21:7: undefined: SCOPE_LINK
  ./route.go:23:7: undefined: SCOPE_HOST
  ./route.go:25:7: undefined: SCOPE_NOWHERE
  ./route.go:55:7: undefined: unix.RTPROT_BABEL
  ./route.go:57:7: undefined: unix.RTPROT_BGP
  ./route.go:59:7: undefined: unix.RTPROT_BIRD
  ./route.go:61:7: undefined: unix.RTPROT_BOOT
  ./route.go:63:7: undefined: unix.RTPROT_DHCP
  ./route.go:63:7: too many errors

Move the platform-specific implementations to platform-specific files
and add stubs to satisfy other platforms.

Fixes: ec93726159 ("Adds strings translation methods")
Signed-off-by: Joe Stringer <joe@cilium.io>
2021-03-16 07:45:50 -07:00
yaocw2020 c30d9bc9e7 Add ip route append
Signed-off-by: yaocw2020 <yaocanwu@gmail.com>
2021-03-15 00:21:01 -07:00
Ivan Milchev 2dd616d00b implemented handling of uint64 for HTB class rate/ceil 2021-03-09 16:12:16 -08:00
Zhiyuan Hou 3bf47faadc support u32 link option
Signed-off-by: Zhiyuan Hou <zhiyuan2048@linux.alibaba.com>
2021-03-05 07:50:18 -08:00
Riccardo Manfrin ec93726159 Adds strings translation methods
RTPROT_KEEPALIVED is commented to interop with earlier go versions (1.13, 1.14)
2021-03-04 14:52:04 -08:00
arthurchiao 9de6d08565 Allow to set/get netlink socket timeout for default handle
Ref: #613

Signed-off-by: arthurchiao <arthurchiao@hotmail.com>
2021-02-17 20:27:53 -08:00
Julian Kornberger 6ffafa9fc1 Improve attribute parsing
This improves dealing with invalid input data.
2020-12-30 21:45:07 -08:00
Paul Chaignon 7f66fb2805 Support mask for XfrmState's output mark
XfrmState currently doesn't allow setting the mask for the output mark.
As a result, setting an output mark always clears all bits. This commit
adds support for the mask value.

Signed-off-by: Paul Chaignon <paul@cilium.io>
2020-12-30 07:19:35 -08:00
Moshe Litvin 77e4d032a0 Allow building on non-linux machine 2020-12-28 10:31:32 -08:00
Sargun Dhillon a67bebfcc8 Add support for addition FQ Codel knobs
These knobs are supported in recent kernels, and are useful for tuning
in the datacenter.
2020-12-28 10:28:43 -08: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
Ahmet OZER f2f0bfd10a Fix Geneve remote ipv4 attr 2020-12-05 19:47:00 -08:00
Steve Shaw fbe60771a0 Adding support for RTA_VIA
Signed-off-by: Steve Shaw <shaw38@gmail.com>
2020-12-03 10:12:37 -08:00
Oliver Herms 85be4431fe SocketDiagTCPInfo: Add support for BBR information 2020-11-26 10:01:29 -08:00
Stephen Hassard d185ffdb62 Add Geneve link support
Heavily based on the existing Gretap support
2020-11-21 23:35:49 -08:00
Parav Pandit e440572571 Add devlink command to get port by index
Add a command to get information about a specific devlink port
referenced by device name and port index(bus, device, port index).

Signed-off-by: Parav Pandit <parav@mellanox.com>
2020-11-21 23:31:39 -08:00
Parav Pandit ff8f17bc19 Add devlink command to query devlink port list
Add devlink command to get list of devlink ports and their common
attributes.

Signed-off-by: Parav Pandit <parav@mellanox.com>
2020-11-21 23:31:39 -08:00
Oliver Herms ffba2c833f RouteGetWithOptions: Add source address option 2020-11-21 22:56:51 -08:00
lmbsog0 c7261bd9e0 add support for CAN 2020-11-20 12:42:29 -08:00
Riccardo Manfrin 8b655377ac Allows direct usage of String() method 2020-11-19 09:59:55 -08:00
killianmuldoon d40f9887b8 Add TxBytes to VFStats collection 2020-10-29 16:33:52 -04:00
bianze fb953eb4ce Add whole route metrics for netlink
There are lots of route metrics to be added, such as rto_min,
quick_ack and so on, and these metrics are useful for users to
tune network performance, so we add all these metrics.

Signed-off-by: bianze <bianze1993@gmail.com>
2020-10-19 15:37:56 -04:00
root e30b76407c VF stats struct and deserialization method added. VfStats now reported in the VfInfo struct
Co-authored-by: PatrickKutch <patrick.kutch@gmail.com>
2020-10-19 15:29:26 -04:00
Ivan Milchev abd6d09710 added support for SFQ qdiscs 2020-10-19 15:28:26 -04:00
Julian Kornberger 1e3d26b1b3 Add support for ipset 2020-09-24 21:36:22 -04:00
Julian Kornberger b4a20b8556 Add Uint32Attribute 2020-09-24 21:36:22 -04:00
Jaime Caamaño Ruiz 02121dbd7e Add LinkSetMacvlanMode 2020-09-24 21:35:02 -04:00
Oleg Senin e499154279 Add SocketDiagTCPInfo with some constants and structs to get tcp_info via sock_diag
Add simple test for SocketDiagTCPInfo
2020-09-24 21:34:23 -04:00
tanbangcheng 06362a6c16 Add DestPort to TunnelKeyAction
Fix parsing of TCA_TUNNEL_KEY_ENC_IPV6_SRC & TCA_TUNNEL_KEY_ENC_IPV6_DST
2020-09-24 21:30:07 -04:00
Chun Chen 339a215d65 Fix NewHtbClass
- Prio and Quantum should be set equal to the input params
- Fix buffer and cbuffer due to incorrect hz
- Fix Xmittime which is also not equal the behavior of c library.
C library converts time to uint32 to drop precision before multiply
tick_in_usec. ref https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/tc/tc_core.c#n62
2020-09-15 14:32:20 -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
Vishvananda Abrams 872fbf27a2 Fixes Issue #509 more generically
The first fix #512 apparently didn't solve all cases. This generically
skips values that are null to solve the problem. Also closes #548.
2020-09-14 10:54:56 -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
Wu Zongyong e909d4e8ec rule_linux: convert IIFNAME and OIFNAME to null terminated string
Strings in GO is not null-terminated while linux is written by
C and strings in C is null-terminated. Request will fail if we
perform rule request with not null-terminated iifname or ofiname,
with error message "no such file or directory".

Signed-off-by: Wu Zongyong <wuzongyong@linux.alibaba.com>
2020-09-14 10:47:31 -04:00
Sebastiaan van Stijn 6efc62b265 travis: add go 1.13, 1.14, and drop go 1.10, 1.11
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-14 10:46:18 -04:00
Sebastiaan van Stijn 85b8ad0ce1 go.mod: update dependencies
full diffs:

- 0a2b9b5464...db3c7e526a
- 34d275377b...3e129f6d46

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-14 10:45:41 -04:00
Julian Kornberger 01e0a49c1f Add additional fields to link.Ip6tnl
and optimize aligment of Sittun fields
2020-09-14 10:42:05 -04:00
Sylvain Baubeau fe26ba2db0 Set default values for link attributes
When deserializing a link related netlink message, if no network namespace id
attribute is specified, we need to set it to -1 otherwise it defaults to 0
which is a valid id. Using NewLinkAttrs sets the default values and allows
the user to distinguish an empty value from a missing value
2020-09-14 10:41:08 -04:00
whywaita 98629f7ffc change interface to compatible linux implement 2020-08-02 16:18:18 -07:00
Antonio Ojea bca67dfc82 conntrack filter by port and protocol
Add a new method to the ConntrackFilter to be able to
filter conntrack entries by Layer 4 protocol and source
and destination port.

Signed-off-by: Antonio Ojea <aojea@redhat.com>
2020-06-25 10:50:47 -07:00