]> git.baikalelectronics.ru Git - kernel.git/commitdiff
netfilter: flowtable: fix missing FLOWI_FLAG_ANYSRC flag
authorwenxu <wenxu@chinatelecom.cn>
Thu, 26 May 2022 01:25:45 +0000 (21:25 -0400)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 31 May 2022 21:14:03 +0000 (23:14 +0200)
The nf_flow_table gets route through ip_route_output_key. If the saddr
is not local one, then FLOWI_FLAG_ANYSRC flag should be set. Without
this flag, the route lookup for other_dst will fail.

Fixes: fb0f8e678cd4 (netfilter: flowtable: nft_flow_route use more data for reverse route)
Signed-off-by: wenxu <wenxu@chinatelecom.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_flow_offload.c

index a16cf47199b79571ddc4457d13597065a34ac3bd..20e5f372dd7613a0c1b2933856528400596a638a 100644 (file)
@@ -237,6 +237,7 @@ static int nft_flow_route(const struct nft_pktinfo *pkt,
                fl.u.ip4.flowi4_iif = this_dst->dev->ifindex;
                fl.u.ip4.flowi4_tos = RT_TOS(ip_hdr(pkt->skb)->tos);
                fl.u.ip4.flowi4_mark = pkt->skb->mark;
+               fl.u.ip4.flowi4_flags = FLOWI_FLAG_ANYSRC;
                break;
        case NFPROTO_IPV6:
                fl.u.ip6.daddr = ct->tuplehash[dir].tuple.src.u3.in6;
@@ -245,6 +246,7 @@ static int nft_flow_route(const struct nft_pktinfo *pkt,
                fl.u.ip6.flowi6_iif = this_dst->dev->ifindex;
                fl.u.ip6.flowlabel = ip6_flowinfo(ipv6_hdr(pkt->skb));
                fl.u.ip6.flowi6_mark = pkt->skb->mark;
+               fl.u.ip6.flowi6_flags = FLOWI_FLAG_ANYSRC;
                break;
        }