jwang12340 opened a new pull request, #20333:
URL: https://github.com/apache/nuttx/pull/20333

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   Implement the `CAN_RAW_LOOPBACK` and `CAN_RAW_RECV_OWN_MSGS` socket options
   for SocketCAN, following standard Linux behavior.
   
   ## Impact
   
   - Users: Applications using SocketCAN can now use CAN_RAW_LOOPBACK (enabled 
by default) and CAN_RAW_RECV_OWN_MSGS socket options as on Linux. TX 
confirmation is available via MSG_CONFIRM flag in recvmsg().
   - Build: No new Kconfig options. The loopback logic is guarded by the 
existing CONFIG_NET_CANPROTO_OPTIONS. No impact on builds that do not enable 
SocketCAN.
   - Compatibility: CAN_RAW_LOOPBACK is enabled by default, consistent with 
Linux. Existing applications that did not set this option will now see loopback 
behavior (same as Linux default). Applications that explicitly disabled 
loopback via setsockopt are unaffected.
   
   ## Testing
   
   Host: Ubuntu 22.04 x86_64
   
   Tested on QEMU ARM with virtual CAN interfaces:
   - Verified loopback is enabled by default (sender receives its own frames
     on other local sockets)
   - Verified `setsockopt(CAN_RAW_LOOPBACK, 0)` disables loopback
   - Verified `CAN_RAW_RECV_OWN_MSGS` controls whether the sending socket
     itself receives the looped-back frame
   - Verified `MSG_CONFIRM` flag is set on TX confirmation messages
   - Verified no IOB memory leak when loopback clone fails or conditions 
mismatch


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