You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/05/14 13:52:04 UTC

[incubator-nuttx-apps] branch master updated (f3934ec -> 3b98acc)

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

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


    from f3934ec  wireless: gs2200m: Add support for getsockname() to gs2200m
     new ed3ac15  netutils/dhcpd: Fix the minor typo error
     new 3b98acc  netutils/dhcpd: correct the option header check

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:
 netutils/dhcpd/Kconfig |  2 +-
 netutils/dhcpd/dhcpd.c | 28 +++++++++++-----------------
 2 files changed, 12 insertions(+), 18 deletions(-)


[incubator-nuttx-apps] 01/02: netutils/dhcpd: Fix the minor typo error

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

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

commit ed3ac15526fdd03a5d23ef23287992bc08c62ee5
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu May 14 20:25:43 2020 +0800

    netutils/dhcpd: Fix the minor typo error
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 netutils/dhcpd/Kconfig |  2 +-
 netutils/dhcpd/dhcpd.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/netutils/dhcpd/Kconfig b/netutils/dhcpd/Kconfig
index b107f11..c595b07 100644
--- a/netutils/dhcpd/Kconfig
+++ b/netutils/dhcpd/Kconfig
@@ -18,7 +18,7 @@ config NETUTILS_DHCPD_HOST
 	depends on EXPERIMENTAL
 	---help---
 		DHCPD supports a host based build for testing on a PC.  It is
-		enabled by this configuration, however, ti cannot really be used
+		enabled by this configuration, however, it cannot really be used
 		in the context to the NuttX build as it currently stands.
 
 config NETUTILS_DHCPD_IGNOREBROADCAST
diff --git a/netutils/dhcpd/dhcpd.c b/netutils/dhcpd/dhcpd.c
index f47fea9..5718d3d 100644
--- a/netutils/dhcpd/dhcpd.c
+++ b/netutils/dhcpd/dhcpd.c
@@ -814,7 +814,7 @@ static int dhcpd_addoption32(uint8_t code, uint32_t value)
  * Name: dhcp_addoption32p
  ****************************************************************************/
 
