CubeMX and LwIP : DHCP packet is sent, but something is wrong
Hello,
I'm trying to get DHCP working as an initial step in using LwIP. Have generated project with CubeMX and now I'm catching the problem.
Using Wireshark, I can see that DHCP Discover packet is sent, but no response is received. IT seems that something is wrong with the packet. As a reference, I also captured DHCP packet from my laptop that does work and gets response.
Any advice what is wrong ?
Thanks in advance,
regards,
Rob.
Packet from STM32F439 :
No. Time Source Destination Protocol Length Info
3006 49.570106 0.0.0.0 255.255.255.255 DHCP 350 DHCP Discover - Transaction ID 0x5851f42d
Frame 3006: 350 bytes on wire (2800 bits), 350 bytes captured (2800 bits) on interface 0
Interface id: 0 (\Device\NPF_{A7ACDF3A-ED3E-4FAD-B7B4-533C6D411BF2})
Encapsulation type: Ethernet (1)
Arrival Time: May 1, 2019 10:37:34.873435000 Srednjeevropski poletni �?as
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1556699854.873435000 seconds
[Time delta from previous captured frame: 0.075670000 seconds]
[Time delta from previous displayed frame: 11.888756000 seconds]
[Time since reference or first frame: 49.570106000 seconds]
Frame Number: 3006
Frame Length: 350 bytes (2800 bits)
Capture Length: 350 bytes (2800 bits)
[Frame is marked: True]
[Frame is ignored: False]
[Protocols in frame: eth:ethertype:ip:udp:dhcp]
[Coloring Rule Name: UDP]
[Coloring Rule String: udp]
Ethernet II, Src: Stmicroe_00:00:00 (00:80:e1:00:00:00), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Destination: Broadcast (ff:ff:ff:ff:ff:ff)
Source: Stmicroe_00:00:00 (00:80:e1:00:00:00)
Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
0100 .... = Version: 4
.... 0101 = Header Length: 20 bytes (5)
Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
Total Length: 336
Identification: 0x0001 (1)
Flags: 0x0000
Time to live: 255
Protocol: UDP (17)
Header checksum: 0xba9c [validation disabled]
[Header checksum status: Unverified]
Source: 0.0.0.0
Destination: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Source Port: 68
Destination Port: 67
Length: 316
Checksum: 0xf773 [unverified]
[Checksum Status: Unverified]
[Stream index: 8]
[Timestamps]
Dynamic Host Configuration Protocol (Discover)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x5851f42d
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: Stmicroe_00:00:00 (00:80:e1:00:00:00)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Discover)
Length: 1
DHCP: Discover (1)
Option: (57) Maximum DHCP Message Size
Length: 2
Maximum DHCP Message Size: 1500
Option: (55) Parameter Request List
Length: 3
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (3) Router
Parameter Request List Item: (28) Broadcast Address
Option: (255) End
Option End: 255
Padding: 000000000000000000000000000000000000000000000000…and working DHCP packet from laptop (and DHCP offer it gets as a response) :
No. Time Source Destination Protocol Length Info
280 37.678948 0.0.0.0 255.255.255.255 DHCP 351 DHCP Discover - Transaction ID 0xac96b414
Frame 280: 351 bytes on wire (2808 bits), 351 bytes captured (2808 bits) on interface 0
Interface id: 0 (\Device\NPF_{A7ACDF3A-ED3E-4FAD-B7B4-533C6D411BF2})
Encapsulation type: Ethernet (1)
Arrival Time: May 1, 2019 10:37:22.982277000 Srednjeevropski poletni �?as
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1556699842.982277000 seconds
[Time delta from previous captured frame: 0.235728000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 37.678948000 seconds]
Frame Number: 280
Frame Length: 351 bytes (2808 bits)
Capture Length: 351 bytes (2808 bits)
[Frame is marked: True]
[Frame is ignored: False]
[Protocols in frame: eth:ethertype:ip:udp:dhcp]
[Coloring Rule Name: UDP]
[Coloring Rule String: udp]
Ethernet II, Src: Pegatron_bb:30:10 (0c:54:a5:bb:30:10), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Destination: Broadcast (ff:ff:ff:ff:ff:ff)
Source: Pegatron_bb:30:10 (0c:54:a5:bb:30:10)
Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
0100 .... = Version: 4
.... 0101 = Header Length: 20 bytes (5)
Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
Total Length: 337
Identification: 0x62af (25263)
Flags: 0x0000
Time to live: 128
Protocol: UDP (17)
Header checksum: 0x0000 [validation disabled]
[Header checksum status: Unverified]
Source: 0.0.0.0
Destination: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Source Port: 68
Destination Port: 67
Length: 317
Checksum: 0xa8e9 [unverified]
[Checksum Status: Unverified]
[Stream index: 8]
[Timestamps]
Dynamic Host Configuration Protocol (Discover)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0xac96b414
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: Pegatron_bb:30:10 (0c:54:a5:bb:30:10)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Discover)
Length: 1
DHCP: Discover (1)
Option: (61) Client identifier
Length: 7
Hardware type: Ethernet (0x01)
Client MAC address: Pegatron_bb:30:10 (0c:54:a5:bb:30:10)
Option: (50) Requested IP Address (192.168.0.212)
Length: 4
Requested IP Address: 192.168.0.212
Option: (12) Host Name
Length: 22
Host Name: Robi_Ideapad710_laptop
Option: (60) Vendor class identifier
Length: 8
Vendor class identifier: MSFT 5.0
Option: (55) Parameter Request List
Length: 14
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (3) Router
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (31) Perform Router Discover
Parameter Request List Item: (33) Static Route
Parameter Request List Item: (43) Vendor-Specific Information
Parameter Request List Item: (44) NetBIOS over TCP/IP Name Server
Parameter Request List Item: (46) NetBIOS over TCP/IP Node Type
Parameter Request List Item: (47) NetBIOS over TCP/IP Scope
Parameter Request List Item: (119) Domain Search
Parameter Request List Item: (121) Classless Static Route
Parameter Request List Item: (249) Private/Classless Static Route (Microsoft)
Parameter Request List Item: (252) Private/Proxy autodiscovery
Option: (255) End
Option End: 255