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 Import dhcpcd-7.2.0 with the followin...



details:   https://anonhg.NetBSD.org/src/rev/de341945ddb1
branches:  roy
changeset: 450560:de341945ddb1
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Apr 17 23:33:08 2019 +0000

description:
Import dhcpcd-7.2.0 with the following changes:
  *  BSD: PF_LINK sockets now closed when no longer needed
  *  BSD: Fix detecting interface for scoped routes
  *  script: Allow "" to mean /dev/null
  *  script: Add static routers and routes to env
  *  DHCP: outbound interface is no longer dictated with IP_PKTINFO
  *  DHCP: BPF sockets now closed when no longer needed
  *  DHCPv6: Allow nooption dhcp6_unicast to work
  *  DHCPv6: Don't spam syslog if we always get the same error
  *  route: Log pid which deleted routes of interest

This release fixes PR bin/53705.

diffstat:

 external/bsd/dhcpcd/dist/BUILDING.md      |    3 -
 external/bsd/dhcpcd/dist/Makefile         |   12 +-
 external/bsd/dhcpcd/dist/configure        |    2 +-
 external/bsd/dhcpcd/dist/iconfig.mk       |    3 +-
 external/bsd/dhcpcd/dist/src/Makefile     |    6 +-
 external/bsd/dhcpcd/dist/src/arp.c        |   15 +-
 external/bsd/dhcpcd/dist/src/arp.h        |    1 -
 external/bsd/dhcpcd/dist/src/common.c     |   48 --
 external/bsd/dhcpcd/dist/src/common.h     |    2 -
 external/bsd/dhcpcd/dist/src/defs.h       |    2 +-
 external/bsd/dhcpcd/dist/src/dhcp.c       |  283 +++++++++++------
 external/bsd/dhcpcd/dist/src/dhcp.h       |    1 +
 external/bsd/dhcpcd/dist/src/dhcp6.c      |  230 ++++++-------
 external/bsd/dhcpcd/dist/src/dhcp6.h      |    2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.8.in  |    2 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.c     |   12 +-
 external/bsd/dhcpcd/dist/src/dhcpcd.h     |   13 -
 external/bsd/dhcpcd/dist/src/duid.c       |    1 +
 external/bsd/dhcpcd/dist/src/if-bsd.c     |   81 +++-
 external/bsd/dhcpcd/dist/src/if-linux.c   |   80 ++--
 external/bsd/dhcpcd/dist/src/if-options.c |  141 ++++----
 external/bsd/dhcpcd/dist/src/if-sun.c     |  490 ++++++++++++++++++++---------
 external/bsd/dhcpcd/dist/src/if.c         |  125 ++++++-
 external/bsd/dhcpcd/dist/src/if.h         |    9 +
 external/bsd/dhcpcd/dist/src/ipv4.c       |   10 +-
 external/bsd/dhcpcd/dist/src/ipv4ll.c     |    2 +
 external/bsd/dhcpcd/dist/src/ipv6.c       |   47 +-
 external/bsd/dhcpcd/dist/src/ipv6nd.c     |  194 +++++------
 external/bsd/dhcpcd/dist/src/route.c      |    9 +-
 external/bsd/dhcpcd/dist/src/route.h      |    2 +-
 external/bsd/dhcpcd/dist/src/script.c     |   10 +-
 external/bsd/dhcpcd/dist/tests/Makefile   |    6 +-
 32 files changed, 1055 insertions(+), 789 deletions(-)

diffs (truncated from 3688 to 300 lines):

diff -r 23b03aaacbb3 -r de341945ddb1 external/bsd/dhcpcd/dist/BUILDING.md
--- a/external/bsd/dhcpcd/dist/BUILDING.md      Thu Feb 07 21:34:30 2019 +0000
+++ b/external/bsd/dhcpcd/dist/BUILDING.md      Wed Apr 17 23:33:08 2019 +0000
@@ -3,9 +3,6 @@
 This attempts to document various ways of building dhcpcd for your
 platform.
 
-Building for distribution (ie making a dhcpcd source tarball) now requires
-gmake-4 or any BSD make.
-
 ## Size is an issue
 To compile small dhcpcd, maybe to be used for installation media where
 size is a concern, you can use the `--small` configure option to enable
