Skip to content

Commit 4a6fbdd

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: conntrack: tag conntracks picked up in local out hook
This allows to identify flows that originate from local machine in a followup patch. It would be possible to make this a ->status bit instead. For now I did not do that yet because I don't have a use-case for exposing this info to userspace. If one comes up the toggle can be replaced with a status bit. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 023223d commit 4a6fbdd

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎include/net/netfilter/nf_conntrack.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ struct nf_conn {
9595
unsigned long status;
9696

9797
u16 cpu;
98+
u16 local_origin:1;
9899
possible_net_t ct_net;
99100

100101
#if IS_ENABLED(CONFIG_NF_NAT)

‎net/netfilter/nf_conntrack_core.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,9 @@ resolve_normal_ct(struct nf_conn *tmpl,
17471747
return 0;
17481748
if (IS_ERR(h))
17491749
return PTR_ERR(h);
1750+
1751+
ct = nf_ct_tuplehash_to_ctrack(h);
1752+
ct->local_origin = state->hook == NF_INET_LOCAL_OUT;
17501753
}
17511754
ct = nf_ct_tuplehash_to_ctrack(h);
17521755

0 commit comments

Comments
 (0)