[Top][All Lists]

[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: Mon, 28 Jun 2004 20:19:39 +0200
User-agent: Mozilla Thunderbird 0.5 (Windows/20040207)


Gratuitous ARP: Up through 0.7.2, I show no code in netif_set_ipaddr
that uses etharp_query(netif, ipaddr, NULL). Outside of the cmp for
It seems I added the code to the CVS main trunk only (i.e. HEAD) in-line
with the concept of not adding new features to the stable trunk (0.7.x).

So, only when you do a CVS checkout will you see this. However, your
solution works perfectly for a Ethernet-only lwIP host:

Implemented in dhcp at the end of dhcp_bind,
  /* netif is now bound to DHCP leased address */
  dhcp_set_state(dhcp, DHCP_BOUND);

  etharp_query(netif, &dhcp->offered_ip_addr, NULL);

Yup, nice place to put it. I want to forward this change into lwIP, but
first I have to remove the dependency on Ethernet.

The arp entry on my PC client _does_ get updated! Following is a dump ( which performs 4 calls ) is this correct?

No. Time        Source           Destination      Protocol Info
51  9.375649  Qualstar_ff:ff:07  Broadcast        ARP      Who has  Tell
52  9.805944  Qualstar_ff:ff:07  Broadcast        ARP      Who has  Tell
53  10.314237 Qualstar_ff:ff:07  Broadcast        ARP      Who has  Tell
55  10.822746 Qualstar_ff:ff:07  Broadcast        ARP      Who has  Tell

Seems fine. Some explanation:

Packets #51 through #53 probably(*) is the lwIP host, that has just received an DHCP_ACK for a REQUESTED address OFFERED earlier by the DHCP server. It asks around if anyone else has this address in use. See dhcp_check().

After a second and a half, after nobody has replied on the offered address (which is good), dhcp_bind() kicks in, taking the address.

Your modification (see above) now emits a gratuitous ARP message,
with ARP/IP source pair (Qualstar_ff:ff:07 / in packet #55. This should update all local network hosts' ARP caches (and it does).

(*)You can see the relationship between DHCP and ARP simply by using
"dhcp || arp" as the Ethereal filter (IIRC).

I have also added etharp_query(netif, &dhcp->offered_ip_addr, NULL) to my
change-MAC-on-a-static-IP routine also and that works as well.


Let me know if there is any other testing I might be able to do.

Nope, but I am planning some changes in this area which might destabilize this a bit. However, staying on 0.7 is the safe path
for a production quality stack.

Upcoming changes in CVS:

interface up/down capability
interface link type knowledge
making arp link layer independent



reply via email to

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