diff -r 23b03aaacbb3 -r de341945ddb1 external/bsd/dhcpcd/dist/Makefile
--- a/external/bsd/dhcpcd/dist/Makefile Thu Feb 07 21:34:30 2019 +0000
+++ b/external/bsd/dhcpcd/dist/Makefile Wed Apr 17 23:33:08 2019 +0000
@@ -22,10 +22,10 @@
 .SUFFIXES:     .in
 
 all: config.h
-       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
+       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@ || exit $$?; cd ..; done
 
 depend: config.h
-       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
+       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@ || exit $$?; cd ..; done
 
 tests:
        cd $@; ${MAKE} $@
@@ -36,17 +36,17 @@
        cd $@; ${MAKE}
 
 eginstall:
-       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
+       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@ || exit $$?; cd ..; done
 
 install:
-       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
+       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@ || exit $$?; cd ..; done
 
 proginstall:
-       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
+       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@ || exit $$?; cd ..; done
 
 clean:
        rm -rf cov-int dhcpcd.xz
-       for x in ${SUBDIRS} tests; do cd $$x; ${MAKE} $@; cd ..; done
+       for x in ${SUBDIRS} tests; do cd $$x; ${MAKE} $@ || exit $$?; cd ..; done
 
 distclean: clean
        rm -f config.h config.mk config.log \
diff -r 23b03aaacbb3 -r de341945ddb1 external/bsd/dhcpcd/dist/configure
--- a/external/bsd/dhcpcd/dist/configure        Thu Feb 07 21:34:30 2019 +0000
+++ b/external/bsd/dhcpcd/dist/configure        Wed Apr 17 23:33:08 2019 +0000
@@ -454,7 +454,7 @@
        echo "CPPFLAGS+=        -D_XPG4_2 -D__EXTENSIONS__ -DBSD_COMP" \
            >>$CONFIG_MK
        echo "DHCPCD_SRCS+=     if-sun.c" >>$CONFIG_MK
-       echo "LDADD+=           -ldlpi" >>$CONFIG_MK
+       echo "LDADD+=           -ldlpi -lkstat" >>$CONFIG_MK
        ;;
 *)
        echo "DHCPCD_SRCS+=     if-bsd.c" >>$CONFIG_MK
diff -r 23b03aaacbb3 -r de341945ddb1 external/bsd/dhcpcd/dist/iconfig.mk
--- a/external/bsd/dhcpcd/dist/iconfig.mk       Thu Feb 07 21:34:30 2019 +0000
+++ b/external/bsd/dhcpcd/dist/iconfig.mk       Wed Apr 17 23:33:08 2019 +0000
@@ -1,7 +1,8 @@
 # Nasty hack so that make clean works without configure being run
-# Requires gmake4
 TOP?=          .
 _CONFIG_MK!=   test -e ${TOP}/config.mk && \
                    echo config.mk || echo config-null.mk
+_CONFIG_MK?=   $(shell test -e ${TOP}/config.mk && \
+                   echo config.mk || echo config-null.mk)
 CONFIG_MK?=    ${_CONFIG_MK}
 include                ${TOP}/${CONFIG_MK}
diff -r 23b03aaacbb3 -r de341945ddb1 external/bsd/dhcpcd/dist/src/Makefile
--- a/external/bsd/dhcpcd/dist/src/Makefile     Thu Feb 07 21:34:30 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/Makefile     Wed Apr 17 23:33:08 2019 +0000
@@ -45,7 +45,7 @@
                $< > $@
 
 all: ${TOP}/config.h ${PROG} ${SCRIPTS} ${MAN5} ${MAN8}
-       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
+       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@ || exit $$?; cd ..; done
 
 dev:
        cd dev && ${MAKE}
@@ -84,7 +84,7 @@
        ${INSTALL} -d ${DESTDIR}${DBDIR}
 
 proginstall: _proginstall ${EMBEDDEDINSTALL}
-       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
+       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@ || exit $$?; cd ..; done
 
 _maninstall: ${MAN5} ${MAN8}
        ${INSTALL} -d ${DESTDIR}${MANDIR}/man5
