On Mon, May 8, 2017 at 3:41 AM, Ian Burns <ian.bu...@rinstrum.com> wrote: > Hi, > > As recommended, I've updated my udhcpc command line from "udhcpc -h > <hostname> ..." to "udhcpc -x hostname:<hostname> ...". > However when running as a daemon/background, the new "-x hostname" option > ceases to send the hostname in the DHCP discover broadcast. I've confirmed > this by looking at the network traffic. In foreground mode (--foreground), > "-x hostname" works as expected. > > This issue may have come up previously: > http://lists.busybox.net/pipermail/busybox/2012-July/078179.html but there > was no resolution. > > I'm running busybox on a nommu platform, which compiles in some special case > code in dhcpc.c > > Adding some debug prints before the call to bb_daemonize_or_rexec(), I get an > argv of: > "udhcpc", "--syslog", "--background", "-x", "hostname", "--interface", > "eth0", NULL > > The "while (list_x) {" bit is modifying the hostname string with "*colon = ' > ';" and the call to udhcp_str2optset(). The modified argv is then passed to > bb_daemonize_or_rexec(). > > My question is: Is there a way to know if the udhcpc instance is the original > invocation, or the re-exec'd invocation?
There is a global bool variable, "re_execed". > If there is a way to know, my proposed solution would be to conditionally run > the "while (list_x) {" bit only once running as the re-exec'd udhcpc. How about this: --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -1365,6 +1365,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) /* now it looks similar to udhcpd's config file line: * "optname optval", using the common routine: */ udhcp_str2optset(optstr, &client_config.options); + if (colon) + *colon = ':'; /* for NOMMU reexec */ } if (udhcp_read_interface(client_config.interface, _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox