Commit Diff


commit - eb5d12f955f3d56f05ad6ec160eba2786b113dd8
commit + 16a04e0fcc6f8084731bf3279fff9f2a422bad4a
blob - 94a5f8d21bdd5c4824a9d3ee370631ebe3743778
blob + 8d999f84ddff7665cd1602d15e11097aa5f62b9d
--- ctl.c
+++ ctl.c
@@ -89,6 +89,7 @@ void install_crontab(char *);
 void edit_motd(char *);
 void call_editor(char *, char **, char *);
 void start_dhcpd(char *, char *, char *, char *, char *);
+void restart_dhcpd(char *, char *, char *, char *, char *);
 int edit_file(char *, mode_t, char *, char **);
 void ctl_symlink(char *, char *, char *);
 int rule_writeline(char *, mode_t, char *);
@@ -450,6 +451,9 @@ struct ctl2 ctl_dhcp[] = {
 	{ "config-test",   "test staged DHCPd config",
             { DHCPD, "-nc", REQTEMP, "-l", DHCPLEASES, NULL }, { NULL, },
 	    NULL, 0, T_EXEC },
+	{ "restart",        "restart DHCPd daemon",
+	    { DHCPD, "-c", REQTEMP, "-l", DHCPLEASES, NULL }, { NULL, },
+	    restart_dhcpd, DB_X_ENABLE, T_HANDLER },
 	{ NULL, NULL, { NULL }, { NULL }, NULL, 0, 0 }
 };
 
@@ -817,6 +821,16 @@ ctlhandler(int argc, char **argv, char *modhvar)
 done:
 	free(daemons1.table);
 	return rv;
+}
+
+void
+restart_dhcpd(char *arg0, char *arg1, char *arg2, char *arg3, char *arg4)
+{
+	char *argv_pkill[] = { PKILL, table, "dhcpd", NULL };
+
+	cmdargs(argv_pkill[0], argv_pkill);
+	sleep(1);
+	start_dhcpd(arg0, arg1, arg2, arg3, arg4);
 }
 
 /*
blob - c88fd19c4873d1a21e811a7bf9b973e94f2177e2
blob + d5ba7949d72cc6a35d217e62c9bc32fbcc22f9c5
--- nsh.8
+++ nsh.8
@@ -1319,11 +1319,12 @@ nsh(config-p)/sasync
 .Tg dhcpd
 .Tg dhcp
 .Ic dhcp
-.Op Cm  \&? | enable | disable | edit
+.Op Cm  \&? | enable | disable | edit | restart
 .Pp
-Enable or disable or configure the
+Enable, disable, configure, or restart the
 .Xr dhcpd 8
 Dynamic Host Configuration Protocol daemon.
+This daemon acts as a DHCP server.
 The configuration of
 .Ic dhcp
 daemon can be edited with
@@ -1332,6 +1333,9 @@ command, the configuration syntax of
 .Ic dhcp
 daemon is documented in
 .Xr dhcpd.conf 5 .
+Configuration file changes will not take effect until
+.Xr dhcpd 8
+is restarted.
 .Pp
 .Tg snmpd
 .Tg snmp