-#ifdef HAVE_DSNIP
+#ifdef HAVE_DNSIP
 static int dhcp_addoption32p(uint8_t code, FAR uint8_t *value)
 {
   uint8_t option[6];
@@ -832,7 +832,7 @@ static int dhcp_addoption32p(uint8_t code, FAR uint8_t *value)
 #endif
 
 /****************************************************************************
- * Name: dhcpd_soclet
+ * Name: dhcpd_socket
  ****************************************************************************/
 
 static inline int dhcpd_socket(void)
@@ -1061,7 +1061,7 @@ static int dhcpd_sendpacket(int bbroadcast)
 static inline int dhcpd_sendoffer(in_addr_t ipaddr, uint32_t leasetime)
 {
   in_addr_t netaddr;
-#ifdef HAVE_DSNIP
+#ifdef HAVE_DNSIP
   uint32_t dnsaddr;
   dnsaddr = htonl(CONFIG_NETUTILS_DHCPD_DNSIP);
 #endif
@@ -1089,7 +1089,7 @@ static inline int dhcpd_sendoffer(in_addr_t ipaddr, uint32_t leasetime)
   dhcpd_addoption32(DHCP_OPTION_ROUTER,
                     htonl(CONFIG_NETUTILS_DHCPD_ROUTERIP));
 #endif
-#ifdef HAVE_DSNIP
+#ifdef HAVE_DNSIP
   dhcp_addoption32p(DHCP_OPTION_DNS_SERVER, (FAR uint8_t *)&dnsaddr);
 #endif
 
@@ -1123,7 +1123,7 @@ int dhcpd_sendack(in_addr_t ipaddr)
 {
   uint32_t leasetime = CONFIG_NETUTILS_DHCPD_LEASETIME;
   in_addr_t netaddr;
-#ifdef HAVE_DSNIP
+#ifdef HAVE_DNSIP
   uint32_t dnsaddr;
   dnsaddr = htonl(CONFIG_NETUTILS_DHCPD_DNSIP);
 #endif
@@ -1153,7 +1153,7 @@ int dhcpd_sendack(in_addr_t ipaddr)
   dhcpd_addoption32(DHCP_OPTION_ROUTER,
                     htonl(CONFIG_NETUTILS_DHCPD_ROUTERIP));
 #endif
-#ifdef HAVE_DSNIP
+#ifdef HAVE_DNSIP
   dhcp_addoption32p(DHCP_OPTION_DNS_SERVER, (FAR uint8_t *)&dnsaddr);
 #endif
 


[incubator-nuttx-apps] 02/02: netutils/dhcpd: correct the option header check

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

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

commit 3b98acc87c4d02b4ccedbc61dc117d3d59e0f227
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu May 14 20:29:22 2020 +0800

    netutils/dhcpd: correct the option header check
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 netutils/dhcpd/dhcpd.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/netutils/dhcpd/dhcpd.c b/netutils/dhcpd/dhcpd.c
index 5718d3d..a1ea181 100644
--- a/netutils/dhcpd/dhcpd.c
+++ b/netutils/dhcpd/dhcpd.c
@@ -595,7 +595,7 @@ static inline bool dhcpd_parseoptions(void)
 #ifndef CONFIG_NET_DHCP_LIGHT
           case DHCP_OPTION_OVERLOAD:
             optlen = ptr[DHCPD_OPTION_LENGTH] + 2;
-            if (optlen >= 1 && optlen < remaining)
+            if (optlen >= 3 && optlen < remaining)
               {
                 overloaded = ptr[DHCPD_OPTION_DATA];
               }
@@ -629,7 +629,7 @@ static inline bool dhcpd_parseoptions(void)
 
           case DHCP_OPTION_REQ_IPADDR: /* Requested IP Address */
             optlen = ptr[DHCPD_OPTION_LENGTH] + 2;
-            if (optlen >= 4 && optlen < remaining)
+            if (optlen >= 6 && optlen < remaining)
               {
                 memcpy(&tmp, &ptr[DHCPD_OPTION_DATA], 4);
                 g_state.ds_optreqip = (in_addr_t)ntohl(tmp);
@@ -638,7 +638,7 @@ static inline bool dhcpd_parseoptions(void)
 
           case DHCP_OPTION_LEASE_TIME: /* IP address lease time */
              optlen = ptr[DHCPD_OPTION_LENGTH] + 2;
-            if (optlen >= 4 && optlen < remaining)
+            if (optlen >= 6 && optlen < remaining)
               {
                 memcpy(&tmp, &ptr[DHCPD_OPTION_DATA], 4);
                 g_state.ds_optleasetime = (time_t)ntohl(tmp);
@@ -647,7 +647,7 @@ static inline bool dhcpd_parseoptions(void)
 
          case DHCP_OPTION_MSG_TYPE: /* DHCP message type */
             optlen = ptr[DHCPD_OPTION_LENGTH] + 2;
-            if (optlen >= 1 && optlen < remaining)
+            if (optlen >= 3 && optlen < remaining)
               {
                 g_state.ds_optmsgtype = ptr[DHCPD_OPTION_DATA];
               }
@@ -655,7 +655,7 @@ static inline bool dhcpd_parseoptions(void)
 
           case DHCP_OPTION_SERVER_ID: /* Server identifier */
             optlen = ptr[DHCPD_OPTION_LENGTH] + 2;
-            if (optlen >= 4 && optlen < remaining)
+            if (optlen >= 6 && optlen < remaining)
               {
                 memcpy(&tmp, &ptr[DHCPD_OPTION_DATA], 4);
                 g_state.ds_optserverip = (in_addr_t)ntohl(tmp);
@@ -943,12 +943,6 @@ static void dhcpd_initpacket(uint8_t mtype)
     {
       g_state.ds_outpacket.flags  = g_state.ds_inpacket.flags;
     }
-  else
-    {
-      g_state.ds_outpacket.flags  = 0;
-    }
-
-  memset(g_state.ds_outpacket.giaddr, 0, 4);
 
   /* Add the generic options */