Commit Graph

11 Commits

Author SHA1 Message Date
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
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
Chris Telfer 8aa85bfa77 Add support for action and ifindex in XFRM policy
The action and ifindex fields aren't represented in the XfrmPolicy type
although they exist in the the linux equivalent data structures.   They
are represented in the serialized versions of those datatypes.  So this
patch simply exposes those fields to the user-consumable side of the
API.  This patch makes the policy's action a specific type in the same
style as the Dir field in XfrmPolicy.

Update the existing unit tests to compare Ifindex and Action fields in
the XFRM structure.  Verify that the default policy returns an action of
ALLOW and an ifindex of 0.  Add a unit test to add and read back a
policy to the loopback interface (ifindex 1) with action "block".

Signed-off-by: Chris Telfer <ctelfer@docker.com>
2018-08-14 10:33:37 -07:00
Alessandro Boch 9b552a7a61 Allow SPI to be passed in policy template (#127)
- It is part of the ID and it is needed when you
  program policies for different SAs which share
  same src and dst

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-25 11:10:56 -07:00
Alessandro Boch e361359783 Add String() method to user structures (#116)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-09 16:53:16 -07:00
Alessandro Boch a123807666 Allow to program L4 fields in policy selector (#113)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-09 09:19:18 -07:00
Alessandro Boch 18e9389da5 Add Mark field to xrfm state and policy (#110)
* Add Mark to xrfm state

Signed-off-by: Alessandro Boch <aboch@docker.com>

* Add Mark to xfrm policies

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-30 20:31:59 -07:00
Alexander Morozov 8bde0c8190 Use more accustomed way to define enums
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-02-12 11:16:19 -08:00
Vishvananda Ishaya 88c13bcb5c Add support for more xfrm policy dir values 2014-09-15 17:03:37 -07:00
Vishvananda Ishaya 0e7e6d493a Convert addr and xfrm to use IPNet pointers 2014-09-07 11:27:46 -07:00
Vishvananda Ishaya 8dab8b7462 Initial commit of netlink package 2014-08-31 20:34:46 -07:00