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 Import dhcpcd-7.0.8 with the fo...



details:   https://anonhg.NetBSD.org/src/rev/ac95084f5074
branches:  trunk
changeset: 365535:ac95084f5074
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Aug 20 10:55:03 2018 +0000

description:
Import dhcpcd-7.0.8 with the following changes:
  *  Don't use IP_PKTINFO on NetBSD-7 as it's incomplete.
  *  Workaround RTM_NEWADDR sending the wrong broadcast address
     on NetBSD-7.
  *  Silence diagnostics if an address vanishes when reading
     it's flags on all BSD's.
  *  Misc compiler warnings fixed.

diffstat:

 external/bsd/dhcpcd/dist/src/defs.h   |   2 +-
 external/bsd/dhcpcd/dist/src/dhcp6.c  |   1 -
 external/bsd/dhcpcd/dist/src/if-bsd.c |  30 +++++++++++++++++++++++++++---
 external/bsd/dhcpcd/dist/src/if.c     |   8 +++-----
 external/bsd/dhcpcd/dist/src/ipv4.c   |  14 +++++++++++---
 external/bsd/dhcpcd/dist/src/ipv6.c   |   5 +++--
 6 files changed, 45 insertions(+), 15 deletions(-)

diffs (151 lines):

diff -r 95c9fe653bf1 -r ac95084f5074 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Mon Aug 20 10:27:32 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Mon Aug 20 10:55:03 2018 +0000
@@ -28,7 +28,7 @@
 #define CONFIG_H
 
 #define PACKAGE                        "dhcpcd"
-#define VERSION                        "7.0.7"
+#define VERSION                        "7.0.8"
 
 #ifndef CONFIG
 # define CONFIG                        SYSCONFDIR "/" PACKAGE ".conf"
