The branch stable/13 has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5f4e11e111a26abe817e0f790cdbbd376374c45f

commit 5f4e11e111a26abe817e0f790cdbbd376374c45f
Author:     Isaac Cilia Attard <icatt...@freebsd.org>
AuthorDate: 2024-07-08 06:33:13 +0000
Commit:     Colin Percival <cperc...@freebsd.org>
CommitDate: 2024-08-20 04:58:36 +0000

    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 <icatt...@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)
---
 sbin/dhclient/dhclient.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 27e027646ef6..576d7260086c 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -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);
 }

Reply via email to