Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/roy]: src/external/bsd/dhcpcd/dist/src Update to dhcpcd-9.1.3 with the f...



details:   https://anonhg.NetBSD.org/src/rev/cb49acd4310a
branches:  roy
changeset: 935426:cb49acd4310a
user:      roy <roy%NetBSD.org@localhost>
date:      Thu Jul 02 13:57:40 2020 +0000

description:
Update to dhcpcd-9.1.3 with the following changes:

 * inet6: Add support for reporting Mobile IPv6 RA's
 * inet6: Report RA Proxy flag if set
 * BSD: Allow non NetBSD and OpenBSD to set IN6_IFF_AUTOCONF
 * privsep: Don't handle any signals meant for the main process
 * eloop: Try and survive a signal storm
 * dhcpcd: Add an option to poll the interface carrier state
 * script: Make visible some link level parameters to lease dumping
 * inet6: Don't regen temp addresses we didn't add
 * privsep: Don't limit file writes if logging to a file
 * DHCP6: Fix lease timings with nodelay option

diffstat:

 external/bsd/dhcpcd/dist/src/common.h          |    2 +
 external/bsd/dhcpcd/dist/src/defs.h            |    2 +-
 external/bsd/dhcpcd/dist/src/dhcp6.c           |    6 +-
 external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c |    8 +-
 external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h |    2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.c          |   73 ++++++++++-------
 external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in  |    8 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.h          |    4 -
 external/bsd/dhcpcd/dist/src/eloop.c           |   63 +++++----------
 external/bsd/dhcpcd/dist/src/if-bsd.c          |    9 +-
 external/bsd/dhcpcd/dist/src/if-options.c      |   36 +++++++-
 external/bsd/dhcpcd/dist/src/if-options.h      |    2 +
 external/bsd/dhcpcd/dist/src/if.c              |  102 +++++++++++++++++++-----
 external/bsd/dhcpcd/dist/src/if.h              |    5 +
 external/bsd/dhcpcd/dist/src/ipv6.c            |    1 +
 external/bsd/dhcpcd/dist/src/ipv6.h            |    3 +-
 external/bsd/dhcpcd/dist/src/ipv6nd.c          |   62 +++++++++++---
 external/bsd/dhcpcd/dist/src/logerr.c          |   46 +++++++++-
 external/bsd/dhcpcd/dist/src/logerr.h          |    2 +
 external/bsd/dhcpcd/dist/src/script.c          |   41 +++++----
 20 files changed, 316 insertions(+), 161 deletions(-)

diffs (truncated from 1102 to 300 lines):

diff -r 5db9347aa187 -r cb49acd4310a external/bsd/dhcpcd/dist/src/common.h
--- a/external/bsd/dhcpcd/dist/src/common.h     Mon Jun 15 16:58:01 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/common.h     Thu Jul 02 13:57:40 2020 +0000
@@ -31,6 +31,7 @@
 
 #include <sys/param.h>
 #include <sys/time.h>
+#include <sys/types.h>
 #include <stdint.h>
 #include <stdio.h>
 
@@ -43,6 +44,7 @@
 #define        ELOOP_IPV6ND            6
 #define        ELOOP_IPV6RA_EXPIRE     7
 #define        ELOOP_DHCP6             8
+#define        ELOOP_IF                9
 
 #ifndef HOSTNAME_MAX_LEN
 #define HOSTNAME_MAX_LEN       250     /* 255 - 3 (FQDN) - 2 (DNS enc) */
diff -r 5db9347aa187 -r cb49acd4310a external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Mon Jun 15 16:58:01 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Thu Jul 02 13:57:40 2020 +0000
@@ -29,7 +29,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "9.1.2"
+#define VERSION                        "9.1.3"
 
 #ifndef PRIVSEP_USER
 # define PRIVSEP_USER          "_" PACKAGE
diff -r 5db9347aa187 -r cb49acd4310a external/bsd/dhcpcd/dist/src/dhcp6.c
--- a/external/bsd/dhcpcd/dist/src/dhcp6.c      Mon Jun 15 16:58:01 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp6.c      Thu Jul 02 13:57:40 2020 +0000
@@ -3183,14 +3183,12 @@
                        state->state = DH6S_BOUND;
                state->failed = false;
 
-               if ((state->renew != 0 || state->rebind != 0) &&
-                   state->renew != ND6_INFINITE_LIFETIME)
+               if (state->renew && state->renew != ND6_INFINITE_LIFETIME)
                        eloop_timeout_add_sec(ifp->ctx->eloop,
                            state->renew,
                            state->state == DH6S_INFORMED ?
                            dhcp6_startinform : dhcp6_startrenew, ifp);
-               if ((state->rebind != 0 || state->expire != 0) &&
-                   state->rebind != ND6_INFINITE_LIFETIME)
+               if (state->rebind && state->rebind != ND6_INFINITE_LIFETIME)
                        eloop_timeout_add_sec(ifp->ctx->eloop,
                            state->rebind, dhcp6_startrebind, ifp);
                if (state->expire != ND6_INFINITE_LIFETIME)
