• Florian Westphal's avatar
    netfilter: conntrack: reset tcp maxwin on re-register · f94e6380
    Florian Westphal authored
    Doug Smythies says:
      Sometimes it is desirable to temporarily disable, or clear,
      the iptables rule set on a computer being controlled via a
      secure shell session (SSH). While unwise on an internet facing
      computer, I also do it often on non-internet accessible computers
      while testing. Recently, this has become problematic, with the
      SSH session being dropped upon re-load of the rule set.
    
    The problem is that when all rules are deleted, conntrack hooks get
    unregistered.
    
    In case the rules are re-added later, its possible that tcp window
    has moved far enough so that all packets are considered invalid (out of
    window) until entry expires (which can take forever, default
    established timeout is 5 days).
    
    Fix this by clearing maxwin of existing tcp connections on register.
    
    v2: don't touch entries on hook removal.
    v3: remove obsolete expiry check.
    Reported-by: default avatarDoug Smythies <dsmythies@telus.net>
    Fixes: 4d3a57f2 ("netfilter: conntrack: do not enable connection tracking unless needed")
    Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    f94e6380
nf_conntrack_proto.c 24.9 KB