Skip to content
  • Eric Dumazet's avatar
    pkt_sched: fq: better control of DDOS traffic · 06eb395f
    Eric Dumazet authored
    FQ has a fast path for skb attached to a socket, as it does not
    have to compute a flow hash. But for other packets, FQ being non
    stochastic means that hosts exposed to random Internet traffic
    can allocate million of flows structure (104 bytes each) pretty
    easily. Not only host can OOM, but lookup in RB trees can take
    too much cpu and memory resources.
    This patch adds a new attribute, orphan_mask, that is adding
    possibility of having a stochastic hash for orphaned skb.
    Its default value is 1024 slots, to mimic SFQ behavior.
    Note: This does not apply to locally generated TCP traffic,
    and no locally generated traffic will share a flow structure
    with another perfect or stochastic flow.
    This patch also handles the specific case of SYNACK messages:
    They are attached to the listener socket, and therefore all map
    to a single hash bucket. If listener have set SO_MAX_PACING_RATE,
    hoping to have new accepted socket inherit this rate, SYNACK
    might be paced and even dropped.
    This is very similar to an internal patch Google have used more
    than one year.
    Signed-off-by: default avatarEric Dumazet <>
    Signed-off-by: default avatarDavid S. Miller <>