Guys,
OK then - I finally found an old hub which is working (ie not a switch!)., and managed to capture the DHCP trace using netmon 3.4.
The problem is (as I originally suspected) with the ‘accept’ message from the client code. Somehow - it seems to be getting a fixed Server IP address (probably hard-coded :-O) of 192.168.0.1.
My DHCP server is 192.168.1.1.
The DHCPOFFER clearly has the ServerIdentifier as its own correct address :
ServerIdentifier: 192.168.1.1 - Type 54
The following DHCPREQUEST from the Wiznet client code tries to accept the offer from the wrong server:
ServerIdentifier: 192.168.0.1 - Type 54
This would therefore explain why the DHCP server never responds with a DHCPACK (or even NAK), and thus also never registers the address in its list of DHCP clients !!.
Of course - in practice the client code should not go ahead and start using this IP address until the server responds with a DHCPACK anyway - but it currently does - as EnableDhcp just exits and we carry on…
So - the question is how to get this code fixed ???.
As this is ‘open-source’ code - do I have to find the code, fix it, rebuild it and then reload, test and upload the changes ??? This would of course mean that I am then working on a ‘special’ code build - which I would definitely rather NOT do !!
Sorry - not up to speed with modifying open source code - its something I have avoided for way too many years !!..I just want to be an application programmer - really ;-)).
NB I added the packet captures below to confirm my findings…enjoy!!
Many Thanks
Graham
Frame: Number = 55, Captured Frame Length = 342, MediaType = ETHERNET
+ Ethernet: Etype = Internet IP (IPv4),DestinationAddress:[FF-FF-FF-FF-FF-FF],SourceAddress:[00-1C-F0-F1-96-A4]
+ Ipv4: Src = 192.168.1.1, Dest = 255.255.255.255, Next Protocol = UDP, Packet ID = 20886, Total IP Length = 328
+ Udp: SrcPort = BOOTP server(67), DstPort = BOOTP client(68), Length = 308
- Dhcp: Reply, MsgType = OFFER, TransactionID = 0x12345678
OpCode: Reply, 2(0x02)
Hardwaretype: Ethernet
HardwareAddressLength: 6 (0x6)
HopCount: 0 (0x0)
TransactionID: 305419896 (0x12345678)
Seconds: 0 (0x0)
+ Flags: 32768 (0x8000)
ClientIP: 0.0.0.0
YourIP: 192.168.1.35
ServerIP: 0.0.0.0
RelayAgentIP: 0.0.0.0
+ ClientHardwareAddress: 00-26-1C-7B-29-E8
ServerHostName:
BootFileName:
MagicCookie: 99.130.83.99
+ MessageType: OFFER - Type 53
+ RebindingTimeValue: Subnet Mask: 0 day(s),21 hour(s) 0 minute(s) 0 second(s) - Type 59
+ RenewTimeValue: Subnet Mask: 0 day(s),12 hour(s) 0 minute(s) 0 second(s) - Type 58
+ DomainName: GS - Type 15
- DomainNameServer: 0.0.773752851.773752850 - Type 6
Code: Domain Name Server, 6(0x06)
Length: 8 UINT8(s)
- IpAddress:
IpAddress: 46.30.136.18
IpAddress: 46.30.136.19
- Router: 192.168.1.1 - Type 3
Code: Router, 3(0x03)
Length: 4 UINT8(s)
- IpAddress:
IpAddress: 192.168.1.1
- SubnetMask: 255.255.255.0 - Type 1
Code: Subnet Mask, 1(0x01)
Length: 4 UINT8(s)
- IpAddress:
IpAddress: 255.255.255.0
- ServerIdentifier: 192.168.1.1 - Type 54
Code: Server Identifier, 54(0x36)
Length: 4 UINT8(s)
- IpAddress:
IpAddress: 192.168.1.1
+ IPAddressLeaseTime: Subnet Mask: 1 day(s),0 hour(s) 0 minute(s) 0 second(s) - Type 51
+ End:
Padding: Binary Large Object (6 Bytes)
Frame: Number = 56, Captured Frame Length = 590, MediaType = ETHERNET
+ Ethernet: Etype = Internet IP (IPv4),DestinationAddress:[FF-FF-FF-FF-FF-FF],SourceAddress:[00-26-1C-7B-29-E8]
+ Ipv4: Src = 0.0.0.0, Dest = 255.255.255.255, Next Protocol = UDP, Packet ID = 7, Total IP Length = 576
+ Udp: SrcPort = BOOTP client(68), DstPort = BOOTP server(67), Length = 556
- Dhcp: Request, MsgType = REQUEST, TransactionID = 0x12345678
OpCode: Request, 1(0x01)
Hardwaretype: Ethernet
HardwareAddressLength: 6 (0x6)
HopCount: 0 (0x0)
TransactionID: 305419896 (0x12345678)
Seconds: 0 (0x0)
+ Flags: 0 (0x0)
ClientIP: 0.0.0.0
YourIP: 0.0.0.0
ServerIP: 0.0.0.0
RelayAgentIP: 0.0.0.0
+ ClientHardwareAddress: 00-26-1C-7B-29-E8
ServerHostName:
BootFileName:
MagicCookie: 99.130.83.99
+ MessageType: REQUEST - Type 53
- clientID: (Type 1) - Type 61
Code: Client-identifier, 61(0x3D)
Length: 7 UINT8(s)
Type: HardwareAddress(1)
ClientID: Binary Large Object (6 Bytes)
- RequestedIPAddress: 192.168.1.35 - Type 50
Code: Requested IP Address, 50(0x32)
Length: 4 UINT8(s)
- IpAddress:
IpAddress: 192.168.1.35
- ServerIdentifier: 192.168.0.1 - Type 54
Code: Server Identifier, 54(0x36)
Length: 4 UINT8(s)
- IpAddress:
IpAddress: 192.168.0.1
- DHCPEOptionsHostName:
+ HostName: panda - Type 12
+ ParameterRequestList: - Type 55
+ End:
Padding: Binary Large Object (263 Bytes)