#include <linux/list.h>
#include <linux/netfilter/nf_conntrack_pptp.h>
+struct nf_conn;
+
/* The structure embedded in the conntrack structure. */
struct nf_nat_info
{
struct list_head bysource;
struct nf_nat_seq seq[IP_CT_DIR_MAX];
+ struct nf_conn *ct;
};
/* per conntrack: nat application helper private data */
#endif
};
-struct nf_conn;
-
/* Set up the info structure to map into this range. */
extern unsigned int nf_nat_setup_info(struct nf_conn *ct,
const struct nf_nat_range *range,
nat = nfct_nat(conn);
write_lock_bh(&nf_nat_lock);
list_del(&nat->info.bysource);
+ nat->info.ct = NULL;
write_unlock_bh(&nf_nat_lock);
}
read_lock_bh(&nf_nat_lock);
list_for_each_entry(nat, &bysource[h], info.bysource) {
- ct = (struct nf_conn *)((char *)nat - offsetof(struct nf_conn, data));
+ ct = nat->info.ct;
if (same_src(ct, tuple)) {
/* Copy source part from reply tuple. */
nf_ct_invert_tuplepr(result,
srchash = hash_by_src(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
write_lock_bh(&nf_nat_lock);
+ info->ct = ct;
list_add(&info->bysource, &bysource[srchash]);
write_unlock_bh(&nf_nat_lock);
}