[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Sending to a non-local network without default netif set

From: Mark Lvov
Subject: [lwip-users] Sending to a non-local network without default netif set
Date: Thu, 7 Aug 2014 19:19:47 +0400


I have two network interfaces: ethernet and ppp (they obviously don't
share a subnet). I need to open a number of TCP connections with the
requirement, that certain connections must be opened via a particular
interface. I was trying to achieve that by binding to an address-port
prior to connecting, where the address corresponds to an address of a
particular interface.

However, I've noticed that when the destination is not in the same
network with any of the interfaces, the packets fail to route, even
though the default gateway on the interface is defined (so there
should be no problem routing the packet).

While reading the source of ip4.c I've realized, that
* the source address is not considered, which means, that binding to a
particular address before connecting is apparently meaningless
* the gw, that's set on the interface is not considered
I understand, that gw *is* considered in etharp_output, but since it
is called after ip_route, it is never reached. etharp_output is not
relevant for ppp, too.

I see, there's the notion of a "default" interface, but I believe,
that it does not apply to my case, since is a requirement, that
certain connections must go through certain interfaces.

Hopefully, I've managed to express my question adequately.

Is there anything that could be done? I see, that I could define
LWIP_HOOK_IP4_ROUTE, but, unfortunately, it does not receive the
source address as an argument, so that would not work.

Maybe, I am missing something obvious?

Thanks in advance,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]