Commit Graph

608 Commits

Author SHA1 Message Date
Tom Payne
ab4cd23987 add build on macOS test
netlink is Linux-only, but adding this test ensures that netlink builds
without error on macOS, which helps catch missing build tags.
2022-01-25 13:50:16 -06:00
Artem Glazychev
d6b03fdeb8 Fix review comment
Signed-off-by: Artem Glazychev <artem.glazychev@xored.com>
2022-01-18 11:05:37 -06:00
Zihong Zheng
5a3e901175 rule: add support for ipproto
This is similar to https://github.com/vishvananda/netlink/pull/511,
but this time for the ipproto option:
```
ip rule add ipproto xxx table main
```
2022-01-18 11:05:37 -06:00
Tobias Klauser
796d4ea903 Only set XFRMA_IF_ID if not 0
A value of 0 for XFRMA_IF_ID is not valid and will be rejected as of
Linux kernel commit torvalds/linux@68ac0f3810 ("xfrm: state and policy
should fail if XFRMA_IF_ID 0"), which will return EINVAL when setting
XFRMA_IF_ID = 0. Thus, only set the XFRMA_IF_ID attribute in case
XfrmState.Ifid or XfrmPolicy.Ifid are != 0.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2022-01-17 14:58:32 -08:00
Steven Falken
dd687eb2f2 feat: add proc events support 2022-01-15 12:48:04 -06:00
conjones
76d8bfe0aa Adds ip6tunnel encap types, encap flags, and flags 2022-01-12 19:00:49 -06:00
Vishvananda Abrams
359304793a fix badge 2022-01-12 16:57:20 -06:00
Vishvananda Abrams
47ee01798a skip flaky test in ci 2022-01-12 16:52:50 -06:00
Vishvananda Abrams
523ee65ce3 fix the tests to run again 2022-01-12 16:05:20 -06:00
Vishvananda Abrams
e5fd1f8193 replace travis with github action 2022-01-12 13:45:29 -06:00
Wu Zongyong
9ada19101f filter: add support for police action
This patch adds support for tc police action. And codes of fw filter
have been refactored with the police action for reducing redundant
codes.

Signed-off-by: Wu Zongyong <wuzongyong@linux.alibaba.com>
2021-11-29 08:39:51 -08:00
Tobias Urdin
650dca95af Export LinkModify function
When the LinkModify was merged in [1] a function
that exports it outside of pkgHandle was never
added like is available for LinkAdd, LinkDel etc.

Update testing to use exported LinkModify that
itself calls the pkgHandle.LinkModify function.

[1] https://github.com/vishvananda/netlink/pull/541
2021-11-18 08:18:26 -08:00
Patryk Strusiewicz-Surmacki
b10eb8fe5c Support for devlink info command 2021-11-01 11:35:09 -05:00
Daniel Borkmann
74e723f230 Fix inserting a nil neigh.HardwareAddr into the neighboring subsystem
The condition to demand a lladdress for neigh.Flags != NTF_PROXY is just
buggy, since there are various other flags such as NTF_USE, NTF_EXT_MANAGED,
etc where this is not required. Besides, the kernel handles this internally
anyway if it demands a NDA_LLADDR attribute. Simply get rid of the NTF_PROXY
flag/condition since it's wrong.

Fixes: d710fbade4 ("Add proxy support to the neighbor functions (#149)")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2021-11-01 11:31:57 -05:00
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