2025-04-30 12:31 AM
Dear colleagues, hello! Question about LWIP. I have two network interfaces, one on the QCA 7000 chip via SPI, the second on LAN 8742, installed on the debug board. I use the Socket API. The problem is as follows: The server is running on one interface, the client on the other. When they are not running at the same time, everything works fine. But if you enable them at the same time, sometimes the outgoing packet on the QCA 7000 interface gets stuck in the LWIP library for about 210ms. And this time interval is always the same. Please tell me which way to look to solve this problem
2025-04-30 12:48 AM
Welcome to the forum.
Please see How to write your question to maximize your chances to find a solution for best results.
@Ivan4S4 wrote:on the debug board.
What board is that?
@Ivan4S4 wrote:Please tell me which way to look to solve this problem
See this article for LwIP debug options.
See also: https://www.nongnu.org/lwip/2_0_x/group__lwip__opts__debugmsg.html
2025-04-30 1:03 AM
Just guessing and googling: maybe it's the same problem?
"LwIP wasn't designed to work well with multiple netif's. The function ip4_route is used, which wrongly selects the first netif it can find, so the tcp traffic used two different physical ports for the same source IP address when routed to the same switch"
And have you given each netif a dedicated IP address?
2025-04-30 1:14 AM - edited 2025-04-30 1:15 AM
@LCE wrote:"LwIP wasn't designed to work well with multiple netif's..."
Indeed - people often forget that the "Lw" in "LwIP" stands for Light-weight.
From the LwIP Home Page:
"lwIP is a small independent implementation of the TCP/IP protocol suite"
"The focus of the lwIP TCP/IP implementation is to reduce resource usage while still having a full scale TCP. This makes lwIP suitable for use in embedded systems with tens of kilobytes of free RAM and room for around 40 kilobytes of code ROM."
@Ivan4S4 hasn't said what MCU is being used, but F7 is tagged - which has resources far beyond that "tens of kilobytes of free RAM and room for around 40 kilobytes of code" !
So maybe a more capable stack would be appropriate?
2025-04-30 1:53 AM - edited 2025-04-30 1:54 AM
The SO question is 5 years old. Better ask via the LwIP mailing list
2025-04-30 1:54 AM
Dear colleagues, thank you to everyone who joined the discussion. Yes, I am using the STM32F746 Discovery debugging board. By setting the SO_BINDTODEVICE option, I assigned a specific interface to the sockets, as mentioned above. I'm scanning packets using Wireshark. And I see that when using two interfaces at the same time, outgoing packets on one of them are lost from time to time.
2025-04-30 1:56 AM
So have you enabled the debug trace options to see what's going on?
2025-04-30 2:14 AM
By the way, if I turn off the TCP client and use PING, ICMP packets that I send to the first interface, this also happens from time to time.
2025-04-30 2:16 AM
What kind of debugging option do you have in mind?
2025-04-30 2:36 AM - edited 2025-04-30 2:37 AM
The ones I linked in my first reply!