You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/04/22 06:22:26 UTC

[GitHub] [incubator-nuttx] anchao commented on pull request #3586: Revert a change that accepted UDP packets not destined for us.

anchao commented on pull request #3586:
URL: https://github.com/apache/incubator-nuttx/pull/3586#issuecomment-824572981


   The purpose of make changing here is that the nuttx device can't get the address through dhcpc in unicast mode. In further investigation, I found that the dhcpc OFFER message has been discarded by IP layer:
   
   https://github.com/apache/incubator-nuttx/blob/ae420057120a8dcc59eb6104b36278ba09cfce17/net/devif/ipv4_input.c#L262
   
   dev->d_ipaddr address is INADDR_ANY by default, which will causes the unicast directional message to be discarded by mistake, referring to other protocol stacks, this is incorrect. if the network card address is INADDR_ANY, UDP packets need to be discarded by the UDP stack:
   
   1. IP drop
   
   ```
   NUTTX(DHCPC)              ->  HOSTAP(DHCPD)
   0.0.0.0                   ->  255.255.255.255   DISCOVER
   100.1.1.1 (unicast)       ->  100.1.1.4         OFFER       <-- IP drop
   ```
   
   https://github.com/apache/incubator-nuttx/blob/ae420057120a8dcc59eb6104b36278ba09cfce17/net/devif/ipv4_input.c#L312
   
   2. After patch:
   ```
   NUTTX(DHCPC)              ->  HOSTAP(DHCPD)
   0.0.0.0                   ->  255.255.255.255   DISCOVER
   100.1.1.1 (unicast)       ->  100.1.1.4         OFFER       <-- IP bypass the udp packet
   0.0.0.0                   ->  255.255.255.255   REQUEST
   100.1.1.1 (unicast)       ->  100.1.1.4         ACK
   ```


-- 
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:
users@infra.apache.org