Thanks for the great suggestion, Simon! Yes, what you suggest would work.. almost! Indeed, the destination addresses are there in the configuration (along with the interfaces associated with those destinations), so, theoretically, I could indeed route based on destination address only. Problem is, its not the destination address, but the address-port tuple. I am not sure how probable is the configuration where you have similar destination addresses associated with different network interfaces, but it certainly is possible and I can not really enforce the uniqueness of destination addresses. So, while this is definitely a good way to handle multihomed configurations in general, I'll have to do it some other way.
Perhaps, I'll borrow the idea from this bug report: http://savannah.nongnu.org/bugs/?34683 Thanks again. Mark On Fri, Aug 8, 2014 at 12:11 AM, Simon Goldschmidt <goldsi...@gmx.de> wrote: > 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 > > _______________________________________________ > lwip-users mailing list > lwip-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users