Source-Changes-HG archive

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

[src/netbsd-8]: src Sync to head the following, requested by roy in ticket #981:



details:   https://anonhg.NetBSD.org/src/rev/8b573e093b28
branches:  netbsd-8
changeset: 435205:8b573e093b28
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Aug 25 11:38:19 2018 +0000

description:
Sync to head the following, requested by roy in ticket #981:

        external/bsd/dhcpcd/dist/src/defs.h             up to 1.1.1.16
        external/bsd/dhcpcd/dist/src/dhcp.c             up to 1.13
        external/bsd/dhcpcd/dist/src/dhcp6.c            up to 1.1.1.13
        external/bsd/dhcpcd/dist/src/if-bsd.c           up to 1.1.1.9
        external/bsd/dhcpcd/dist/src/if.c               up to 1.1.1.9
        external/bsd/dhcpcd/dist/src/ipv4.c             up to 1.1.1.10
        external/bsd/dhcpcd/dist/src/ipv6.c             up to 1.1.1.12
        doc/3RDPARTY                                    (manually edited)

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:

 doc/3RDPARTY                          |   6 +++---
 external/bsd/dhcpcd/dist/src/defs.h   |   2 +-
 external/bsd/dhcpcd/dist/src/dhcp.c   |   7 ++++++-
 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 +++--
 8 files changed, 54 insertions(+), 19 deletions(-)

diffs (195 lines):

diff -r 70aaf0269de7 -r 8b573e093b28 doc/3RDPARTY
--- a/doc/3RDPARTY      Sat Aug 25 11:29:52 2018 +0000
+++ b/doc/3RDPARTY      Sat Aug 25 11:38:19 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: 3RDPARTY,v 1.1444.2.16 2018/08/11 14:54:49 martin Exp $
+#      $NetBSD: 3RDPARTY,v 1.1444.2.17 2018/08/25 11:38:19 martin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -334,8 +334,8 @@
 Use the dhcp2netbsd script.
 
 Package:       dhcpcd
-Version:       7.0.7
-Current Vers:  7.0.7
+Version:       7.0.8
+Current Vers:  7.0.8
 Maintainer:    roy
 Archive Site:  ftp://roy.marples.name/pub/dhcpcd/
 Home Page:     http://roy.marples.name/projects/dhcpcd/
diff -r 70aaf0269de7 -r 8b573e093b28 external/bsd/dhcpcd/dist/src/defs.h
--- a/external/bsd/dhcpcd/dist/src/defs.h       Sat Aug 25 11:29:52 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/defs.h       Sat Aug 25 11:38:19 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 70aaf0269de7 -r 8b573e093b28 external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c       Sat Aug 25 11:29:52 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c       Sat Aug 25 11:38:19 2018 +0000
@@ -86,6 +86,11 @@
 #define IPDEFTTL 64 /* RFC1340 */
 #endif
 
+/* NetBSD-7 has an incomplete IP_PKTINFO implementation. */
+#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 800000000
+#undef IP_PKTINFO
+#endif
+
 /* Assert the correct structure size for on wire */
 __CTASSERT(sizeof(struct ip)           == 20);
 __CTASSERT(sizeof(struct udphdr)       == 8);
@@ -3267,7 +3272,7 @@
        struct bootp_pkt *p;
 
        p = (struct bootp_pkt *)udp;
-       *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp);
+       *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp);
        return (char *)udp + offsetof(struct bootp_pkt, bootp);
 }
 
diff -r 70aaf0269de7 -r 8b573e093b28 external/bsd/dhcpcd/dist/src/dhcp6.c
--- a/external/bsd/dhcpcd/dist/src/dhcp6.c      Sat Aug 25 11:29:52 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp6.c      Sat Aug 25 11:38:19 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 70aaf0269de7 -r 8b573e093b28 external/bsd/dhcpcd/dist/src/if-bsd.c
--- a/external/bsd/dhcpcd/dist/src/if-bsd.c     Sat Aug 25 11:29:52 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-bsd.c     Sat Aug 25 11:38:19 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 70aaf0269de7 -r 8b573e093b28 external/bsd/dhcpcd/dist/src/if.c
--- a/external/bsd/dhcpcd/dist/src/if.c Sat Aug 25 11:29:52 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/if.c Sat Aug 25 11:38:19 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 70aaf0269de7 -r 8b573e093b28 external/bsd/dhcpcd/dist/src/ipv4.c
--- a/external/bsd/dhcpcd/dist/src/ipv4.c       Sat Aug 25 11:29:52 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv4.c       Sat Aug 25 11:38:19 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 70aaf0269de7 -r 8b573e093b28 external/bsd/dhcpcd/dist/src/ipv6.c
--- a/external/bsd/dhcpcd/dist/src/ipv6.c       Sat Aug 25 11:29:52 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/ipv6.c       Sat Aug 25 11:38:19 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