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 Import dhcpcd-8.0.2 with the follow...



details:   https://anonhg.NetBSD.org/src/rev/87fd22a9e94d
branches:  trunk
changeset: 1000597:87fd22a9e94d
user:      roy <roy%NetBSD.org@localhost>
date:      Tue Jul 30 10:23:01 2019 +0000

description:
Import dhcpcd-8.0.2 with the following changes:

  *  NetBSD: Can be build without ARP support but listen to kernel DaD
  *  ND6: Removed NA support from SMALL builds
  *  DHCP: Avoid duplicate read of UDP socket when BPF is also open
  *  IP: Avoid adding address if already exists on OS other than Linux
  *  route: Fixed a NULL de-reference error on static routes
  *  DHCP6: Move to REQUEST if any IA has no-binding in REWNEW/REBIND
  *  IP: Accept packets with IP header options

diffstat:

 external/bsd/dhcpcd/dist/BUILDING.md             |   5 ++-
 external/bsd/dhcpcd/dist/configure               |   3 +-
 external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant |   8 +++--
 external/bsd/dhcpcd/dist/src/defs.h              |   2 +-
 external/bsd/dhcpcd/dist/src/dhcp6.h             |   1 +
 external/bsd/dhcpcd/dist/src/if.h                |   3 --
 external/bsd/dhcpcd/dist/src/ipv4.c              |  35 ++++++++++++++++++++---
 external/bsd/dhcpcd/dist/src/ipv4.h              |   6 ++++
 external/bsd/dhcpcd/dist/src/route.c             |   6 ++-
 external/bsd/dhcpcd/dist/src/script.c            |   7 ++--
 10 files changed, 55 insertions(+), 21 deletions(-)

diffs (198 lines):

diff -r 94386f60b5cd -r 87fd22a9e94d external/bsd/dhcpcd/dist/BUILDING.md
--- a/external/bsd/dhcpcd/dist/BUILDING.md      Tue Jul 30 08:44:28 2019 +0000
+++ b/external/bsd/dhcpcd/dist/BUILDING.md      Tue Jul 30 10:23:01 2019 +0000
@@ -8,8 +8,9 @@
 size is a concern, you can use the `--small` configure option to enable
 a reduced feature set within dhcpcd.
 Currently this just removes non important options out of
-`dhcpcd-definitions.conf`, the logfile option and
-support for DHCPv6 Prefix Delegation.
+`dhcpcd-definitions.conf`, the logfile option,
+DHCPv6 Prefix Delegation and IPv6 address announcement *(to prefer an
+address on another interface)*.
 Other features maybe dropped as and when required.
 dhcpcd can also be made smaller by removing the IPv4 or IPv6 stack:
   *  `--disable-inet`
diff -r 94386f60b5cd -r 87fd22a9e94d external/bsd/dhcpcd/dist/configure
--- a/external/bsd/dhcpcd/dist/configure        Tue Jul 30 08:44:28 2019 +0000
+++ b/external/bsd/dhcpcd/dist/configure        Tue Jul 30 10:23:01 2019 +0000
@@ -747,8 +747,7 @@
        cat <<EOF >_open_memstream.c
 #include <stdio.h>
 int main(void) {
-       open_memstream(NULL, NULL);
-       return 0;
+       return open_memstream(NULL, NULL) != NULL ? 0 : 1;
 }
 EOF
        if $XCC _open_memstream.c -o _open_memstream 2>&3; then
diff -r 94386f60b5cd -r 87fd22a9e94d external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
--- a/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant  Tue Jul 30 08:44:28 2019 +0000
+++ b/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant  Tue Jul 30 10:23:01 2019 +0000
@@ -1,7 +1,9 @@
 # Start, reconfigure and stop wpa_supplicant per wireless interface.
-# This is needed because wpa_supplicant lacks hotplugging of any kind
-# and the user should not be expected to have to wire it into their system
-# if the base system doesn't do this itself.
+#
+# This is only needed when using wpa_supplicant-2.5 or older, OR
+# when wpa_supplicant has not been built with CONFIG_MATCH_IFACE, OR
+# wpa_supplicant was launched without the -M flag to activate
+# interface matching.
 
 if [ -z "$wpa_supplicant_conf" ]; then
        for x in \
diff -r 94386f60b5cd -r 87fd22a9e94d external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Tue Jul 30 08:44:28 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Tue Jul 30 10:23:01 2019 +0000
@@ -29,7 +29,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "8.0.1"
+#define VERSION                        "8.0.2"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r 94386f60b5cd -r 87fd22a9e94d external/bsd/dhcpcd/dist/src/dhcp6.h
--- a/external/bsd/dhcpcd/dist/src/dhcp6.h      Tue Jul 30 08:44:28 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp6.h      Tue Jul 30 10:23:01 2019 +0000
@@ -208,6 +208,7 @@
        char leasefile[sizeof(LEASEFILE6) + IF_NAMESIZE + (IF_SSIDLEN * 4) +3];
        const char *reason;
        uint16_t lerror; /* Last error received from DHCPv6 reply. */
+       bool has_no_binding;
        struct authstate auth;
 };
 
diff -r 94386f60b5cd -r 87fd22a9e94d external/bsd/dhcpcd/dist/src/if.h
--- a/external/bsd/dhcpcd/dist/src/if.h Tue Jul 30 08:44:28 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/if.h Tue Jul 30 10:23:01 2019 +0000
@@ -91,9 +91,6 @@
            ((addr & IN_CLASSB_NET) == 0xc0a80000))
 #endif
 
