• Peter Oskolkov's avatar
    ip: fail fast on IP defrag errors · 0ff89efb
    Peter Oskolkov authored
    The current behavior of IP defragmentation is inconsistent:
    - some overlapping/wrong length fragments are dropped without
      affecting the queue;
    - most overlapping fragments cause the whole frag queue to be dropped.
    
    This patch brings consistency: if a bad fragment is detected,
    the whole frag queue is dropped. Two major benefits:
    - fail fast: corrupted frag queues are cleared immediately, instead of
      by timeout;
    - testing of overlapping fragments is now much easier: any kind of
      random fragment length mutation now leads to the frag queue being
      discarded (IP packet dropped); before this patch, some overlaps were
      "corrected", with tests not seeing expected packet drops.
    
    Note that in one case (see "if (end&7)" conditional) the current
    behavior is preserved as there are concerns that this could be
    legitimate padding.
    Signed-off-by: default avatarPeter Oskolkov <posk@google.com>
    Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
    Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    0ff89efb
ip_fragment.c 24.2 KB