btashton commented on pull request #3624:
URL: https://github.com/apache/incubator-nuttx/pull/3624#issuecomment-828953901


   @patacongo thanks for putting the patch together.  I also have verified this 
on my hardware using a nucleo-f767zi.
   
   I am running the kea dhcp server https://kea.readthedocs.io/ with this 
configuration bound to a raw socket on a usb ethernet adapter:
   ```json
   {
       "Dhcp4": {
           "interfaces-config": {
               "interfaces": [ "enp0s20u2/192.0.2.201" ],
               "dhcp-socket-type": "raw"
           },
           "valid-lifetime": 4000,
           "renew-timer": 1000,
           "rebind-timer": 2000,
           "subnet4": [{
              "pools": [ { "pool": "192.0.2.1-192.0.2.200" } ],
              "subnet": "192.0.2.0/24"
           }],
   
          "loggers": [{
               "name": "*",
               "severity": "DEBUG"
           }]
       }
   }
   ```
   
   With the NuttX dhcp client using 0x0000 for bootp (unicast)
   ```
   No.  Time         Source       Destination      Protocol  Length  Info
   1    0.000000000  0.0.0.0      255.255.255.255  DHCP      300     DHCP 
Discover - Transaction ID 0xadde1223
   2    0.000845158  192.0.2.201  192.0.2.1        DHCP      325     DHCP Offer 
   - Transaction ID 0xadde1223
   3    0.001383136  192.0.2.1    255.255.255.255  DHCP      307     DHCP 
Request  - Transaction ID 0xadde1223
   4    0.002137266  192.0.2.201  192.0.2.1        DHCP      325     DHCP ACK   
   - Transaction ID 0xadde1223
   ```
   Specifically looking at the offer:
   ```
   Frame 2: 325 bytes on wire (2600 bits), 325 bytes captured (2600 bits) on 
interface enp0s20u2, id 0
   Ethernet II, Src: GoodWayI_29:71:50 (00:50:b6:29:71:50), Dst: 
5a:1d:cd:df:f4:44 (5a:1d:cd:df:f4:44)
   Internet Protocol Version 4, Src: 192.0.2.201, Dst: 192.0.2.1
   User Datagram Protocol, Src Port: 67, Dst Port: 68
   Dynamic Host Configuration Protocol (Offer)
       Message type: Boot Reply (2)
       Hardware type: Ethernet (0x01)
       Hardware address length: 6
       Hops: 0
       Transaction ID: 0xadde1223
       Seconds elapsed: 0
       Bootp flags: 0x0000 (Unicast)
       Client IP address: 0.0.0.0
       Your (client) IP address: 192.0.2.1
       Next server IP address: 0.0.0.0
       Relay agent IP address: 0.0.0.0
       Client MAC address: 5a:1d:cd:df:f4:44 (5a:1d:cd:df:f4:44)
       Client hardware address padding: 00000000000000000000
       Server host name not given
       Boot file name not given
       Magic cookie: DHCP
       Option: (53) DHCP Message Type (Offer)
       Option: (1) Subnet Mask (255.255.255.0)
       Option: (12) Host Name
       Option: (51) IP Address Lease Time
       Option: (54) DHCP Server Identifier (192.0.2.201)
       Option: (58) Renewal Time Value
       Option: (59) Rebinding Time Value
       Option: (255) End
   ```
   
   
   With the NuttX client configured with bootp flags of 0x8000 (broadcast)
   ```
   No.  Time         Source       Destination      Protocol  Length  Info
   1    0.000000000  0.0.0.0      255.255.255.255  DHCP      300     DHCP 
Discover - Transaction ID 0xadde1223
   2    0.001298032  192.0.2.201  255.255.255.255  DHCP      325     DHCP Offer 
   - Transaction ID 0xadde1223
   3    0.001839593  192.0.2.1    255.255.255.255  DHCP      307     DHCP 
Request  - Transaction ID 0xadde1223
   4    0.002628014  192.0.2.201  255.255.255.255  DHCP      325     DHCP ACK   
   - Transaction ID 0xadde1223
   ````
    And once again the offer this time showing the expected flags
   ```
   Frame 2: 325 bytes on wire (2600 bits), 325 bytes captured (2600 bits) on 
interface enp0s20u2, id 0
   Ethernet II, Src: GoodWayI_29:71:50 (00:50:b6:29:71:50), Dst: 
5a:1d:cd:df:f4:44 (5a:1d:cd:df:f4:44)
   Internet Protocol Version 4, Src: 192.0.2.201, Dst: 255.255.255.255
   User Datagram Protocol, Src Port: 67, Dst Port: 68
   Dynamic Host Configuration Protocol (Offer)
       Message type: Boot Reply (2)
       Hardware type: Ethernet (0x01)
       Hardware address length: 6
       Hops: 0
       Transaction ID: 0xadde1223
       Seconds elapsed: 0
       Bootp flags: 0x8000, Broadcast flag (Broadcast)
       Client IP address: 0.0.0.0
       Your (client) IP address: 192.0.2.1
       Next server IP address: 0.0.0.0
       Relay agent IP address: 0.0.0.0
       Client MAC address: 5a:1d:cd:df:f4:44 (5a:1d:cd:df:f4:44)
       Client hardware address padding: 00000000000000000000
       Server host name not given
       Boot file name not given
       Magic cookie: DHCP
       Option: (53) DHCP Message Type (Offer)
       Option: (1) Subnet Mask (255.255.255.0)
       Option: (12) Host Name
       Option: (51) IP Address Lease Time
       Option: (54) DHCP Server Identifier (192.0.2.201)
       Option: (58) Renewal Time Value
       Option: (59) Rebinding Time Value
       Option: (255) End
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to