zhhyu7 opened a new pull request, #4204: URL: https://github.com/apache/nuttx-apps/pull/4204
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary Add rpmsg_tun_server and rpmsg_tun_client, which bridge a local TUN interface to a peer CPU through an AF_RPMSG stream socket, so one core can use the IP stack of another: rpmsg_tun_server <tunname> <ip> <mask> [<ifname>] rpmsg_tun_client <tunname> <ip> <mask> <cpu> [<ifname>] Each side configures its TUN interface and copies packets between the TUN fd and the RPMsg socket. TUN, RPMsg and netlink sockets are non-blocking and served from one poll() loop. With <ifname>, a side watches that interface through netlink and only forwards while it is running and has an IPv4 address. The client reconnects when the server goes away; ENOMEM from the TUN write is treated as transient. ## Impact - New, opt-in: CONFIG_NETUTILS_RPMSG_TUN_SERVER (needs NET_NETLINK) and CONFIG_NETUTILS_RPMSG_TUN_CLIENT; both need RPMSG and NET_TUN. ## Testing Two sim processes connected by sim RPTUN: sim:rpserver (master, "server") and a slave image built from sim:rpserver with SIM_RPMSG_MASTER=n and RPMSG_LOCAL_CPUNAME="proxy". Both with NET_TUN and NET_NETLINK. ``` server> rpmsg_tun_server tun0 192.168.77.1 255.255.255.0 & proxy> rpmsg_tun_client tun0 192.168.77.2 255.255.255.0 server & ``` Client -> server: ``` proxy> ping -c 3 192.168.77.1 PING 192.168.77.1 56 bytes of data 56 bytes from 192.168.77.1: icmp_seq=0 time=9.1 ms 56 bytes from 192.168.77.1: icmp_seq=1 time=10.0 ms 56 bytes from 192.168.77.1: icmp_seq=2 time=20.1 ms 3 packets transmitted, 3 received, 0% packet loss, time 3039 ms ``` Server -> client (200-byte payload; the TUN MTU is 296): ``` server> ping -c 3 -s 200 192.168.77.2 PING 192.168.77.2 200 bytes of data 200 bytes from 192.168.77.2: icmp_seq=0 time=18.7 ms 200 bytes from 192.168.77.2: icmp_seq=1 time=10.3 ms 200 bytes from 192.168.77.2: icmp_seq=2 time=20.1 ms 3 packets transmitted, 3 received, 0% packet loss, time 3038 ms rtt min/avg/max/mdev = 10.389/16.412/20.113/4.295 ms ``` Open issue found on sim: - After "kill -9" of a running rpmsg_tun_client, a new rpmsg_tun_client starts but no traffic passes ("No response" to ping); the server task stays in its loop. kill -9 does not run the client's cleanup, so the old TUN fd and RPMsg socket are only released by task teardown; not yet clear whether the server or the RPMsg socket close is at fault. Normal start/stop was not affected. checkpatch.sh -c -u -m -g passes for every commit. -- 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]
