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 2020/05/15 02:15:31 UTC

[GitHub] [incubator-nuttx] anchao commented on a change in pull request #1047: sim/tapdev: follow the tunnel MTU size

anchao commented on a change in pull request #1047:
URL: https://github.com/apache/incubator-nuttx/pull/1047#discussion_r425528457



##########
File path: net/netdev/netdev_register.c
##########
@@ -333,6 +335,18 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
             return -EINVAL;
         }
 
+      /* Update the package length */
+
+      if (dev->d_llhdrlen == 0)
+        {
+          dev->d_llhdrlen = llhdrlen;
+        }
+
+      if (dev->d_pktsize == 0)
+        {
+          dev->d_pktsize = pktsize;
+        }
+

Review comment:
       Configure the MTU packet size in the SIM scenario is a invalid choice,
   the MTU will only take effect at the link layer when configuring the tunnel bridge:
   
   tools/simbridge.sh:
   
   ```
    if [ "$2" == "on" ]; then
      ip link add nuttx0 type bridge
      ip addr flush dev $1
   +  ip link set dev nuttx0 mtu size?
      ip link set $1 master nuttx0
      ip link set dev nuttx0 up
      dhclient nuttx0
   ```
   
   
   ```
   nuttx0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
           inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
           inet6 fe80::a00:27ff:fe63:d2e7  prefixlen 64  scopeid 0x20<link>
   ```
   
   If the nuttx MTU size is small than tunnel, the larger packets will do drop processing at:
   
   net/devif/ipv4_input.c:
   ...
   377   /* Check the size of the packet.  If the size reported to us in d_len is
   378    * smaller the size reported in the IP header, we assume that the packet
   379    * has been corrupted in transit.  If the size of d_len is larger than the
   380    * size reported in the IP packet header, the packet has been padded and
   381    * we set d_len to the correct value.
   382    */
   383 
   384   totlen = (ipv4->len[0] << 8) + ipv4->len[1];
   385   if (totlen <= dev->d_len)
   386     {
   387       dev->d_len = totlen;
   388     }
   389   else
   390     {
   391       nwarn("WARNING: IP packet shorter than length in IP header\n");
   392       goto drop;
   393     }
   ...
   
   in this situation, I think obtain the MTU size dynamically is a necessary choice.
   Regarding your concerns, We will check further whether there is side effects in the mainline.




----------------------------------------------------------------
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