mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
dhclient: Make arp_timeout configurable
Make arp_timeout available to dhclient.c, set the default timeout to 250 ms, and provide a new command-line argument, 'n' for setting the timeout to 0. Sponsored by: Google LLC (GSoC 2024) Signed-off-by: Isaac Cilia Attard <icattard@FreeBSD.org> MFC after: 10 days Reviwed by: cperciva, brooks, Tom Hukins, Alexander Ziaee Pull Request: https://github.com/freebsd/freebsd-src/pull/1368 (cherry picked from commit b51569ad3c806688befc00dad51d15a7e61659fb)
This commit is contained in:
parent
7ee68314d3
commit
7bdd17d8d3
1 changed files with 6 additions and 3 deletions
|
|
@ -121,7 +121,7 @@ struct pidfh *pidfile;
|
|||
*/
|
||||
#define TIME_MAX ((((time_t) 1 << (sizeof(time_t) * CHAR_BIT - 2)) - 1) * 2 + 1)
|
||||
|
||||
static struct timespec arp_timeout = { .tv_sec = 2, .tv_nsec = 0 };
|
||||
static struct timespec arp_timeout = { .tv_sec = 0, .tv_nsec = 250 * 1000 * 1000 };
|
||||
static const struct timespec zero_timespec = { .tv_sec = 0, .tv_nsec = 0 };
|
||||
int log_priority;
|
||||
static int no_daemon;
|
||||
|
|
@ -386,7 +386,7 @@ main(int argc, char *argv[])
|
|||
cap_openlog(capsyslog, getprogname(), LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY);
|
||||
cap_setlogmask(capsyslog, LOG_UPTO(LOG_DEBUG));
|
||||
|
||||
while ((ch = getopt(argc, argv, "bc:dl:p:qu")) != -1)
|
||||
while ((ch = getopt(argc, argv, "bc:dl:np:qu")) != -1)
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
immediate_daemon = 1;
|
||||
|
|
@ -400,6 +400,9 @@ main(int argc, char *argv[])
|
|||
case 'l':
|
||||
path_dhclient_db = optarg;
|
||||
break;
|
||||
case 'n':
|
||||
arp_timeout = zero_timespec;
|
||||
break;
|
||||
case 'p':
|
||||
path_dhclient_pidfile = optarg;
|
||||
break;
|
||||
|
|
@ -576,7 +579,7 @@ void
|
|||
usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: %s [-bdqu] ", getprogname());
|
||||
fprintf(stderr, "usage: %s [-bdnqu] ", getprogname());
|
||||
fprintf(stderr, "[-c conffile] [-l leasefile] interface\n");
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue