-
Notifications
You must be signed in to change notification settings - Fork 10
Support for lwIP #8
Comments
First of all, this sounds great! Thanks for having a look. I always intended to add LWIP support but never got around to it. My first suggestion would be to not attempt to adapt |
Some hints:
That being said, it is usually convenient to have You could also implement Again, I recommend using LwIP directly instead of using the BSD-Sockets emulation that comes with LwIP. It will give you a tighter, better integrated solution. |
Thanks for the quick reply! For now I'm hacking the plat_posix code, because it's faster and I've got a demo on Thursday 😱 It's compiling and basically running now; I will know if it works properly in a few hours when I get the rest of my demo functional. |
How'd the demo go? |
Pretty well, thanks. It had a tendency to stop responding after a minute or so, but I worked around that. Afterwards I found the reason — I had an uninitialized variable, which was sometimes causing huge I have a branch with my changes; I'll clean it up and submit it to you as a PR. (As I said earlier, it adapts the existing POSIX code to make it compatible with lwIP's POSIX adapter layer, instead of creating a new implementation.) |
I'd like to use libnyoci on an Espressif ESP32 system (SparkFun's ESP32 Thing.) The software stack for this is the ESP IoT Development Framework, ESP-IDF, which uses lwIP for IP networking. This is apparently a pretty widespread IP stack; Wikipedia says "lwIP is used by many manufacturers of embedded systems. Examples include Altera (in the Nios II operating system), Analog Devices (for the Blackfin DSP chip), Xilinx, Honeywell ... and Freescale."
Most of libnyoci builds fine, but there are a bunch of errors in
plat-net/posix/
due to missing functionality in lwIP:poll
isn't supported, sonyoci_plat_update_pollfds
needs to be#ifdef
'd out, but thennyoci_plat_wait
andnyoci_plat_process
break because they call it.cmsgheader
and all its ancillary types and constants aren't defined. This breakssendtofrom
.ipv6_mreq
is calledip6_mreq
for some reason, and itsipv6mr_interface
field is of typein6_addr
notint
, i.e. it wants the IP address of the interface, not its index in the interface list (which doesn't seem to exist; there is nogetifaddrs
.)in_pktinfo
andin6_pktinfo
aren't defined. This breaks thepktinfo
field ofnyoci_plat_s
(which seems to be unused. It's written to innyoci_plat_process
, but never read.)IN6_IS_ADDR_V4MAPPED
is not defined. I worked around this by copying in the definition from macOS's<in6.h>
.<sys/select.h>
for some reason, insteadselect
is in<lwip/sockets.h>
.The first issue is the hardest one for me, since I don't know much about either poll or select. Looks like I need to reimplement
nyoci_plat_wait
andnyoci_plat_process
usingnyoci_plat_update_fdsets
. Probably easy, but I'd appreciate any clues.The second and third issues seem to be related to multihoming; not a problem for my use case because my board only has a single (WiFi) interface.
The other issues I think I've fixed locally.
The text was updated successfully, but these errors were encountered: