diff options
author | 2024-04-30 09:08:52 +0200 | |
---|---|---|
committer | 2024-05-01 10:05:11 +0200 | |
commit | a4a87fa4e96c7746e009de06a567688fd9af6013 (patch) | |
tree | 6d37f9d613320a65c2c79166d7611a28632eff21 /net/xfrm/xfrm_device.c | |
parent | udpencap: Remove Obsolete UDP_ENCAP_ESPINUDP_NON_IKE Support (diff) | |
download | linux-a4a87fa4e96c7746e009de06a567688fd9af6013.tar.gz linux-a4a87fa4e96c7746e009de06a567688fd9af6013.tar.bz2 linux-a4a87fa4e96c7746e009de06a567688fd9af6013.zip |
xfrm: Add Direction to the SA in or out
This patch introduces the 'dir' attribute, 'in' or 'out', to the
xfrm_state, SA, enhancing usability by delineating the scope of values
based on direction. An input SA will restrict values pertinent to input,
effectively segregating them from output-related values.
And an output SA will restrict attributes for output. This change aims
to streamline the configuration process and improve the overall
consistency of SA attributes during configuration.
This feature sets the groundwork for future patches, including
the upcoming IP-TFS patch.
Signed-off-by: Antony Antony <antony.antony@secunet.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm/xfrm_device.c')
-rw-r--r-- | net/xfrm/xfrm_device.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c index 6346690d5c69..2455a76a1cff 100644 --- a/net/xfrm/xfrm_device.c +++ b/net/xfrm/xfrm_device.c @@ -253,6 +253,12 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, return -EINVAL; } + if ((xuo->flags & XFRM_OFFLOAD_INBOUND && x->dir == XFRM_SA_DIR_OUT) || + (!(xuo->flags & XFRM_OFFLOAD_INBOUND) && x->dir == XFRM_SA_DIR_IN)) { + NL_SET_ERR_MSG(extack, "Mismatched SA and offload direction"); + return -EINVAL; + } + is_packet_offload = xuo->flags & XFRM_OFFLOAD_PACKET; /* We don't yet support UDP encapsulation and TFC padding. */ |