[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d6f1f8a1-2e29-08c3-55db-1080a8c6efd0@iogearbox.net>
Date: Wed, 24 Aug 2022 23:33:21 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Eyal Birger <eyal.birger@...il.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, steffen.klassert@...unet.com,
herbert@...dor.apana.org.au, pablo@...filter.org,
contact@...elbtn.com, dsahern@...nel.org, netdev@...r.kernel.org,
bpf@...r.kernel.org, devel@...ux-ipsec.org
Subject: Re: [PATCH ipsec-next 2/3] xfrm: interface: support collect metadata
mode
On 8/24/22 8:25 PM, Eyal Birger wrote:
> On Wed, Aug 24, 2022 at 8:06 PM Daniel Borkmann <daniel@...earbox.net> wrote:
>> On 8/23/22 5:45 PM, Eyal Birger wrote:
>>> This commit adds support for 'collect_md' mode on xfrm interfaces.
>>>
>>> Each net can have one collect_md device, created by providing the
>>> IFLA_XFRM_COLLECT_METADATA flag at creation. This device cannot be
>>> altered and has no if_id or link device attributes.
>>>
>>> On transmit to this device, the if_id is fetched from the attached dst
>>> metadata on the skb. The dst metadata type used is METADATA_XFRM
>>> which holds the if_id property.
>>>
>>> On the receive side, xfrmi_rcv_cb() populates a dst metadata for each
>>> packet received and attaches it to the skb. The if_id used in this case is
>>> fetched from the xfrm state. This can later be used by upper layers such
>>> as tc, ebpf, and ip rules.
>>>
>>> Because the skb is scrubed in xfrmi_rcv_cb(), the attachment of the dst
>>> metadata is postponed until after scrubing. Similarly, xfrm_input() is
>>> adapted to avoid dropping metadata dsts by only dropping 'valid'
>>> (skb_valid_dst(skb) == true) dsts.
>>>
>>> Policy matching on packets arriving from collect_md xfrmi devices is
>>> done by using the xfrm state existing in the skb's sec_path.
>>> The xfrm_if_cb.decode_cb() interface implemented by xfrmi_decode_session()
>>> is changed to keep the details of the if_id extraction tucked away
>>> in xfrm_interface.c.
>>>
>>> Signed-off-by: Eyal Birger <eyal.birger@...il.com>
>>
>> Can be done in follow-up (once merged back from net-next into bpf-next),
>> but it would be nice to also have a BPF CI selftest for it to make sure
>> the ipsec+collect_md with BPF is consistently tested for incoming patches.
>
> Indeed. Note that this requires the addition of set/get bpf helpers for
> this metadata as the existing helpers are tied to ip_tunnel_info.
>
> I used such helpers as part of testing this patch series, and plan to submit
> them with the respective tests to bpf-next once this feature is merged in
> its final form.
Great, looking forward!
Thanks,
Daniel
Powered by blists - more mailing lists