You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by bt...@apache.org on 2021/01/31 00:04:51 UTC

[incubator-nuttx] branch master updated (52b4c73 -> 38e2c4b)

This is an automated email from the ASF dual-hosted git repository.

btashton pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 52b4c73  arch/riscv: Remove references to MIPS.
     new ab148bc  net/ip: do not drop the udp packet from IP layer
     new 38e2c4b  net/ip: fix nxstyle warning

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 net/devif/ipv4_input.c | 29 +++++++++++++++--------------
 net/devif/ipv6_input.c | 39 +++++++++++++++++++--------------------
 2 files changed, 34 insertions(+), 34 deletions(-)


[incubator-nuttx] 01/02: net/ip: do not drop the udp packet from IP layer

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit ab148bc69fe9fb66a849043612dc7aa89515295c
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Jan 18 16:43:52 2021 +0800

    net/ip: do not drop the udp packet from IP layer
    
    this change to support receive the udp data from the specified
    port without obtaining the address.
    
    e.g: disable the Bootstrap flag on dhcpc handshake
    
    Reference:
    RFC1542: Clarifications and Extensions for the Bootstrap Protocol.
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 net/devif/ipv4_input.c | 20 ++++++++++----------
 net/devif/ipv6_input.c | 29 +++++++++++++----------------
 2 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/net/devif/ipv4_input.c b/net/devif/ipv4_input.c
index e88c3b2..8e35497 100644
--- a/net/devif/ipv4_input.c
+++ b/net/devif/ipv4_input.c
@@ -237,16 +237,6 @@ int ipv4_input(FAR struct net_driver_s *dev)
     }
   else
 #endif
-#ifdef CONFIG_NET_ICMP
-  /* In other cases, the device must be assigned a non-zero IP address. */
-
-  if (net_ipv4addr_cmp(dev->d_ipaddr, INADDR_ANY))
-    {
-      nwarn("WARNING: No IP address assigned\n");
-      goto drop;
-    }
-  else
-#endif
 #if defined(CONFIG_NET_BROADCAST) && defined(NET_UDP_HAVE_STACK)
   /* The address is not the broadcast address and we have been assigned a
    * address.  So there is also the possibility that the destination address
@@ -307,6 +297,7 @@ int ipv4_input(FAR struct net_driver_s *dev)
             }
           else
 #endif
+          if (ipv4->proto != IP_PROTO_UDP)
             {
               /* Not destined for us and not forwardable... Drop the
                * packet.
@@ -322,6 +313,15 @@ int ipv4_input(FAR struct net_driver_s *dev)
             }
         }
     }
+#ifdef CONFIG_NET_ICMP
+  /* In other cases, the device must be assigned a non-zero IP address. */
+
+  else if (net_ipv4addr_cmp(dev->d_ipaddr, INADDR_ANY))
+    {
+      nwarn("WARNING: No IP address assigned\n");
+      goto drop;
+    }
+#endif
 
   if (ipv4_chksum(dev) != 0xffff)
     {
diff --git a/net/devif/ipv6_input.c b/net/devif/ipv6_input.c
index 95d75cc..5d56d83 100644
--- a/net/devif/ipv6_input.c
+++ b/net/devif/ipv6_input.c
@@ -409,22 +409,6 @@ int ipv6_input(FAR struct net_driver_s *dev)
        * address by its IPv6 nexthdr field.
        */
     }
-
-  /* In other cases, the device must be assigned a non-zero IP address
-   * (the all zero address is the "unspecified" address.
-   */
-
-  else
-#endif
-#ifdef CONFIG_NET_ICMPv6
-  if (net_ipv6addr_cmp(dev->d_ipv6addr, g_ipv6_unspecaddr))
-    {
-      nwarn("WARNING: No IP address assigned\n");
-      goto drop;
-    }
-
-  /* Check if the packet is destined for out IP address */
-
   else
 #endif
     {
@@ -449,6 +433,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
             }
           else
 #endif
+          if (nxthdr != IP_PROTO_UDP)
             {
               /* Not destined for us and not forwardable... drop the packet. */
 
@@ -457,6 +442,18 @@ int ipv6_input(FAR struct net_driver_s *dev)
             }
         }
     }
+#ifdef CONFIG_NET_ICMPv6
+
+  /* In other cases, the device must be assigned a non-zero IP address
+   * (the all zero address is the "unspecified" address.
+   */
+
+  if (net_ipv6addr_cmp(dev->d_ipv6addr, g_ipv6_unspecaddr))
+    {
+      nwarn("WARNING: No IP address assigned\n");
+      goto drop;
+    }
+#endif
 
   /* Now process the incoming packet according to the protocol specified in
    * the next header IPv6 field.


[incubator-nuttx] 02/02: net/ip: fix nxstyle warning

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 38e2c4ba53784d929ca723086f37c3228b4baa92
Author: chao.an <an...@xiaomi.com>
AuthorDate: Sat Jan 30 08:58:47 2021 +0800

    net/ip: fix nxstyle warning
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 net/devif/ipv4_input.c |  9 +++++----
 net/devif/ipv6_input.c | 10 ++++++----
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/net/devif/ipv4_input.c b/net/devif/ipv4_input.c
index 8e35497..e0227a1 100644
--- a/net/devif/ipv4_input.c
+++ b/net/devif/ipv4_input.c
@@ -207,11 +207,11 @@ int ipv4_input(FAR struct net_driver_s *dev)
   if ((ipv4->ipoffset[0] & 0x3f) != 0 || ipv4->ipoffset[1] != 0)
     {
 #ifdef CONFIG_NET_STATISTICS
-       g_netstats.ipv4.drop++;
-       g_netstats.ipv4.fragerr++;
+      g_netstats.ipv4.drop++;
+      g_netstats.ipv4.fragerr++;
 #endif
-       nwarn("WARNING: IP fragment dropped\n");
-       goto drop;
+      nwarn("WARNING: IP fragment dropped\n");
+      goto drop;
     }
 
   /* Get the destination IP address in a friendlier form */
@@ -314,6 +314,7 @@ int ipv4_input(FAR struct net_driver_s *dev)
         }
     }
 #ifdef CONFIG_NET_ICMP
+
   /* In other cases, the device must be assigned a non-zero IP address. */
 
   else if (net_ipv4addr_cmp(dev->d_ipaddr, INADDR_ANY))
diff --git a/net/devif/ipv6_input.c b/net/devif/ipv6_input.c
index 5d56d83..168cffd 100644
--- a/net/devif/ipv6_input.c
+++ b/net/devif/ipv6_input.c
@@ -391,8 +391,8 @@ int ipv6_input(FAR struct net_driver_s *dev)
     {
 #ifdef CONFIG_NET_IPFORWARD_BROADCAST
 
-      /* Packets sent to ffx0 are reserved, ffx1 are interface-local, and ffx2
-       * are interface-local, and therefore, should not be forwarded
+      /* Packets sent to ffx0 are reserved, ffx1 are interface-local, and
+       * ffx2 are interface-local, and therefore, should not be forwarded
        */
 
       if ((ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff00)) &&
@@ -435,9 +435,11 @@ int ipv6_input(FAR struct net_driver_s *dev)
 #endif
           if (nxthdr != IP_PROTO_UDP)
             {
-              /* Not destined for us and not forwardable... drop the packet. */
+              /* Not destined for us and not forwardable...
+               * drop the packet.
+               */
 
-              nwarn("WARNING: Not destined for us; not forwardable... Dropping!\n");
+              nwarn("WARNING: Not destined for us... Dropping!\n");
               goto drop;
             }
         }