Commit Graph

584 Commits

Author SHA1 Message Date
Zack Liu
fc21756312 Make IPSet actually support hash set types 2021-09-18 10:50:26 -07:00
Wei Fu
c33185cb84 rdma: support rdma link add/del functionality
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-09-18 10:31:51 -07:00
TheDiveO
626202eca8 Provide handle Close() and deprecate Delete() 2021-09-18 09:03:48 -07:00
Milan Lenco
871f8a156e Add test for conntrack entry raw data parsing
Signed-off-by: Milan Lenco <milan@zededa.com>
2021-09-17 19:01:08 -07:00
GopiKrishna Kodali
607db9998a Fix netlink to skip reading TLVs that we are not interested.
Signed-off-by: GopiKrishna Kodali <gkodali@zededa.com>
2021-09-17 19:01:08 -07:00
Naiming Shen
fbf10179ff add timestamp/timeout to netlink/conntrack
Signed-off-by: Naiming Shen <naiming@zededa.com>
2021-09-17 19:01:08 -07:00
tanbangcheng
5f76ae2b4d Add basic flower support
Signed-off-by: tanbangcheng <tanbangcheng@bytedance.com>
2021-09-17 18:42:15 -07:00
bersoare
7992ad9959 add support for bareudp link type 2021-09-17 10:14:18 -07:00
Vishvananda Abrams
2c39f34919 one more fix 2021-09-16 11:13:39 -05:00
Vishvananda Abrams
bb30b20672 fix the travis badge 2021-09-16 11:09:50 -05:00
Sig Lange
e1a867c6b4 fix size required for a uint64 2021-08-11 12:18:23 -07:00
Dennis Afanasev
21f2c55a77 Add PHYS_SWITCH_ID attribute to LinkAttrs 2021-07-03 11:55:58 +02:00
Oliver Geiselhardt-Herms
d1fad16de5 Expose AFI on routes 2021-07-03 11:44:51 +02:00
bersoare
079db23e21 lwtunnel: add support for encap type bpf
add bpf program types

add unit tests

don't use strings to determine type

fix camel case
2021-07-03 11:44:22 +02:00
Joe Swantek
53455394aa Correct panic when IPv4 lacks IFA_ADDRESS address
IFA_ADDRESS is to be used as the peer address if it differs from IFA_LOCAL.
Therefore, include the check for "no IFA_ADDRESS" in the difference check.

Example: ppp interfaces can contain IFA_LOCAL and no IFA_ADDRESS attribute
2021-07-03 11:34:00 +02:00
Neo Zhuo
14e832ae1e feat: support diag TCP with only socket returns
For something like statistics that just requires socket info only
2021-05-30 12:58:56 +02:00
eriknordmark
f9d8f911db more consistent error handling
Signed-off-by: eriknordmark <erik@zededa.com>
2021-05-30 12:55:19 +02:00
dennisafa
d1e684a60b Ability to set multicast attribute on a link 2021-05-30 12:51:51 +02:00
Arseny Mitin
b239a3083a Add support for extern_learn like in ip-neigh 2021-05-30 12:42:04 +02:00
Adrian Chiris
4cb3795f2c Remove trailing null char from string in devlink
netlink(kernel) returns the string values in a c-style
manner terminating with null.

when converting to go string these need to be removed
as done in other places in the project.

keeping the null terminating char prevents comparing
devlink dev/port string attributes as the `==` string
operand will fail.

Signed-off-by: Adrian Chiris <adrianc@nvidia.com>
2021-05-18 08:56:37 -07:00
Tobias Klauser
d17758a128 Don't re-initialize package level var native in (*Handle).RouteGetWithOptions
This was missed in #637 due to it being introduced by #623, which was
merged just recently.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
2021-05-10 09:43:52 -07:00
Tobias Klauser
4ef7bcbf15 Don't re-initialize or shadow package level var native to fix data race
The package level var native (holding the native endianness) is
initialized at package load time. Thus there is no need to re-initalize
it in functions using it, e.g. (*Handle).filterModify, parseU32Data,
parseFwData, parseBpfData and parseMatchAllData.

This fixes a data race between these functions and any read access of
var native, e.g. in LinkDeserialize as reported in issue #633.

Also don't re-declare local variables shadowing the global package-level
var.

Fixes #633

Signed-off-by: Tobias Klauser <tobias@cilium.io>
2021-05-10 07:24:37 -07:00
Riccardo Manfrin
af1e63ea7b Adds vrf slave link slave data parse 2021-05-10 07:22:18 -07:00
Antonio Ojea
a3836f0b5d conntrack: allow to filter by subnet
Add a new conntrack filter to be able to filter by subnet, in
addition to current IP address filter.

Signed-off-by: Antonio Ojea <aojea@redhat.com>
2021-05-08 17:46:37 -07:00
Dongdong Wang
dbf5d9e510 Fix another panic case of #509.
Signed-off-by: Dongdong Wang <wangdongdong.6@bytedance.com>
2021-05-08 09:21:41 -07:00
Bjorn Svensson
6063cc66d7 Add allmulti to link attributes
Provide the status of the allmulticast option via the highlevel
link attributes instead of requiring raw flag handling.

Avoid comparing all rawflags before and after in tests due to that
the IFF_RUNNING flag might change independenly.

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
2021-05-08 09:10:00 -07:00
Parav Pandit
77f3f25cb4 Add devlink port function set attribute
Add ability to set port function attributes such as state and hardware
address.

Signed-off-by: Parav Pandit <parav@nvidia.com>
2021-05-08 09:00:34 -07:00
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