]> git.baikalelectronics.ru Git - kernel.git/commit
xfrm: Don't accidentally set RTO_ONLINK in decode_session4()
authorGuillaume Nault <gnault@redhat.com>
Mon, 10 Jan 2022 13:43:06 +0000 (14:43 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 12 Jan 2022 04:36:08 +0000 (20:36 -0800)
commitd58bb7216e9c9a2aa7d2162a80c70342d8980823
tree549b4fea8308a48d1b0030edc194f9b2f3cf12cc
parentcc6b245c9897693daef03e4c49895a8cbdd94faf
xfrm: Don't accidentally set RTO_ONLINK in decode_session4()

Similar to commit bbe527113b03 ("xfrm4: strip ECN bits from tos field"),
clear the ECN bits from iph->tos when setting ->flowi4_tos.
This ensures that the last bit of ->flowi4_tos is cleared, so
ip_route_output_key_hash() isn't going to restrict the scope of the
route lookup.

Use ~INET_ECN_MASK instead of IPTOS_RT_MASK, because we have no reason
to clear the high order bits.

Found by code inspection, compile tested only.

Fixes: fdd908bd47b0 ("[IPSEC]: Use TOS when doing tunnel lookups")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/xfrm/xfrm_policy.c