diff -r 5db9347aa187 -r cb49acd4310a external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c
--- a/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c    Mon Jun 15 16:58:01 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c    Thu Jul 02 13:57:40 2020 +0000
@@ -68,7 +68,7 @@
 "definend 2 binhex target_address\n"
 "definend 3 index embed prefix_information\n"
 "embed byte length\n"
-"embed bitflags=LA flags\n"
+"embed bitflags=LAH flags\n"
 "embed uint32 vltime\n"
 "embed uint32 pltime\n"
 "embed uint32 reserved\n"
@@ -301,7 +301,7 @@
 "definend 2 binhex target_address\n"
 "definend 3 index embed prefix_information\n"
 "embed byte length\n"
-"embed bitflags=LA flags\n"
+"embed bitflags=LAH flags\n"
 "embed uint32 vltime\n"
 "embed uint32 pltime\n"
 "embed uint32 reserved\n"
@@ -309,6 +309,10 @@
 "definend 5 embed mtu\n"
 "embed uint16 reserved\n"
 "embed uint32 mtu\n"
+"definend 8 embed homeagent_information\n"
+"embed uint16 reserved\n"
+"embed uint16 preference\n"
+"embed uint16 lifetime\n"
 "definend 25 index embed rdnss\n"
 "embed uint16 reserved\n"
 "embed uint32 lifetime\n"
diff -r 5db9347aa187 -r cb49acd4310a external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h
--- a/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h    Mon Jun 15 16:58:01 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h    Thu Jul 02 13:57:40 2020 +0000
@@ -31,7 +31,7 @@
 #define INITDEFINE6S         14
 #else
 #define INITDEFINES         124
-#define INITDEFINENDS         6
+#define INITDEFINENDS         7
 #define INITDEFINE6S         69
 #endif
 
diff -r 5db9347aa187 -r cb49acd4310a external/bsd/dhcpcd/dist/src/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.c     Mon Jun 15 16:58:01 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.c     Thu Jul 02 13:57:40 2020 +0000
@@ -339,6 +339,7 @@
        return 0;
 #else
        int i;
+       unsigned int logopts = loggetopts();
 
        if (ctx->options & DHCPCD_DAEMONISE &&
            !(ctx->options & (DHCPCD_DAEMONISED | DHCPCD_NOWAITIP)))
@@ -359,7 +360,7 @@
                return;
 
        /* Don't use loginfo because this makes no sense in a log. */
-       if (!(loggetopts() & LOGERR_QUIET))
+       if (!(logopts & LOGERR_QUIET))
                (void)fprintf(stderr, "forked to background, child pid %d\n",
                    getpid());
        i = EXIT_SUCCESS;
@@ -369,16 +370,11 @@
        eloop_event_delete(ctx->eloop, ctx->fork_fd);
        close(ctx->fork_fd);
        ctx->fork_fd = -1;
-#ifdef PRIVSEP
-       if (ctx->options & DHCPCD_PRIVSEP) {
-               /* Aside from Linux, we don't have access to /dev/null */
-               fclose(stdout);
-               fclose(stderr);
-       } else
-#endif
-       {
-               (void)freopen(_PATH_DEVNULL, "w", stdout);
-               (void)freopen(_PATH_DEVNULL, "w", stderr);
+
+       if (isatty(loggeterrfd())) {
+               logopts &= ~LOGERR_ERR;
+               logsetopts(logopts);
+               logseterrfd(-1);
        }
 #endif
 }
