.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd July 5, 2009
+.Dd July 11, 2009
.Dt DHCPCD 8 SMM
.Os
.Sh NAME
.D1 -S domain_name_servers=192.168.0.1 \e
.D1 eth0
.It Fl T, -test
-On receipt of OFFER messages just call
+On receipt of DHCP messages just call
.Pa @SCRIPT@
with the reason of TEST which echo's the DHCP variables found in the message
to the console.
The interface configuration isn't touched and neither are any configuration
files.
+To test INFORM the interface needs to be configured with the desired address
+before starting
+.Nm .
.It Fl V, -variables
Display a list of option codes and the associated variable for use in
.Xr dhcpcd-run-hooks 8 .
else
ifaces = ifp->next;
free_interface(ifp);
- if (!(options & DHCPCD_MASTER))
+ if (!(options & (DHCPCD_MASTER | DHCPCD_TEST)))
exit(EXIT_FAILURE);
}
if (handle_3rdparty(iface))
return;
- iface->state->options->options |= DHCPCD_STATIC;
- start_static(iface);
- iface->state->options->options &= ~DHCPCD_STATIC;
+ if (options & DHCPCD_TEST) {
+ iface->addr.s_addr = iface->state->options->req_addr.s_addr;
+ iface->net.s_addr = iface->state->options->req_mask.s_addr;
+ } else {
+ iface->state->options->options |= DHCPCD_STATIC;
+ start_static(iface);
+ }
iface->state->state = DHS_INFORM;
iface->state->xid = arc4random();
free(iface->state->offer);
iface->state->offer = NULL;
- if (options & DHCPCD_TEST) {
- start_discover(iface);
- return;
- }
if (iface->state->arping_index < ifo->arping_len) {
start_arping(iface);
return;
return;
}
+ if (options & DHCPCD_TEST)
+ exit(EXIT_FAILURE);
+
/* As drop_config could re-arrange the order, we do it like this. */
for (;;) {
/* Be sane and drop the last config first */
exit(EXIT_FAILURE);
}
options = ifo->options;
- if (i)
+ if (i != 0) {
options |= DHCPCD_TEST | DHCPCD_PERSISTENT;
-
+ options &= ~DHCPCD_DAEMONISE;
+ }
+
#ifdef THERE_IS_NO_FORK
options &= ~DHCPCD_DAEMONISE;
#endif
else if (options & DHCPCD_QUIET)
setlogmask(LOG_UPTO(LOG_WARNING));
- /* If we have any other args, we should run as a single dhcpcd instance
- * for that interface. */
- len = strlen(PIDFILE) + IF_NAMESIZE + 2;
- pidfile = xmalloc(len);
- if (optind == argc - 1 && !(options & DHCPCD_TEST)) {
- snprintf(pidfile, len, PIDFILE, "-", argv[optind]);
- } else {
- snprintf(pidfile, len, PIDFILE, "", "");
- options |= DHCPCD_MASTER;
+ if (!(options & DHCPCD_TEST)) {
+ /* If we have any other args, we should run as a single dhcpcd
+ * instance for that interface. */
+ len = strlen(PIDFILE) + IF_NAMESIZE + 2;
+ pidfile = xmalloc(len);
+ if (optind == argc - 1)
+ snprintf(pidfile, len, PIDFILE, "-", argv[optind]);
+ else {
+ snprintf(pidfile, len, PIDFILE, "", "");
+ options |= DHCPCD_MASTER;
+ }
}
if (chdir("/") == -1)
syslog(LOG_ERR, "chdir `/': %m");
atexit(cleanup);
- if (!(options & DHCPCD_MASTER)) {
+ if (!(options & (DHCPCD_MASTER | DHCPCD_TEST))) {
control_fd = open_control();
if (control_fd != -1) {
syslog(LOG_INFO,