lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] DHCP and changing the MAC address


From: Leon Woestenberg
Subject: Re: [lwip-users] DHCP and changing the MAC address
Date: Thu, 24 Jun 2004 22:22:06 +0200
User-agent: Mozilla Thunderbird 0.5 (Windows/20040207)

Hello Tom,

Tom C. Barker wrote:
I have a manufacturing scenario where I need to change the
MAC address after DHCP has come up. My code will stop_dhcp
and then start_dhcp. If I initially zero out the ip address, I get a response from my dhcp server and am up and running however, when the code goes to change the listening pcbs for any previously running services, no pcb local addresses get changed to the new dhcp-assigned addressed because the interface ip was set to zero and does not match the original pcb's local address.
If I do not zero the ip address prior to asking for a new
dhcp address, (ask for a new dhcp address while I claim I
have an address) I get no response from my dhcp server. The
coarse timer simply keeps sending out requests every 10 seconds.

Going back and forth from DHCP-off and a static IP address
to DHCP-on performs perfectly. Could anyone help on this issue?
Sure.

The current way of stopping DHCP is dhcp_release() then dhcp_stop().
As solo, dhcp_stop() does not release the DHCP lease.

However, release() does exactly what you describe; it also zeroes
the netif address (see dhcp.c source code of _release).

I suggest removing these lines from dhcp_release:
  /* remove IP address from interface */
  netif_set_ipaddr(netif, IP_ADDR_ANY);
  netif_set_gw(netif, IP_ADDR_ANY);
  netif_set_netmask(netif, IP_ADDR_ANY);

and then try again using dhcp_start(), release() then stop(), then change MAC, then start().

Of course, that may fail still;

What is interesting to examine then, is what the failing pair of DHCP request/offer messages look like. (i.e. where things fail).

Can you use ethereal(.org)? You may especially look at
the dhcp.ciaddr field, source ARP and IP address.

Regards, Leon.





reply via email to

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