@@ -867,7 +863,6 @@
 {
        struct interface *ifp = arg;
        struct if_options *ifo = ifp->options;
-       int carrier;
 
        if (ifo->options & DHCPCD_LINK) {
                switch (ifp->carrier) {
@@ -879,19 +874,8 @@
                case LINK_UNKNOWN:
                        /* No media state available.
                         * Loop until both IFF_UP and IFF_RUNNING are set */
-                       carrier = if_carrier(ifp);
-                       if (carrier == LINK_UNKNOWN) {
-                               if (IF_UPANDRUNNING(ifp))
-                                       carrier = LINK_UP;
-                               else {
-                                       eloop_timeout_add_msec(ifp->ctx->eloop,
-                                           IF_POLL_UP * MSEC_PER_SEC,
-                                           dhcpcd_startinterface, ifp);
-                                       return;
-                               }
-                       }
-                       dhcpcd_handlecarrier(ifp->ctx, carrier,
-                           ifp->flags, ifp->name);
+                       if (ifo->poll == 0)
+                               if_pollinit(ifp);
                        return;
                }
        }
@@ -979,6 +963,7 @@
 dhcpcd_prestartinterface(void *arg)
 {
        struct interface *ifp = arg;
+       struct dhcpcd_ctx *ctx = ifp->ctx;
        bool anondown;
 
        if (ifp->carrier == LINK_DOWN &&
@@ -990,7 +975,7 @@
        } else
                anondown = false;
 
-       if ((!(ifp->ctx->options & DHCPCD_MASTER) ||
+       if ((!(ctx->options & DHCPCD_MASTER) ||
            ifp->options->options & DHCPCD_IF_UP || anondown) &&
            !(ifp->flags & IFF_UP))
        {
@@ -1001,6 +986,9 @@
                        logerr(__func__);
        }
 
+       if (ifp->options->poll != 0)
+               if_pollinit(ifp);
+
        dhcpcd_startinterface(ifp);
 }
 
@@ -1299,7 +1287,9 @@
        if ((ifo = read_config(ctx, NULL, NULL, NULL)) == NULL)
                return;
        add_options(ctx, NULL, ifo, ctx->argc, ctx->argv);
-       /* We need to preserve these two options. */
+       /* We need to preserve these options. */
+       if (ctx->options & DHCPCD_STARTED)
+               ifo->options |= DHCPCD_STARTED;
        if (ctx->options & DHCPCD_MASTER)
                ifo->options |= DHCPCD_MASTER;
        if (ctx->options & DHCPCD_DAEMONISED)
@@ -1409,6 +1399,9 @@
        }
 
        if (sig != SIGCHLD && ctx->options & DHCPCD_FORKED) {
+               if (sig == SIGHUP)
+                       return;
+
                pid_t pid = pidfile_read(ctx->pidfile);
                if (pid == -1) {
                        if (errno != ENOENT)
@@ -1861,9 +1854,7 @@
 #endif
 #ifdef PRIVSEP
        ctx.ps_root_fd = ctx.ps_data_fd = -1;
-#ifdef PRIVSEP_COMTROLLER
-       ctx.ps_ctl_fd = -1;
-#endif
+       ctx.ps_inet_fd = ctx.ps_control_fd = -1;
        TAILQ_INIT(&ctx.ps_processes);
 #endif
        rt_init(&ctx);
@@ -2210,7 +2201,9 @@
        }
 
        loginfox(PACKAGE "-" VERSION " starting");
-       freopen(_PATH_DEVNULL, "r", stdin);
+       if (freopen(_PATH_DEVNULL, "r", stdin) == NULL)
+               logerr("%s: freopen stdin", __func__);
+
 
 #ifdef PRIVSEP
        ps_init(&ctx);
@@ -2275,6 +2268,22 @@
                if_disable_rtadv();
 #endif
 
+       if (isatty(STDOUT_FILENO) &&
+           freopen(_PATH_DEVNULL, "r", stdout) == NULL)
+               logerr("%s: freopen stdout", __func__);
+       if (isatty(STDERR_FILENO)) {
+               int fd = dup(STDERR_FILENO);
+
+               if (fd == -1)
+                       logerr("%s: dup", __func__);
+               else if (logseterrfd(fd) == -1)
+                       logerr("%s: logseterrfd", __func__);
+               else if (freopen(_PATH_DEVNULL, "r", stderr) == NULL) {
+                       logseterrfd(-1);
+                       logerr("%s: freopen stderr", __func__);
+               }
+       }
+
        /* If we're not running in privsep, we need to create the DB
         * directory here. */
        if (!(ctx.options & DHCPCD_PRIVSEP)) {
@@ -2328,7 +2337,7 @@
 
        /* Cache the default vendor option. */
        if (dhcp_vendor(ctx.vendor, sizeof(ctx.vendor)) == -1)
-               logerrx("dhcp_vendor");
+               logerr("dhcp_vendor");
 
        /* Start handling kernel messages for interfaces, addresses and
         * routes. */
diff -r 5db9347aa187 -r cb49acd4310a external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in     Mon Jun 15 16:58:01 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in     Thu Jul 02 13:57:40 2020 +0000
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 12, 2020
+.Dd June 18, 2020
 .Dt DHCPCD.CONF 5
 .Os
 .Sh NAME
@@ -595,6 +595,12 @@
 detects an address added to a point to point interface (PPP, TUN, etc) then
 it will set the listed DHCP options to the destination address of the
 interface.
+.It Ic poll Op Ar time
+Polls the interface every
+.Ar time
+milliseconds (default of 100) to check flags and carrier status.
+This option should only be used if the driver does not report link state
+changes but can report the link state.
 .It Ic profile Ar name
 Subsequent options are only parsed for this profile
 .Ar name .
diff -r 5db9347aa187 -r cb49acd4310a external/bsd/dhcpcd/dist/src/dhcpcd.h
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.h     Mon Jun 15 16:58:01 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.h     Thu Jul 02 13:57:40 2020 +0000
@@ -66,10 +66,6 @@
 #define IF_DATA_DHCP6  6
 #define IF_DATA_MAX    7



Home | Main Index | Thread Index | Old Index