Commit Graph

594 Commits

Author SHA1 Message Date
Daniel Borkmann
b08d99c0d0 Add support for NDA_FLAGS_EXT neighboring attribute
This allows to set NTF_EXT_MANAGED neighbor flag for managed neighbor
entries as per kernel commit 7482e3841d52 ("net, neigh: Add NTF_MANAGED
flag for managed neighbor entries"). The flag then indicates to the
kernel that the neighbor entry should be periodically probed for keeping
the entry in NUD_REACHABLE state iff possible.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2021-11-01 11:31:57 -05:00
Joris Bonnefoy
fc5a223eaf Set NetNsId to -1 when attr is not specified 2021-11-01 11:26:46 -05:00
montag451
187053b978 Use SyscallConn() instead of Fd() to persist TUN/TAP interface
os.File.Fd() puts back the file descriptor in blocking mode which is
pretty annoying as SetDeadline will stop working
2021-09-24 15:29:09 -05:00
Vishvananda Abrams
d5e9ae8469 link travis to builds, not image 2021-09-21 09:39:15 -05:00
yuwenchao
f055e5464f Add linux route get oif option.
This option is equivalent to "ip route get ... dev ...", which is useful when the route is multipath.

Signed-off-by: yuwenchao <yuwenchao@qiyi.com>
2021-09-21 09:12:08 -05:00
Rinat Baygildin
533d417a1a Extend route unspecified operations 2021-09-21 09:11:18 -05:00
张祖建
b8aac10bba fix staticcheck issues 2021-09-21 09:10:48 -05:00
张祖建
6757be61c4 Add trailing null char to string in devlink request 2021-09-21 09:09:38 -05:00
Quentin McGaw
30ec08bc3d Rule.String() method returns .Dst
- Return `to <all | ipNetString>` in string
- Return `all` for `from` if `rule.Src == nil`
- Return `all` for `to` if `rule.Dst == nil`

Add unit test
2021-09-20 13:10:42 -07:00
Tobias Urdin
65349edba8 Add support for RTA_FLOW
This adds support for the RTA_FLOW routing msg
attribute and adds the Realm field to the Route
object.
2021-09-20 10:45:34 -07:00
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