1. 02 Jul, 2021 2 commits
    • Florian Westphal's avatar
      netfilter: conntrack: do not renew entry stuck in tcp SYN_SENT state · e15d4cdf
      Florian Westphal authored
      Consider:
        client -----> conntrack ---> Host
      
      client sends a SYN, but $Host is unreachable/silent.
      Client eventually gives up and the conntrack entry will time out.
      
      However, if the client is restarted with same addr/port pair, it
      may prevent the conntrack entry from timing out.
      
      This is noticeable when the existing conntrack entry has no NAT
      transformation or an outdated one and port reuse happens either
      on client or due to a NAT middlebox.
      
      This change prevents refresh of the timeout for SYN retransmits,
      so entry is going away after nf_conntrack_tcp_timeout_syn_sent
      seconds (default: 60).
      
      Entry will be re-created on next connection attempt, but then
      nat rules will be evaluated again.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      e15d4cdf
    • Florian Westphal's avatar
      selftest: netfilter: add test case for unreplied tcp connections · 37d220b5
      Florian Westphal authored
      TCP connections in UNREPLIED state (only SYN seen) can be kept alive
      indefinitely, as each SYN re-sets the timeout.
      
      This means that even if a peer has closed its socket the entry
      never times out.
      
      This also prevents re-evaluation of configured NAT rules.
      Add a test case that sets SYN timeout to 10 seconds, then check
      that the nat redirection added later eventually takes effect.
      
      This is based off a repro script from Antonio Ojea.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      37d220b5
  2. 01 Jul, 2021 38 commits