* (defined via CONFIG_IFUPDOWN_IFSTATE_PATH) and can be overridden by build
* configuration.
*
- * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
static const struct dhcp_client_t ext_dhcp_clients[] = {
{ "dhcpcd",
- "dhcpcd[[ -h %hostname%]][[ -i %vendor%]][[ -I %clientid%]][[ -l %leasetime%]] %iface%",
+ "dhcpcd[[ -h %hostname%]][[ -i %vendor%]][[ -I %client%]][[ -l %leasetime%]] %iface%",
"dhcpcd -k %iface%",
},
{ "dhclient",
"pump -i %iface% -k",
},
{ "udhcpc",
- "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %clientid%]]"
+ "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %client%]]"
"[[ -s %script%]][[ %udhcpc_opts%]]",
"kill `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null",
},
return 0;
#endif
return execute("udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid "
- "-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]][[ %udhcpc_opts%]]",
+ "-i %iface%[[ -H %hostname%]][[ -c %client%]][[ -s %script%]][[ %udhcpc_opts%]]",
ifd, exec);
}
#else
static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec)
{
int result;
- result = execute("kill "
- "`cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
+ result = execute(
+ "test -f /var/run/udhcpc.%iface%.pid && "
+ "kill `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null",
+ ifd, exec);
/* Also bring the hardware interface down since
killing the dhcp client alone doesn't do it.
This enables consecutive ifup->ifdown->ifup */
xpiped_pair(outfd);
fflush_all();
- pid = vfork();
+ pid = xvfork();
- switch (pid) {
- case -1: /* failure */
- bb_perror_msg_and_die("vfork");
- case 0: /* child */
+ if (pid == 0) {
+ /* Child */
/* NB: close _first_, then move fds! */
close(infd.wr);
close(outfd.rd);
xmove_fd(infd.rd, 0);
xmove_fd(outfd.wr, 1);
- BB_EXECVP(command, argv);
- _exit(127);
+ BB_EXECVP_or_die(argv);
}
/* parent */
close(infd.rd);