[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Multiple IP addresses
From: |
Leon Woestenberg |
Subject: |
Re: [lwip-users] Multiple IP addresses |
Date: |
Thu, 10 Jun 2004 19:14:23 +0200 |
User-agent: |
Mozilla Thunderbird 0.5 (Windows/20040207) |
Hello Paul,
Paul wrote:
I have been asked to implement a dhcp assigned ip address such that if
there is
no dhcp server present the interface will default to a 10.0.0.x ip
address. I figure I could start the dhcp code and some time later check
if the
interface has an ip address or
Two things:
1) I would like to add this to lwIP, but I will do it the neat way
which will involve a netif NETIF_UP and DOWN flag.
2) If you want something that works now, the easiest thing to do is
modify this piece of code in dhcp.c:
---
static void dhcp_timeout(struct netif *netif)
{
/* back-off period has passed, or server selection timed out */
if ((dhcp->state == DHCP_BACKING_OFF) ||
(dhcp->state == DHCP_SELECTING)) {
dhcp_discover(netif);
/* receiving the requested lease timed out */
} else if (dhcp->state == DHCP_REQUESTING) {
---
into this:
---
static void dhcp_timeout(struct netif *netif)
{
if ((dhcp->state == DHCP_BACKING_OFF)
{
/* stop trying DHCP */
dhcp_stop(netif);
/* fallback */
ipconfig_fallback(netif);
} else if (dhcp->state == DHCP_SELECTING) {
if (dhcp->tries <= 2) {
dhcp_discover(netif);
} else {
/* stop trying DHCP */
dhcp_stop(netif);
/* fallback */
ipconfig_fallback(netif);
}
}
In ipconfig_fallback() configure the network interface as you like.
I am wondering if it is possible to have an interface configured for DHCP
and have a second ip address assigned to the same interface?
Not at the moment. What I would like to see implemented is this:
1) Mark the interface down.
2) *Optionally* provide an address to the interface using netif_addr()
3) If (2) did not provide an address, start ARP quering for available
addresses in the address space allocated for that (like Windows does
when it does not find a DHCP server). (Must lookup defacto spec...).
3) In parallel, (!) query for a DHCP server.
4) If 3 fails, fallback to 3 (or to 2 if an address was specified).
If you want to work in either area, I am interested in reviewing the
code for inclusion in the CVS source tree, but only if it is not
hackery. :-)
Regards,
Leon.
Or, if the
or is there a better way ?
Thanks
Paul
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users