Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/dhcpcd/dist/src Update to dhcpcd-9.3.1 with the...



details:   https://anonhg.NetBSD.org/src/rev/fbac1bca6dc0
branches:  trunk
changeset: 1015065:fbac1bca6dc0
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Oct 12 14:07:55 2020 +0000

description:
Update to dhcpcd-9.3.1 with the following changes:
 * dhcpcd: carrier handling issue fixed from 9.3.0
 * dhcpcd: log if interface type is unsupported in debug
 * duid: memory leak fixed if UUID wanted but none available
 * privsep: fix receiving inet and no BPF running
 * privsep: allow gettimeofday for SECCOMP
 * privsep: fix stderr redirection again

diffstat:

 external/bsd/dhcpcd/dist/src/arp.c          |   2 +-
 external/bsd/dhcpcd/dist/src/defs.h         |   2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.h       |   1 -
 external/bsd/dhcpcd/dist/src/duid.c         |   5 ++-
 external/bsd/dhcpcd/dist/src/if-options.h   |   2 +-
 external/bsd/dhcpcd/dist/src/if.c           |  34 ++++++++++++++++++++++------
 external/bsd/dhcpcd/dist/src/if.h           |   1 +
 external/bsd/dhcpcd/dist/src/privsep-bpf.c  |  14 +++++++++--
 external/bsd/dhcpcd/dist/src/privsep-inet.c |  22 ++++++++++++++++++
 external/bsd/dhcpcd/dist/src/privsep-inet.h |   1 +
 10 files changed, 67 insertions(+), 17 deletions(-)

diffs (208 lines):

diff -r 7f0f3441e817 -r fbac1bca6dc0 external/bsd/dhcpcd/dist/src/arp.c
--- a/external/bsd/dhcpcd/dist/src/arp.c        Mon Oct 12 13:54:51 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.c        Mon Oct 12 14:07:55 2020 +0000
@@ -506,7 +506,7 @@
        struct ipv4_addr *iap;
 
        TAILQ_FOREACH(ifp, ctx->ifaces, next) {
-               if (!ifp->active || ifp->carrier <= LINK_DOWN)
+               if (!ifp->active || !if_is_link_up(ifp))
                        continue;
                iap = ipv4_iffindaddr(ifp, ia, NULL);
                if (iap == NULL)
diff -r 7f0f3441e817 -r fbac1bca6dc0 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Mon Oct 12 13:54:51 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Mon Oct 12 14:07:55 2020 +0000
@@ -29,7 +29,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "9.3.0"
+#define VERSION                        "9.3.1"
 
 #ifndef PRIVSEP_USER
 # define PRIVSEP_USER          "_" PACKAGE
diff -r 7f0f3441e817 -r fbac1bca6dc0 external/bsd/dhcpcd/dist/src/dhcpcd.h
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.h     Mon Oct 12 13:54:51 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.h     Mon Oct 12 14:07:55 2020 +0000
@@ -55,7 +55,6 @@
 #define        LINK_UP         1
 #define        LINK_UNKNOWN    0
 #define        LINK_DOWN       -1
-#define        LINK_DOWN_IFFUP -2
 
 #define IF_DATA_IPV4   0
 #define IF_DATA_ARP    1
diff -r 7f0f3441e817 -r fbac1bca6dc0 external/bsd/dhcpcd/dist/src/duid.c
--- a/external/bsd/dhcpcd/dist/src/duid.c       Mon Oct 12 13:54:51 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/duid.c       Mon Oct 12 14:07:55 2020 +0000
@@ -178,8 +178,9 @@
        if (ifp == NULL) {
                if (ctx->duid_type != DUID_DEFAULT &&
                    ctx->duid_type != DUID_UUID)
-                       return 0;
-               len = duid_make_uuid(data);
+                       len = 0;
+               else
+                       len = duid_make_uuid(data);
                if (len == 0)
                        free(data);
                else
diff -r 7f0f3441e817 -r fbac1bca6dc0 external/bsd/dhcpcd/dist/src/if-options.h
--- a/external/bsd/dhcpcd/dist/src/if-options.h Mon Oct 12 13:54:51 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-options.h Mon Oct 12 14:07:55 2020 +0000
@@ -99,7 +99,7 @@
 #define DHCPCD_NOALIAS                 (1ULL << 39)
 #define DHCPCD_IA_FORCED               (1ULL << 40)
 #define DHCPCD_STOPPING                        (1ULL << 41)
-#define DHCPCD_DEPARTED                        (1ULL << 42)
+#define DHCPCD_LAUNCHER                        (1ULL << 42)
 #define DHCPCD_HOSTNAME_SHORT          (1ULL << 43)
 #define DHCPCD_EXITING                 (1ULL << 44)
 #define DHCPCD_WAITIP4                 (1ULL << 45)
diff -r 7f0f3441e817 -r fbac1bca6dc0 external/bsd/dhcpcd/dist/src/if.c
--- a/external/bsd/dhcpcd/dist/src/if.c Mon Oct 12 13:54:51 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if.c Mon Oct 12 14:07:55 2020 +0000
@@ -193,6 +193,17 @@
        return 0;
 }
 
+bool
+if_is_link_up(const struct interface *ifp)
+{
+
+       return ifp->flags & IFF_UP &&
+           (ifp->carrier == LINK_UP ||
+            (ifp->carrier == LINK_UNKNOWN &&
+             !(ifp->options == NULL ||
+               ifp->options->options & DHCPCD_LINK)));
+}
+
 int
 if_randomisemac(struct interface *ifp)
 {
@@ -411,11 +422,16 @@
                }
                break;
        default:
-               if (if_noconf)
-                       active = IF_INACTIVE;
-               if (active)
-                       logwarnx("%s: unsupported interface type 0x%.2x",
+               if (active) {
+                       int i;
+
+                       if (if_noconf)
+                               active = IF_INACTIVE;
+                       i = active ? LOG_WARNING : LOG_DEBUG;
+                       logmessage(i, "%s: unsupported"
+                           " interface type 0x%.2x",
                            ifp->name, ifp->hwtype);
+               }
                break;
        }
 
@@ -621,12 +637,14 @@
 #endif
                        default:
                                /* Don't allow unless explicit */
-                               if (if_noconf)
-                                       active = IF_INACTIVE;
-                               if (active)
-                                       logwarnx("%s: unsupported"
+                               if (active) {
+                                       if (if_noconf)
+                                               active = IF_INACTIVE;
+                                       i = active ? LOG_WARNING : LOG_DEBUG;
+                                       logmessage(i, "%s: unsupported"
                                            " interface type 0x%.2x",
                                            ifp->name, sdl->sdl_type);
+                               }
                                /* Pretend it's ethernet */
                                ifp->hwtype = ARPHRD_ETHER;
                                break;
diff -r 7f0f3441e817 -r fbac1bca6dc0 external/bsd/dhcpcd/dist/src/if.h
--- a/external/bsd/dhcpcd/dist/src/if.h Mon Oct 12 13:54:51 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/if.h Mon Oct 12 14:07:55 2020 +0000
@@ -146,6 +146,7 @@
 int if_setflag(struct interface *, short, short);
 #define if_up(ifp) if_setflag((ifp), (IFF_UP | IFF_RUNNING), 0)
 #define if_down(ifp) if_setflag((ifp), 0, IFF_UP);
+bool if_is_link_up(const struct interface *);
 bool if_valid_hwaddr(const uint8_t *, size_t);
 struct if_head *if_discover(struct dhcpcd_ctx *, struct ifaddrs **,
     int, char * const *);
diff -r 7f0f3441e817 -r fbac1bca6dc0 external/bsd/dhcpcd/dist/src/privsep-bpf.c
--- a/external/bsd/dhcpcd/dist/src/privsep-bpf.c        Mon Oct 12 13:54:51 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/privsep-bpf.c        Mon Oct 12 14:07:55 2020 +0000
@@ -253,6 +253,17 @@
        uint8_t *bpf;
        size_t bpf_len;
 
+       switch (psm->ps_cmd) {
+#ifdef ARP
+       case PS_BPF_ARP:
+#endif
+       case PS_BPF_BOOTP:
+               break;
+       default:
+               errno = ENOTSUP;
+               return -1;
+       }
+
        ifp = if_findindex(ctx->ifaces, psm->ps_id.psi_ifindex);
        /* interface may have departed .... */
        if (ifp == NULL)
@@ -270,9 +281,6 @@
        case PS_BPF_BOOTP:
                dhcp_packet(ifp, bpf, bpf_len, (unsigned int)psm->ps_flags);
                break;
-       default:
-               errno = ENOTSUP;
-               return -1;
        }
 
        return 1;
diff -r 7f0f3441e817 -r fbac1bca6dc0 external/bsd/dhcpcd/dist/src/privsep-inet.c
--- a/external/bsd/dhcpcd/dist/src/privsep-inet.c       Mon Oct 12 13:54:51 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/privsep-inet.c       Mon Oct 12 14:07:55 2020 +0000
@@ -89,6 +89,28 @@
 }
 #endif
 
