netfilter: nft_ct: support expectation creation for natted flows
Subsystems (2)
Florian Westphal
maintainerPATCH 1/1 netfilter: nft_ct: support expectation creation for natted flows
This feature only works for connections originating from the host and only if there is no active source address rewrite.
Add the needed nat glue to have the expectation follow the original nat binding.
Signed-off-by Florian Westphal <[email protected]>
--- net/netfilter/nft_ct.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
net/netfilter/nft_ct.c +15 -0
@@ -1297,6 +1297,15 @@ static int nft_ct_expect_obj_dump(struct sk_buff *skb,return 0 ; } +static void nft_ct_nat_follow_master (struct nf_conn *ct,struct nf_conntrack_expect *this) +{ +const struct nf_ct_helper_expectfn *expfn; + + expfn =nf_ct_helper_expectfn_find_by_name ("nat-follow-master" ); +if (expfn) + expfn->expectfn (ct, this); +} +static void nft_ct_expect_obj_eval (struct nft_object *obj,struct nft_regs *regs,const struct nft_pktinfo *pkt)
@@ -1342,6 +1351,12 @@ static void nft_ct_expect_obj_eval(struct nft_object *obj, priv->l4proto, NULL, &priv->dport); exp->timeout += priv->timeout; +if (ct->status &IPS_NAT_MASK ) { + exp->saved_proto.tcp.port = priv->dport; + exp->dir = !dir; + exp->expectfn = nft_ct_nat_follow_master; + } +if (nf_ct_expect_related (exp,0 ) !=0 ) regs->verdict.code =NF_DROP ;
Signature · 1 line
2.53.0