Sat Aug 25 11:38:19 2018 UTC ()
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.


(martin)
diff -r1.1444.2.16 -r1.1444.2.17 src/doc/3RDPARTY
diff -r1.1.1.4.2.5 -r1.1.1.4.2.6 src/external/bsd/dhcpcd/dist/src/defs.h
diff -r1.1.1.3.8.4 -r1.1.1.3.8.5 src/external/bsd/dhcpcd/dist/src/dhcp.c
diff -r1.1.1.4.2.3 -r1.1.1.4.2.4 src/external/bsd/dhcpcd/dist/src/dhcp6.c
diff -r1.1.1.3.2.3 -r1.1.1.3.2.4 src/external/bsd/dhcpcd/dist/src/if-bsd.c
diff -r1.1.1.3.2.2 -r1.1.1.3.2.3 src/external/bsd/dhcpcd/dist/src/if.c
diff -r1.1.1.3.2.2 -r1.1.1.3.2.3 src/external/bsd/dhcpcd/dist/src/ipv4.c
diff -r1.1.1.3.2.4 -r1.1.1.3.2.5 src/external/bsd/dhcpcd/dist/src/ipv6.c

cvs diff -r1.1444.2.16 -r1.1444.2.17 src/doc/3RDPARTY (expand / switch to unified diff)

--- src/doc/3RDPARTY 2018/08/11 14:54:49 1.1444.2.16
+++ src/doc/3RDPARTY 2018/08/25 11:38:19 1.1444.2.17
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: 3RDPARTY,v 1.1444.2.16 2018/08/11 14:54:49 martin Exp $ 1# $NetBSD: 3RDPARTY,v 1.1444.2.17 2018/08/25 11:38:19 martin Exp $
2# 2#
3# This file contains a list of the software that has been integrated into 3# This file contains a list of the software that has been integrated into
4# NetBSD where we are not the primary maintainer. 4# NetBSD where we are not the primary maintainer.
5# 5#
6# When you make changes to this software, be sure to discuss it with the 6# When you make changes to this software, be sure to discuss it with the
7# maintainer and contribute your patches. Divergence from the official 7# maintainer and contribute your patches. Divergence from the official
8# sources is not desirable, and should be avoided as much as possible. 8# sources is not desirable, and should be avoided as much as possible.
9# 9#
10# When importing, please deal with the RCS IDs in this way: 10# When importing, please deal with the RCS IDs in this way:
11# 1. Preserve the RCS IDs in the files by removing the $ signs from 11# 1. Preserve the RCS IDs in the files by removing the $ signs from
12# the IDs before you do the import. 12# the IDs before you do the import.
13# 2. After the import, add NetBSD RCS IDs to all of the files. 13# 2. After the import, add NetBSD RCS IDs to all of the files.
14# 14#
@@ -324,28 +324,28 @@ Maintainer: mellon @@ -324,28 +324,28 @@ Maintainer: mellon
324Archive Site: ftp://ftp.isc.org/isc/dhcp/ 324Archive Site: ftp://ftp.isc.org/isc/dhcp/
325Home Page: http://www.isc.org/software/dhcp/ 325Home Page: http://www.isc.org/software/dhcp/
326Mailing List: dhcp-server@isc.org 326Mailing List: dhcp-server@isc.org
327Mailing List: dhcp-client@isc.org 327Mailing List: dhcp-client@isc.org
328Mailing List: dhcp-announce@isc.org 328Mailing List: dhcp-announce@isc.org
329Mailing List: dhcp-bugs@isc.org 329Mailing List: dhcp-bugs@isc.org
330Responsible: mellon 330Responsible: mellon
331License: BSD (3-clause) 331License: BSD (3-clause)
332Location: external/bsd/dhcp 332Location: external/bsd/dhcp
333Notes: 333Notes:
334Use the dhcp2netbsd script. 334Use the dhcp2netbsd script.
335 335
336Package: dhcpcd 336Package: dhcpcd
337Version: 7.0.7 337Version: 7.0.8
338Current Vers: 7.0.7 338Current Vers: 7.0.8
339Maintainer: roy 339Maintainer: roy
340Archive Site: ftp://roy.marples.name/pub/dhcpcd/ 340Archive Site: ftp://roy.marples.name/pub/dhcpcd/
341Home Page: http://roy.marples.name/projects/dhcpcd/ 341Home Page: http://roy.marples.name/projects/dhcpcd/
342Mailing List: dhcpcd-discuss@marples.name 342Mailing List: dhcpcd-discuss@marples.name
343License: BSD (2-clause) 343License: BSD (2-clause)
344Location: external/bsd/dhcpcd/dist 344Location: external/bsd/dhcpcd/dist
345Notes: 345Notes:
346Please submit all changes to the author. 346Please submit all changes to the author.
347 347
348Package: drm 348Package: drm
349Version: Linux 3.15 349Version: Linux 3.15
350Current Vers: ? 350Current Vers: ?
351Maintainer: Intel, AMD, Linux kernel developers 351Maintainer: Intel, AMD, Linux kernel developers

