diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-18 07:43:34 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-18 07:43:34 -0600 |
commit | 87c318d32fed2b36d195f3a5e2c50d196616e228 (patch) | |
tree | dda52563083415e99dc171078f054bca9bdfe398 /apps | |
parent | bb01a9e28a690e1a550ddcbcafe58d02597d18f4 (diff) | |
download | nuttx-87c318d32fed2b36d195f3a5e2c50d196616e228.tar.gz nuttx-87c318d32fed2b36d195f3a5e2c50d196616e228.tar.bz2 nuttx-87c318d32fed2b36d195f3a5e2c50d196616e228.zip |
Ooops.. Fix oversight in last commit
Diffstat (limited to 'apps')
-rw-r--r-- | apps/netutils/dhcpd/dhcpd.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/apps/netutils/dhcpd/dhcpd.c b/apps/netutils/dhcpd/dhcpd.c index 5ab9c831e..3f8aae0a5 100644 --- a/apps/netutils/dhcpd/dhcpd.c +++ b/apps/netutils/dhcpd/dhcpd.c @@ -756,6 +756,27 @@ static int dhcpd_addoption32(uint8_t code, uint32_t value) } /**************************************************************************** + * Name: dhcp_addoption32p + ****************************************************************************/ + +#if HAVE_DNSIP +static int dhcp_addoption32p(uint8_t code, FAR uint8_t *value) +{ + uint8_t option[6]; + + /* Construct the option sequence */ + + option[DHCPD_OPTION_CODE] = code; + option[DHCPD_OPTION_LENGTH] = 4; + memcpy(&option[DHCPD_OPTION_DATA], value, 4); + + /* Add the option sequence to the response */ + + return dhcpd_addoption(option); +} +#endif + +/**************************************************************************** * Name: dhcpd_soclet ****************************************************************************/ @@ -999,7 +1020,7 @@ static inline int dhcpd_sendoffer(in_addr_t ipaddr, uint32_t leasetime) dhcpd_addoption32(DHCP_OPTION_ROUTER, htonl(CONFIG_NETUTILS_DHCPD_ROUTERIP)); #endif #if HAVE_DNSIP - dhcpd_addoption32(DHCP_OPTION_DNS_SERVER, (uint8_t*)&dnsaddr); + dhcp_addoption32p(DHCP_OPTION_DNS_SERVER, (FAR uint8_t*)&dnsaddr); #endif /* Send the offer response */ @@ -1061,7 +1082,7 @@ int dhcpd_sendack(in_addr_t ipaddr) dhcpd_addoption32(DHCP_OPTION_ROUTER, htonl(CONFIG_NETUTILS_DHCPD_ROUTERIP)); #endif #if HAVE_DNSIP - dhcpd_addoption32(DHCP_OPTION_DNS_SERVER, (uint8_t*)&dnsaddr); + dhcp_addoption32p(DHCP_OPTION_DNS_SERVER, (FAR uint8_t*)&dnsaddr); #endif #ifdef CONFIG_NETUTILS_DHCPD_IGNOREBROADCAST |