History

xfrm: rate limit SA mapping change message to user space

Kernel generates mapping change message, XFRM_MSG_MAPPING, when a source port chage is detected on a input state with UDP encapsulation set. Kernel generates a message for each IPsec packet with new source port. For a high speed flow per packet mapping change message can be excessive, and can overload the user space listener. Introduce rate limiting for XFRM_MSG_MAPPING message to the user space. The rate limiting is configurable via netlink, when adding a new SA or updating it. Use the new attribute XFRMA_MTIMER_THRESH in seconds. v1->v2 change: update xfrm_sa_len() v2->v3 changes: use u32 insted unsigned long to reduce size of struct xfrm_state fix xfrm_ompat size Reported-by: kernel test robot <lkp@intel.com> accept XFRM_MSG_MAPPING only when XFRMA_ENCAP is present

Antony Antony committed 4 years ago

Commit 4e484b31 parent 23b6a6d5 files · +49 −4Browse files

Showing the changes to include (2 of 5 files). Show all

Unified · Split

2 files
  1. include/net/xfrm.h +5 −0
  2. include/uapi/linux/xfrm.h +1 −0
include/net/xfrm.h+5−0
@@ -200,6 +200,11 @@ struct xfrm_state { · 199 unmodified lines
200200 struct xfrm_algo_aead *aead;
201201 const char *geniv;
202202
203+ /* mapping change rate limiting */
204+ __be16 new_mapping_sport;
205+ u32 new_mapping; /* seconds */
206+ u32 mapping_maxage; /* seconds for input SA */
207+
203208 /* Data for encapsulator */
204209 struct xfrm_encap_tmpl *encap;
205210 struct sock __rcu *encap_sk;
include/uapi/linux/xfrm.h+1−0
@@ -313,6 +313,7 @@ enum xfrm_attr_type_t { · 312 unmodified lines
313313 XFRMA_SET_MARK, /* __u32 */
314314 XFRMA_SET_MARK_MASK, /* __u32 */
315315 XFRMA_IF_ID, /* __u32 */
316+ XFRMA_MTIMER_THRESH, /* __u32 in seconds for input SA */
316317 __XFRMA_MAX
317318
318319 #define XFRMA_OUTPUT_MARK XFRMA_SET_MARK /* Compatibility */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t