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


##########
net/tcp/tcp_input.c:
##########
@@ -1570,38 +1573,104 @@ static void tcp_input(FAR struct net_driver_s *dev, 
uint8_t domain,
 
         if ((tcp->flags & TCP_URG) != 0)
           {
-            dev->d_urglen = (tcp->urgp[0] << 8) | tcp->urgp[1];
-            if (dev->d_urglen > dev->d_len)
+            uint16_t urgp = (tcp->urgp[0] << 8) | tcp->urgp[1];
+
+            /* BSD/Linux default semantics (tcp_stdurg=0):
+             * The urgent pointer points ONE BYTE PAST the urgent byte.
+             * The single urgent byte is at payload[urgp - 1].
+             *
+             * If urgp is within the current segment (1 <= urgp <= d_len):
+             * - Extract the single urgent byte into conn->urgreadahead.
+             * - Compact the remaining payload in place.
+             * - Advance rcvseq by 1 for the urgent byte.
+             *
+             * If urgp > d_len:
+             * - The urgent byte is located in a future segment not yet
+             *   received; keep current payload intact in normal stream.
+             *
+             * If urgp == 0:
+             * - Invalid urgent offset; keep payload intact in normal stream.
+             */
+
+#ifdef CONFIG_NET_SOCKOPTS
+            if (urgp >= 1 && urgp <= dev->d_len &&
+                !_SO_GETOPT(conn->sconn.s_options, _SO_OOBINLINE))

Review Comment:
   ```tcp_input.c:1594:52: error: ‘_SO_OOBINLINE’ undeclared```
   Also, when we call _SO_GETOPT, we should use ```SO_OOBINLINE``` instead of 
```_SO_OOBINLINE``` when 



-- 
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