Am 07.03.2021 um 12:50 schrieb JonathonS: > Hello, I am attempting to implement an Android VPN service which > provides me raw IP packets on the TUN interface. What I'd like to do is > simply send the whole IP packet (including IP header) to its > destination. I know I can parse the IP packet to pull out only the > TCP/UDP transport layer data and then send it over a TCP/UDP socket > myself but if this is already done by lwip, then I'd prefer to use it > instead.
I'm afraid I don't really underdstand what you mean. You should be able to get a whole packet out of the stack by implementing a non-ethernet netif. For this, set netif->output to your own function instead of etharp_output and don't set the flags NETIF_FLAG_ETHARP and NETIF_FLAG_ETHERNET. This way, your netif->output functions should get pbufs starting with the IP header. If that's what you wanted (as I said, I'm not sure). > > I found the raw APIs > (https://www.nongnu.org/lwip/2_1_x/group__raw__raw.html > <https://www.nongnu.org/lwip/2_1_x/group__raw__raw.html>), but wasn't > sure if this is what I needed to use. Since I am running in user-space > as a regular Android application, I am unable to run as root so not sure > if the raw APIs require that I create a raw socket (which requires root). This question doesn't seem to have anything to do with lwIP or does it? There's no such thing as 'root' in lwIP. Regards, Simon > > Also, if you can provide any sample code, this would be greatly > appreciated. Thanks! > > > _______________________________________________ > lwip-users mailing list > lwip-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/lwip-users > _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users