netfilter: add and use nf_ct_set helper
Add a helper to assign a nf_conn entry and the ctinfo bits to an sk_buff. This avoids changing code in followup patch that merges skb->nfct and skb->nfctinfo into skb->_nfct. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
committed by
Pablo Neira Ayuso
parent
cb9c68363e
commit
c74454fadd
@@ -71,8 +71,7 @@ synproxy_send_tcp(struct net *net,
|
||||
skb_dst_set(nskb, dst);
|
||||
|
||||
if (nfct) {
|
||||
nskb->nfct = nfct;
|
||||
nskb->nfctinfo = ctinfo;
|
||||
nf_ct_set(nskb, (struct nf_conn *)nfct, ctinfo);
|
||||
nf_conntrack_get(nfct);
|
||||
}
|
||||
|
||||
|
||||
@@ -189,8 +189,7 @@ icmpv6_error_message(struct net *net, struct nf_conn *tmpl,
|
||||
}
|
||||
|
||||
/* Update skb to refer to this connection */
|
||||
skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general;
|
||||
skb->nfctinfo = ctinfo;
|
||||
nf_ct_set(skb, nf_ct_tuplehash_to_ctrack(h), ctinfo);
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
@@ -222,8 +221,7 @@ icmpv6_error(struct net *net, struct nf_conn *tmpl,
|
||||
type = icmp6h->icmp6_type - 130;
|
||||
if (type >= 0 && type < sizeof(noct_valid_new) &&
|
||||
noct_valid_new[type]) {
|
||||
skb->nfct = &nf_ct_untracked_get()->ct_general;
|
||||
skb->nfctinfo = IP_CT_NEW;
|
||||
nf_ct_set(skb, nf_ct_untracked_get(), IP_CT_NEW);
|
||||
nf_conntrack_get(skb_nfct(skb));
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
@@ -58,8 +58,7 @@ void nf_dup_ipv6(struct net *net, struct sk_buff *skb, unsigned int hooknum,
|
||||
|
||||
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
|
||||
nf_reset(skb);
|
||||
skb->nfct = &nf_ct_untracked_get()->ct_general;
|
||||
skb->nfctinfo = IP_CT_NEW;
|
||||
nf_ct_set(skb, nf_ct_untracked_get(), IP_CT_NEW);
|
||||
nf_conntrack_get(skb->nfct);
|
||||
#endif
|
||||
if (hooknum == NF_INET_PRE_ROUTING ||
|
||||
|
||||
Reference in New Issue
Block a user