Skip to content

Documentation/netutils: add comprehensive guide for dhcpc - #20513

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
Swatantra-66:doc/dhcpc-guide
Oct 9, 2026
Merged

xiaoxiang781216 merged 1 commit into
apache:masterfrom
Swatantra-66:doc/dhcpc-guide

Conversation

@Swatantra-66

@Swatantra-66 Swatantra-66 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Provides a comprehensive, production-grade documentation guide for the dhcpc (Dynamic Host Configuration Protocol client) network utility in Documentation/applications/netutils/dhcpc/index.rst, replacing the previous 7-line placeholder stub.

Addresses #11081

Key Additions

  • Protocol Architecture & State Machine: Details RFC 2131 (IPv4) and RFC 1542 (BOOTP interoperability), mapping the 6-stage lifecycle (INIT, SELECTING, REQUESTING, BOUND, RENEWING/REBINDING, and RELEASE).
  • Security Considerations: Highlights the unauthenticated nature of plaintext DHCPv4, rogue DHCP server risks, and mitigations (DHCP Snooping, Port Security, end-to-end transport encryption).
  • Requirements & Prerequisites: Explicitly lists networking dependencies, including CONFIG_NET_BROADCAST=y (required for DHCPDISCOVER broadcast traffic) and CONFIG_NET_BINDTODEVICE=y.
  • Configuration Reference: Complete Kconfig options table (CONFIG_NETUTILS_DHCPC, hostname, timeouts, retries, BOOTP broadcast flags, NTP/DNS server counts, and release transmission delays).
  • NSH Integration: Runtime commands (ifconfig <ifname> dhcp) and network verification (ifconfig, ping).
  • C API Reference: Detailed specification of struct dhcpc_state and core lifecycle functions with documented POSIX ERROR / errno return contracts (dhcpc_open, dhcpc_request, dhcpc_request_async, dhcpc_release, dhcpc_cancel, dhcpc_close).
  • Runnable Application Examples:
    1. Synchronous IP acquisition flow querying hardware MAC via netlib, performing DHCP negotiation, and applying IP/netmask/router/DNS parameters to the stack.
    2. Graceful lease release before system reboot or link teardown via dhcpc_release().
  • Embedded Design Guidelines: Lease renewal timer scheduling ($T_1$) for long-running IoT devices, wireless retransmission tuning, and SO_BINDTODEVICE multihomed operation.

Impact

  • Documentation: Fills one of the missing documentation stubs identified under Documentation: blank pages in documentation #11081.
  • Completeness: Completes the core network client trilogy (webclient, tftpc, and dhcpc) for Apache NuttX documentation.
  • Code/Build: Documentation-only change. No functional code or ABI alterations.

Testing

  • Validated Sphinx reStructuredText syntax, formatting, and table alignment.
  • Verified C API signatures and data structures against apps/include/netutils/dhcpc.h.
  • Verified return values and errno behavior against apps/netutils/dhcpc/dhcpc.c.
  • Verified NSH CLI commands against apps/nshlib/nsh_netcmds.c.
  • Confirmed zero trailing whitespaces across all 430+ lines.

xiaoxiang781216
xiaoxiang781216 previously approved these changes Oct 8, 2026
@acassis
acassis requested review from cederom and jerpelea October 8, 2026 12:17
acassis
acassis previously approved these changes Oct 8, 2026
@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Size: M The size of the change in this PR is medium labels Oct 8, 2026
@Swatantra-66
Swatantra-66 dismissed stale reviews from acassis and xiaoxiang781216 via 3637350 October 8, 2026 13:04
acassis
acassis previously approved these changes Oct 8, 2026
Provide a complete documentation guide for the dhcpc (DHCP client) network
utility in Documentation/applications/netutils/dhcpc/index.rst, replacing
the previous 7-line placeholder stub.

Includes:
- Protocol architecture overview and RFC 2131 / RFC 1542 finite state machine
  (DISCOVER, OFFER, REQUEST, ACK, RELEASE)
- Security considerations regarding plaintext DHCPv4, rogue servers, and network isolation
- Configuration options table and networking prerequisites including CONFIG_NET_BROADCAST
- NSH usage for dynamic interface configuration (ifconfig <ifname> dhcp) and verification
- Public C API reference for data structures (struct dhcpc_state) and lifecycle
  functions with documented POSIX ERROR/errno contracts (dhcpc_open, dhcpc_request,
  dhcpc_request_async, dhcpc_release, dhcpc_close)
- Complete, runnable C application examples demonstrating synchronous interface
  configuration and graceful lease release
- Embedded design and tuning guidelines (lease renewal scheduling, wireless
  retransmission tuning, and SO_BINDTODEVICE multihomed operation)

Addresses apache#11081

Signed-off-by: Swatantra Yadav <[email protected]>

@hartmannathan hartmannathan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for helping to improve NuttX Documentation!!

@Swatantra-66

Copy link
Copy Markdown
Contributor Author

Apologies for the earlier false alarm!

I have conducted a deep line-by-line review and locally validated dhcpc/index.rst through Sphinx with -W (zero warnings, zero errors). The nested list indentation and line continuation issues are completely resolved.

@xiaoxiang781216
xiaoxiang781216 merged commit 4ef1d60 into apache:master Oct 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Documentation Improvements or additions to documentation Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants