Module Name: src Committed By: roy Date: Fri Sep 13 11:01:51 UTC 2019
Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c dhcpcd.c if-bsd.c ipv6.c ipv6.h ipv6nd.c Removed Files: src/external/bsd/dhcpcd/dist: .gitignore BUILDING.md Makefile Makefile.inc config-null.mk configure iconfig.mk src/external/bsd/dhcpcd/dist/compat: _strtoi.h arc4random.c arc4random.h arc4random_uniform.c arc4random_uniform.h bitops.h consttime_memequal.h dprintf.c dprintf.h endian.h pidfile.c pidfile.h queue.h rb.c rbtree.h reallocarray.c reallocarray.h strlcpy.c strlcpy.h strtoi.c strtoi.h strtou.c src/external/bsd/dhcpcd/dist/compat/crypt: hmac.c hmac.h md5.c md5.h sha256.c sha256.h src/external/bsd/dhcpcd/dist/hooks: 50-dhcpcd-compat 50-yp.conf Makefile src/external/bsd/dhcpcd/dist/src: GNUmakefile Makefile dev.c dhcpcd-definitions-small.conf dhcpcd-definitions.conf dhcpcd-embedded.c.in dhcpcd-embedded.h.in genembedc genembedh if-linux-wext.c if-linux.c if-sun.c src/external/bsd/dhcpcd/dist/src/dev: Makefile udev.c src/external/bsd/dhcpcd/dist/tests: Makefile src/external/bsd/dhcpcd/dist/tests/crypt: .gitignore GNUmakefile Makefile README.md run-test.c test.h test_hmac_md5.c src/external/bsd/dhcpcd/dist/tests/eloop-bench: .gitignore Makefile README.md eloop-bench.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.4 -r0 src/external/bsd/dhcpcd/dist/.gitignore cvs rdiff -u -r1.1.1.5 -r0 src/external/bsd/dhcpcd/dist/BUILDING.md cvs rdiff -u -r1.1.1.7 -r0 src/external/bsd/dhcpcd/dist/Makefile cvs rdiff -u -r1.1.1.3 -r0 src/external/bsd/dhcpcd/dist/Makefile.inc cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/dhcpcd/dist/config-null.mk cvs rdiff -u -r1.1.1.15 -r0 src/external/bsd/dhcpcd/dist/configure cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/dhcpcd/dist/iconfig.mk cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/dhcpcd/dist/compat/_strtoi.h \ src/external/bsd/dhcpcd/dist/compat/arc4random.c \ src/external/bsd/dhcpcd/dist/compat/arc4random.h \ src/external/bsd/dhcpcd/dist/compat/arc4random_uniform.c \ src/external/bsd/dhcpcd/dist/compat/arc4random_uniform.h \ src/external/bsd/dhcpcd/dist/compat/bitops.h \ src/external/bsd/dhcpcd/dist/compat/consttime_memequal.h \ src/external/bsd/dhcpcd/dist/compat/endian.h \ src/external/bsd/dhcpcd/dist/compat/pidfile.c \ src/external/bsd/dhcpcd/dist/compat/pidfile.h \ src/external/bsd/dhcpcd/dist/compat/queue.h \ src/external/bsd/dhcpcd/dist/compat/reallocarray.c \ src/external/bsd/dhcpcd/dist/compat/reallocarray.h \ src/external/bsd/dhcpcd/dist/compat/strlcpy.c \ src/external/bsd/dhcpcd/dist/compat/strlcpy.h \ src/external/bsd/dhcpcd/dist/compat/strtoi.c \ src/external/bsd/dhcpcd/dist/compat/strtoi.h \ src/external/bsd/dhcpcd/dist/compat/strtou.c cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/dhcpcd/dist/compat/dprintf.c \ src/external/bsd/dhcpcd/dist/compat/dprintf.h \ src/external/bsd/dhcpcd/dist/compat/rb.c \ src/external/bsd/dhcpcd/dist/compat/rbtree.h cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/dhcpcd/dist/compat/crypt/hmac.c \ src/external/bsd/dhcpcd/dist/compat/crypt/hmac.h \ src/external/bsd/dhcpcd/dist/compat/crypt/md5.c \ src/external/bsd/dhcpcd/dist/compat/crypt/sha256.h cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/dhcpcd/dist/compat/crypt/md5.h \ src/external/bsd/dhcpcd/dist/compat/crypt/sha256.c cvs rdiff -u -r1.1.1.1 -r0 \ src/external/bsd/dhcpcd/dist/hooks/50-dhcpcd-compat cvs rdiff -u -r1.2 -r0 src/external/bsd/dhcpcd/dist/hooks/50-yp.conf cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/dhcpcd/dist/hooks/Makefile cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/dhcpcd/dist/src/GNUmakefile \ src/external/bsd/dhcpcd/dist/src/genembedc \ src/external/bsd/dhcpcd/dist/src/genembedh cvs rdiff -u -r1.1.1.6 -r0 src/external/bsd/dhcpcd/dist/src/Makefile cvs rdiff -u -r1.1.1.5 -r0 src/external/bsd/dhcpcd/dist/src/dev.c cvs rdiff -u -r1.25 -r1.26 src/external/bsd/dhcpcd/dist/src/dhcp.c \ src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.1.1.2 -r0 \ src/external/bsd/dhcpcd/dist/src/dhcpcd-definitions-small.conf \ src/external/bsd/dhcpcd/dist/src/dhcpcd-definitions.conf cvs rdiff -u -r1.1.1.3 -r0 \ src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c.in \ src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h.in cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.1.1.4 -r0 src/external/bsd/dhcpcd/dist/src/if-linux-wext.c cvs rdiff -u -r1.1.1.16 -r0 src/external/bsd/dhcpcd/dist/src/if-linux.c cvs rdiff -u -r1.1.1.11 -r0 src/external/bsd/dhcpcd/dist/src/if-sun.c cvs rdiff -u -r1.4 -r1.5 src/external/bsd/dhcpcd/dist/src/ipv6.c cvs rdiff -u -r1.5 -r1.6 src/external/bsd/dhcpcd/dist/src/ipv6.h cvs rdiff -u -r1.11 -r1.12 src/external/bsd/dhcpcd/dist/src/ipv6nd.c cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/dhcpcd/dist/src/dev/Makefile cvs rdiff -u -r1.1.1.4 -r0 src/external/bsd/dhcpcd/dist/src/dev/udev.c cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/dhcpcd/dist/tests/Makefile cvs rdiff -u -r1.1.1.1 -r0 \ src/external/bsd/dhcpcd/dist/tests/crypt/.gitignore \ src/external/bsd/dhcpcd/dist/tests/crypt/GNUmakefile \ src/external/bsd/dhcpcd/dist/tests/crypt/README.md cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/dhcpcd/dist/tests/crypt/Makefile \ src/external/bsd/dhcpcd/dist/tests/crypt/run-test.c \ src/external/bsd/dhcpcd/dist/tests/crypt/test.h cvs rdiff -u -r1.1.1.3 -r0 \ src/external/bsd/dhcpcd/dist/tests/crypt/test_hmac_md5.c cvs rdiff -u -r1.1.1.1 -r0 \ src/external/bsd/dhcpcd/dist/tests/eloop-bench/.gitignore \ src/external/bsd/dhcpcd/dist/tests/eloop-bench/README.md cvs rdiff -u -r1.1.1.2 -r0 \ src/external/bsd/dhcpcd/dist/tests/eloop-bench/Makefile cvs rdiff -u -r1.1.1.3 -r0 \ src/external/bsd/dhcpcd/dist/tests/eloop-bench/eloop-bench.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/dhcpcd/dist/src/dhcp.c diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.25 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.26 --- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.25 Wed Sep 4 13:28:56 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcp.c Fri Sep 13 11:01:50 2019 @@ -3250,7 +3250,7 @@ valid_udp_packet(void *packet, size_t pl .ip_dst = ip->ip_dst }; size_t ip_hlen; - uint16_t ip_len, uh_sum; + uint16_t ip_len, udp_len, uh_sum; struct udphdr *udp; uint32_t csum; @@ -3276,27 +3276,31 @@ valid_udp_packet(void *packet, size_t pl errno = ERANGE; return -1; } - /* Check we don't go beyond the payload */ + /* Check IP doesn't go beyond the payload */ if (ip_len > plen) { errno = ENOBUFS; return -1; } - if (flags & BPF_PARTIALCSUM) + /* Check UDP doesn't go beyond the payload */ + udp = (struct udphdr *)(void *)((char *)ip + ip_hlen); + udp_len = ntohs(udp->uh_ulen); + if (udp_len > plen - ip_hlen) { + errno = ENOBUFS; + return -1; + } + + if (udp->uh_sum == 0 || flags & BPF_PARTIALCSUM) return 0; /* UDP checksum is based on a pseudo IP header alongside * the UDP header and payload. */ - udp = (struct udphdr *)(void *)((char *)ip + ip_hlen); - if (udp->uh_sum == 0) - return 0; - uh_sum = udp->uh_sum; udp->uh_sum = 0; pseudo_ip.ip_len = udp->uh_ulen; csum = 0; in_cksum(&pseudo_ip, sizeof(pseudo_ip), &csum); - csum = in_cksum(udp, ntohs(udp->uh_ulen), &csum); + csum = in_cksum(udp, udp_len, &csum); if (csum != uh_sum) { errno = EINVAL; return -1; @@ -3338,12 +3342,13 @@ dhcp_handlepacket(struct interface *ifp, const struct dhcp_state *state = D_CSTATE(ifp); if (valid_udp_packet(data, len, &from, state->bpf_flags) == -1) { + const char *errstr; + if (errno == EINVAL) - logerrx("%s: checksum failure from %s", - ifp->name, inet_ntoa(from)); + errstr = "checksum failure"; else - logerr("%s: invalid UDP packet from %s", - ifp->name, inet_ntoa(from)); + errstr = "invalid UDP packet"; + logerrx("%s: %s from %s", errstr, ifp->name, inet_ntoa(from)); return; } Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.25 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.26 --- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.25 Wed Sep 4 13:28:56 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c Fri Sep 13 11:01:50 2019 @@ -590,6 +590,12 @@ configure_interface1(struct interface *i } } #endif + + /* If root is network mounted, we don't want to kill the connection + * if the DHCP server goes the way of the dodo OR dhcpcd is rebooting + * and the lease file has expired. */ + if (is_root_local() == 0) + ifo->options |= DHCPCD_LASTLEASE_EXTEND; } int Index: src/external/bsd/dhcpcd/dist/src/if-bsd.c diff -u src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.12 src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.13 --- src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.12 Wed Sep 4 13:28:56 2019 +++ src/external/bsd/dhcpcd/dist/src/if-bsd.c Fri Sep 13 11:01:50 2019 @@ -653,6 +653,12 @@ if_copyrt(struct dhcpcd_ctx *ctx, struct return -1; } #endif +#ifdef RTF_WASCLONED + if (rtm->rtm_flags & RTF_WASCLONED) { + errno = ENOTSUP; + return -1; + } +#endif #ifdef RTF_LOCAL if (rtm->rtm_flags & RTF_LOCAL) { errno = ENOTSUP; Index: src/external/bsd/dhcpcd/dist/src/ipv6.c diff -u src/external/bsd/dhcpcd/dist/src/ipv6.c:1.4 src/external/bsd/dhcpcd/dist/src/ipv6.c:1.5 --- src/external/bsd/dhcpcd/dist/src/ipv6.c:1.4 Wed Sep 4 13:28:56 2019 +++ src/external/bsd/dhcpcd/dist/src/ipv6.c Fri Sep 13 11:01:50 2019 @@ -1065,28 +1065,31 @@ ipv6_getstate(struct interface *ifp) } struct ipv6_addr * -ipv6_ifanyglobal(struct interface *ifp) +ipv6_anyglobal(struct interface *sifp) { + struct interface *ifp; struct ipv6_state *state; struct ipv6_addr *ia; - if (ifp->carrier == LINK_DOWN) - return NULL; - - state = IPV6_STATE(ifp); - if (state == NULL) - return NULL; + TAILQ_FOREACH(ifp, sifp->ctx->ifaces, next) { + if (ifp != sifp && ip6_forwarding(ifp->name) != 1) + continue; - TAILQ_FOREACH(ia, &state->addrs, next) { - if (IN6_IS_ADDR_LINKLOCAL(&ia->addr)) + state = IPV6_STATE(ifp); + if (state == NULL) continue; - /* Let's be optimistic. - * Any decent OS won't forward or accept traffic - * from/to tentative or detached addresses. */ - if (!(ia->addr_flags & IN6_IFF_DUPLICATED)) - break; + + TAILQ_FOREACH(ia, &state->addrs, next) { + if (IN6_IS_ADDR_LINKLOCAL(&ia->addr)) + continue; + /* Let's be optimistic. + * Any decent OS won't forward or accept traffic + * from/to tentative or detached addresses. */ + if (!(ia->addr_flags & IN6_IFF_DUPLICATED)) + return ia; + } } - return ia; + return NULL; } void @@ -1133,7 +1136,7 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx, return; if ((state = ipv6_getstate(ifp)) == NULL) return; - anyglobal = ipv6_ifanyglobal(ifp) != NULL; + anyglobal = ipv6_anyglobal(ifp) != NULL; TAILQ_FOREACH(ia, &state->addrs, next) { if (IN6_ARE_ADDR_EQUAL(&ia->addr, addr)) @@ -1252,7 +1255,7 @@ out: * call rt_build to add/remove the default route. */ if (ifp->active && ifp->options->options & DHCPCD_IPV6 && !(ctx->options & DHCPCD_RTBUILD) && - (ipv6_ifanyglobal(ifp) != NULL) != anyglobal) + (ipv6_anyglobal(ifp) != NULL) != anyglobal) rt_build(ctx, AF_INET6); } @@ -2335,7 +2338,7 @@ inet6_raroutes(rb_tree_t *routes, struct } if (rap->lifetime == 0) continue; - if (ipv6_ifanyglobal(rap->iface) == NULL) + if (ipv6_anyglobal(rap->iface) == NULL) continue; rt = inet6_makerouter(rap); if (rt == NULL) Index: src/external/bsd/dhcpcd/dist/src/ipv6.h diff -u src/external/bsd/dhcpcd/dist/src/ipv6.h:1.5 src/external/bsd/dhcpcd/dist/src/ipv6.h:1.6 --- src/external/bsd/dhcpcd/dist/src/ipv6.h:1.5 Wed Sep 4 13:28:56 2019 +++ src/external/bsd/dhcpcd/dist/src/ipv6.h Fri Sep 13 11:01:50 2019 @@ -273,7 +273,7 @@ int ipv6_handleifa_addrs(int, struct ipv struct ipv6_addr *ipv6_iffindaddr(struct interface *, const struct in6_addr *, int); int ipv6_hasaddr(const struct interface *); -struct ipv6_addr *ipv6_ifanyglobal(struct interface *); +struct ipv6_addr *ipv6_anyglobal(struct interface *); int ipv6_findaddrmatch(const struct ipv6_addr *, const struct in6_addr *, unsigned int); struct ipv6_addr *ipv6_findaddr(struct dhcpcd_ctx *, Index: src/external/bsd/dhcpcd/dist/src/ipv6nd.c diff -u src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.11 src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.12 --- src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.11 Wed Sep 4 13:28:56 2019 +++ src/external/bsd/dhcpcd/dist/src/ipv6nd.c Fri Sep 13 11:01:50 2019 @@ -1290,7 +1290,7 @@ ipv6nd_handlera(struct dhcpcd_ctx *ctx, } } - if (new_data && !has_address && rap->lifetime && !ipv6_ifanyglobal(ifp)) + if (new_data && !has_address && rap->lifetime && !ipv6_anyglobal(ifp)) logwarnx("%s: no global addresses for default route", ifp->name);