+bool
+ps_inet_canstart(const struct dhcpcd_ctx *ctx)
+{
+
+#ifdef INET
+       if ((ctx->options & (DHCPCD_IPV4 | DHCPCD_MASTER)) ==
+           (DHCPCD_IPV4 | DHCPCD_MASTER))
+               return true;
+#endif
+#if defined(INET6) && !defined(__sun)
+       if (ctx->options & DHCPCD_IPV6)
+               return true;
+#endif
+#ifdef DHCP6
+       if ((ctx->options & (DHCPCD_IPV6 | DHCPCD_MASTER)) ==
+           (DHCPCD_IPV6 | DHCPCD_MASTER))
+               return true;
+#endif
+
+       return false;
+}
+
 static int
 ps_inet_startcb(void *arg)
 {
diff -r 7f0f3441e817 -r fbac1bca6dc0 external/bsd/dhcpcd/dist/src/privsep-inet.h
--- a/external/bsd/dhcpcd/dist/src/privsep-inet.h       Mon Oct 12 13:54:51 2020 +0000
+++ b/external/bsd/dhcpcd/dist/src/privsep-inet.h       Mon Oct 12 14:07:55 2020 +0000
@@ -29,6 +29,7 @@
 #ifndef PRIVSEP_INET_H
 #define PRIVSEP_INET_H
 
+bool ps_inet_canstart(const struct dhcpcd_ctx *);
 pid_t ps_inet_start(struct dhcpcd_ctx *);
 int ps_inet_stop(struct dhcpcd_ctx *);
 ssize_t ps_inet_cmd(struct dhcpcd_ctx *, struct ps_msghdr *, struct msghdr *);



Home | Main Index | Thread Index | Old Index