From cb90edf46fc3d000ac31fe207a9c2ed4887350b0 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 24 Aug 2010 10:36:20 +0000 Subject: [PATCH] Allow interface to also be a path to a DHCP wire formatted file. --- dhcpcd.8.in | 2 ++ dhcpcd.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/dhcpcd.8.in b/dhcpcd.8.in index b966746b..31796ea9 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -495,6 +495,8 @@ before starting Dumps the last lease for the .Ar interface to stdout. +.Ar interface +could also be a path to a DHCP wire formatted file. .It Fl V, -variables Display a list of option codes and the associated variable for use in .Xr dhcpcd-run-hooks 8 . diff --git a/dhcpcd.c b/dhcpcd.c index 07e68ed4..1678e5eb 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -1780,6 +1780,11 @@ main(int argc, char **argv) strlcpy(iface->state->options->script, if_options->script, sizeof(iface->state->options->script)); iface->state->new = read_lease(iface); + if (iface->state->new == NULL && errno == ENOENT) { + strlcpy(iface->leasefile, argv[optind], + sizeof(iface->leasefile)); + iface->state->new = read_lease(iface); + } if (iface->state->new == NULL) { if (errno == ENOENT) syslog(LOG_ERR, "%s: no lease to dump",