lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Sending to a non-local network without default netif se


From: Simon Goldschmidt
Subject: Re: [lwip-users] Sending to a non-local network without default netif set
Date: Thu, 7 Aug 2014 22:11:39 +0200

Mark Lvov wrote:

> [..] 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.
> [..]
> 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?

I don't think you missed something obvious other than that lwIP wasn't meant to 
support the things you want to do. The routing hook you found was meant to 
support better routing, but it might not be enough for you.

In cases like this, ask yourself how would you write the same application on 
windows or Linux? Normally you'd have to adjust the routing table. And at least 
on windows, IPv4 routing takes the target address only. So you'd have to set up 
a routing table for all your target addresses and use it to decide in your 
routing hook function without the need of binding to a local IP address of one 
of the interfaces. Wouldn't that work? Aren't the destination addresses unique 
for your application?

Simon



reply via email to

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