-#define RAW_EOF                        1 << 0
-#define RAW_PARTIALCSUM                2 << 0
-
 #ifndef CLLADDR
 #ifdef AF_LINK
 #  define CLLADDR(sdl) (const void *)((sdl)->sdl_data + (sdl)->sdl_nlen)
diff -r 94386f60b5cd -r 87fd22a9e94d external/bsd/dhcpcd/dist/src/ipv4.c
--- a/external/bsd/dhcpcd/dist/src/ipv4.c       Tue Jul 30 08:44:28 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv4.c       Tue Jul 30 10:23:01 2019 +0000
@@ -659,8 +659,13 @@
 
        ia->mask = *mask;
        ia->brd = *bcast;
+#ifdef IP_LIFETIME
        ia->vltime = vltime;
        ia->pltime = pltime;
+#else
+       UNUSED(vltime);
+       UNUSED(pltime);
+#endif
        snprintf(ia->saddr, sizeof(ia->saddr), "%s/%d",
            inet_ntoa(*addr), inet_ntocidr(*mask));
 
@@ -746,16 +751,36 @@
                return;
        }
 
-#if __linux__
-       /* If the netmask or broadcast is different, re-add the addresss */
        ia = ipv4_iffindaddr(ifp, &lease->addr, NULL);
+       /* If the netmask or broadcast is different, re-add the addresss.
+        * If IP addresses do not have lifetimes, there is a very real chance
+        * that re-adding them will scrub the subnet route temporarily
+        * which is a bad thing, so avoid it. */
        if (ia != NULL &&
-           (ia->mask.s_addr != lease->mask.s_addr ||
-           ia->brd.s_addr != lease->brd.s_addr))
-               ipv4_deladdr(ia, 0);
+           ia->mask.s_addr == lease->mask.s_addr &&
+           ia->brd.s_addr == lease->brd.s_addr)
+       {
+#ifndef IP_LIFETIME
+               logdebugx("%s: IP address %s already exists",
+                   ifp->name, ia->saddr);
 #endif
+       } else {
+#ifdef __linux__
+               /* Linux does not change netmask/broadcast address
+                * for re-added addresses, so we need to delete the old one
+                * first. */
+               if (ia != NULL)
+                       ipv4_deladdr(ia, 0);
+#endif
+#ifndef IP_LIFETIME
+               if (ipv4_daddaddr(ifp, lease) == -1 && errno != EEXIST)
+                       return;
+#endif
+       }
+#ifdef IP_LIFETIME
        if (ipv4_daddaddr(ifp, lease) == -1 && errno != EEXIST)
                return;
+#endif
 
        ia = ipv4_iffindaddr(ifp, &lease->addr, NULL);
        if (ia == NULL) {
diff -r 94386f60b5cd -r 87fd22a9e94d external/bsd/dhcpcd/dist/src/ipv4.h
--- a/external/bsd/dhcpcd/dist/src/ipv4.h       Tue Jul 30 08:44:28 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv4.h       Tue Jul 30 10:23:01 2019 +0000
@@ -75,6 +75,10 @@
 #define IN_ARE_ADDR_EQUAL(a, b)                ((a)->s_addr == (b)->s_addr)
 #define IN_IS_ADDR_UNSPECIFIED(a)      ((a)->s_addr == INADDR_ANY)
 
+#ifdef __linux__
+#define IP_LIFETIME
+#endif
+
 struct ipv4_addr {
        TAILQ_ENTRY(ipv4_addr) next;
        struct in_addr addr;
@@ -83,8 +87,10 @@
        struct interface *iface;
        int addr_flags;
        unsigned int flags;
+#ifdef IP_LIFETIME
        uint32_t vltime;
        uint32_t pltime;
+#endif
        char saddr[INET_ADDRSTRLEN + 3];
 #ifdef ALIAS_ADDR
        char alias[IF_NAMESIZE];
diff -r 94386f60b5cd -r 87fd22a9e94d external/bsd/dhcpcd/dist/src/route.c
--- a/external/bsd/dhcpcd/dist/src/route.c      Tue Jul 30 08:44:28 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/route.c      Tue Jul 30 10:23:01 2019 +0000
@@ -392,8 +392,10 @@
        struct dhcpcd_ctx *ctx;
 
        assert(rt != NULL);
-       assert(rt->rt_ifp != NULL);
-       assert(rt->rt_ifp->ctx != NULL);
+       if (rt->rt_ifp == NULL) {
+               free(rt);
+               return;
+       }
 
        ctx = rt->rt_ifp->ctx;
        rb_tree_insert_node(&ctx->froutes, rt);
diff -r 94386f60b5cd -r 87fd22a9e94d external/bsd/dhcpcd/dist/src/script.c
--- a/external/bsd/dhcpcd/dist/src/script.c     Tue Jul 30 08:44:28 2019 +0000
+++ b/external/bsd/dhcpcd/dist/src/script.c     Tue Jul 30 10:23:01 2019 +0000
@@ -213,10 +213,11 @@
        if (tmpfd == -1)
                goto eexit;
        unlink(tmpfile);
-       fp = fopen(tmpfile, "w+");
-       close(tmpfd);
-       if (fp == NULL)
+       fp = fdopen(tmpfd, "w+");
+       if (fp == NULL) {
+               close(tmpfd);
                goto eexit;
+       }
 #endif
 
 #ifdef INET



Home | Main Index | Thread Index | Old Index