You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/02/12 05:39:42 UTC
[incubator-nuttx-apps] branch master updated: netutils/dhcpc:
configurable Bootstrap flags
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new ebbf2fc netutils/dhcpc: configurable Bootstrap flags
ebbf2fc is described below
commit ebbf2fc072c421aa58ee0f6d2064bc2b0199c68b
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Jan 18 17:57:33 2021 +0800
netutils/dhcpc: configurable Bootstrap flags
Signed-off-by: chao.an <an...@xiaomi.com>
---
netutils/dhcpc/Kconfig | 8 ++++++++
netutils/dhcpc/dhcpc.c | 10 ++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/netutils/dhcpc/Kconfig b/netutils/dhcpc/Kconfig
index 1a2839e..368b162 100644
--- a/netutils/dhcpc/Kconfig
+++ b/netutils/dhcpc/Kconfig
@@ -29,4 +29,12 @@ config NETUTILS_DHCPC_RETRIES
This setting determines how many times resolver retries request
until failing.
+config NETUTILS_DHCPC_BOOTP_FLAGS
+ hex "Flags of Bootstrap"
+ default 0x8000
+ ---help---
+ This setting to set the BOOTP broadcast flags.
+ Reference RFC1542: Clarifications and Extensions for the
+ Bootstrap Protocol.
+
endif
diff --git a/netutils/dhcpc/dhcpc.c b/netutils/dhcpc/dhcpc.c
index 93e92cd..dd643c0 100644
--- a/netutils/dhcpc/dhcpc.c
+++ b/netutils/dhcpc/dhcpc.c
@@ -71,8 +71,6 @@
#define STATE_HAVE_OFFER 1
#define STATE_HAVE_LEASE 2
-#define BOOTP_BROADCAST 0x8000
-
#define DHCP_REQUEST 1
#define DHCP_REPLY 2
#define DHCP_HTYPE_ETHERNET 1
@@ -261,7 +259,9 @@ static int dhcpc_sendmsg(FAR struct dhcpc_state_s *pdhcpc,
* unicast traffic before being fully configured.
*/
- pdhcpc->packet.flags = HTONS(BOOTP_BROADCAST); /* Broadcast bit. */
+ /* Broadcast bit. */
+
+ pdhcpc->packet.flags = HTONS(CONFIG_NETUTILS_DHCPC_BOOTP_FLAGS);
pend = dhcpc_addhostname(hostname, pend);
pend = dhcpc_addreqoptions(pend);
@@ -274,7 +274,9 @@ static int dhcpc_sendmsg(FAR struct dhcpc_state_s *pdhcpc,
* unicast traffic before being fully configured.
*/
- pdhcpc->packet.flags = HTONS(BOOTP_BROADCAST); /* Broadcast bit. */
+ /* Broadcast bit. */
+
+ pdhcpc->packet.flags = HTONS(CONFIG_NETUTILS_DHCPC_BOOTP_FLAGS);
pend = dhcpc_addhostname(hostname, pend);
pend = dhcpc_addserverid(&pdhcpc->serverid, pend);