Commit c196def0 authored by Antony Antony's avatar Antony Antony Committed by Steffen Klassert
Browse files

xfrm: set ipv4 no_pmtu_disc flag only on output sa when direction is set

The XFRM_STATE_NOPMTUDISC flag is only meaningful for output SAs, but
it was being applied regardless of the SA direction when the sysctl
ip_no_pmtu_disc is enabled. This can unintentionally affect input SAs.

Limit setting XFRM_STATE_NOPMTUDISC to output SAs when the SA direction
is configured.

Closes: https://github.com/strongswan/strongswan/issues/2946


Fixes: a4a87fa4 ("xfrm: Add Direction to the SA in or out")
Signed-off-by: default avatarAntony Antony <antony.antony@secunet.com>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent 3d5221af
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3151,6 +3151,7 @@ int __xfrm_init_state(struct xfrm_state *x, struct netlink_ext_ack *extack)
	int err;

	if (family == AF_INET &&
	    (!x->dir || x->dir == XFRM_SA_DIR_OUT) &&
	    READ_ONCE(xs_net(x)->ipv4.sysctl_ip_no_pmtu_disc))
		x->props.flags |= XFRM_STATE_NOPMTUDISC;