cvs diff -r1.1.1.4.2.5 -r1.1.1.4.2.6 src/external/bsd/dhcpcd/dist/src/defs.h (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/src/defs.h 2018/07/27 10:22:52 1.1.1.4.2.5
+++ src/external/bsd/dhcpcd/dist/src/defs.h 2018/08/25 11:38:19 1.1.1.4.2.6
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE. 24 * SUCH DAMAGE.
25 */ 25 */
26 26
27#ifndef CONFIG_H 27#ifndef CONFIG_H
28#define CONFIG_H 28#define CONFIG_H
29 29
30#define PACKAGE "dhcpcd" 30#define PACKAGE "dhcpcd"
31#define VERSION "7.0.7" 31#define VERSION "7.0.8"
32 32
33#ifndef CONFIG 33#ifndef CONFIG
34# define CONFIG SYSCONFDIR "/" PACKAGE ".conf" 34# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
35#endif 35#endif
36#ifndef SCRIPT 36#ifndef SCRIPT
37# define SCRIPT LIBEXECDIR "/" PACKAGE "-run-hooks" 37# define SCRIPT LIBEXECDIR "/" PACKAGE "-run-hooks"
38#endif 38#endif
39#ifndef DEVDIR 39#ifndef DEVDIR
40# define DEVDIR LIBDIR "/" PACKAGE "/dev" 40# define DEVDIR LIBDIR "/" PACKAGE "/dev"
41#endif 41#endif
42#ifndef DUID 42#ifndef DUID
43# define DUID DBDIR "/duid" 43# define DUID DBDIR "/duid"
44#endif 44#endif

cvs diff -r1.1.1.3.8.4 -r1.1.1.3.8.5 src/external/bsd/dhcpcd/dist/src/dhcp.c (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/src/dhcp.c 2018/06/07 18:34:03 1.1.1.3.8.4
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c 2018/08/25 11:38:19 1.1.1.3.8.5
@@ -76,26 +76,31 @@ @@ -76,26 +76,31 @@
76 76
77/* We should define a maximum for the NAK exponential backoff */ 77/* We should define a maximum for the NAK exponential backoff */
78#define NAKOFF_MAX 60 78#define NAKOFF_MAX 60
79 79
80/* Wait N nanoseconds between sending a RELEASE and dropping the address. 80/* Wait N nanoseconds between sending a RELEASE and dropping the address.
81 * This gives the kernel enough time to actually send it. */ 81 * This gives the kernel enough time to actually send it. */
82#define RELEASE_DELAY_S 0 82#define RELEASE_DELAY_S 0
83#define RELEASE_DELAY_NS 10000000 83#define RELEASE_DELAY_NS 10000000
84 84
85#ifndef IPDEFTTL 85#ifndef IPDEFTTL
86#define IPDEFTTL 64 /* RFC1340 */ 86#define IPDEFTTL 64 /* RFC1340 */
87#endif 87#endif
88 88
 89/* NetBSD-7 has an incomplete IP_PKTINFO implementation. */
 90#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 800000000
 91#undef IP_PKTINFO
 92#endif
 93
89/* Assert the correct structure size for on wire */ 94/* Assert the correct structure size for on wire */
90__CTASSERT(sizeof(struct ip) == 20); 95__CTASSERT(sizeof(struct ip) == 20);
91__CTASSERT(sizeof(struct udphdr) == 8); 96__CTASSERT(sizeof(struct udphdr) == 8);
92__CTASSERT(sizeof(struct bootp) == 300); 97__CTASSERT(sizeof(struct bootp) == 300);
93 98
94struct dhcp_op { 99struct dhcp_op {
95 uint8_t value; 100 uint8_t value;
96 const char *name; 101 const char *name;
97}; 102};
98 103
99static const struct dhcp_op dhcp_ops[] = { 104static const struct dhcp_op dhcp_ops[] = {
100 { DHCP_DISCOVER, "DISCOVER" }, 105 { DHCP_DISCOVER, "DISCOVER" },
101 { DHCP_OFFER, "OFFER" }, 106 { DHCP_OFFER, "OFFER" },
@@ -3257,27 +3262,27 @@ rapidcommit: @@ -3257,27 +3262,27 @@ rapidcommit:
3257#ifdef ARP 3262#ifdef ARP
3258 dhcp_arp_bind(ifp); 3263 dhcp_arp_bind(ifp);
3259#else 3264#else
3260 dhcp_bind(ifp); 3265 dhcp_bind(ifp);
3261#endif 3266#endif
3262} 3267}
3263 3268
3264static void * 3269static void *
3265get_udp_data(void *udp, size_t *len) 3270get_udp_data(void *udp, size_t *len)
3266{ 3271{
3267 struct bootp_pkt *p; 3272 struct bootp_pkt *p;
3268 3273
3269 p = (struct bootp_pkt *)udp; 3274 p = (struct bootp_pkt *)udp;
3270 *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); 3275 *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp);
3271 return (char *)udp + offsetof(struct bootp_pkt, bootp); 3276 return (char *)udp + offsetof(struct bootp_pkt, bootp);
3272} 3277}
3273 3278
3274static int 3279static int
3275valid_udp_packet(void *data, size_t data_len, struct in_addr *from, 3280valid_udp_packet(void *data, size_t data_len, struct in_addr *from,
3276 int noudpcsum) 3281 int noudpcsum)
3277{ 3282{
3278 struct bootp_pkt *p; 3283 struct bootp_pkt *p;
3279 uint16_t bytes; 3284 uint16_t bytes;
3280 3285
3281 if (data_len < sizeof(p->ip)) { 3286 if (data_len < sizeof(p->ip)) {
3282 if (from) 3287 if (from)
3283 from->s_addr = INADDR_ANY; 3288 from->s_addr = INADDR_ANY;

cvs diff -r1.1.1.4.2.3 -r1.1.1.4.2.4 src/external/bsd/dhcpcd/dist/src/dhcp6.c (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/src/dhcp6.c 2018/06/07 18:34:03 1.1.1.4.2.3
+++ src/external/bsd/dhcpcd/dist/src/dhcp6.c 2018/08/25 11:38:19 1.1.1.4.2.4
@@ -767,27 +767,26 @@ dhcp6_makemessage(struct interface *ifp) @@ -767,27 +767,26 @@ dhcp6_makemessage(struct interface *ifp)
767#ifndef SMALL 767#ifndef SMALL
768 len += sizeof(o) + sizeof(struct dhcp6_pd_addr); 768 len += sizeof(o) + sizeof(struct dhcp6_pd_addr);
769 if (ap->prefix_exclude_len) 769 if (ap->prefix_exclude_len)
770 len += sizeof(o) + 1 + 770 len += sizeof(o) + 1 +
771 (uint8_t)((ap->prefix_exclude_len - 771 (uint8_t)((ap->prefix_exclude_len -
772 ap->prefix_len - 1) / NBBY) + 1; 772 ap->prefix_len - 1) / NBBY) + 1;
773#endif 773#endif
774 } else 774 } else
775 len += sizeof(o) + sizeof(struct dhcp6_ia_addr); 775 len += sizeof(o) + sizeof(struct dhcp6_ia_addr);
776 } 776 }
777 /* FALLTHROUGH */ 777 /* FALLTHROUGH */
778 case DH6S_INIT: 778 case DH6S_INIT:
779 for (l = 0; l < ifo->ia_len; l++) { 779 for (l = 0; l < ifo->ia_len; l++) {
780 ifia = &ifo->ia[l]; 
781 len += sizeof(o) + sizeof(uint32_t); /* IAID */ 780 len += sizeof(o) + sizeof(uint32_t); /* IAID */
782 /* IA_TA does not have T1 or T2 timers */ 781 /* IA_TA does not have T1 or T2 timers */
783 if (ifo->ia[l].ia_type != D6_OPTION_IA_TA) 782 if (ifo->ia[l].ia_type != D6_OPTION_IA_TA)
784 len += sizeof(uint32_t) + sizeof(uint32_t); 783 len += sizeof(uint32_t) + sizeof(uint32_t);
785 } 784 }
786 IA = 1; 785 IA = 1;
787 break; 786 break;
788 default: 787 default:
789 IA = 0; 788 IA = 0;
790 } 789 }
791 790
792 if (state->state == DH6S_DISCOVER && 791 if (state->state == DH6S_DISCOVER &&
793 !(ifp->ctx->options & DHCPCD_TEST) && 792 !(ifp->ctx->options & DHCPCD_TEST) &&

cvs diff -r1.1.1.3.2.3 -r1.1.1.3.2.4 src/external/bsd/dhcpcd/dist/src/if-bsd.c (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/src/if-bsd.c 2018/06/07 18:34:03 1.1.1.3.2.3
+++ src/external/bsd/dhcpcd/dist/src/if-bsd.c 2018/08/25 11:38:19 1.1.1.3.2.4
@@ -1093,29 +1093,52 @@ if_ifa(struct dhcpcd_ctx *ctx, const str @@ -1093,29 +1093,52 @@ if_ifa(struct dhcpcd_ctx *ctx, const str
1093#ifdef INET 1093#ifdef INET
1094 case AF_INET: 1094 case AF_INET:
1095 case 255: /* FIXME: Why 255? */ 1095 case 255: /* FIXME: Why 255? */
1096 { 1096 {
1097 const struct sockaddr_in *sin; 1097 const struct sockaddr_in *sin;
1098 struct in_addr addr, mask, bcast; 1098 struct in_addr addr, mask, bcast;
1099 1099
1100 sin = (const void *)rti_info[RTAX_IFA]; 1100 sin = (const void *)rti_info[RTAX_IFA];
1101 addr.s_addr = sin != NULL && sin->sin_family == AF_INET ? 1101 addr.s_addr = sin != NULL && sin->sin_family == AF_INET ?
1102 sin->sin_addr.s_addr : INADDR_ANY; 1102 sin->sin_addr.s_addr : INADDR_ANY;
1103 sin = (const void *)rti_info[RTAX_NETMASK]; 1103 sin = (const void *)rti_info[RTAX_NETMASK];
1104 mask.s_addr = sin != NULL && sin->sin_family == AF_INET ? 1104 mask.s_addr = sin != NULL && sin->sin_family == AF_INET ?
1105 sin->sin_addr.s_addr : INADDR_ANY; 1105 sin->sin_addr.s_addr : INADDR_ANY;
 1106
 1107#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 800000000
 1108 /* NetBSD-7 and older send an invalid broadcast address.
 1109 * So we need to query the actual address to get
 1110 * the right one. */
 1111 {
 1112 struct in_aliasreq ifra;
 1113
 1114 memset(&ifra, 0, sizeof(ifra));
 1115 strlcpy(ifra.ifra_name, ifp->name,
 1116 sizeof(ifra.ifra_name));
 1117 ifra.ifra_addr.sin_family = AF_INET;
 1118 ifra.ifra_addr.sin_len = sizeof(ifra.ifra_addr);
 1119 ifra.ifra_addr.sin_addr = addr;
 1120 if (ioctl(ctx->pf_inet_fd, SIOCGIFALIAS, &ifra) == -1) {
 1121 if (errno != EADDRNOTAVAIL)
 1122 logerr("%s: SIOCGIFALIAS", __func__);
 1123 break;
 1124 }
 1125 bcast = ifra.ifra_broadaddr.sin_addr;
 1126 }
 1127#else
1106 sin = (const void *)rti_info[RTAX_BRD]; 1128 sin = (const void *)rti_info[RTAX_BRD];
1107 bcast.s_addr = sin != NULL && sin->sin_family == AF_INET ? 1129 bcast.s_addr = sin != NULL && sin->sin_family == AF_INET ?
1108 sin->sin_addr.s_addr : INADDR_ANY; 1130 sin->sin_addr.s_addr : INADDR_ANY;
 1131#endif
1109 1132
1110#if defined(__FreeBSD__) || defined(__DragonFly__) 1133#if defined(__FreeBSD__) || defined(__DragonFly__)
1111 /* FreeBSD sends RTM_DELADDR for each assigned address 1134 /* FreeBSD sends RTM_DELADDR for each assigned address
1112 * to an interface just brought down. 1135 * to an interface just brought down.
1113 * This is wrong, because the address still exists. 1136 * This is wrong, because the address still exists.
1114 * So we need to ignore it. 1137 * So we need to ignore it.
1115 * Oddly enough this only happens for INET addresses. */ 1138 * Oddly enough this only happens for INET addresses. */
1116 if (ifam->ifam_type == RTM_DELADDR) { 1139 if (ifam->ifam_type == RTM_DELADDR) {
1117 struct ifreq ifr; 1140 struct ifreq ifr;
1118 struct sockaddr_in *ifr_sin; 1141 struct sockaddr_in *ifr_sin;
1119 1142
1120 memset(&ifr, 0, sizeof(ifr)); 1143 memset(&ifr, 0, sizeof(ifr));
1121 strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); 1144 strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
@@ -1124,53 +1147,54 @@ if_ifa(struct dhcpcd_ctx *ctx, const str @@ -1124,53 +1147,54 @@ if_ifa(struct dhcpcd_ctx *ctx, const str
1124 ifr_sin->sin_addr = addr; 1147 ifr_sin->sin_addr = addr;
1125 if (ioctl(ctx->pf_inet_fd, SIOCGIFADDR, &ifr) == 0) { 1148 if (ioctl(ctx->pf_inet_fd, SIOCGIFADDR, &ifr) == 0) {
1126 logwarnx("%s: ignored false RTM_DELADDR for %s", 1149 logwarnx("%s: ignored false RTM_DELADDR for %s",
1127 ifp->name, inet_ntoa(addr)); 1150 ifp->name, inet_ntoa(addr));
1128 break; 1151 break;
1129 } 1152 }
1130 } 1153 }
1131#endif 1154#endif
1132 1155
1133#ifndef HAVE_IFAM_ADDRFLAGS 1156#ifndef HAVE_IFAM_ADDRFLAGS
1134 if (ifam->ifam_type == RTM_DELADDR) 1157 if (ifam->ifam_type == RTM_DELADDR)
1135 addrflags = 0 ; 1158 addrflags = 0 ;
1136 else if ((addrflags = if_addrflags(ifp, &addr, NULL)) == -1) { 1159 else if ((addrflags = if_addrflags(ifp, &addr, NULL)) == -1) {
1137 logerr("%s: if_addrflags: %s", 1160 if (errno != EADDRNOTAVAIL)
1138 ifp->name, inet_ntoa(addr)); 1161 logerr("%s: if_addrflags", __func__);
1139 break; 1162 break;
1140 } 1163 }
1141#endif 1164#endif
1142 1165
1143 ipv4_handleifa(ctx, ifam->ifam_type, NULL, ifp->name, 1166 ipv4_handleifa(ctx, ifam->ifam_type, NULL, ifp->name,
1144 &addr, &mask, &bcast, addrflags, pid); 1167 &addr, &mask, &bcast, addrflags, pid);
1145 break; 1168 break;
1146 } 1169 }
1147#endif 1170#endif
1148#ifdef INET6 1171#ifdef INET6
1149 case AF_INET6: 1172 case AF_INET6:
1150 { 1173 {
1151 struct in6_addr addr6, mask6; 1174 struct in6_addr addr6, mask6;
1152 const struct sockaddr_in6 *sin6; 1175 const struct sockaddr_in6 *sin6;
1153 1176
1154 sin6 = (const void *)rti_info[RTAX_IFA]; 1177 sin6 = (const void *)rti_info[RTAX_IFA];
1155 addr6 = sin6->sin6_addr; 1178 addr6 = sin6->sin6_addr;
1156 sin6 = (const void *)rti_info[RTAX_NETMASK]; 1179 sin6 = (const void *)rti_info[RTAX_NETMASK];
1157 mask6 = sin6->sin6_addr; 1180 mask6 = sin6->sin6_addr;
1158 1181
1159#ifndef HAVE_IFAM_ADDRFLAGS 1182#ifndef HAVE_IFAM_ADDRFLAGS
1160 if (ifam->ifam_type == RTM_DELADDR) 1183 if (ifam->ifam_type == RTM_DELADDR)
1161 addrflags = 0; 1184 addrflags = 0;
1162 else if ((addrflags = if_addrflags6(ifp, &addr6, NULL)) == -1) { 1185 else if ((addrflags = if_addrflags6(ifp, &addr6, NULL)) == -1) {
1163 logerr("%s: if_addrflags6", ifp->name); 1186 if (errno != EADDRNOTAVAIL)
 1187 logerr("%s: if_addrflags6", __func__);
1164 break; 1188 break;
1165 } 1189 }
1166#endif 1190#endif
1167 1191
1168#ifdef __KAME__ 1192#ifdef __KAME__
1169 if (IN6_IS_ADDR_LINKLOCAL(&addr6)) 1193 if (IN6_IS_ADDR_LINKLOCAL(&addr6))
1170 /* Remove the scope from the address */ 1194 /* Remove the scope from the address */
1171 addr6.s6_addr[2] = addr6.s6_addr[3] = '\0'; 1195 addr6.s6_addr[2] = addr6.s6_addr[3] = '\0';
1172#endif 1196#endif
1173 1197
1174 ipv6_handleifa(ctx, ifam->ifam_type, NULL, 1198 ipv6_handleifa(ctx, ifam->ifam_type, NULL,
1175 ifp->name, &addr6, ipv6_prefixlen(&mask6), addrflags, pid); 1199 ifp->name, &addr6, ipv6_prefixlen(&mask6), addrflags, pid);
1176 break; 1200 break;

cvs diff -r1.1.1.3.2.2 -r1.1.1.3.2.3 src/external/bsd/dhcpcd/dist/src/if.c (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/src/if.c 2018/04/09 16:46:34 1.1.1.3.2.2
+++ src/external/bsd/dhcpcd/dist/src/if.c 2018/08/25 11:38:19 1.1.1.3.2.3
@@ -230,53 +230,51 @@ if_learnaddrs(struct dhcpcd_ctx *ctx, st @@ -230,53 +230,51 @@ if_learnaddrs(struct dhcpcd_ctx *ctx, st
230 switch(ifa->ifa_addr->sa_family) { 230 switch(ifa->ifa_addr->sa_family) {
231#ifdef INET 231#ifdef INET
232 case AF_INET: 232 case AF_INET:
233 addr = (void *)ifa->ifa_addr; 233 addr = (void *)ifa->ifa_addr;
234 net = (void *)ifa->ifa_netmask; 234 net = (void *)ifa->ifa_netmask;
235 if (ifa->ifa_flags & IFF_POINTOPOINT) 235 if (ifa->ifa_flags & IFF_POINTOPOINT)
236 brd = (void *)ifa->ifa_dstaddr; 236 brd = (void *)ifa->ifa_dstaddr;
237 else 237 else
238 brd = (void *)ifa->ifa_broadaddr; 238 brd = (void *)ifa->ifa_broadaddr;
239#ifndef HAVE_IFADDRS_ADDRFLAGS 239#ifndef HAVE_IFADDRS_ADDRFLAGS
240 addrflags = if_addrflags(ifp, &addr->sin_addr, 240 addrflags = if_addrflags(ifp, &addr->sin_addr,
241 ifa->ifa_name); 241 ifa->ifa_name);
242 if (addrflags == -1) { 242 if (addrflags == -1) {
243 if (errno != EEXIST) 243 if (errno != EEXIST && errno != EADDRNOTAVAIL)
244 logerr("%s: if_addrflags: %s", 244 logerr("%s: if_addrflags", __func__);
245 __func__, 
246 inet_ntoa(addr->sin_addr)); 
247 continue; 245 continue;
248 } 246 }
249#endif 247#endif
250 ipv4_handleifa(ctx, RTM_NEWADDR, ifs, ifa->ifa_name, 248 ipv4_handleifa(ctx, RTM_NEWADDR, ifs, ifa->ifa_name,
251 &addr->sin_addr, &net->sin_addr, 249 &addr->sin_addr, &net->sin_addr,
252 brd ? &brd->sin_addr : NULL, addrflags, 0); 250 brd ? &brd->sin_addr : NULL, addrflags, 0);
253 break; 251 break;
254#endif 252#endif
255#ifdef INET6 253#ifdef INET6
256 case AF_INET6: 254 case AF_INET6:
257 sin6 = (void *)ifa->ifa_addr; 255 sin6 = (void *)ifa->ifa_addr;
258 net6 = (void *)ifa->ifa_netmask; 256 net6 = (void *)ifa->ifa_netmask;
259#ifdef __KAME__ 257#ifdef __KAME__
260 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) 258 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
261 /* Remove the scope from the address */ 259 /* Remove the scope from the address */
262 sin6->sin6_addr.s6_addr[2] = 260 sin6->sin6_addr.s6_addr[2] =
263 sin6->sin6_addr.s6_addr[3] = '\0'; 261 sin6->sin6_addr.s6_addr[3] = '\0';
264#endif 262#endif
265#ifndef HAVE_IFADDRS_ADDRFLAGS 263#ifndef HAVE_IFADDRS_ADDRFLAGS
266 addrflags = if_addrflags6(ifp, &sin6->sin6_addr, 264 addrflags = if_addrflags6(ifp, &sin6->sin6_addr,
267 ifa->ifa_name); 265 ifa->ifa_name);
268 if (addrflags == -1) { 266 if (addrflags == -1) {
269 if (errno != EEXIST) 267 if (errno != EEXIST && errno != EADDRNOTAVAIL)
270 logerr("%s: if_addrflags6", __func__); 268 logerr("%s: if_addrflags6", __func__);
271 continue; 269 continue;
272 } 270 }
273#endif 271#endif
274 ipv6_handleifa(ctx, RTM_NEWADDR, ifs, 272 ipv6_handleifa(ctx, RTM_NEWADDR, ifs,
275 ifa->ifa_name, &sin6->sin6_addr, 273 ifa->ifa_name, &sin6->sin6_addr,
276 ipv6_prefixlen(&net6->sin6_addr), addrflags, 0); 274 ipv6_prefixlen(&net6->sin6_addr), addrflags, 0);
277 break; 275 break;
278#endif 276#endif
279 } 277 }
280 } 278 }
281 279
282 freeifaddrs(*ifaddrs); 280 freeifaddrs(*ifaddrs);

cvs diff -r1.1.1.3.2.2 -r1.1.1.3.2.3 src/external/bsd/dhcpcd/dist/src/ipv4.c (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/src/ipv4.c 2018/04/09 16:46:34 1.1.1.3.2.2
+++ src/external/bsd/dhcpcd/dist/src/ipv4.c 2018/08/25 11:38:19 1.1.1.3.2.3
@@ -806,29 +806,37 @@ ipv4_deletestaleaddrs(struct interface * @@ -806,29 +806,37 @@ ipv4_deletestaleaddrs(struct interface *
806 806
807void 807void
808ipv4_handleifa(struct dhcpcd_ctx *ctx, 808ipv4_handleifa(struct dhcpcd_ctx *ctx,
809 int cmd, struct if_head *ifs, const char *ifname, 809 int cmd, struct if_head *ifs, const char *ifname,
810 const struct in_addr *addr, const struct in_addr *mask, 810 const struct in_addr *addr, const struct in_addr *mask,
811 const struct in_addr *brd, int addrflags, pid_t pid) 811 const struct in_addr *brd, int addrflags, pid_t pid)
812{ 812{
813 struct interface *ifp; 813 struct interface *ifp;
814 struct ipv4_state *state; 814 struct ipv4_state *state;
815 struct ipv4_addr *ia; 815 struct ipv4_addr *ia;
816 bool ia_is_new; 816 bool ia_is_new;
817 817
818#if 0 818#if 0
819 logdebugx("%s: %s %s/%d %d", ifname, 819 char sbrdbuf[INET_ADDRSTRLEN];
820 cmd == RTM_NEWADDR ? "RTM_NEWADDR" : cmd == RTM_DELADDR ? "RTM_DELADDR" : "???", 820 const char *sbrd;
821 inet_ntoa(*addr), inet_ntocidr(*mask), addrflags); 821
 822 if (brd)
 823 sbrd = inet_ntop(AF_INET, brd, sbrdbuf, sizeof(sbrdbuf));
 824 else
 825 sbrd = NULL;
 826 logdebugx("%s: %s %s/%d %s %d", ifname,
 827 cmd == RTM_NEWADDR ? "RTM_NEWADDR" :
 828 cmd == RTM_DELADDR ? "RTM_DELADDR" : "???",
 829 inet_ntoa(*addr), inet_ntocidr(*mask), sbrd, addrflags);
822#endif 830#endif
823 831
824 if (ifs == NULL) 832 if (ifs == NULL)
825 ifs = ctx->ifaces; 833 ifs = ctx->ifaces;
826 if (ifs == NULL) { 834 if (ifs == NULL) {
827 errno = ESRCH; 835 errno = ESRCH;
828 return; 836 return;
829 } 837 }
830 if ((ifp = if_find(ifs, ifname)) == NULL) 838 if ((ifp = if_find(ifs, ifname)) == NULL)
831 return; 839 return;
832 if ((state = ipv4_getstate(ifp)) == NULL) { 840 if ((state = ipv4_getstate(ifp)) == NULL) {
833 errno = ENOENT; 841 errno = ENOENT;
834 return; 842 return;

cvs diff -r1.1.1.3.2.4 -r1.1.1.3.2.5 src/external/bsd/dhcpcd/dist/src/ipv6.c (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/src/ipv6.c 2018/07/27 10:22:52 1.1.1.3.2.4
+++ src/external/bsd/dhcpcd/dist/src/ipv6.c 2018/08/25 11:38:19 1.1.1.3.2.5
@@ -420,27 +420,27 @@ ipv6_mask(struct in6_addr *mask, int len @@ -420,27 +420,27 @@ ipv6_mask(struct in6_addr *mask, int len
420 { 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff }; 420 { 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
421 int bytes, bits, i; 421 int bytes, bits, i;
422 422
423 if (len < 0 || len > 128) { 423 if (len < 0 || len > 128) {
424 errno = EINVAL; 424 errno = EINVAL;
425 return -1; 425 return -1;
426 } 426 }
427 427
428 memset(mask, 0, sizeof(*mask)); 428 memset(mask, 0, sizeof(*mask));
429 bytes = len / NBBY; 429 bytes = len / NBBY;
430 bits = len % NBBY; 430 bits = len % NBBY;
431 for (i = 0; i < bytes; i++) 431 for (i = 0; i < bytes; i++)
432 mask->s6_addr[i] = 0xff; 432 mask->s6_addr[i] = 0xff;
433 if (bits) { 433 if (bits != 0) {
434 /* Coverify false positive. 434 /* Coverify false positive.
435 * bytelen cannot be 16 if bitlen is non zero */ 435 * bytelen cannot be 16 if bitlen is non zero */
436 /* coverity[overrun-local] */ 436 /* coverity[overrun-local] */
437 mask->s6_addr[bytes] = masks[bits - 1]; 437 mask->s6_addr[bytes] = masks[bits - 1];
438 } 438 }
439 return 0; 439 return 0;
440} 440}
441 441
442uint8_t 442uint8_t
443ipv6_prefixlen(const struct in6_addr *mask) 443ipv6_prefixlen(const struct in6_addr *mask)
444{ 444{
445 int x = 0, y; 445 int x = 0, y;
446 const unsigned char *lim, *p; 446 const unsigned char *lim, *p;
@@ -557,27 +557,28 @@ void @@ -557,27 +557,28 @@ void
557ipv6_checkaddrflags(void *arg) 557ipv6_checkaddrflags(void *arg)
558{ 558{
559 struct ipv6_addr *ia; 559 struct ipv6_addr *ia;
560 int flags; 560 int flags;
561 const char *alias; 561 const char *alias;
562 562
563 ia = arg; 563 ia = arg;
564#ifdef ALIAS_ADDR 564#ifdef ALIAS_ADDR
565 alias = ia->alias; 565 alias = ia->alias;
566#else 566#else
567 alias = NULL; 567 alias = NULL;
568#endif 568#endif
569 if ((flags = if_addrflags6(ia->iface, &ia->addr, alias)) == -1) { 569 if ((flags = if_addrflags6(ia->iface, &ia->addr, alias)) == -1) {
570 logerr("%s: if_addrflags6", ia->iface->name); 570 if (errno != EEXIST && errno != EADDRNOTAVAIL)
 571 logerr("%s: if_addrflags6", __func__);
571 return; 572 return;
572 } 573 }
573 574
574 if (!(flags & IN6_IFF_TENTATIVE)) { 575 if (!(flags & IN6_IFF_TENTATIVE)) {
575 /* Simulate the kernel announcing the new address. */ 576 /* Simulate the kernel announcing the new address. */
576 ipv6_handleifa(ia->iface->ctx, RTM_NEWADDR, 577 ipv6_handleifa(ia->iface->ctx, RTM_NEWADDR,
577 ia->iface->ctx->ifaces, ia->iface->name, 578 ia->iface->ctx->ifaces, ia->iface->name,
578 &ia->addr, ia->prefix_len, flags, 0); 579 &ia->addr, ia->prefix_len, flags, 0);
579 } else { 580 } else {
580 /* Still tentative? Check again in a bit. */ 581 /* Still tentative? Check again in a bit. */
581 struct timespec tv; 582 struct timespec tv;
582 583
583 ms_to_ts(&tv, RETRANS_TIMER / 2); 584 ms_to_ts(&tv, RETRANS_TIMER / 2);