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 Import dhcpcd-8.0.1 with the foll...



details:   https://anonhg.NetBSD.org/src/rev/46d7a633d24f
branches:  ROY
changeset: 455224:46d7a633d24f
user:      roy <roy%NetBSD.org@localhost>
date:      Thu Jul 25 08:53:54 2019 +0000

description:
Import dhcpcd-8.0.1 with the following changes:

  *  Compile fixes for various build options on various platforms
  *  IPv4LL is fixed on NetBSD-8
  *  Script buffers are freed on forking

diffstat:

 external/bsd/dhcpcd/dist/src/defs.h   |   2 +-
 external/bsd/dhcpcd/dist/src/dhcp.c   |  19 +++++++++++++------
 external/bsd/dhcpcd/dist/src/dhcpcd.c |  14 ++++++++------
 external/bsd/dhcpcd/dist/src/ipv4.c   |   6 ++++--
 external/bsd/dhcpcd/dist/src/ipv4ll.c |  13 +++++++++----
 external/bsd/dhcpcd/dist/src/logerr.c |   1 +
 external/bsd/dhcpcd/dist/src/script.c |   2 +-
 7 files changed, 37 insertions(+), 20 deletions(-)

diffs (232 lines):

diff -r 634f42e171a0 -r 46d7a633d24f external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Wed Jul 24 09:54:49 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Thu Jul 25 08:53:54 2019 +0000
@@ -29,7 +29,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "8.0.0"
+#define VERSION                        "8.0.1"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r 634f42e171a0 -r 46d7a633d24f external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c       Wed Jul 24 09:54:49 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c       Thu Jul 25 08:53:54 2019 +0000
@@ -127,7 +127,7 @@
 
 static int dhcp_openbpf(struct interface *);
 static void dhcp_start1(void *);
-#ifdef ARP
+#if defined(ARP) && (!defined(KERNEL_RFC5227) || defined(ARPING))
 static void dhcp_arp_found(struct arp_state *, const struct arp_msg *);
 #endif
 static void dhcp_handledhcp(struct interface *, struct bootp *, size_t,
@@ -1958,6 +1958,7 @@
        send_rebind(ifp);
 }
 
+#if defined(ARP) || defined(IN_IFF_DUPLICATED)
 static void
 dhcp_finish_dad(struct interface *ifp, struct in_addr *ia)
 {
@@ -2026,19 +2027,22 @@
        eloop_timeout_add_sec(ifp->ctx->eloop,
            DHCP_RAND_MAX, dhcp_discover, ifp);
 }