diff -r 95c9fe653bf1 -r ac95084f5074 external/bsd/dhcpcd/dist/src/dhcp6.c
--- a/external/bsd/dhcpcd/dist/src/dhcp6.c      Mon Aug 20 10:27:32 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp6.c      Mon Aug 20 10:55:03 2018 +0000
@@ -777,7 +777,6 @@
                /* FALLTHROUGH */
        case DH6S_INIT:
                for (l = 0; l < ifo->ia_len; l++) {
-                       ifia = &ifo->ia[l];
                        len += sizeof(o) + sizeof(uint32_t); /* IAID */
                        /* IA_TA does not have T1 or T2 timers */
                        if (ifo->ia[l].ia_type != D6_OPTION_IA_TA)
diff -r 95c9fe653bf1 -r ac95084f5074 external/bsd/dhcpcd/dist/src/if-bsd.c
--- a/external/bsd/dhcpcd/dist/src/if-bsd.c     Mon Aug 20 10:27:32 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-bsd.c     Mon Aug 20 10:55:03 2018 +0000
@@ -1103,9 +1103,32 @@
                sin = (const void *)rti_info[RTAX_NETMASK];
                mask.s_addr = sin != NULL && sin->sin_family == AF_INET ?
                    sin->sin_addr.s_addr : INADDR_ANY;
+
+#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 800000000
+               /* NetBSD-7 and older send an invalid broadcast address.
+                * So we need to query the actual address to get
+                * the right one. */
+               {
+                       struct in_aliasreq ifra;
+
+                       memset(&ifra, 0, sizeof(ifra));
+                       strlcpy(ifra.ifra_name, ifp->name,
+                           sizeof(ifra.ifra_name));
+                       ifra.ifra_addr.sin_family = AF_INET;
+                       ifra.ifra_addr.sin_len = sizeof(ifra.ifra_addr);
+                       ifra.ifra_addr.sin_addr = addr;
+                       if (ioctl(ctx->pf_inet_fd, SIOCGIFALIAS, &ifra) == -1) {
+                               if (errno != EADDRNOTAVAIL)
+                                       logerr("%s: SIOCGIFALIAS", __func__);
+                               break;
+                       }
+                       bcast = ifra.ifra_broadaddr.sin_addr;
+               }
+#else
                sin = (const void *)rti_info[RTAX_BRD];
                bcast.s_addr = sin != NULL && sin->sin_family == AF_INET ?
                    sin->sin_addr.s_addr : INADDR_ANY;
+#endif
 
 #if defined(__FreeBSD__) || defined(__DragonFly__)
                /* FreeBSD sends RTM_DELADDR for each assigned address
@@ -1134,8 +1157,8 @@
                if (ifam->ifam_type == RTM_DELADDR)
                        addrflags = 0 ;
                else if ((addrflags = if_addrflags(ifp, &addr, NULL)) == -1) {
-                       logerr("%s: if_addrflags: %s",
-                           ifp->name, inet_ntoa(addr));
+                       if (errno != EADDRNOTAVAIL)
+                               logerr("%s: if_addrflags", __func__);
                        break;
                }
 #endif
@@ -1160,7 +1183,8 @@
                if (ifam->ifam_type == RTM_DELADDR)
                    addrflags = 0;
                else if ((addrflags = if_addrflags6(ifp, &addr6, NULL)) == -1) {
-                       logerr("%s: if_addrflags6", ifp->name);
+                       if (errno != EADDRNOTAVAIL)
+                               logerr("%s: if_addrflags6", __func__);
                        break;
                }
 #endif
diff -r 95c9fe653bf1 -r ac95084f5074 external/bsd/dhcpcd/dist/src/if.c
--- a/external/bsd/dhcpcd/dist/src/if.c Mon Aug 20 10:27:32 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/if.c Mon Aug 20 10:55:03 2018 +0000
@@ -240,10 +240,8 @@
                        addrflags = if_addrflags(ifp, &addr->sin_addr,
                            ifa->ifa_name);
                        if (addrflags == -1) {
-                               if (errno != EEXIST)
-                                       logerr("%s: if_addrflags: %s",
-                                           __func__,
-                                           inet_ntoa(addr->sin_addr));
+                               if (errno != EEXIST && errno != EADDRNOTAVAIL)
+                                       logerr("%s: if_addrflags", __func__);
                                continue;
                        }
 #endif
@@ -266,7 +264,7 @@
                        addrflags = if_addrflags6(ifp, &sin6->sin6_addr,
                            ifa->ifa_name);
                        if (addrflags == -1) {
-                               if (errno != EEXIST)
+                               if (errno != EEXIST && errno != EADDRNOTAVAIL)
                                        logerr("%s: if_addrflags6", __func__);
                                continue;
                        }
diff -r 95c9fe653bf1 -r ac95084f5074 external/bsd/dhcpcd/dist/src/ipv4.c
--- a/external/bsd/dhcpcd/dist/src/ipv4.c       Mon Aug 20 10:27:32 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv4.c       Mon Aug 20 10:55:03 2018 +0000
@@ -816,9 +816,17 @@
        bool ia_is_new;
 
 #if 0
-       logdebugx("%s: %s %s/%d %d", ifname,
-           cmd == RTM_NEWADDR ? "RTM_NEWADDR" : cmd == RTM_DELADDR ? "RTM_DELADDR" : "???",
-           inet_ntoa(*addr), inet_ntocidr(*mask), addrflags);
+       char sbrdbuf[INET_ADDRSTRLEN];
+       const char *sbrd;
+
+       if (brd)
+               sbrd = inet_ntop(AF_INET, brd, sbrdbuf, sizeof(sbrdbuf));
+       else
+               sbrd = NULL;
+       logdebugx("%s: %s %s/%d %s %d", ifname,
+           cmd == RTM_NEWADDR ? "RTM_NEWADDR" :
+           cmd == RTM_DELADDR ? "RTM_DELADDR" : "???",
+           inet_ntoa(*addr), inet_ntocidr(*mask), sbrd, addrflags);
 #endif
 
        if (ifs == NULL)
diff -r 95c9fe653bf1 -r ac95084f5074 external/bsd/dhcpcd/dist/src/ipv6.c
--- a/external/bsd/dhcpcd/dist/src/ipv6.c       Mon Aug 20 10:27:32 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv6.c       Mon Aug 20 10:55:03 2018 +0000
@@ -430,7 +430,7 @@
        bits = len % NBBY;
        for (i = 0; i < bytes; i++)
                mask->s6_addr[i] = 0xff;
-       if (bits) {
+       if (bits != 0) {
                /* Coverify false positive.
                 * bytelen cannot be 16 if bitlen is non zero */
                /* coverity[overrun-local] */
@@ -567,7 +567,8 @@
        alias = NULL;
 #endif
        if ((flags = if_addrflags6(ia->iface, &ia->addr, alias)) == -1) {
-               logerr("%s: if_addrflags6", ia->iface->name);
+               if (errno != EEXIST && errno != EADDRNOTAVAIL)
+                       logerr("%s: if_addrflags6", __func__);
                return;
        }
 



Home | Main Index | Thread Index | Old Index