Skip to content

Commit 7f2ca96

Browse files
Guillaume Naultgregkh
authored andcommitted
xfrm: Don't accidentally set RTO_ONLINK in decode_session4()
commit 23e7b1b upstream. Similar to commit 94e2238 ("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: 4da3089 ("[IPSEC]: Use TOS when doing tunnel lookups") Signed-off-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2b1415c commit 7f2ca96

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎net/xfrm/xfrm_policy.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/if_tunnel.h>
3232
#include <net/dst.h>
3333
#include <net/flow.h>
34+
#include <net/inet_ecn.h>
3435
#include <net/xfrm.h>
3536
#include <net/ip.h>
3637
#include <net/gre.h>
@@ -3294,7 +3295,7 @@ decode_session4(struct sk_buff *skb, struct flowi *fl, bool reverse)
32943295
fl4->flowi4_proto = iph->protocol;
32953296
fl4->daddr = reverse ? iph->saddr : iph->daddr;
32963297
fl4->saddr = reverse ? iph->daddr : iph->saddr;
3297-
fl4->flowi4_tos = iph->tos;
3298+
fl4->flowi4_tos = iph->tos & ~INET_ECN_MASK;
32983299

32993300
if (!ip_is_fragment(iph)) {
33003301
switch (iph->protocol) {

0 commit comments

Comments
 (0)