-
-#ifdef ARP
+#endif
+
+#if defined(ARP) && (!defined(KERNEL_RFC5227) || defined(ARPING))
 static void
 dhcp_arp_not_found(struct arp_state *astate)
 {
        struct interface *ifp;
+#ifdef ARPING
        struct dhcp_state *state;
        struct if_options *ifo;
+#endif
 
        ifp = astate->iface;
+#ifdef ARPING
        state = D_STATE(ifp);
        ifo = ifp->options;
-#ifdef ARPING
        if (ifo->arping_len && state->arping_index < ifo->arping_len) {
                /* We didn't find a profile for this
                 * address or hwaddr, so move to the next
@@ -2062,12 +2066,11 @@
 dhcp_arp_found(struct arp_state *astate, const struct arp_msg *amsg)
 {
        struct in_addr addr;
+       struct interface *ifp = astate->iface;
 #ifdef ARPING
-       struct interface *ifp;
        struct dhcp_state *state;
        struct if_options *ifo;
 
-       ifp = astate->iface;
        state = D_STATE(ifp);
 
        ifo = ifp->options;
@@ -2093,6 +2096,8 @@
                dhcpcd_startinterface(ifp);
                return;
        }
+#else
+       UNUSED(amsg);
 #endif
 
        addr = astate->addr;
@@ -2304,6 +2309,7 @@
 }
 #endif
 
+#if !defined(KERNEL_RFC5227) || defined(ARPING)
 static struct arp_state *
 dhcp_arp_new(struct interface *ifp, struct in_addr *addr)
 {
@@ -2322,6 +2328,7 @@
 #endif
        return astate;
 }
+#endif
 
 static int
 dhcp_arp_address(struct interface *ifp)
diff -r 634f42e171a0 -r 46d7a633d24f external/bsd/dhcpcd/dist/src/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.c     Wed Jul 24 09:54:49 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.c     Thu Jul 25 08:53:54 2019 +0000
@@ -1210,9 +1210,11 @@
 static void
 if_reboot(struct interface *ifp, int argc, char **argv)
 {
+#ifdef INET
        unsigned long long oldopts;
 
        oldopts = ifp->options->options;
+#endif
        script_runreason(ifp, "RECONFIGURE");
        dhcpcd_initstate1(ifp, argc, argv, 0);
 #ifdef INET
@@ -2123,6 +2125,12 @@
                }
                free(ctx.ifaces);
        }
+#ifdef HAVE_OPEN_MEMSTREAM
+       if (ctx.script_fp)
+               fclose(ctx.script_fp);
+#endif
+       free(ctx.script_buf);
+       free(ctx.script_env);
        free_options(&ctx, ifo);
        rt_dispose(&ctx);
        free(ctx.duid);
@@ -2146,11 +2154,5 @@
        if (ctx.options & DHCPCD_FORKED)
                _exit(i); /* so atexit won't remove our pidfile */
 #endif
-#ifdef HAVE_OPEN_MEMSTREAM
-       if (ctx.script_fp)
-               fclose(ctx.script_fp);
-#endif
-       free(ctx.script_buf);
-       free(ctx.script_env);
        return i;
 }
diff -r 634f42e171a0 -r 46d7a633d24f external/bsd/dhcpcd/dist/src/ipv4.c
--- a/external/bsd/dhcpcd/dist/src/ipv4.c       Wed Jul 24 09:54:49 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv4.c       Thu Jul 25 08:53:54 2019 +0000
@@ -453,9 +453,7 @@
 inet_getroutes(struct dhcpcd_ctx *ctx, rb_tree_t *routes)
 {
        struct interface *ifp;
-#ifdef IPV4LL
        bool have_default = false;
-#endif
 
        TAILQ_FOREACH(ifp, ctx->ifaces, next) {
                if (!ifp->active)
@@ -504,6 +502,8 @@
 #ifdef ARP
        if (!keeparp)
                arp_freeaddr(addr->iface, &addr->addr);
+#else
+       UNUSED(keeparp);
 #endif
 
        state = IPV4_STATE(addr->iface);
@@ -541,7 +541,9 @@
            ifo->options & DHCPCD_INFORM ||
            (ifo->options & DHCPCD_STATIC && ifo->req_addr.s_addr == 0))
                return 0;
+#ifdef ARP
        arp_freeaddr(ifp, &state->addr->addr);
+#endif
        r = ipv4_deladdr(state->addr, 0);
        return r;
 }
diff -r 634f42e171a0 -r 46d7a633d24f external/bsd/dhcpcd/dist/src/ipv4ll.c
--- a/external/bsd/dhcpcd/dist/src/ipv4ll.c     Wed Jul 24 09:54:49 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv4ll.c     Thu Jul 25 08:53:54 2019 +0000
@@ -298,7 +298,7 @@
        state = IPV4LL_STATE(ifp);
        assert(state != NULL);
        assert(state->arp == astate);
-       ipv4ll_not_found_arp(astate);
+       ipv4ll_not_found(ifp);
 }
 
 static void
@@ -552,19 +552,24 @@
 
        ifp = ia->iface;
        state = IPV4LL_STATE(ifp);
-       if (state == NULL || state->addr == NULL ||
-           !IN_ARE_ADDR_EQUAL(&state->addr->addr, &ia->addr))
+       if (state == NULL)
                return;
 
-       if (cmd == RTM_DELADDR) {
+       if (cmd == RTM_DELADDR &&
+           state->addr != NULL &&
+           IN_ARE_ADDR_EQUAL(&state->addr->addr, &ia->addr))
+       {
                loginfox("%s: pid %d deleted IP address %s",
                    ifp->name, pid, ia->saddr);
                ipv4ll_defend_failed(ifp);
+               return;
        }
 
 #ifdef IN_IFF_DUPLICATED
        if (cmd != RTM_NEWADDR)
                return;
+       if (!IN_ARE_ADDR_EQUAL(&state->pickedaddr, &ia->addr))
+               return;
        if (!(ia->addr_flags & IN_IFF_NOTUSEABLE))
                ipv4ll_not_found(ifp);
        else if (ia->addr_flags & IN_IFF_DUPLICATED) {
diff -r 634f42e171a0 -r 46d7a633d24f external/bsd/dhcpcd/dist/src/logerr.c
--- a/external/bsd/dhcpcd/dist/src/logerr.c     Wed Jul 24 09:54:49 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/logerr.c     Thu Jul 25 08:53:54 2019 +0000
@@ -209,6 +209,7 @@
 
 #ifdef SMALL
        vsyslog(pri, fmt, args);
+       return len;
 #else
        if (ctx->log_file == NULL) {
                vsyslog(pri, fmt, args);
diff -r 634f42e171a0 -r 46d7a633d24f external/bsd/dhcpcd/dist/src/script.c
--- a/external/bsd/dhcpcd/dist/src/script.c     Wed Jul 24 09:54:49 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/script.c     Thu Jul 25 08:53:54 2019 +0000
@@ -180,7 +180,7 @@
        char **env, **envp, *buf, *bufp, *endp, *path;
        size_t nenv;
        long buf_pos, i;
-       int protocol;
+       int protocol = PROTO_LINK;
        const struct if_options *ifo = ifp->options;
        const struct interface *ifp2;
        int af;



Home | Main Index | Thread Index | Old Index