lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Multiple network adapters


From: Kieran Mansley
Subject: Re: [lwip-users] Multiple network adapters
Date: Wed, 13 Apr 2011 21:21:04 +0100

On 13 Apr 2011, at 09:21, Adam Fullerton wrote:

> Attached is the diagram with the IP addresses. The problem is when the PC 
> attempts to access the web server on 192.168.1.13, lwIP routes the messages 
> to Port1 since this was the last port on the list.
> 
> To workaround this I keep a cache of the IP addresses received by each port. 
> I am sure that there is a better way of doing it.

Assuming they are all using the same netmask, and so are on the same IP subnet, 
there's no way for IP routing in its standard form to give the right answer: it 
assumes that because both the interfaces are in the same subnet the rest of the 
subnet can be reached by either interface.  You could:

1) Move 192.168.1.14 and 192.168.1.15 to a different IP subnet; this would be 
the most straightforward and standard way but might not work for some other 
reason.

2) Implement SO_BINDTODEVICE for lwIP which allows you to bind a socket to a 
particular network interface, and bypass normal IP routing.  lwIP doesn't 
support it at the moment.

3) Do something like you are with caching of seen addresses, which while 
imperfect might be good enough.  It's essentially how a switch would work, and 
as you're sort of operating like a switch there's some merit to this idea.

4) Fundamentally, should your device be operating at the IP layer at all?  I 
can't really answer this but depending on what it does it might be better if it 
(like a switch) did not use IP addresses itself and just echoed traffic 
received on port A onto port B and vice versa.

Kieran


reply via email to

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