Open snej opened 6 years ago
I think a better approach would be to create a net platform rather than modifying the posix platform in-place, even if the new platform is based on posix.
Maybe call it plat-net/lwip-sockets
?
I think a better approach would be to create a net platform rather than modifying the posix platform in-place, even if the new platform is based on posix.
But that would mean duplicating ~1200 lines of code, which I couldn't bring myself to do (I'm pretty strict about DRY.)
Consider also that most of the changes aren't specific to lwIP; they'll add support for any other POSIX-like platform that's missing poll
and/or sendmsg
.
But it is of course your call. I may just keep my fork, err, forked. In that case, mind if I submit a smaller PR for just the ESP32-specific changes (e.g. to logging?)
I'll take another look over the changes. If there are other POSIX platforms that your changes help make LibNyoci build on (Solaris? QNX? Minix?), then I'd be inclined to accept it. QNX in particular might benefit from it.
But I may end up just going ahead and implementing support for native LWIP.
Travis is failing here with these changes:
../../../../src/plat-net/posix/nyoci-plat-net.c:922:4: error: field designator 'sin6_len' does not refer to any field in type 'struct sockaddr_in6'
.sin6_len = sizeof(struct sockaddr_in6),
^
But let me review this stuff before you spend any significant amount of time trying to address that.
Good news: It looks like I'll be adding real native support for LWIP at some point between now and the end of November. I'll also be adding support for bare-bones OpenThread.
You've got some good changes in this PR, so I'm going to keep this open for now.
lwIP = Lightweight IP library http://savannah.nongnu.org/projects/lwip/
ESP-IDF = iOT Development Framework for Espressif's ESP32 chip https://github.com/espressif/esp-idf
New preprocessor flags for configuration:
poll
system call is available and should be used instead ofselect
. Defaults to 1 unless building for lwIP; explicitly define it as 0 to force use ofselect
.sendmsg
system call is available and should be used instead ofsend
. Defaults to 1 unless building for lwIP; explicitly define it as 0 to force use ofsend
. Note:send
does not support setting the “from” address of the packet.Fixes #8
(I also added a one-line commit that fixes a recent regression on the master branch that I discovered when rebasing just now.)