NetBurner 3.5.6
PDF Version
DHCPv6

DHCPv6 Client Application

Overview

This application demonstrates the implementation of a DHCPv6 (Dynamic Host Configuration Protocol for IPv6) client using the NetBurner NNDK (NetBurner Network Development Kit). The application showcases various callback functions for requesting, adding, and processing DHCPv6 options in an IPv6 network environment.

Application Name

IPv6-DHCPv6**

Purpose

The DHCPv6 client application serves as a comprehensive example of how to:

  • Implement DHCPv6 client functionality in embedded systems
  • Configure and handle DHCPv6 callback functions
  • Request specific DHCPv6 options from servers
  • Process DHCPv6 reply messages
  • Manage device naming for DHCP offers
  • Display IPv6 address information

Key Features

DHCPv6 Client Callbacks

The application implements three main callback functions in the NB::V6::DHCPv6 namespace:

  1. **Option Request Callback (AddORO)**
    • Returns additional options to receive from the DHCPv6 server
    • Configured to request: Preference, DNS Servers, and Domain List options
    • The returned list must be NULL-terminated
  2. **Request Option Callback (AddSendOption)**
    • Allows setting additional options for outgoing DHCPv6 messages
    • Can determine message type using msg.GetType()
    • Currently contains example code for FQDN options (commented out)
  3. **Reply Callback (GetReply)**
    • Called when Reply messages are received and verified
    • Processes DHCPv6 options that the system requires
    • Provides debug output for received messages

Device Naming

  • Uses the DEVICE_NAME parameter from configuration settings for DHCP offers
  • Automatically generates device names if not configured (when autoDeviceName is enabled)
  • Format: NB_[PlatformName]_[Last3MacBytes]
  • Automatically saves configuration and reboots when creating new device names

Network Interface Management

  • Waits for active network connection (10-second timeout)
  • Retrieves and displays the first available network interface
  • Shows device name used for DHCP offers

Required Dependencies

NetBurner Libraries

Compilation Requirements

  • IPv6 support must be enabled (IPV6 preprocessor definition)
  • Application will display an error message if IPv6 is disabled

Usage

Startup Sequence

  1. Initialize system and enable diagnostics
  2. Wait for active network connection
  3. Start HTTP server
  4. Check and configure device name if necessary
  5. Set up DHCPv6 callbacks
  6. Display application information
  7. Enter interactive mode

Interactive Mode

  • Press Enter to display current IPv6 address information
  • Application continuously monitors and displays network status
  • Note: Routable addresses may take several seconds to receive

Debug Information

  • Enable DHCP_DEBUG in dhcpv6_internal.h and recompile the library to see full DHCPv6 messages
  • System diagnostics are enabled by default (should be disabled for production)

DHCPv6 Options Requested

The application is configured to request the following DHCPv6 options:

  • OPT_PREFERENCE - Server preference values
  • OPT_DNS_SERVERS - DNS server addresses
  • OPT_DOMAIN_LIST - Domain search list

Configuration

Device Name Configuration

  • Set DEVICE_NAME in the network interface configuration
  • If not set and autoDeviceName is enabled, the application will:
    1. Generate a name based on platform and MAC address
    2. Save the configuration
    3. Automatically reboot the device

Network Interface

  • Application uses the first available network interface
  • Displays the interface's MAC address and device name
  • Waits up to 10 seconds for network activation

Build Configuration

Preprocessor Definitions

  • IPV6 must be defined for the application to function
  • Without IPv6 support, the application will display an error message

Production Considerations

  • Remove EnableSystemDiagnostics() call for production builds
  • Disable DHCP_DEBUG in production environments
  • Consider disabling automatic device name generation (autoDeviceName = false)

Example Output

Application: IPv6-DHCPv6
NNDK Revision: [Version]
DHCP Offer Name: [DeviceName]
Type the enter key to display address information
Note that routable addresses may take a few seconds to receive
Reply Callback
[DHCPv6 debug information if enabled]
[IPv6 address information]
DHCP Namespace.
Definition dhcpd.h:39

Error Handling

  • Graceful handling of missing device names
  • Automatic configuration and reboot when needed
  • Network timeout protection (10-second wait)
  • IPv6 availability checking

Files

  • main.cpp - Main application implementation
  • ReadMe.txt - Original documentation
  • ip_util.h - IP utility functions (referenced)

Technical Notes

  • The application uses the NetBurner RTOS task system
  • Memory management follows NetBurner guidelines
  • All DHCPv6 option arrays must be statically allocated (not stack-based)
  • The library automatically prevents duplicate options from being sent