1 diff -Naur busybox-1.11.3/networking/udhcp/dhcpc.c busybox-1.11.3_dhcp-hostname/networking/udhcp/dhcpc.c
2 --- busybox-1.11.3/networking/udhcp/dhcpc.c 2008-06-25 14:51:14.000000000 +0200
3 +++ busybox-1.11.3_dhcp-hostname/networking/udhcp/dhcpc.c 2008-12-05 11:41:36.000000000 +0100
6 struct dhcpMessage packet;
8 + char hostbuf[256]; /* SUSv2: hostnames are <= 255 bytes */
10 #if ENABLE_GETOPT_LONG
11 static const char udhcpc_longopts[] ALIGN1 =
13 USE_FEATURE_UDHCP_PORT(CLIENT_PORT = 68;)
14 client_config.interface = "eth0";
15 client_config.script = DEFAULT_SCRIPT;
16 + if (gethostname (hostbuf, sizeof (hostbuf)) == 0) {
17 + int len = strlen (hostbuf);
18 + client_config.hostname = xmalloc (len + 2);
19 + client_config.hostname[OPT_CODE] = DHCP_HOST_NAME;
20 + client_config.hostname[OPT_LEN] = len;
21 + strncpy(client_config.hostname + 2, hostbuf, len);
24 /* Parse command line */
25 /* Cc: mutually exclusive; O: list; -T,-t,-A take numeric param */