Commit Graph

151 Commits

Author SHA1 Message Date
Steven Falken dd687eb2f2 feat: add proc events support 2022-01-15 12:48:04 -06:00
Patryk Strusiewicz-Surmacki b10eb8fe5c Support for devlink info command 2021-11-01 11:35:09 -05:00
张祖建 b8aac10bba fix staticcheck issues 2021-09-21 09:10:48 -05: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
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
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
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
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
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
Moshe Litvin 77e4d032a0 Allow building on non-linux machine 2020-12-28 10:31:32 -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 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
lmbsog0 c7261bd9e0 add support for CAN 2020-11-20 12:42:29 -08: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
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
Tobias Klauser bfba8e4149 Correct value of SizeofXfrmUsersaFlush
struct xfrm_usersa_flush contains a single u8, thus sizeof(struct
xfrm_usersa_flush) == 1 as can be verified by running the following
code through go tool cgo -godefs:

    package xfrm_test

    // #include <linux/xfrm.h>
    import "C"

    const SizeofXfrmUsersaFlush = C.sizeof_struct_xfrm_usersa_flush

which results in

    // Code generated by cmd/cgo -godefs; DO NOT EDIT.
    // cgo -godefs foo.go

    package xfrm_test

    const SizeofXfrmUsersaFlush = 0x1

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-02-10 14:25:39 -08:00
chendotjs a2e8781202 rule: add support for dport/sport 2020-02-10 06:52:06 -08:00
Jianlin Lv 5e92c072cd check payload of the NLMSG_DONE nlmsg
check the payload of the NLMSG_DONE type netlink
message for possible error

Signed-off-by: Jianlin Lv <Jianlin.Lv@arm.com>
2020-02-09 10:25:19 -08:00
Tobias Klauser 8f32382eaa Use IfaCacheinfo and IFA_* consts from golang.org/x/sys/unix
Use the IfaCacheinfo type and the IFA_* consts from
golang.org/x/sys/unix instead of locally duplicating them.
2020-01-27 15:51:47 -08:00
Konstantin Belyalov b2372689b9 Save XDP attach mode into LinkXdp. 2020-01-27 15:47:19 -08:00
Zhiyuan Hou ed8931371a filter, action: Add support for skbedit
Signed-off-by: Zhiyuan Hou <zhiyuan2048@linux.alibaba.com>
2019-12-17 09:15:28 -08:00
Zhiyuan Hou e25c252266 filter, action: Add support for tunnel_key
Signed-off-by: Zhiyuan Hou <zhiyuan2048@linux.alibaba.com>
2019-12-03 14:07:18 -08:00
Takushi Fujiwara 205a160d2e Add bond slave information
This PR refers to PR@lebauce and add some changes.
- Added some tests to retrieve bond slave information.
- Link.BondSlave is changed to LinkSlave interface.
- BondSlaveState.String() returns UPPER case. (same as iproute2)
- BondSlaveMiiStatus.String() returns UPPER case. (same as iproute2)
2019-09-16 08:52:39 -07:00
Laurent Bernaille e906d22624 Add support for output-mark 2019-09-16 08:26:04 -07:00
Yakushi Fujiwara 254c8a89c5 Replace values defined in unix package.
- replace following values to unix.*
  AF_MPLS, RTA_NEWDST, RTA_ENCAP_TYPE, RTA_ENCAP
2019-08-23 11:17:48 -07:00
Naiming Shen e825b754c0 Add Timestamp, Timeout to conntrack
Signed-off-by: Naiming Shen <naiming@zededa.com>
2019-08-12 12:01:13 -07:00
Adrian Chiris 46ae81cf70 Add support for IPoIB interfaces
- Add a new Link type, IPoIB, that exposes the following IPoIB attributes:
    * IFLA_IPOIB_PKEY
    * IFLA_IPOIB_MODE
    * IFLA_IPOIB_UMCAST
- Suppport Deserialize for IPoIB link attributes in LinkDeserialize()
- Support IPoIB attributes in LinkAdd()
2019-08-12 04:46:40 -07:00
bingshen.wbs 14bd2e6fd2 support ipvlan flag
Signed-off-by: bingshen.wbs <bingshen.wbs@alibaba-inc.com>
2019-07-25 03:37:08 +02:00
Daniel Borkmann b1e9859792 netlink: enforce similar pid checks as in iproute2
iproute2's own netlink library asserts that the sockaddr sender pid
has to be the one of the kernel [0]. It also doesn't bail out on pid
mismatch but only skips the message instead. We've seen cases where
the latter had a pid 0; in such case we should skip to the next nl
message instead of hard bail out.

  [0] https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/lib/libnetlink.c
      rtnl_dump_filter_l(), __rtnl_talk_iov()

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2019-07-18 17:26:53 -07:00
Farid Zakaria 2e4a68ee6c Add support for additional TC BPF filter attributes
In order to support BPF_SYSCALL `PROG_GET_FD_BY_ID` -- the ID of the
eBPF must be available.

