• H
    tcp: Always set urgent pointer if it's beyond snd_nxt · 64ff3b93
    Herbert Xu 提交于
    Our TCP stack does not set the urgent flag if the urgent pointer
    does not fit in 16 bits, i.e., if it is more than 64K from the
    sequence number of a packet.
    
    This behaviour is different from the BSDs, and clearly contradicts
    the purpose of urgent mode, which is to send the notification
    (though not necessarily the associated data) as soon as possible.
    Our current behaviour may in fact delay the urgent notification
    indefinitely if the receiver window does not open up.
    
    Simply matching BSD however may break legacy applications which
    incorrectly rely on the out-of-band delivery of urgent data, and
    conversely the in-band delivery of non-urgent data.
    
    Alexey Kuznetsov suggested a safe solution of following BSD only
    if the urgent pointer itself has not yet been transmitted.  This
    way we guarantee that when the remote end sees the packet with
    non-urgent data marked as urgent due to wrap-around we would have
    advanced the urgent pointer beyond, either to the actual urgent
    data or to an as-yet untransmitted packet.
    
    The only potential downside is that applications on the remote
    end may see multiple SIGURG notifications.  However, this would
    occur anyway with other TCP stacks.  More importantly, the outcome
    of such a duplicate notification is likely to be harmless since
    the signal itself does not carry any information other than the
    fact that we're in urgent mode.
    Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    64ff3b93
tcp_output.c 73.8 KB