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: Tom C. Barker
Subject: RE: [lwip-users] DHCP and changing the MAC address
Date: Thu, 24 Jun 2004 14:52:05 -0700

Thanks Leon.
I did not use dhcp_release because of its static keyword and 
that it was not listed in the .h file. But, fixing these two,
I ran it and it got even worse. I use ethereal constantly, so
here's the dump of what happens on stop, release, start with
no other intervention: the module just loops on the coarse timer
sends a discover and request every 10 seconds. It does not wait 
for a response from the discover.

Tom


No.     Time        Source                Destination           Protocol Info
    249 65.901966   16.101.63.101         255.255.255.255       DHCP     DHCP 
Discover - Transaction ID 0xabcd000a

Frame 249 (350 bytes on wire, 350 bytes captured)
Ethernet II, Src: 00:08:4f:ff:ff:08, Dst: ff:ff:ff:ff:ff:ff
    Destination: ff:ff:ff:ff:ff:ff (Broadcast)
    Source: 00:08:4f:ff:ff:08 (Qualstar_ff:ff:08)
    Type: IP (0x0800)
Internet Protocol, Src Addr: 16.101.63.101 (16.101.63.101), Dst Addr: 
255.255.255.255 (255.255.255.255)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
    Total Length: 336
    Identification: 0x000a (10)
    Flags: 0x04 (Don't Fragment)
    Fragment offset: 0
    Time to live: 255
    Protocol: UDP (0x11)
    Header checksum: 0x62c8 (correct)
    Source: 16.101.63.101 (16.101.63.101)
    Destination: 255.255.255.255 (255.255.255.255)
User Datagram Protocol, Src Port: bootpc (68), Dst Port: bootps (67)
    Source port: bootpc (68)
    Destination port: bootps (67)
    Length: 316
    Checksum: 0x96f9 (correct)
Bootstrap Protocol
    Message type: Boot Request (1)
    Hardware type: Ethernet
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0xabcd000a
    Seconds elapsed: 0
    Bootp flags: 0x0000 (Unicast)
    Client IP address: 16.101.63.101 (16.101.63.101)
    Your (client) IP address: 0.0.0.0 (0.0.0.0)
    Next server IP address: 0.0.0.0 (0.0.0.0)
    Relay agent IP address: 0.0.0.0 (0.0.0.0)
    Client hardware address: 00:08:4f:ff:ff:08
    Server host name not given
    Boot file name not given
    Magic cookie: (OK)
    Option 53: DHCP Message Type = DHCP Discover
    Option 57: Maximum DHCP Message Size = 576
    Option 55: Parameter Request List
    End Option
    Padding

No.     Time        Source                Destination           Protocol Info
    250 65.984217   16.101.63.101         255.255.255.255       DHCP     DHCP 
Request  - Transaction ID 0xabcd000b

Frame 250 (350 bytes on wire, 350 bytes captured)
Ethernet II, Src: 00:08:4f:ff:ff:08, Dst: ff:ff:ff:ff:ff:ff
    Destination: ff:ff:ff:ff:ff:ff (Broadcast)
    Source: 00:08:4f:ff:ff:08 (Qualstar_ff:ff:08)
    Type: IP (0x0800)
Internet Protocol, Src Addr: 16.101.63.101 (16.101.63.101), Dst Addr: 
255.255.255.255 (255.255.255.255)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
    Total Length: 336
    Identification: 0x000b (11)
    Flags: 0x04 (Don't Fragment)
    Fragment offset: 0
    Time to live: 255
    Protocol: UDP (0x11)
    Header checksum: 0x62c7 (correct)
    Source: 16.101.63.101 (16.101.63.101)
    Destination: 255.255.255.255 (255.255.255.255)
User Datagram Protocol, Src Port: bootpc (68), Dst Port: bootps (67)
    Source port: bootpc (68)
    Destination port: bootps (67)
    Length: 316
    Checksum: 0xf560 (correct)
Bootstrap Protocol
    Message type: Boot Request (1)
    Hardware type: Ethernet
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0xabcd000b
    Seconds elapsed: 0
    Bootp flags: 0x0000 (Unicast)
    Client IP address: 16.101.63.101 (16.101.63.101)
    Your (client) IP address: 0.0.0.0 (0.0.0.0)
    Next server IP address: 0.0.0.0 (0.0.0.0)
    Relay agent IP address: 0.0.0.0 (0.0.0.0)
    Client hardware address: 00:08:4f:ff:ff:08
    Server host name not given
    Boot file name not given
    Magic cookie: (OK)
    Option 53: DHCP Message Type = DHCP Request
    Option 57: Maximum DHCP Message Size = 576
    Option 50: Requested IP Address = 16.101.63.200
    Option 54: Server Identifier = 16.101.63.3
    Option 55: Parameter Request List
    End Option
    Padding







-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf
Of Leon Woestenberg
Sent: Thursday, June 24, 2004 1:22 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] DHCP and changing the MAC address


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.



_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users




reply via email to

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