Add the additional enumerations and handle them when parsing the BPF
filter.
2019-07-01 11:37:39 -07:00
Parav Pandit 123a384710 Add an API to change net namespace of RDMA device
Add an API to change net namespace of RDMA device similar to

$ rdma dev set [DEV] netns NSNAME

Signed-off-by: Parav Pandit <parav@mellanox.com>
2019-06-13 22:19:36 -07:00
Parav Pandit 0f040b9e2c Add an API to set RDMA subsystem network namespace mode
Add an API to change the RDMA subsystem network namespace mode as either
shared or exclusive similar to

$ rdma system set netns { shared | exclusive }

Signed-off-by: Parav Pandit <parav@mellanox.com>
2019-06-07 21:21:07 -07:00
Parav Pandit 4666477197 Add an API to query RDMA subsystem net namespace mode
RDMA subsystem can be running in shared or exclusive mode with regards
to sharing RDMA device sharing among multiple network namespaces.

Add and API to query such mode of kernel similar to iproute2 command
$ rdma system show netns

Signed-off-by: Parav Pandit <parav@mellanox.com>
2019-06-07 21:21:07 -07:00
Archana Shinde db99c040b9 tuntap: Return TunTapLink instead of GenericLink
For tuntap interfaces, return a TunTap Interface instead of
a Generic link when retrieving the interface.
Use netlink extended attributes to populate the Link attributes
for the tuntap link.
In case of older tun driver which does not provide these
attributes, use sysfs to retrieve these attributes.

This commit also adds Owner and Group attributes for the TunTap
Link.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2019-06-03 12:01:21 -07:00
Krister Johansen 00009fb860 Add support for TC_ACT_CONNMARK
Implements the connmark action described in tc-connmark(8)

Signed-off-by: Krister Johansen <krister.johansen@oracle.com>
2019-05-22 08:35:24 -07:00
Parav Pandit fd97bf4e47 Add command to set devlink device switchdev mode
Devlink device currently has legacy and switchdev mode.
Add an API to set devlink device mode for discovered devlink device.

Signed-off-by: Parav Pandit <parav@mellanox.com>
2019-05-01 11:37:24 -07:00
CodeLingo Bot f504738125 Fix function comments based on best practices from Effective Go
Signed-off-by: CodeLingo Bot <bot@codelingo.io>
2019-03-19 09:31:22 -07:00
Matt Ellison 1e2e7ab670 Add Support for Virtual XFRM Interfaces
XFRM interfaces are available in Linux Kernel 4.19+

When an IF_ID is applied to a XFRM policy and state, the corresponding
traffic will be sent through the virtual interface with the same IF_ID.
2019-01-05 11:40:40 -08:00
Milan Lenco e37f4b431a Avoid 64K allocation on the heap with each Receive
Currently each call to Receive() allocates 64K buffer on the heap
for the data to receive from a netlink socket. This is rather costly
considering that in most cases only fraction of this memory is actually
needed.

A quick fix is to make sure that the large buffer does not "escape" -
i.e. that it is sufficient to have it allocated on the stack.
Then only the prefix of the buffer that was actually used
is copied to the heap.

Fix for issue: #379

Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
2019-01-03 08:31:59 -08:00
Parav Pandit 332a6983d9 Add devlink commands for devlink device information
This patch adds very basic support for getting information about
devlink devices which are typically PCI devices which exposes Networking
switch or legacy devices.

This information includes bus name, device name and eswitch modes.
This is done through devlink family of commands via generic netlink
sockets provided by Linux kernel.

DevlinkDevice represents a devlink device which is identified by bus
name and device name (unlike interface index for netdevices).
It contains the DevlinkDevAttrs device attributes.
Currently only eswitch attributes are queried. In future more attributes
such as port, shared buffer, traffic class will be added.

Signed-off-by: Parav Pandit <parav@mellanox.com>
2018-12-19 14:37:14 -08:00
Julian Kornberger 023a6dafdc Make go vet happier 2018-11-08 14:21:39 -08:00
Julian Kornberger aa5b058fc0 Simplify code 2018-10-30 10:31:46 -07:00
Julian Kornberger e137ed6e2c Replace nl.NewRtAttrChild with method on struct 2018-10-30 10:31:19 -07:00
Parav Pandit b48eed5d7d Add an API to rename rdma device name
Add an API RdmaLinkSetName() and test case to rename a
rdma device name.

Signed-off-by: Parav Pandit <parav@mellanox.com>
2018-10-29 12:38:29 -07:00