zhhyu7 commented on code in PR #20627:
URL: https://github.com/apache/nuttx/pull/20627#discussion_r4259596220


##########
net/tcp/tcp_send_buffered.c:
##########
@@ -1135,6 +1147,24 @@ static uint32_t psock_send_eventhandler(FAR struct 
net_driver_s *dev,
               return flags;
             }
 
+#ifdef CONFIG_NET_TCPURGDATA
+          if (wrb->wb_urg > 0)
+            {
+              uint16_t urg_offset = wrb->wb_urg;

Review Comment:
   ```wb_urg``` is an offset from the start of the wrb. On a partial ACK, 
```TCP_WBTRIM()``` removes the acknowledged bytes from the head of the wrb and 
decreases ```TCP_WBSENT()```, but wb_urg keeps its old value. The urgent 
pointer then moves forward by the trimmed amount in every following segment, 
and the fast-retransmit path at line 803 uses the same stale value. Reproduced 
with a 3000-byte OOB send over loopback (every segment is ACKed before the next 
is sent): the pointer always points past the segment, so the receiver never 
finds the urgent byte. A Linux receiver would treat a later byte of the stream 
as urgent.
   
   Also, when ```wb_urg < TCP_WBSENT(wrb)``` (the urgent byte was already 
sent), the code keeps ```urg_offset = wb_urg``` instead of not setting 
```URG```.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to