Bug 10946 - Add support for "Merit Dump" DHCP option
Summary: Add support for "Merit Dump" DHCP option
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Networking (show other bugs)
Version: 1.28.x
Hardware: All Linux
: P5 enhancement
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-13 09:05 UTC by Philip Munts
Modified: 2018-04-13 11:20 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
Patch to enable "Merit Dump" DHCP option. (1.04 KB, patch)
2018-04-13 09:05 UTC, Philip Munts
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Munts 2018-04-13 09:05:13 UTC
Created attachment 7566 [details]
Patch to enable "Merit Dump" DHCP option.

The "Merit Dump" DHCP option can be used to pass an arbitrary string from a DHCP server to a DHCP client.  I use it for passing NFS mount points to a Linux netboot client.

Patch for 1.28.3 attached.
Comment 1 Denys Vlasenko 2018-04-13 11:20:49 UTC
I added support for arbitrary options to be specified as strings:

BusyBox v1.29.0.git (2018-04-01 19:58:41 CEST) multi-call binary.

Usage: udhcpc [-fbqvRB] [-a[MSEC]] [-t N] [-T SEC] [-A SEC/-n]
	[-i IFACE] [-s PROG] [-p PIDFILE]
	[-oC] [-r IP] [-V VENDOR] [-F NAME] [-x OPT:VAL]... [-O OPT]...

	-i IFACE	Interface to use (default eth0)
	-s PROG		Run PROG at DHCP events (default /usr/share/udhcpc/default.script)
	-p FILE		Create pidfile
	-B		Request broadcast replies
	-t N		Send up to N discover packets (default 3)
	-T SEC		Pause between packets (default 3)
	-A SEC		Wait if lease is not obtained (default 20)
	-n		Exit if lease is not obtained
	-q		Exit after obtaining lease
	-R		Release IP on exit
	-f		Run in foreground
	-b		Background if lease is not obtained
	-S		Log to syslog too
	-a[MSEC]	Validate offered address with ARP ping
	-r IP		Request this IP address
	-o		Don't request any options (unless -O is given)
	-O OPT		Request option OPT from server (cumulative)
	-x OPT:VAL	Include option OPT in sent packets (cumulative)
			Examples of string, numeric, and hex byte opts:
			-x hostname:bbox - option 12
			-x lease:3600 - option 51 (lease time)
			-x 0x3d:0100BEEFC0FFEE - option 61 (client id)
			-x 14:'"dumpfile"' - option 14 (shell-quoted)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	-F NAME		Ask server to update DNS mapping for NAME
	-V VENDOR	Vendor identifier (default 'udhcp VERSION')
	-C		Don't send MAC as client identifier
	-v		Verbose


examples/udhcp/udhcpd.conf:
 .........
 option lease   864000          # default: 10 days
 option msstaticroutes  10.0.0.0/8 10.127.0.1           # single static route
 option staticroutes    10.0.0.0/8 10.127.0.1, 10.11.12.0/24 10.11.12.1
 # Arbitrary option in hex or string form:
 option 0x08    01020304        # option 8: "cookie server IP addr: 1.2.3.4"
 option 14      "dumpfile"