Lwip pppos define netif?

I am trying to create a socket connection through lwip.

on the call lwip_connect(int s, const struct sockaddr *name, socklen_t namelen) fails on a routing error. Stepping through the code I can see that ip4.c returns NULL as it can’t find a netif which has the correct settings for the requested dest ip address.

I think the modem itself is properly set in ppp mode. I used the following sequence to get it in ppp:



Get IP Address
(I can’t ping this, I think it’s shielded of by provider)

Enable ppp mode

I have lwip sio.h functions implemented, so that they read/write from/to my LTE modem. I can see data being transferred in and out of lwip core, so I think I have this part working properly as well.

I suspect I am missing proper configuration before calling pppos_create. I can see that the implementation of pppos_create also takes care of adding the netif, but it does that with “any” ipaddress/broadcast/subnet. I tried to take care of the netif_add myself, where I also supply the IP address of the modem, its subnet, and its default gateway. Unfortunately this makes no change for the ip_route. It still returns NULL.

I would really appreciate some help / guidance.

I published the current state of this project here:
basprins/freertos_lwip_stm32f446 (github.com)

Many thanks in advance!

1 Like

I managed to get passed the routing issue by adding netif_set_default(&pppos_netif) and netif_set_link_up(&pppos_netif). Still I wonder if I should do this, it feels a bit backwards since my ppp connection shouldn’t care too much about routing. It goes from the point of the modem, to the point of the ISP, right? But maybe lwip still needs to add this information to the header of the packet. The guessing doesn’t give me a lot of confident; I must admit, I don’t really know what I am doing… If only I had 10 years + experience in modem technology ;-).

Anyway, when I “sort of hack through the routing problem” I get to the point where lwip initiates the tcp connection, but blocks forever on a semaphore.

I guess the reason is, that it tries to send over the bytes on my ppp connection, but because of the “cheated routing” it ends up nowhere. I guess the api_msg is waiting for some response which never comes, and game over.

Maybe some additional questions that can be answered (since I am still too stubborn to give up… just yet).

  • is there any way I can “test” my ppp connection without relying on lwip? Is there a not too complicated trick I can do to send raw bytes to my uart connected to the “modem in ppp mode” and validate if certain bytes are returned which proof that at least the ppp mode is properly set up
  • is there anybody that can explain which steps I should take to have lwip properly configure the pppos connection? I have googled so much, I can’t imagine there is still a page on this topic I haven’t seen, but none of them seem to reveal anything “new” or something I am seem to miss. The thing that concerns me a bit, is that none of the fragments I see here and there, seem to care about configuring the netif manually. They all seem to rely on the pppos_create call, which kind of tells me I am doing something wrong.

Or maybe, somebody can discourage me further that I have no business attempting to configure lwip when I don’t master the ppp / LTE modem domain. :slight_smile: I have no idea what I can expect from this library. I also don’t have a degree in networking, yet I am perfectly capable of writing robust TCP/IP software in .NET. Can I expect the same from lwip? Or is lwip really a different story, and is this really for the “big boys” with years of experience low level networking etc?

Thanks for taking the time to answer, even if it is not really what I want to hear :wink: