Skip to content

Commit 77b3371

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: conntrack: don't refresh sctp entries in closed state
Vivek Thrivikraman reported: An SCTP server application which is accessed continuously by client application. When the session disconnects the client retries to establish a connection. After restart of SCTP server application the session is not established because of stale conntrack entry with connection state CLOSED as below. (removing this entry manually established new connection): sctp 9 CLOSED src=10.141.189.233 [..] [ASSURED] Just skip timeout update of closed entries, we don't want them to stay around forever. Reported-and-tested-by: Vivek Thrivikraman <[email protected]> Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1579 Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent ed14fc7 commit 77b3371

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

net/netfilter/nf_conntrack_proto_sctp.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,15 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct,
489489
pr_debug("Setting vtag %x for dir %d\n",
490490
ih->init_tag, !dir);
491491
ct->proto.sctp.vtag[!dir] = ih->init_tag;
492+
493+
/* don't renew timeout on init retransmit so
494+
* port reuse by client or NAT middlebox cannot
495+
* keep entry alive indefinitely (incl. nat info).
496+
*/
497+
if (new_state == SCTP_CONNTRACK_CLOSED &&
498+
old_state == SCTP_CONNTRACK_CLOSED &&
499+
nf_ct_is_confirmed(ct))
500+
ignore = true;
492501
}
493502

494503
ct->proto.sctp.state = new_state;

0 commit comments

Comments
 (0)