netfilter: flowtable: fix nft_flow_route miss FLOWI_FLAG_ANYSRC flag
Subsystems (2)
PATCH 1/2 netfilter: flowtable: fix nft_flow_route miss FLOWI_FLAG_ANYSRC flag
From: wenxu <[email protected]>
The nf_flow_tabel get route through ip_route_output_key. When the saddr is not local one, the FLOWI_FLAG_ANYSRC flag should be setten. Without this flag, the route lookup for other_dst will failed.
Fixes 3412e1641828 (netfilter: flowtable: nft_flow_route use more data for reverse route)
Signed-off-by wenxu <[email protected]>
--- net/netfilter/nft_flow_offload.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nft_flow_offload.c +2 -0
@@ -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 ; }
Signature · 1 line
1.8.3.1
PATCH 2/2 netfilter: flowtable: fix nft_flow_route use saddr for nat case
From: wenxu <[email protected]>
For snat and dnat case the saddr should get from reverse tuple.
Fixes 3412e1641828 (netfilter: flowtable: nft_flow_route use more data for reverse route)
Signed-off-by wenxu <[email protected]>
--- net/netfilter/nft_flow_offload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nft_flow_offload.c +2 -2
@@ -232,7 +232,7 @@ static int nft_flow_route(const struct nft_pktinfo *pkt,switch (nft_pf (pkt)) {case NFPROTO_IPV4 : fl.u.ip4.daddr = ct->tuplehash[dir].tuple.src.u3.ip; - fl.u.ip4.saddr = ct->tuplehash[dir].tuple.dst.u3.ip; + fl.u.ip4.saddr = ct->tuplehash[!dir].tuple.src.u3.ip; fl.u.ip4.flowi4_oif =nft_in (pkt)->ifindex; fl.u.ip4.flowi4_iif = this_dst->dev->ifindex; fl.u.ip4.flowi4_tos =RT_TOS (ip_hdr (pkt->skb)->tos);
@@ -241,7 +241,7 @@ static int nft_flow_route(const struct nft_pktinfo *pkt,break ;case NFPROTO_IPV6 : fl.u.ip6.daddr = ct->tuplehash[dir].tuple.src.u3.in6; - fl.u.ip6.saddr = ct->tuplehash[dir].tuple.dst.u3.in6; + fl.u.ip6.saddr = ct->tuplehash[!dir].tuple.src.u3.in6; fl.u.ip6.flowi6_oif =nft_in (pkt)->ifindex; fl.u.ip6.flowi6_iif = this_dst->dev->ifindex; fl.u.ip6.flowlabel =ip6_flowinfo (ipv6_hdr (pkt->skb));
Signature · 1 line
1.8.3.1
Pablo Neira Ayuso
maintainerRe: [PATCH nf-next 2/2] netfilter: flowtable: fix nft_flow_route use saddr for nat case
Also applied.
Applied to nf, thanks