@@ -130,7 +130,7 @@
 
 clean:
        rm -f ${OBJS} ${PROG} ${PROG}.core ${CLEANFILES}
-       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@; cd ..; done
+       for x in ${SUBDIRS}; do cd $$x; ${MAKE} $@ || exit $$?; cd ..; done
 
 distclean: clean
        rm -f .depend
diff -r 23b03aaacbb3 -r de341945ddb1 external/bsd/dhcpcd/dist/src/arp.c
--- a/external/bsd/dhcpcd/dist/src/arp.c        Thu Feb 07 21:34:30 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.c        Wed Apr 17 23:33:08 2019 +0000
@@ -175,17 +175,18 @@
        }
 }
 
-void
+static void
 arp_close(struct interface *ifp)
 {
        struct iarp_state *state;
 
-       if ((state = ARP_STATE(ifp)) != NULL && state->bpf_fd != -1) {
-               eloop_event_delete(ifp->ctx->eloop, state->bpf_fd);
-               bpf_close(ifp, state->bpf_fd);
-               state->bpf_fd = -1;
-               state->bpf_flags |= BPF_EOF;
-       }
+       if ((state = ARP_STATE(ifp)) == NULL || state->bpf_fd == -1)
+               return;
+
+       eloop_event_delete(ifp->ctx->eloop, state->bpf_fd);
+       bpf_close(ifp, state->bpf_fd);
+       state->bpf_fd = -1;
+       state->bpf_flags |= BPF_EOF;
 }
 
 static void
diff -r 23b03aaacbb3 -r de341945ddb1 external/bsd/dhcpcd/dist/src/arp.h
--- a/external/bsd/dhcpcd/dist/src/arp.h        Thu Feb 07 21:34:30 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/arp.h        Wed Apr 17 23:33:08 2019 +0000
@@ -90,7 +90,6 @@
 int arp_open(struct interface *);
 ssize_t arp_request(const struct interface *, in_addr_t, in_addr_t);
 void arp_probe(struct arp_state *);
-void arp_close(struct interface *);
 void arp_report_conflicted(const struct arp_state *, const struct arp_msg *);
 struct arp_state *arp_new(struct interface *, const struct in_addr *);
 struct arp_state *arp_find(struct interface *, const struct in_addr *);
diff -r 23b03aaacbb3 -r de341945ddb1 external/bsd/dhcpcd/dist/src/common.c
--- a/external/bsd/dhcpcd/dist/src/common.c     Thu Feb 07 21:34:30 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/common.c     Wed Apr 17 23:33:08 2019 +0000
@@ -200,51 +200,3 @@
        fclose(fp);
        return len;
 }
-
-ssize_t
-recvmsg_realloc(int fd, struct msghdr *msg, int flags)
-{
-       struct iovec *iov;
-       ssize_t slen;
-       size_t len;
-       void *n;
-
-       assert(msg != NULL);
-       assert(msg->msg_iov != NULL && msg->msg_iovlen > 0);
-       assert((flags & (MSG_PEEK | MSG_TRUNC)) == 0);
-
-       /* Assume we are reallocing the last iovec. */
-       iov = &msg->msg_iov[msg->msg_iovlen - 1];
-
-       for (;;) {
-               /* Passing MSG_TRUNC should return the actual size needed. */
-               slen = recvmsg(fd, msg, flags | MSG_PEEK | MSG_TRUNC);
-               if (slen == -1)
-                       return -1;
-               if (!(msg->msg_flags & MSG_TRUNC))
-                       break;
-
-               len = (size_t)slen;
-
-               /* Some kernels return the size of the receive buffer
-                * on truncation, not the actual size needed.
-                * So grow the buffer and try again. */
-               if (iov->iov_len == len)
-                       len++;
-               else if (iov->iov_len > len)
-                       break;
-               len = roundup(len, IOVEC_BUFSIZ);
-               if ((n = realloc(iov->iov_base, len)) == NULL)
-                       return -1;
-               iov->iov_base = n;
-               iov->iov_len = len;
-       }
-
-       slen = recvmsg(fd, msg, flags);
-       if (slen != -1 && msg->msg_flags & MSG_TRUNC) {
-               /* This should not be possible ... */
-               errno = ENOBUFS;
-               return -1;
-       }
-       return slen;
-}
diff -r 23b03aaacbb3 -r de341945ddb1 external/bsd/dhcpcd/dist/src/common.h
--- a/external/bsd/dhcpcd/dist/src/common.h     Thu Feb 07 21:34:30 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/common.h     Wed Apr 17 23:33:08 2019 +0000
@@ -181,6 +181,4 @@
 const char *hwaddr_ntoa(const void *, size_t, char *, size_t);
 size_t hwaddr_aton(uint8_t *, const char *);
 size_t read_hwaddr_aton(uint8_t **, const char *);
