Skip to content

Commit 8a9dc07

Browse files
Florian Westphalummakynes
Florian Westphal
authored andcommitted
netfilter: conntrack: gre: don't set assured flag for clash entries
Now that conntrack core is allowd to insert clashing entries, make sure GRE won't set assured flag on NAT_CLASH entries, just like UDP. Doing so prevents early_drop logic for these entries. Fixes: d671fd8 ("netfilter: conntrack: allow insertion clash of gre protocol") Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 1689f25 commit 8a9dc07

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

net/netfilter/nf_conntrack_proto_gre.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ int nf_conntrack_gre_packet(struct nf_conn *ct,
205205
enum ip_conntrack_info ctinfo,
206206
const struct nf_hook_state *state)
207207
{
208+
unsigned long status;
209+
208210
if (!nf_ct_is_confirmed(ct)) {
209211
unsigned int *timeouts = nf_ct_timeout_lookup(ct);
210212

@@ -217,11 +219,17 @@ int nf_conntrack_gre_packet(struct nf_conn *ct,
217219
ct->proto.gre.timeout = timeouts[GRE_CT_UNREPLIED];
218220
}
219221

222+
status = READ_ONCE(ct->status);
220223
/* If we've seen traffic both ways, this is a GRE connection.
221224
* Extend timeout. */
222-
if (ct->status & IPS_SEEN_REPLY) {
225+
if (status & IPS_SEEN_REPLY) {
223226
nf_ct_refresh_acct(ct, ctinfo, skb,
224227
ct->proto.gre.stream_timeout);
228+
229+
/* never set ASSURED for IPS_NAT_CLASH, they time out soon */
230+
if (unlikely((status & IPS_NAT_CLASH)))
231+
return NF_ACCEPT;
232+
225233
/* Also, more likely to be important, and not a probe. */
226234
if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
227235
nf_conntrack_event_cache(IPCT_ASSURED, ct);

0 commit comments

Comments
 (0)