Ticket #13632: tcp-rfc-7323-added-PAWS-timestamp-check-on-Receive.patch

File tcp-rfc-7323-added-PAWS-timestamp-check-on-Receive.patch, 1.2 KB (added by a-star, 7 years ago)
  • src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp

    From 3c5a63a78adeec716e64b0d66b05359934c7d16e Mon Sep 17 00:00:00 2001
    From: A-star-ayush <myselfthebest@yahoo.com>
    Date: Wed, 26 Jul 2017 01:14:45 +0530
    Subject: [PATCH] tcp: rfc 7323: added PAWS timestamp check on Receive
    
    ---
     src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp | 8 ++++++++
     1 file changed, 8 insertions(+)
    
    diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp
    index 0a7c5fa..4ab6cdb 100644
    a b TCPEndpoint::_SynchronizeSentReceive(tcp_segment_header &segment,  
    15231523int32
    15241524TCPEndpoint::_Receive(tcp_segment_header& segment, net_buffer* buffer)
    15251525{
     1526    // PAWS processing takes precedence over regular TCP acceptability check
     1527    if (fFlags & FLAG_OPTION_TIMESTAMP && (segment.flags & TCP_FLAG_RESET == 0)) {
     1528        if ((segment.options & TCP_HAS_TIMESTAMPS) == 0)
     1529            return DROP;
     1530        if (segment.timestamp_value < fReceivedTimestamp)
     1531            return DROP | IMMEDIATE_ACKNOWLEDGE;
     1532    }
     1533
    15261534    uint32 advertisedWindow = (uint32)segment.advertised_window
    15271535        << fSendWindowShift;
    15281536    size_t segmentLength = buffer->size;