-
-ssize_t recvmsg_realloc(int, struct msghdr *, int);
 #endif
diff -r 23b03aaacbb3 -r de341945ddb1 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Thu Feb 07 21:34:30 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Wed Apr 17 23:33:08 2019 +0000
@@ -28,7 +28,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "7.1.1"
+#define VERSION                        "7.2.0"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r 23b03aaacbb3 -r de341945ddb1 external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c       Thu Feb 07 21:34:30 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c       Wed Apr 17 23:33:08 2019 +0000
@@ -86,9 +86,9 @@
 #define IPDEFTTL 64 /* RFC1340 */
 #endif
 
-/* NetBSD-7 has an incomplete IP_PKTINFO implementation. */
-#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 800000000
-#undef IP_PKTINFO
+/* Support older systems with different defines */
+#if !defined(IP_RECVPKTINFO) && defined(IP_PKTINFO)
+#define IP_RECVPKTINFO IP_PKTINFO
 #endif
 
 /* Assert the correct structure size for on wire */
@@ -129,6 +129,9 @@
 #endif
 static void dhcp_handledhcp(struct interface *, struct bootp *, size_t,
     const struct in_addr *);
+#ifdef IP_PKTINFO
+static void dhcp_handleifudp(void *);
+#endif
 static int dhcp_initstate(struct interface *);
 
 void
@@ -447,7 +450,7 @@
                memcpy(&gateway.s_addr, p, 4);
                p += 4;
 
-               /* A host route is normally set by having the
+               /* An on-link host route is normally set by having the
                 * gateway match the destination or assigned address */
                if (gateway.s_addr == dest.s_addr ||
                    (gateway.s_addr == bootp->yiaddr ||
@@ -455,17 +458,14 @@
                {
                        gateway.s_addr = INADDR_ANY;
                        netmask.s_addr = INADDR_BROADCAST;
+               }
+               if (netmask.s_addr == INADDR_BROADCAST)
                        rt->rt_flags = RTF_HOST;
-               }
 
                sa_in_init(&rt->rt_dest, &dest);
                sa_in_init(&rt->rt_netmask, &netmask);
                sa_in_init(&rt->rt_gateway, &gateway);
 
-               /* If CIDR is 32 then it's a host route. */
-               if (cidr == 32)
-                       rt->rt_flags = RTF_HOST;
-
                TAILQ_INSERT_TAIL(routes, rt, rt_next);
                n++;
        }
@@ -638,7 +638,7 @@
                        if ((rt = rt_new(ifp)) == NULL)
                                return -1;
 
-                       /* A host route is normally set by having the
+                       /* A on-link host route is normally set by having the
                         * gateway match the destination or assigned address */
                        if (gateway.s_addr == dest.s_addr ||
                             (gateway.s_addr == bootp->yiaddr ||
@@ -646,12 +646,15 @@
                        {
                                gateway.s_addr = INADDR_ANY;
                                netmask.s_addr = INADDR_BROADCAST;
-                               rt->rt_flags = RTF_HOST;
                        } else
                                netmask.s_addr = route_netmask(dest.s_addr);
+                       if (netmask.s_addr == INADDR_BROADCAST)
+                               rt->rt_flags = RTF_HOST;
+
                        sa_in_init(&rt->rt_dest, &dest);
                        sa_in_init(&rt->rt_netmask, &netmask);
                        sa_in_init(&rt->rt_gateway, &gateway);



Home | Main Index | Thread Index | Old Index