History

xfrm: support sending NAT keepalives in ESP in UDP states

Add the ability to send out RFC-3948 NAT keepalives from the xfrm stack. To use, Userspace sets an XFRM_NAT_KEEPALIVE_INTERVAL integer property when creating XFRM outbound states which denotes the number of seconds between keepalive messages. Keepalive messages are sent from a per net delayed work which iterates over the xfrm states. The logic is guarded by the xfrm state spinlock due to the xfrm state walk iterator. Possible future enhancements: - Adding counters to keep track of sent keepalives. - deduplicate NAT keepalives between states sharing the same nat keepalive parameters. - provisioning hardware offloads for devices capable of implementing this. - revise xfrm state list to use an rcu list in order to avoid running this under spinlock.

Eyal Birger committed 2 years ago

Commit f531d131 parent 5233a5512 files · +361 −3Browse files

Showing the changes to include/uapi (1 of 12 files). Show all

Unified · Split

include/uapi/linux/xfrm.h+1−0
@@ -321,6 +321,7 @@ enum xfrm_attr_type_t { · 320 unmodified lines
321 XFRMA_IF_ID, /* __u32 */321 XFRMA_IF_ID, /* __u32 */
322 XFRMA_MTIMER_THRESH, /* __u32 in seconds for input SA */322 XFRMA_MTIMER_THRESH, /* __u32 in seconds for input SA */
323 XFRMA_SA_DIR, /* __u8 */323 XFRMA_SA_DIR, /* __u8 */
324 XFRMA_NAT_KEEPALIVE_INTERVAL, /* __u32 in seconds for NAT keepalive */
324 __XFRMA_MAX325 __XFRMA_MAX
325 326
326#define XFRMA_OUTPUT_MARK XFRMA_SET_MARK /* Compatibility */327#define XFRMA_OUTPUT_MARK XFRMA_SET_MARK /* Compatibility */