lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] 2 Interfaces


From: Artem Pisarenko
Subject: Re: [lwip-users] 2 Interfaces
Date: Tue, 05 Mar 2013 15:30:24 +0700
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3

05.03.2013 15:07, Fabian Cenedese пишет:
At 11:50 28.02.2013 +0100, you wrote:

Fabian Cenedese wrote:
I have a device with 2 Ethernet interfaces. Can I have two
"instances" of lwip to handle those?
Not unless you use a full-blown OS that can give the 2 instances seperated address 
spaces. In other words, the answer is possibly "no, you can't".

My problem is that both
are equal and should allow the same functionality. E.g. it
should be possible to have handlers that listen on the same
(UDP) port for each interface. But lwip can obviously only
have one handler. Or with sockets, there's no way to specify
an interface if I have two sockets listening on the same port
and the same IP addresses.
You can't do this on the same IP address. To do this with lwIP, you need to 
give each netif a dedicated IP address.
Assuming that both interfaces have different IP/MAC and
don't need to handle the same ports, would it then be
possible to handle both devices with the same instance
of lwip? I mean there's netif_add, can't I call this twice
for every interface and set just one as the default? What
conditions need to be fulfilled to make this work?

Thanks

bye  Fabi


Yes, you can. Also you can listen TCP connections or receive UDP datagrams on specified port within single socket or netconn (binded with IP_ADDR_ANY) from all interfaces. You just need two network drivers initialized with netif_add() and netif_up() each, then set one of them default. Details on how implement drivers depend on your hardware. lwip provides driver functions with netif* instance handle allowing driver(-s) distinguish interface used.

Regards,
Artem Pisarenko




reply via email to

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