CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Thu Oct 19 11:26:52 UTC 2023 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcpcd.c privsep.c script.c Log Message: Sync with dhcpcd-10.0.4 To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.16 -r1.17 src/external/bsd/dhcpcd/dist/src/privsep.c \ src/external/bsd/dhcpcd/dist/src/script.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/dhcpcd.c diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.52 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.53 --- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.52 Fri Oct 6 08:49:42 2023 +++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c Thu Oct 19 11:26:52 2023 @@ -329,6 +329,36 @@ dhcpcd_ipwaited(struct dhcpcd_ctx *ctx) return 1; } +#ifndef THERE_IS_NO_FORK +void +dhcpcd_daemonised(struct dhcpcd_ctx *ctx) +{ + unsigned int logopts = loggetopts(); + + /* + * Stop writing to stderr. + * On the happy path, only the manager process writes to stderr, + * so this just stops wasting fprintf calls to nowhere. + * All other calls - ie errors in privsep processes or script output, + * will error when printing. + * If we *really* want to fix that, then we need to suck + * stderr/stdout in the manager process and either discard it or pass + * it to the launcher process and then to stderr. + */ + logopts &= ~LOGERR_ERR; + logsetopts(logopts); + + /* + * We need to do something with stdout/stderr to avoid SIGPIPE + * We know that stdin is already mapped to /dev/null + */ + dup2(STDIN_FILENO, STDOUT_FILENO); + dup2(STDIN_FILENO, STDERR_FILENO); + + ctx->options |= DHCPCD_DAEMONISED; +} +#endif + /* Returns the pid of the child, otherwise 0. */ void dhcpcd_daemonise(struct dhcpcd_ctx *ctx) @@ -363,6 +393,13 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx) if (!(logopts & LOGERR_QUIET) && ctx->stderr_valid) (void)fprintf(stderr, "forked to background, child pid %d\n", getpid()); + +#ifdef PRIVSEP + ps_daemonised(ctx); +#else + dhcpcd_daemonised(ctx); +#endif + i = EXIT_SUCCESS; if (write(ctx->fork_fd, , sizeof(i)) == -1) logerr("write"); @@ -370,19 +407,6 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx) eloop_event_delete(ctx->eloop, ctx->fork_fd); close(ctx->fork_fd); ctx->fork_fd = -1; - - /* - * Stop writing to stderr. - * On the happy path, only the manager process writes to stderr, - * so this just stops wasting fprintf calls to nowhere. - * All other calls - ie errors in privsep processes or script output, - * will error when printing. - * If we *really* want to fix that, then we need to suck - * stderr/stdout in the manager process and either disacrd it or pass - * it to the launcher process and then to stderr. - */ - logopts &= ~LOGERR_ERR; - logsetopts(logopts); #endif } @@ -1869,6 +1893,22 @@ dhcpcd_pidfile_timeout(void *arg) dhcpcd_pidfile_timeout, ctx); } +static int dup_null(int fd) +{ + int fd_null = open(_PATH_DEVNULL, O_WRONLY); + int err; + + if (fd_null == -1) { + logwarn("open %s", _PATH_DEVNULL); + return -1; + } + + if ((err = dup2(fd_null, fd)) == -1) + logwarn("dup2 %d", fd); + close(fd_null); + return err; +} + int main(int argc, char **argv, char **envp) { @@ -1972,6 +2012,15 @@ main(int argc, char **argv, char **envp) ctx.stdout_valid = fcntl(STDOUT_FILENO, F_GETFD) != -1; ctx.stderr_valid = fcntl(STDERR_FILENO, F_GETFD) != -1; + /* Even we if we don't have input/outputs, we need to + * ensure they are setup for shells. */ + if (!ctx.stdin_valid) + dup_null(STDIN_FILENO); + if (!ctx.stdout_valid) + dup_null(STDOUT_FILENO); + if (!ctx.stderr_valid) + dup_null(STDERR_FILENO); + logopts = LOGERR_LOG | LOGERR_LOG_DATE | LOGERR_LOG_PID; if (ctx.stderr_valid) logopts |= LOGERR_ERR; @@ -2341,8 +2390,10 @@ printpidfile: } loginfox(PACKAGE "-" VERSION " starting"); - if (ctx.stdin_valid && freopen(_PATH_DEVNULL, "w", stdin) == NULL) - logwarn("freopen stdin"); + + // We don't need stdin past this point + if (ctx.stdin_valid) + dup_null(STDIN_FILENO); #if defined(USE_SIGNALS) && !defined(THERE_IS_NO_FORK) if (!(ctx.options & DHCPCD_DAEMONISE)) @@ -2385,10 +2436,9 @@ printpidfile: logerr("dup2"); close(stderr_fd[0]); close(stderr_fd[1]); - } else if (ctx.stdout_valid) { - if (freopen(_PATH_DEVNULL, "w", stdout) == NULL) -logerr("freopen stdout"); - } + } else if (ctx.stdout_valid) + dup_null(STDOUT_FILENO); + if (setsid() == -1) { logerr("%s: setsid", __func__); goto exit_failure; Index: src/external/bsd/dhcpcd/dist/src/privsep.c diff -u src/external/bsd/dhcpcd/dist/src/privsep.c:1.16 src/external/bsd/dhcpcd/dist/src/privsep.c:1.17 --- src/external/bsd/dhcpcd/dist/src/privsep.c:1.16 Fri Oct 6 08:49:42 2023 +++ src/external/bsd/dhcpcd/dist/src/privsep.c Thu Oct 19 11:26:52 2023 @@ -1100,6
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Thu Oct 19 11:26:52 UTC 2023 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcpcd.c privsep.c script.c Log Message: Sync with dhcpcd-10.0.4 To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.16 -r1.17 src/external/bsd/dhcpcd/dist/src/privsep.c \ src/external/bsd/dhcpcd/dist/src/script.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Oct 6 08:49:42 UTC 2023 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c dhcp6.c dhcpcd.c if-options.c ipv6nd.c privsep.c Log Message: sync with dhcpcd-10.0.3 To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.30 -r1.31 src/external/bsd/dhcpcd/dist/src/dhcp6.c cvs rdiff -u -r1.51 -r1.52 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.34 -r1.35 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.29 -r1.30 src/external/bsd/dhcpcd/dist/src/ipv6nd.c cvs rdiff -u -r1.15 -r1.16 src/external/bsd/dhcpcd/dist/src/privsep.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.48 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.49 --- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.48 Wed Jul 19 13:53:03 2023 +++ src/external/bsd/dhcpcd/dist/src/dhcp.c Fri Oct 6 08:49:42 2023 @@ -3314,7 +3314,8 @@ dhcp_handledhcp(struct interface *ifp, s state->reason = "TEST"; script_runreason(ifp, state->reason); eloop_exit(ifp->ctx->eloop, EXIT_SUCCESS); - state->bpf->bpf_flags |= BPF_EOF; + if (state->bpf) +state->bpf->bpf_flags |= BPF_EOF; return; } eloop_timeout_delete(ifp->ctx->eloop, send_discover, ifp); Index: src/external/bsd/dhcpcd/dist/src/dhcp6.c diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.30 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.31 --- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.30 Wed Jul 19 13:53:03 2023 +++ src/external/bsd/dhcpcd/dist/src/dhcp6.c Fri Oct 6 08:49:42 2023 @@ -1022,9 +1022,11 @@ dhcp6_makemessage(struct interface *ifp) n--; while (n-- > 0) *ep++ = *pp--; - if (u8) + n = (size_t)(ep - exb); + if (u8) { *ep = (uint8_t)(*pp << u8); - n++; + n++; + } COPYIN(D6_OPTION_PD_EXCLUDE, exb, (uint16_t)n); ia_na_len = (uint16_t) @@ -1628,6 +1630,7 @@ dhcp6_startdiscover(void *arg) struct interface *ifp; struct dhcp6_state *state; int llevel; + struct ipv6_addr *ia; ifp = arg; state = D6_STATE(ifp); @@ -1652,6 +1655,14 @@ dhcp6_startdiscover(void *arg) state->new = NULL; state->new_len = 0; + /* If we fail to renew or confirm, our requested addreses will + * be marked as stale. + To re-request them, just mark them as not stale. */ + TAILQ_FOREACH(ia, >addrs, next) { + if (ia->flags & IPV6_AF_REQUEST) + ia->flags &= ~IPV6_AF_STALE; + } + if (dhcp6_makemessage(ifp) == -1) logerr("%s: %s", __func__, ifp->name); else @@ -2268,9 +2279,7 @@ dhcp6_findpd(struct interface *ifp, cons } else { if (!(a->flags & IPV6_AF_DELEGATEDPFX)) a->flags |= IPV6_AF_NEW | IPV6_AF_DELEGATEDPFX; - a->flags &= ~(IPV6_AF_STALE | - IPV6_AF_EXTENDED | - IPV6_AF_REQUEST); + a->flags &= ~(IPV6_AF_STALE | IPV6_AF_EXTENDED); if (a->prefix_vltime != pdp.vltime) a->flags |= IPV6_AF_NEW; } Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.51 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.52 --- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.51 Wed Jul 19 13:53:03 2023 +++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c Fri Oct 6 08:49:42 2023 @@ -75,6 +75,9 @@ static const char dhcpcd_copyright[] = " #ifdef HAVE_CAPSICUM #include #endif +#ifdef HAVE_OPENSSL +#include +#endif #ifdef HAVE_UTIL_H #include #endif @@ -1411,6 +1414,7 @@ dhcpcd_renew(struct dhcpcd_ctx *ctx) #ifdef USE_SIGNALS #define sigmsg "received %s, %s" +static volatile bool dhcpcd_exiting = false; void dhcpcd_signal_cb(int sig, void *arg) { @@ -1483,9 +1487,20 @@ dhcpcd_signal_cb(int sig, void *arg) return; } + /* + * Privsep has a mini-eloop for reading data from other processes. + * This mini-eloop processes signals as well so we can reap children. + * During teardown we don't want to process SIGTERM or SIGINT again, + * as that could trigger memory issues. + */ + if (dhcpcd_exiting) + return; + + dhcpcd_exiting = true; if (!(ctx->options & DHCPCD_TEST)) stop_all_interfaces(ctx, opts); eloop_exit(ctx->eloop, exit_code); + dhcpcd_exiting = false; } #endif @@ -1495,7 +1510,7 @@ dhcpcd_handleargs(struct dhcpcd_ctx *ctx { struct interface *ifp; unsigned long long opts; - int opt, oi, do_reboot, do_renew, af = AF_UNSPEC; + int opt, oi, oifind, do_reboot, do_renew, af = AF_UNSPEC; size_t len, l, nifaces; char *tmp, *p; @@ -1511,7 +1526,7 @@ dhcpcd_handleargs(struct dhcpcd_ctx *ctx return control_queue(fd, UNCONST(fd->ctx->cffile), strlen(fd->ctx->cffile) + 1); } else if (strcmp(*argv, "--getinterfaces") == 0) { - optind = argc = 0; + oifind = argc = 0; goto dumplease; } else if (strcmp(*argv, "--listen") == 0) { fd->flags |= FD_LISTEN; @@ -1574,6
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Oct 6 08:49:42 UTC 2023 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c dhcp6.c dhcpcd.c if-options.c ipv6nd.c privsep.c Log Message: sync with dhcpcd-10.0.3 To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.30 -r1.31 src/external/bsd/dhcpcd/dist/src/dhcp6.c cvs rdiff -u -r1.51 -r1.52 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.34 -r1.35 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.29 -r1.30 src/external/bsd/dhcpcd/dist/src/ipv6nd.c cvs rdiff -u -r1.15 -r1.16 src/external/bsd/dhcpcd/dist/src/privsep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Jul 19 13:53:03 UTC 2023 Modified Files: src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.c if-bsd.c if-options.c privsep.c script.c Log Message: Sync with dhcpcd-10.0.2 To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/external/bsd/dhcpcd/dist/src/bpf.c cvs rdiff -u -r1.47 -r1.48 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.29 -r1.30 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.50 -r1.51 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.33 -r1.34 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/src/privsep.c cvs rdiff -u -r1.15 -r1.16 src/external/bsd/dhcpcd/dist/src/script.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Jul 19 13:53:03 UTC 2023 Modified Files: src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.c if-bsd.c if-options.c privsep.c script.c Log Message: Sync with dhcpcd-10.0.2 To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/external/bsd/dhcpcd/dist/src/bpf.c cvs rdiff -u -r1.47 -r1.48 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.29 -r1.30 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.50 -r1.51 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.33 -r1.34 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/src/privsep.c cvs rdiff -u -r1.15 -r1.16 src/external/bsd/dhcpcd/dist/src/script.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/bpf.c diff -u src/external/bsd/dhcpcd/dist/src/bpf.c:1.19 src/external/bsd/dhcpcd/dist/src/bpf.c:1.20 --- src/external/bsd/dhcpcd/dist/src/bpf.c:1.19 Fri Apr 21 16:54:26 2023 +++ src/external/bsd/dhcpcd/dist/src/bpf.c Wed Jul 19 13:53:03 2023 @@ -610,16 +610,19 @@ static const struct bpf_insn bpf_bootp_b #define BPF_BOOTP_BASE_LEN __arraycount(bpf_bootp_base) static const struct bpf_insn bpf_bootp_read[] = { - /* Make sure it's from and to the right port. */ - BPF_STMT(BPF_LD + BPF_W + BPF_IND, 0), - BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, (BOOTPS << 16) + BOOTPC, 1, 0), + /* Make sure it's to the right port. + * RFC2131 makes no mention of enforcing a source port. */ + BPF_STMT(BPF_LD + BPF_H + BPF_IND, offsetof(struct udphdr, uh_dport)), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, BOOTPC, 1, 0), BPF_STMT(BPF_RET + BPF_K, 0), }; #define BPF_BOOTP_READ_LEN __arraycount(bpf_bootp_read) #ifdef BIOCSETWF static const struct bpf_insn bpf_bootp_write[] = { - /* Make sure it's from and to the right port. */ + /* Make sure it's from and to the right port. + * RFC2131 makes no mention of encforcing a source port, + * but dhcpcd does enforce it for sending. */ BPF_STMT(BPF_LD + BPF_W + BPF_IND, 0), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, (BOOTPC << 16) + BOOTPS, 1, 0), BPF_STMT(BPF_RET + BPF_K, 0), Index: src/external/bsd/dhcpcd/dist/src/dhcp.c diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.47 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.48 --- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.47 Fri Apr 21 16:54:26 2023 +++ src/external/bsd/dhcpcd/dist/src/dhcp.c Wed Jul 19 13:53:03 2023 @@ -3436,8 +3436,8 @@ is_packet_udp_bootp(void *packet, size_t if (ip_hlen + ntohs(udp.uh_ulen) > plen) return false; - /* Check it's to and from the right ports. */ - if (udp.uh_dport != htons(BOOTPC) || udp.uh_sport != htons(BOOTPS)) + /* Check it's to the right port. */ + if (udp.uh_dport != htons(BOOTPC)) return false; return true; Index: src/external/bsd/dhcpcd/dist/src/dhcp6.c diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.29 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.30 --- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.29 Fri Apr 21 16:54:26 2023 +++ src/external/bsd/dhcpcd/dist/src/dhcp6.c Wed Jul 19 13:53:03 2023 @@ -1667,10 +1667,7 @@ dhcp6_startinform(void *arg) ifp = arg; state = D6_STATE(ifp); - if (state->new_start || (state->new == NULL && !state->failed)) - llevel = LOG_INFO; - else - llevel = LOG_DEBUG; + llevel = state->failed ? LOG_DEBUG : LOG_INFO; logmessage(llevel, "%s: requesting DHCPv6 information", ifp->name); state->state = DH6S_INFORM; state->RTC = 0; @@ -3069,7 +3066,7 @@ dhcp6_bind(struct interface *ifp, const int loglevel; struct timespec now; - if (state->state == DH6S_RENEW && !state->new_start) { + if (state->state == DH6S_RENEW) { loglevel = LOG_DEBUG; TAILQ_FOREACH(ia, >addrs, next) { if (ia->flags & IPV6_AF_NEW) { @@ -3968,8 +3965,10 @@ dhcp6_start(struct interface *ifp, enum { /* We don't want log spam when the RA * has just adjusted it's prefix times. */ -if (state->state != DH6S_INFORMED) +if (state->state != DH6S_INFORMED) { state->new_start = true; + state->failed = false; +} dhcp6_startinform(ifp); } break; Index: src/external/bsd/dhcpcd/dist/src/if-bsd.c diff -u src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.29 src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.30 --- src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.29 Thu Apr 27 13:21:59 2023 +++ src/external/bsd/dhcpcd/dist/src/if-bsd.c Wed Jul 19 13:53:03 2023 @@ -154,6 +154,9 @@ if_opensockets_os(struct dhcpcd_ctx *ctx #ifdef RTM_CHGADDR RTM_CHGADDR, #endif +#ifdef RTM_DESYNC + RTM_DESYNC, +#endif RTM_NEWADDR, RTM_DELADDR }; #ifdef ROUTE_MSGFILTER @@ -1332,6 +1335,11 @@ if_ifa(struct dhcpcd_ctx *ctx, const str ifam->ifam_msglen - sizeof(*ifam), rti_info) == -1) return -1; + /* All BSD's set IFF_UP on the interface when adding an
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Thu Apr 27 13:21:59 UTC 2023 Modified Files: src/external/bsd/dhcpcd/dist/src: if-bsd.c Log Message: dhcpcd: Fix non INET6 builds. Thanks to J. Hannken-Illjes for the fix. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/external/bsd/dhcpcd/dist/src/if-bsd.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/if-bsd.c diff -u src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.28 src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.29 --- src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.28 Fri Apr 21 16:54:26 2023 +++ src/external/bsd/dhcpcd/dist/src/if-bsd.c Thu Apr 27 13:21:59 2023 @@ -167,15 +167,13 @@ if_opensockets_os(struct dhcpcd_ctx *ctx #ifdef INET6 priv->pf_inet6_fd = xsocket(PF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0); -#ifdef PRIVSEP_RIGHTS - if (IN_PRIVSEP(ctx)) - ps_rights_limit_ioctl(priv->pf_inet6_fd); -#endif /* Don't return an error so we at least work on kernels witout INET6 * even though we expect INET6 support. * We will fail noisily elsewhere anyway. */ -#else - priv->pf_inet6_fd = -1; +#ifdef PRIVSEP_RIGHTS + if (priv->pf_inet6_fd != -1 && IN_PRIVSEP(ctx)) + ps_rights_limit_ioctl(priv->pf_inet6_fd); +#endif #endif ctx->link_fd = xsocket(PF_ROUTE, SOCK_RAW | SOCK_CXNB, AF_UNSPEC); @@ -234,8 +232,10 @@ if_closesockets_os(struct dhcpcd_ctx *ct struct priv *priv; priv = (struct priv *)ctx->priv; +#ifdef INET6 if (priv->pf_inet6_fd != -1) close(priv->pf_inet6_fd); +#endif #if defined(SIOCALIFADDR) && defined(IFLR_ACTIVE) /*NetBSD */ if (priv->pf_link_fd != -1) close(priv->pf_link_fd);
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Thu Apr 27 13:21:59 UTC 2023 Modified Files: src/external/bsd/dhcpcd/dist/src: if-bsd.c Log Message: dhcpcd: Fix non INET6 builds. Thanks to J. Hannken-Illjes for the fix. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/external/bsd/dhcpcd/dist/src/if-bsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Fri Apr 21 16:54:26 UTC 2023 Modified Files: src/external/bsd/dhcpcd/dist/hooks: 20-resolv.conf 29-lookup-hostname 30-hostname 50-ntp.conf src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.c if-bsd.c if-options.c ipv6.c ipv6.h ipv6nd.c logerr.c privsep.c script.c Log Message: Merge changes To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf cvs rdiff -u -r1.2 -r1.3 \ src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname cvs rdiff -u -r1.5 -r1.6 src/external/bsd/dhcpcd/dist/hooks/30-hostname \ src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf cvs rdiff -u -r1.18 -r1.19 src/external/bsd/dhcpcd/dist/src/bpf.c cvs rdiff -u -r1.46 -r1.47 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.28 -r1.29 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/ipv6nd.c cvs rdiff -u -r1.49 -r1.50 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.27 -r1.28 src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.32 -r1.33 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.17 -r1.18 src/external/bsd/dhcpcd/dist/src/ipv6.c cvs rdiff -u -r1.13 -r1.14 src/external/bsd/dhcpcd/dist/src/ipv6.h \ src/external/bsd/dhcpcd/dist/src/privsep.c cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/src/logerr.c cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/src/script.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/hooks/20-resolv.conf diff -u src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.6 src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.7 --- src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.6 Mon Dec 28 13:57:40 2020 +++ src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf Fri Apr 21 16:54:26 2023 @@ -11,7 +11,7 @@ nocarrier_roaming_dir="$state_dir/roamin NL=" " : ${resolvconf:=resolvconf} -if type "$resolvconf" >/dev/null 2>&1; then +if command -v "$resolvconf" >/dev/null 2>&1; then have_resolvconf=true else have_resolvconf=false Index: src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname diff -u src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname:1.2 src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname:1.3 --- src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname:1.2 Sat Sep 22 13:17:46 2018 +++ src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname Fri Apr 21 16:54:26 2023 @@ -4,20 +4,20 @@ lookup_hostname() { [ -z "$new_ip_address" ] && return 1 # Silly ISC programs love to send error text to stdout - if type dig >/dev/null 2>&1; then + if command -v dig >/dev/null 2>&1; then h=$(dig +short -x $new_ip_address) if [ $? = 0 ]; then echo "$h" | sed 's/\.$//' return 0 fi - elif type host >/dev/null 2>&1; then + elif command -v host >/dev/null 2>&1; then h=$(host $new_ip_address) if [ $? = 0 ]; then echo "$h" \ | sed 's/.* domain name pointer \(.*\)./\1/' return 0 fi - elif type getent >/dev/null 2>&1; then + elif command -v getent >/dev/null 2>&1; then h=$(getent hosts $new_ip_address) if [ $? = 0 ]; then echo "$h" | sed 's/[^ ]* *\([^ ]*\).*/\1/' Index: src/external/bsd/dhcpcd/dist/hooks/30-hostname diff -u src/external/bsd/dhcpcd/dist/hooks/30-hostname:1.5 src/external/bsd/dhcpcd/dist/hooks/30-hostname:1.6 --- src/external/bsd/dhcpcd/dist/hooks/30-hostname:1.5 Fri Oct 22 13:23:20 2021 +++ src/external/bsd/dhcpcd/dist/hooks/30-hostname Fri Apr 21 16:54:26 2023 @@ -25,7 +25,7 @@ _hostname() if [ -z "${1+x}" ]; then if [ -r /proc/sys/kernel/hostname ]; then read name /dev/null 2>/dev/null; then + elif command -v hostname >/dev/null 2>/dev/null; then hostname elif sysctl kern.hostname >/dev/null 2>&1; then sysctl -n kern.hostname @@ -39,7 +39,7 @@ _hostname() if [ -w /proc/sys/kernel/hostname ]; then echo "$1" >/proc/sys/kernel/hostname - elif [ -n "$1" ] && type hostname >/dev/null 2>&1; then + elif [ -n "$1" ] && command -v hostname >/dev/null 2>&1; then hostname "$1" elif sysctl kern.hostname >/dev/null 2>&1; then sysctl -w "kern.hostname=$1" >/dev/null Index: src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf diff -u src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf:1.5 src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf:1.6 --- src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf:1.5 Fri Nov 20 13:24:58 2020 +++ src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf Fri Apr 21 16:54:26 2023 @@ -43,7 +43,7 @@ fi # Debian has a separate file for DHCP config to avoid stamping on # the master. -if [ "$ntp_service" = ntpd ] && type invoke-rc.d >/dev/null 2>&1; then +if [ "$ntp_service" = ntpd ] && command -v invoke-rc.d >/dev/null 2>&1; then [ -e /var/lib/ntp ] || mkdir /var/lib/ntp : ${ntp_service:=ntp} : ${NTP_DHCP_CONF:=/var/lib/ntp/ntp.conf.dhcp} @@ -113,7 +113,7 @@
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Fri Apr 21 16:54:26 UTC 2023 Modified Files: src/external/bsd/dhcpcd/dist/hooks: 20-resolv.conf 29-lookup-hostname 30-hostname 50-ntp.conf src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.c if-bsd.c if-options.c ipv6.c ipv6.h ipv6nd.c logerr.c privsep.c script.c Log Message: Merge changes To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf cvs rdiff -u -r1.2 -r1.3 \ src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname cvs rdiff -u -r1.5 -r1.6 src/external/bsd/dhcpcd/dist/hooks/30-hostname \ src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf cvs rdiff -u -r1.18 -r1.19 src/external/bsd/dhcpcd/dist/src/bpf.c cvs rdiff -u -r1.46 -r1.47 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.28 -r1.29 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/ipv6nd.c cvs rdiff -u -r1.49 -r1.50 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.27 -r1.28 src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.32 -r1.33 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.17 -r1.18 src/external/bsd/dhcpcd/dist/src/ipv6.c cvs rdiff -u -r1.13 -r1.14 src/external/bsd/dhcpcd/dist/src/ipv6.h \ src/external/bsd/dhcpcd/dist/src/privsep.c cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/src/logerr.c cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/src/script.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Fri Oct 22 13:23:20 UTC 2021 Modified Files: src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.c if-bsd.c if-options.c ipv6.c ipv6.h ipv6nd.c logerr.c privsep.c script.c Added Files: src/external/bsd/dhcpcd/dist/hooks: 30-hostname Removed Files: src/external/bsd/dhcpcd/dist/hooks: 30-hostname.in 50-ypbind.in dhcpcd-run-hooks.8.in dhcpcd-run-hooks.in src/external/bsd/dhcpcd/dist/src: dhcpcd.8.in dhcpcd.conf.5.in Log Message: Sync update To generate a diff of this commit: cvs rdiff -u -r0 -r1.5 src/external/bsd/dhcpcd/dist/hooks/30-hostname cvs rdiff -u -r1.1.1.3 -r0 src/external/bsd/dhcpcd/dist/hooks/30-hostname.in cvs rdiff -u -r1.3 -r0 src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in cvs rdiff -u -r1.1.1.8 -r0 \ src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in cvs rdiff -u -r1.6 -r0 src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in cvs rdiff -u -r1.17 -r1.18 src/external/bsd/dhcpcd/dist/src/bpf.c cvs rdiff -u -r1.45 -r1.46 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.27 -r1.28 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/ipv6nd.c cvs rdiff -u -r1.11 -r0 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in cvs rdiff -u -r1.48 -r1.49 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.1.1.25 -r0 src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in cvs rdiff -u -r1.26 -r1.27 src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.31 -r1.32 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.16 -r1.17 src/external/bsd/dhcpcd/dist/src/ipv6.c cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/src/ipv6.h \ src/external/bsd/dhcpcd/dist/src/privsep.c cvs rdiff -u -r1.11 -r1.12 src/external/bsd/dhcpcd/dist/src/logerr.c cvs rdiff -u -r1.13 -r1.14 src/external/bsd/dhcpcd/dist/src/script.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/bpf.c diff -u src/external/bsd/dhcpcd/dist/src/bpf.c:1.17 src/external/bsd/dhcpcd/dist/src/bpf.c:1.18 --- src/external/bsd/dhcpcd/dist/src/bpf.c:1.17 Mon Oct 5 16:02:15 2020 +++ src/external/bsd/dhcpcd/dist/src/bpf.c Fri Oct 22 13:23:20 2021 @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-2-Clause */ /* * dhcpcd: BPF arp and bootp filtering - * Copyright (c) 2006-2020 Roy Marples + * Copyright (c) 2006-2021 Roy Marples * All rights reserved * Redistribution and use in source and binary forms, with or without Index: src/external/bsd/dhcpcd/dist/src/dhcp.c diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.45 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.46 --- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.45 Mon Dec 28 13:57:40 2020 +++ src/external/bsd/dhcpcd/dist/src/dhcp.c Fri Oct 22 13:23:20 2021 @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-2-Clause */ /* * dhcpcd - DHCP client daemon - * Copyright (c) 2006-2020 Roy Marples + * Copyright (c) 2006-2021 Roy Marples * All rights reserved * Redistribution and use in source and binary forms, with or without @@ -2031,14 +2031,14 @@ dhcp_finish_dad(struct interface *ifp, s #ifdef IPV4LL /* Stop IPv4LL now we have a working DHCP address */ - ipv4ll_drop(ifp); + if (!IN_LINKLOCAL(ntohl(ia->s_addr))) + ipv4ll_drop(ifp); #endif if (ifp->options->options & DHCPCD_INFORM) dhcp_inform(ifp); } - static bool dhcp_addr_duplicated(struct interface *ifp, struct in_addr *ia) { @@ -2069,7 +2069,7 @@ dhcp_addr_duplicated(struct interface *i if (opts & (DHCPCD_STATIC | DHCPCD_INFORM)) { state->reason = "EXPIRE"; script_runreason(ifp, state->reason); -#define NOT_ONLY_SELF (DHCPCD_MASTER | DHCPCD_IPV6RS | DHCPCD_DHCP6) +#define NOT_ONLY_SELF (DHCPCD_MANAGER | DHCPCD_IPV6RS | DHCPCD_DHCP6) if (!(ctx->options & NOT_ONLY_SELF)) eloop_exit(ifp->ctx->eloop, EXIT_FAILURE); return deleted; @@ -2380,8 +2380,9 @@ dhcp_bind(struct interface *ifp) dhcp_closebpf(ifp); openudp: - /* If not in master mode, open an address specific socket. */ - if (ctx->options & DHCPCD_MASTER || + /* If not in manager mode, open an address specific socket. */ + if (ctx->options & DHCPCD_MANAGER || + ifo->options & DHCPCD_STATIC || (state->old != NULL && state->old->yiaddr == state->new->yiaddr && old_state & STATE_ADDED && !(old_state & STATE_FAKE))) @@ -2399,7 +2400,7 @@ openudp: state->udp_rfd = dhcp_openudp(>addr->addr); if (state->udp_rfd == -1) { logerr(__func__); - /* Address sharing without master mode is not supported. + /* Address sharing without manager mode is not supported. * It's also possible another DHCP client could be running, * which is even worse. * We still need to work, so re-open BPF. */ @@ -2569,7 +2570,6 @@ dhcp_inform(struct interface *ifp) state = D_STATE(ifp); ifo = ifp->options; - state->state = DHS_INFORM;
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Fri Oct 22 13:23:20 UTC 2021 Modified Files: src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.c if-bsd.c if-options.c ipv6.c ipv6.h ipv6nd.c logerr.c privsep.c script.c Added Files: src/external/bsd/dhcpcd/dist/hooks: 30-hostname Removed Files: src/external/bsd/dhcpcd/dist/hooks: 30-hostname.in 50-ypbind.in dhcpcd-run-hooks.8.in dhcpcd-run-hooks.in src/external/bsd/dhcpcd/dist/src: dhcpcd.8.in dhcpcd.conf.5.in Log Message: Sync update To generate a diff of this commit: cvs rdiff -u -r0 -r1.5 src/external/bsd/dhcpcd/dist/hooks/30-hostname cvs rdiff -u -r1.1.1.3 -r0 src/external/bsd/dhcpcd/dist/hooks/30-hostname.in cvs rdiff -u -r1.3 -r0 src/external/bsd/dhcpcd/dist/hooks/50-ypbind.in cvs rdiff -u -r1.1.1.8 -r0 \ src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8.in cvs rdiff -u -r1.6 -r0 src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.in cvs rdiff -u -r1.17 -r1.18 src/external/bsd/dhcpcd/dist/src/bpf.c cvs rdiff -u -r1.45 -r1.46 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.27 -r1.28 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/ipv6nd.c cvs rdiff -u -r1.11 -r0 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in cvs rdiff -u -r1.48 -r1.49 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.1.1.25 -r0 src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in cvs rdiff -u -r1.26 -r1.27 src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.31 -r1.32 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.16 -r1.17 src/external/bsd/dhcpcd/dist/src/ipv6.c cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/src/ipv6.h \ src/external/bsd/dhcpcd/dist/src/privsep.c cvs rdiff -u -r1.11 -r1.12 src/external/bsd/dhcpcd/dist/src/logerr.c cvs rdiff -u -r1.13 -r1.14 src/external/bsd/dhcpcd/dist/src/script.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
In article <95034282-ebf6-c1d5-8bb1-9258ee825...@marples.name>, Roy Marples wrote: >On 10/05/2020 18:58, Christos Zoulas wrote: >> Module Name: src >> Committed By:christos >> Date:Sun May 10 17:58:16 UTC 2020 >> >> Modified Files: >> src/external/bsd/dhcpcd/dist/src: dhcpcd.c >> >> Log Message: >> Add SIGPIPE to the list of dhcpcd affected signals since we sigignore it. > >Why? Because the forked programs from scripts were executed with SIGPIPE blocked. If that breaks non-kqueue OS's we should just add SIGPIPE to the signal mask to default for posix_spawn(). christos
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 10/05/2020 18:58, Christos Zoulas wrote: Module Name:src Committed By: christos Date: Sun May 10 17:58:16 UTC 2020 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcpcd.c Log Message: Add SIGPIPE to the list of dhcpcd affected signals since we sigignore it. Why? BTW, this breaks non kqueue OS's so can't be accepted upstream. Roy
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 14/02/2020 20:36, Santhosh Raju wrote: On Thu, Feb 13, 2020 at 4:44 PM Santhosh Raju wrote: On Thu, Feb 13, 2020 at 4:32 PM Kamil Rytarowski wrote: On 13.02.2020 22:20, Valery Ushakov wrote: I did not propose to disable the warning. I proposed to downgrade -Werror to -Wno-error (i.e. a warning) and only for the buggy sanitizer build. That file will still be compiled in normal builds with all the warnings=errors enabled, so real problems won't be overlooked. OK, we can try this path. Santosh, could you please revert and try -Wno-error + upstream it? Thank you in advance! Sure, let me prepare the patch. The patch has been prepared. The builds were run both with and without MKLIBCSANITIZER=yes and it was completed successfully. Let us know if it alright to commit this. Looks ok to me, commit it. Roy
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Thu, Feb 13, 2020 at 4:44 PM Santhosh Raju wrote: > > On Thu, Feb 13, 2020 at 4:32 PM Kamil Rytarowski wrote: > > > > On 13.02.2020 22:20, Valery Ushakov wrote: > > > I did not propose to disable the warning. I proposed to downgrade > > > -Werror to -Wno-error (i.e. a warning) and only for the buggy > > > sanitizer build. That file will still be compiled in normal builds > > > with all the warnings=errors enabled, so real problems won't be > > > overlooked. > > > > OK, we can try this path. > > > > Santosh, could you please revert and try -Wno-error + upstream it? > > > > Thank you in advance! > > > > Sure, let me prepare the patch. > The patch has been prepared. The builds were run both with and without MKLIBCSANITIZER=yes and it was completed successfully. Let us know if it alright to commit this. > -- > Santhosh -- Santhosh Index: dist/src/dhcp.c === RCS file: /cvsroot/src/external/bsd/dhcpcd/dist/src/dhcp.c,v retrieving revision 1.33 diff -u -p -u -r1.33 dhcp.c --- dist/src/dhcp.c 8 Feb 2020 12:17:16 - 1.33 +++ dist/src/dhcp.c 14 Feb 2020 20:32:20 - @@ -3307,7 +3307,7 @@ is_packet_udp_bootp(void *packet, size_t memcpy(, (char *)ip + ip_hlen, sizeof(udp)); if (ntohs(udp.uh_ulen) < sizeof(udp)) return false; - if (ip_hlen + (size_t)ntohs(udp.uh_ulen) > plen) + if (ip_hlen + ntohs(udp.uh_ulen) > plen) return false; /* Check it's to and from the right ports. */ Index: sbin/dhcpcd/Makefile === RCS file: /cvsroot/src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile,v retrieving revision 1.50 diff -u -p -u -r1.50 Makefile --- sbin/dhcpcd/Makefile 29 Jan 2020 23:42:57 - 1.50 +++ sbin/dhcpcd/Makefile 14 Feb 2020 20:32:20 - @@ -27,6 +27,11 @@ SRCS+= auth.c .if (${USE_INET} != "no") CPPFLAGS+= -DINET SRCS+= bpf.c dhcp.c ipv4.c +.if (${MKLIBCSANITIZER:Uno} == "yes") +.if (${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8) +COPTS.dhcp.c+= -Wno-error=sign-conversion +.endif +.endif .if !defined(SMALLPROG) CPPFLAGS+= -DARP SRCS+= arp.c
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Thu, Feb 13, 2020 at 4:32 PM Kamil Rytarowski wrote: > > On 13.02.2020 22:20, Valery Ushakov wrote: > > I did not propose to disable the warning. I proposed to downgrade > > -Werror to -Wno-error (i.e. a warning) and only for the buggy > > sanitizer build. That file will still be compiled in normal builds > > with all the warnings=errors enabled, so real problems won't be > > overlooked. > > OK, we can try this path. > > Santosh, could you please revert and try -Wno-error + upstream it? > > Thank you in advance! > Sure, let me prepare the patch. -- Santhosh
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 13.02.2020 22:20, Valery Ushakov wrote: > I did not propose to disable the warning. I proposed to downgrade > -Werror to -Wno-error (i.e. a warning) and only for the buggy > sanitizer build. That file will still be compiled in normal builds > with all the warnings=errors enabled, so real problems won't be > overlooked. OK, we can try this path. Santosh, could you please revert and try -Wno-error + upstream it? Thank you in advance! signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Thu, Feb 13, 2020 at 18:25:41 +0100, Kamil Rytarowski wrote: > On 13.02.2020 18:00, Valery Ushakov wrote: > > Arguably, if the tool you use is broken, you shouln't be mutilating > > the source code just to shut that tool up. > > The introduced changes were good, even if GCC would be silent. You changed one occurence just because it happens to trigger a bug in gcc. There are ntohs() >< size_t_var comparisons right above and below the line you changed, where the same promotion happens (without triggering a gcc bug) and they don't have a cast. So someone reading that code will ask themself, wait a minute, why the cast is necessary in *that* place but not in those places? What is going on there that I miss that required introduction of that cast. I.e. your change create cognitive load for the reader. I don't cosider that good. > [...] the promotion rules are considered by many people as the major > flaw in C. Today I prefer explicit casts (after the MUSL lesson) > even if unnecessary than implicit promotion. Amen. However they are there and we made uneasy peace with them so unless you are consistent in your casting, you send all the wrong singals to the reader. > As an alternative option we can disable warnings but this is in my > opinion much worse in this case than potentially overlooking real > problems in a 4000+ line file. I did not propose to disable the warning. I proposed to downgrade -Werror to -Wno-error (i.e. a warning) and only for the buggy sanitizer build. That file will still be compiled in normal builds with all the warnings=errors enabled, so real problems won't be overlooked. > Repeatedly informing that the tool (GCC) is broken did not solve any > issue. It would be finally better to see someone fixing GCC rather > than informing other GCC users about it. Feel free to follow your own advice here... (After all, it's your sanitizer usage that has problems. The normal builds are fine as they are :) > On the opposite side of this if this camp is MUSL. I used chunks of the > MUSL code and it had poor results. There is a strict policy to avoid > casts unless absolutely needed That's not a bad policy. As I said, a cast is a blunt tool. It's easy to introduce a wrong one that would silence some warning or other but will do the wrong thing, but now since there is a cast the compiler cannot even squeak. I might be misremembering, but IIRC Visual C has some warning(s) that ignore explicit casts, precisely to detect that kind of problems. > and if they are needed this tends to be in as obscure way as > possible (like adding U attribute to one of the arguments in an > expression). What's obscure about adding 'U' to signify unsignedness?! Also it's not a cast to begin with, a literal with the 'u' suffix *is* unsigned. A cast is when you take something of one type and coerce it to be of some other type. -uwe
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 13.02.2020 18:00, Valery Ushakov wrote: > Arguably, if the tool you use is broken, you shouln't be mutilating > the source code just to shut that tool up. The introduced changes were good, even if GCC would be silent. It is far from mutilating. As an alternative option we can disable warnings but this is in my opinion much worse in this case than potentially overlooking real problems in a 4000+ line file. On the opposite side of this if this camp is MUSL. I used chunks of the MUSL code and it had poor results. There is a strict policy to avoid casts unless absolutely needed and if they are needed this tends to be in as obscure way as possible (like adding U attribute to one of the arguments in an expression). This resulted in unmaintainable code and very difficult situation to guess whether code semantics is broken or buggy. For purists, MUSL is not mutilated at all so people wanting this style are informed where to find it now. Today I prefer explicit casts (after the MUSL lesson) even if unnecessary than implicit promotion. I'm not alone in here as the promotion rules are considered by many people as the major flaw in C. Everybody agrees that GCC was picky in that case and not mandatory from a strict language point of view. Repeatedly informing that the tool (GCC) is broken did not solve any issue. It would be finally better to see someone fixing GCC rather than informing other GCC users about it. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Thu, Feb 13, 2020 at 15:03:35 +0100, Kamil Rytarowski wrote: > On 13.02.2020 14:50, Valery Ushakov wrote: > > On Thu, Feb 13, 2020 at 14:18:43 +0100, Kamil Rytarowski wrote: > > > > Can you show the original problem that you are trying to fix here? > > When and how did you get warning? > > GCC has a property (as called by Joerg bug) that different backend, > different optimization levels etc emit different warnings. > > There is a request from certain people around to fix GCC not to mute > down GCC, only because warnings are emitted in one configuration and not > in their build settings. > > I redirect these complains to GCC upstream. > > dhcpcd emits these warnings once we enable -fsanitize=undefined. If I add -fsanitize=undefined to the command line to compile that file (in current) I still do not see that warning. I didn't have time yet to do a full build with sanitizer enabled. Arguably, if the tool you use is broken, you shouln't be mutilating the source code just to shut that tool up. In general I'm quite worried about the recent ongoing activity of sprinkling changes around the tree just to shut up this or that warning without paying much attention to the end result. Some of those changes were wrong. Some left code looking inconsistent as they fixed one place that did produce a warning, but didn't change nearly identical bits of code just next to it that didn't. That leaves code in a fractured state. Casts in particular are a very blunt instrument, and given that history of recent changes your use of that instrument in this case really raised red flags. If -- and I still haven't seen it myself, "works for me" in a naive test -- -fsanitize=undefined is buggy w.r.t. -Wconversion, then you should arange to use say -Wno-error=conversion for that specific file when -fsanitize=undefined is enabled, we do have makefile machinery for that. This way the bug in the tool is not causing random and dubious changes to the code, and is confined to a properly commented change in a Makefile. -uwe
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 13.02.2020 14:50, Valery Ushakov wrote: > On Thu, Feb 13, 2020 at 14:18:43 +0100, Kamil Rytarowski wrote: > >> > Can you show the original problem that you are trying to fix here? > When and how did you get warning? > GCC has a property (as called by Joerg bug) that different backend, different optimization levels etc emit different warnings. There is a request from certain people around to fix GCC not to mute down GCC, only because warnings are emitted in one configuration and not in their build settings. I redirect these complains to GCC upstream. dhcpcd emits these warnings once we enable -fsanitize=undefined. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Thu, Feb 13, 2020 at 14:18:43 +0100, Kamil Rytarowski wrote: > Feel free to fix GCC. That's sounds rather dismissive to me. Can you show the original problem that you are trying to fix here? When and how did you get warning? I do NOT see the warning for this kind of conversion with either current (gcc 8) or on netbsd-8 (gcc 5). If I revert this change the file is compiled just fine. E.g. with a very current current build: $ nbmake-sparc dhcp.o # compile dhcpcd/dhcp.o sparc--netbsdelf-gcc -O2 ... -Wconversion -Wsign-compare -c .../dhcp.c $ > dhcpcd already uses this explicit cast style, e.g. here: > > static void * > get_udp_data(void *packet, size_t *len) > { > const struct ip *ip = packet; > size_t ip_hl = (size_t)ip->ip_hl * 4; > char *p = packet; > > p += ip_hl + sizeof(struct udphdr); > *len = (size_t)ntohs(ip->ip_len) - sizeof(struct udphdr) - ip_hl; > return p; > } Again, I don't get any warnings if I change that to ... /*(size_t)*/ntohs(ip->ip_len) ... I also tried ... /*(size_t)ntohs*/(ip->ip_len) ... as a quick and dirty attempt to emulate little endian where ntohs is a nop (I don't have an up-to-date little endian build handy) and, again, there's no warning. Oh, actually, my tooldir has accreted quite a number of old superh compilers, so: $ cat size.c typedef unsigned short uint16_t; typedef unsigned long size_t; #define ntohs(x) (x) size_t foo(uint16_t ip_len) { return ntohs(ip_len) - sizeof(uint16_t); } $ for CC in $TOOLDIR/bin/shle--netbsdelf-gcc-[0-9]*; do echo $(basename $CC); $CC -Wall -Wextra -Wconversion -Wsign-compare -O2 -S size.c; done shle--netbsdelf-gcc-4.5.4 shle--netbsdelf-gcc-4.8.3 shle--netbsdelf-gcc-4.8.4 shle--netbsdelf-gcc-4.8.5 shle--netbsdelf-gcc-5.4.0 shle--netbsdelf-gcc-5.5.0 shle--netbsdelf-gcc-6.4.0 shle--netbsdelf-gcc-6.5.0 shle--netbsdelf-gcc-7.4.0 $ -uwe
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 13.02.2020 14:13, Joerg Sonnenberger wrote: > On Thu, Feb 13, 2020 at 02:05:12PM +0100, Kamil Rytarowski wrote: >> On 13.02.2020 00:58, Joerg Sonnenberger wrote: >>> On Mon, Feb 10, 2020 at 04:45:35PM +, Roy Marples wrote: On 09/02/2020 19:21, Joerg Sonnenberger wrote: > On Sat, Feb 08, 2020 at 12:17:16PM +, Santhosh Raju wrote: >> Module Name: src >> Committed By:fox >> Date:Sat Feb 8 12:17:16 UTC 2020 >> >> Modified Files: >> src/external/bsd/dhcpcd/dist/src: dhcp.c >> >> Log Message: >> external/bsd/dhcpcd: Fix a -Wconversion warning. >> >> Type cast uint16_t to size_t to prevent implicit type conversion. > > Seriously? That should not warn and no cast should be used either. What fix would you recommend then? >>> >>> Disable the warning in GCC and fill an upstream PR against it. A >>> conversion from uint16_t to size_t is value preserving by definition of >>> the ISO C platform limits. It should never create a warning. >>> >>> Joerg >>> >> >> If we disable warnings in our core software in non-trivial source file >> for over 4000 lines we will mute more serious issues in a pretty >> sensitive file. We fixed this warning in upstream dhcpcd. > > The fix is IMO significantly worse as it actually creates technical > debt. Frankly, I would go so far and say that this should be reverted. > This warning seems to be pretty fundamentally broken by design if the > analysis so far is correct. > > Joerg > Feel free to fix GCC. dhcpcd already uses this explicit cast style, e.g. here: static void * get_udp_data(void *packet, size_t *len) { const struct ip *ip = packet; size_t ip_hl = (size_t)ip->ip_hl * 4; char *p = packet; p += ip_hl + sizeof(struct udphdr); *len = (size_t)ntohs(ip->ip_len) - sizeof(struct udphdr) - ip_hl; return p; } signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Thu, Feb 13, 2020 at 02:05:12PM +0100, Kamil Rytarowski wrote: > On 13.02.2020 00:58, Joerg Sonnenberger wrote: > > On Mon, Feb 10, 2020 at 04:45:35PM +, Roy Marples wrote: > >> On 09/02/2020 19:21, Joerg Sonnenberger wrote: > >>> On Sat, Feb 08, 2020 at 12:17:16PM +, Santhosh Raju wrote: > Module Name: src > Committed By:fox > Date:Sat Feb 8 12:17:16 UTC 2020 > > Modified Files: > src/external/bsd/dhcpcd/dist/src: dhcp.c > > Log Message: > external/bsd/dhcpcd: Fix a -Wconversion warning. > > Type cast uint16_t to size_t to prevent implicit type conversion. > >>> > >>> Seriously? That should not warn and no cast should be used either. > >> > >> What fix would you recommend then? > > > > Disable the warning in GCC and fill an upstream PR against it. A > > conversion from uint16_t to size_t is value preserving by definition of > > the ISO C platform limits. It should never create a warning. > > > > Joerg > > > > If we disable warnings in our core software in non-trivial source file > for over 4000 lines we will mute more serious issues in a pretty > sensitive file. We fixed this warning in upstream dhcpcd. The fix is IMO significantly worse as it actually creates technical debt. Frankly, I would go so far and say that this should be reverted. This warning seems to be pretty fundamentally broken by design if the analysis so far is correct. Joerg
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 13.02.2020 00:58, Joerg Sonnenberger wrote: > On Mon, Feb 10, 2020 at 04:45:35PM +, Roy Marples wrote: >> On 09/02/2020 19:21, Joerg Sonnenberger wrote: >>> On Sat, Feb 08, 2020 at 12:17:16PM +, Santhosh Raju wrote: Module Name: src Committed By: fox Date: Sat Feb 8 12:17:16 UTC 2020 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c Log Message: external/bsd/dhcpcd: Fix a -Wconversion warning. Type cast uint16_t to size_t to prevent implicit type conversion. >>> >>> Seriously? That should not warn and no cast should be used either. >> >> What fix would you recommend then? > > Disable the warning in GCC and fill an upstream PR against it. A > conversion from uint16_t to size_t is value preserving by definition of > the ISO C platform limits. It should never create a warning. > > Joerg > If we disable warnings in our core software in non-trivial source file for over 4000 lines we will mute more serious issues in a pretty sensitive file. We fixed this warning in upstream dhcpcd. We ship with GCC that is typically 2 major versions behind upstream GCC and this at least discourages handling generic issues directly with upstream and upstream has little interest in reiterating over old branches for corner cases that are generally speaking unimportant. So overall I disagree with the request. Feel free to contribute a patch to GCC or find someone in GCC to fix it (we have no resources to do it on our side) so we can remove the cast. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Thu, 13 Feb 2020 02:45:44 + From:Roy Marples Message-ID: | My understanding was if it could be promoted to an int it would be. | So it size_t is bigger in bits than uint16_t and int is also bigger then | promotion occurs and we then have signed vs unsigned. You're right, but I think Joerg is even more right - or I certainly hope so. The reasoning is that when the uint16_t gets promoted to int, since int has more bits than the uint16_t the conversion is done by filling the low 16 bits of the int with the uint16_t value, and zero filling the rest (that is, value preserving). You then have a signed int. But it is known to be >= 0. When that is converted to a size_t (unsigned, and here assumed to be at least as many bits as an int .. similar reasoning applies if not) the signed int is sign extended to fit the size_t, and then made unsigned. "Sign exiended" here means zero fill, as we know the value must be >= 0 (so the sign bit must be 0). The only slightly weird case would be if int were 16 bits, but in that case, a uint16_t would be an unsigned int, and no promotion to int ever happens, it simply gets promoted directly to size_t. If I had to guess, I'd say that gcc is losing the "must be >= 0" part of the conversion from uint16_t to int, and assuming that the int might be negative, which would be bad for converting to a size_t. kre
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 13/02/2020 02:17, Joerg Sonnenberger wrote: I thought this fell under int promotion and thus became signed vs unsigned? size_t is guaranteed to be at least 16bit. If INT_MAX == 32767, an implicit cast of uint16_t would go to unsigned anyway and in all other cases, any implicit cast must be value preserving. My understanding was if it could be promoted to an int it would be. So it size_t is bigger in bits than uint16_t and int is also bigger then promotion occurs and we then have signed vs unsigned. Roy
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Thu, Feb 13, 2020 at 02:07:23AM +, Roy Marples wrote: > On 12/02/2020 23:58, Joerg Sonnenberger wrote: > > On Mon, Feb 10, 2020 at 04:45:35PM +, Roy Marples wrote: > > > On 09/02/2020 19:21, Joerg Sonnenberger wrote: > > > > On Sat, Feb 08, 2020 at 12:17:16PM +, Santhosh Raju wrote: > > > > > Module Name: src > > > > > Committed By: fox > > > > > Date: Sat Feb 8 12:17:16 UTC 2020 > > > > > > > > > > Modified Files: > > > > > src/external/bsd/dhcpcd/dist/src: dhcp.c > > > > > > > > > > Log Message: > > > > > external/bsd/dhcpcd: Fix a -Wconversion warning. > > > > > > > > > > Type cast uint16_t to size_t to prevent implicit type conversion. > > > > > > > > Seriously? That should not warn and no cast should be used either. > > > > > > What fix would you recommend then? > > > > Disable the warning in GCC and fill an upstream PR against it. A > > conversion from uint16_t to size_t is value preserving by definition of > > the ISO C platform limits. It should never create a warning. > > I thought this fell under int promotion and thus became signed vs unsigned? size_t is guaranteed to be at least 16bit. If INT_MAX == 32767, an implicit cast of uint16_t would go to unsigned anyway and in all other cases, any implicit cast must be value preserving. Joerg
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 12/02/2020 23:58, Joerg Sonnenberger wrote: On Mon, Feb 10, 2020 at 04:45:35PM +, Roy Marples wrote: On 09/02/2020 19:21, Joerg Sonnenberger wrote: On Sat, Feb 08, 2020 at 12:17:16PM +, Santhosh Raju wrote: Module Name:src Committed By: fox Date: Sat Feb 8 12:17:16 UTC 2020 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c Log Message: external/bsd/dhcpcd: Fix a -Wconversion warning. Type cast uint16_t to size_t to prevent implicit type conversion. Seriously? That should not warn and no cast should be used either. What fix would you recommend then? Disable the warning in GCC and fill an upstream PR against it. A conversion from uint16_t to size_t is value preserving by definition of the ISO C platform limits. It should never create a warning. I thought this fell under int promotion and thus became signed vs unsigned? Roy
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Mon, Feb 10, 2020 at 04:45:35PM +, Roy Marples wrote: > On 09/02/2020 19:21, Joerg Sonnenberger wrote: > > On Sat, Feb 08, 2020 at 12:17:16PM +, Santhosh Raju wrote: > > > Module Name: src > > > Committed By: fox > > > Date: Sat Feb 8 12:17:16 UTC 2020 > > > > > > Modified Files: > > > src/external/bsd/dhcpcd/dist/src: dhcp.c > > > > > > Log Message: > > > external/bsd/dhcpcd: Fix a -Wconversion warning. > > > > > > Type cast uint16_t to size_t to prevent implicit type conversion. > > > > Seriously? That should not warn and no cast should be used either. > > What fix would you recommend then? Disable the warning in GCC and fill an upstream PR against it. A conversion from uint16_t to size_t is value preserving by definition of the ISO C platform limits. It should never create a warning. Joerg
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 09/02/2020 19:21, Joerg Sonnenberger wrote: On Sat, Feb 08, 2020 at 12:17:16PM +, Santhosh Raju wrote: Module Name:src Committed By: fox Date: Sat Feb 8 12:17:16 UTC 2020 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c Log Message: external/bsd/dhcpcd: Fix a -Wconversion warning. Type cast uint16_t to size_t to prevent implicit type conversion. Seriously? That should not warn and no cast should be used either. What fix would you recommend then? Roy
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Sat, Feb 08, 2020 at 12:17:16PM +, Santhosh Raju wrote: > Module Name: src > Committed By: fox > Date: Sat Feb 8 12:17:16 UTC 2020 > > Modified Files: > src/external/bsd/dhcpcd/dist/src: dhcp.c > > Log Message: > external/bsd/dhcpcd: Fix a -Wconversion warning. > > Type cast uint16_t to size_t to prevent implicit type conversion. Seriously? That should not warn and no cast should be used either. Joerg
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Thanks. Yes, I have the core-dump, no we should not remove the line... Best, christos > On Jan 27, 2020, at 8:03 AM, Roy Marples wrote: > > On 27/01/2020 09:03, Roy Marples wrote: >> On 26/01/2020 22:57, Christos Zoulas wrote: >>> Module Name:src >>> Committed By:christos >>> Date:Sun Jan 26 22:57:52 UTC 2020 >>> >>> Modified Files: >>> src/external/bsd/dhcpcd/dist/src: script.c >>> >>> Log Message: >>> prevent coredump when state == NULL >>> >>> >>> To generate a diff of this commit: >>> cvs rdiff -u -r1.1.1.12 -r1.2 src/external/bsd/dhcpcd/dist/src/script.c >> A quick perusal through the code shows that this should not happen. Every >> time IPV4LL is given as a reason, the state should exist. > > There is one code path where there may be no state when an IPv4LL > address exists and dhcpcd no longer controlls it (ie dhcpcd restarted or a > 3rd party added it) then we delete it anyway (for say when we obtain a DHCP > address). > We should still run the IPV4LL hook script, but it will be empty. > > I've accepted this patch upstream. > > Roy signature.asc Description: Message signed with OpenPGP
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 27/01/2020 09:03, Roy Marples wrote: On 26/01/2020 22:57, Christos Zoulas wrote: Module Name:Â Â Â src Committed By:Â Â Â christos Date:Â Â Â Sun Jan 26 22:57:52 UTC 2020 Modified Files: src/external/bsd/dhcpcd/dist/src: script.c Log Message: prevent coredump when state == NULL To generate a diff of this commit: cvs rdiff -u -r1.1.1.12 -r1.2 src/external/bsd/dhcpcd/dist/src/script.c A quick perusal through the code shows that this should not happen. Every time IPV4LL is given as a reason, the state should exist. There is one code path where there may be no state when an IPv4LL address exists and dhcpcd no longer controlls it (ie dhcpcd restarted or a 3rd party added it) then we delete it anyway (for say when we obtain a DHCP address). We should still run the IPV4LL hook script, but it will be empty. I've accepted this patch upstream. Roy
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 26/01/2020 22:57, Christos Zoulas wrote: Module Name:src Committed By: christos Date: Sun Jan 26 22:57:52 UTC 2020 Modified Files: src/external/bsd/dhcpcd/dist/src: script.c Log Message: prevent coredump when state == NULL To generate a diff of this commit: cvs rdiff -u -r1.1.1.12 -r1.2 src/external/bsd/dhcpcd/dist/src/script.c A quick perusal through the code shows that this should not happen. Every time IPV4LL is given as a reason, the state should exist. If there really is no state then the script should not be called at all - we wouldn't want to pass the error down to dhcpcd listeners who would expect either an old address or new address to be present. Hopefully you still have the coredump so this can be analysed more? Should we also remove this line fromm 3RDPARTY? http://anonhg.netbsd.org/src/file/tip/doc/3RDPARTY#l340 Roy
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Nov 13 10:50:22 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c dhcp6.c dhcpcd.c if-bsd.c ipv6nd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.13 -r1.14 src/external/bsd/dhcpcd/dist/src/dhcp6.c cvs rdiff -u -r1.28 -r1.29 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/src/ipv6nd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Nov 13 10:50:22 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c dhcp6.c dhcpcd.c if-bsd.c ipv6nd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.13 -r1.14 src/external/bsd/dhcpcd/dist/src/dhcp6.c cvs rdiff -u -r1.28 -r1.29 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/src/ipv6nd.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.29 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.30 --- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.29 Wed Oct 16 14:54:39 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcp.c Wed Nov 13 10:50:22 2019 @@ -41,6 +41,10 @@ #include #undef __FAVOR_BSD +#ifdef AF_LINK +# include +#endif + #include #include #include @@ -132,9 +136,7 @@ static void dhcp_arp_found(struct arp_st #endif static void dhcp_handledhcp(struct interface *, struct bootp *, size_t, const struct in_addr *); -#ifdef IP_PKTINFO static void dhcp_handleifudp(void *); -#endif static int dhcp_initstate(struct interface *); void @@ -1550,7 +1552,10 @@ dhcp_openudp(struct interface *ifp) n = 1; if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, , sizeof(n)) == -1) goto eexit; -#ifdef IP_RECVPKTINFO +#ifdef IP_RECVIF + if (setsockopt(s, IPPROTO_IP, IP_RECVIF, , sizeof(n)) == -1) + goto eexit; +#else if (setsockopt(s, IPPROTO_IP, IP_RECVPKTINFO, , sizeof(n)) == -1) goto eexit; #endif @@ -1647,39 +1652,36 @@ dhcp_makeudppacket(size_t *sz, const uin static ssize_t dhcp_sendudp(struct interface *ifp, struct in_addr *to, void *data, size_t len) { - int s; - struct msghdr msg; - struct sockaddr_in sin; - struct iovec iov[1]; - struct dhcp_state *state = D_STATE(ifp); - ssize_t r; - - iov[0].iov_base = data; - iov[0].iov_len = len; - - memset(, 0, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_addr = *to; - sin.sin_port = htons(BOOTPS); + struct sockaddr_in sin = { + .sin_family = AF_INET, + .sin_addr = *to, + .sin_port = htons(BOOTPS), #ifdef HAVE_SA_LEN - sin.sin_len = sizeof(sin); + .sin_len = sizeof(sin), #endif + }; + struct iovec iov[] = { + { .iov_base = data, .iov_len = len } + }; + struct msghdr msg = { + .msg_name = (void *), + .msg_namelen = sizeof(sin), + .msg_iov = iov, + .msg_iovlen = 1, + }; + struct dhcp_state *state = D_STATE(ifp); + ssize_t r; + int fd; - memset(, 0, sizeof(msg)); - msg.msg_name = (void *) - msg.msg_namelen = sizeof(sin); - msg.msg_iov = iov; - msg.msg_iovlen = 1; - - s = state->udp_fd; - if (s == -1) { - s = dhcp_openudp(ifp); - if (s == -1) + fd = state->udp_fd; + if (fd == -1) { + fd = dhcp_openudp(ifp); + if (fd == -1) return -1; } - r = sendmsg(s, , 0); + r = sendmsg(fd, , 0); if (state->udp_fd == -1) - close(s); + close(fd); return r; } @@ -1780,7 +1782,7 @@ send_message(struct interface *ifp, uint * As such we remove it from consideration without actually * stopping the interface. */ if (r == -1) { - logerr("%s: if_sendraw", ifp->name); + logerr("%s: bpf_send", ifp->name); switch(errno) { case ENETDOWN: case ENETRESET: @@ -2257,30 +2259,27 @@ dhcp_bind(struct interface *ifp) ipv4_applyaddr(ifp); -#ifdef IP_PKTINFO /* Close the BPF filter as we can now receive DHCP messages * on a UDP socket. */ - if (state->udp_fd == -1 || - (state->old != NULL && state->old->yiaddr != state->new->yiaddr)) - { - dhcp_close(ifp); - /* If not in master mode, open an address specific socket. */ - if (ctx->udp_fd == -1) { - state->udp_fd = dhcp_openudp(ifp); - if (state->udp_fd == -1) { -logerr(__func__); -/* Address sharing without master mode is - * not supported. It's also possible another - * DHCP client could be running which is - * even worse. - * We still need to work, so re-open BPF. */ -dhcp_openbpf(ifp); - } else -eloop_event_add(ctx->eloop, -state->udp_fd, dhcp_handleifudp, ifp); - } + if (!(state->udp_fd == -1 || + (state->old != NULL && state->old->yiaddr != state->new->yiaddr))) + return; + dhcp_close(ifp); + + /* If not in master mode, open an address specific socket. */ + if (ctx->udp_fd != -1) + return; + state->udp_fd = dhcp_openudp(ifp); + if (state->udp_fd == -1) { + logerr(__func__); + /* Address sharing without master mode is not supported. + * It's also possible another DHCP client could be running, + * which is even worse. + * We still need to work, so re-open BPF. */ + dhcp_openbpf(ifp); + return; } -#endif + eloop_event_add(ctx->eloop, state->udp_fd, dhcp_handleifudp, ifp); } static void @@ -2609,6 +2608,11 @@ dhcp_reboot(struct interface
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Oct 16 14:54:39 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c dhcpcd.c ipv6.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.27 -r1.28 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.5 -r1.6 src/external/bsd/dhcpcd/dist/src/ipv6.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.28 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.29 --- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.28 Fri Oct 11 11:03:59 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcp.c Wed Oct 16 14:54:39 2019 @@ -164,8 +164,6 @@ dhcp_printoptions(const struct dhcpcd_ct } } -#define get_option_raw(ctx, bootp, bootp_len, opt) \ - get_option((ctx), (bootp), (bootp_len), NULL) static const uint8_t * get_option(struct dhcpcd_ctx *ctx, const struct bootp *bootp, size_t bootp_len, @@ -3275,26 +3273,35 @@ is_packet_udp_bootp(void *packet, size_t { struct ip *ip = packet; size_t ip_hlen; - struct udphdr *udp; + struct udphdr udp; - if (sizeof(*ip) > plen) + if (plen < sizeof(*ip)) return false; if (ip->ip_v != IPVERSION || ip->ip_p != IPPROTO_UDP) return false; /* Sanity. */ - if (ntohs(ip->ip_len) != plen) + if (ntohs(ip->ip_len) > plen) return false; ip_hlen = (size_t)ip->ip_hl * 4; + if (ip_hlen < sizeof(*ip)) + return false; + /* Check we have a UDP header and BOOTP. */ - if (ip_hlen + sizeof(*udp) + offsetof(struct bootp, vend) > plen) + if (ip_hlen + sizeof(udp) + offsetof(struct bootp, vend) > plen) + return false; + + /* Sanity. */ + memcpy(, (char *)ip + ip_hlen, sizeof(udp)); + if (ntohs(udp.uh_ulen) < sizeof(udp)) + return false; + if (ip_hlen + ntohs(udp.uh_ulen) > plen) return false; /* Check it's to and from the right ports. */ - udp = (struct udphdr *)(void *)((char *)ip + ip_hlen); - if (udp->uh_dport != htons(BOOTPC) || udp->uh_sport != htons(BOOTPS)) + if (udp.uh_dport != htons(BOOTPC) || udp.uh_sport != htons(BOOTPS)) return false; return true; @@ -3306,14 +3313,17 @@ checksums_valid(void *packet, struct in_addr *from, unsigned int flags) { struct ip *ip = packet; - struct ip pseudo_ip = { - .ip_p = IPPROTO_UDP, - .ip_src = ip->ip_src, - .ip_dst = ip->ip_dst + union pip { + struct ip ip; + uint16_t w[sizeof(struct ip)]; + } pip = { + .ip.ip_p = IPPROTO_UDP, + .ip.ip_src = ip->ip_src, + .ip.ip_dst = ip->ip_dst, }; size_t ip_hlen; - uint16_t udp_len, uh_sum; - struct udphdr *udp; + struct udphdr udp; + char *udpp, *uh_sump; uint32_t csum; if (from != NULL) @@ -3324,22 +3334,32 @@ checksums_valid(void *packet, return false; if (flags & BPF_PARTIALCSUM) - return 0; + return true; - udp = (struct udphdr *)(void *)((char *)ip + ip_hlen); - if (udp->uh_sum == 0) - return 0; + udpp = (char *)ip + ip_hlen; + memcpy(, udpp, sizeof(udp)); + if (udp.uh_sum == 0) + return true; /* UDP checksum is based on a pseudo IP header alongside * the UDP header and payload. */ - udp_len = ntohs(udp->uh_ulen); - uh_sum = udp->uh_sum; - udp->uh_sum = 0; - pseudo_ip.ip_len = udp->uh_ulen; + pip.ip.ip_len = udp.uh_ulen; csum = 0; - in_cksum(_ip, sizeof(pseudo_ip), ); - csum = in_cksum(udp, udp_len, ); - return csum == uh_sum; + + /* Need to zero the UDP sum in the packet for the checksum to work. */ + uh_sump = udpp + offsetof(struct udphdr, uh_sum); + memset(uh_sump, 0, sizeof(udp.uh_sum)); + + /* Checksum psuedo header and then UDP + payload. */ + in_cksum(pip.w, sizeof(pip.w), ); + csum = in_cksum(udpp, ntohs(udp.uh_ulen), ); + +#if 0 /* Not needed, just here for completeness. */ + /* Put the checksum back. */ + memcpy(uh_sump, _sum, sizeof(udp.uh_sum)); +#endif + + return csum == udp.uh_sum; } static void Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.27 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.28 --- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.27 Fri Oct 11 11:03:59 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c Wed Oct 16 14:54:39 2019 @@ -1984,12 +1984,10 @@ printpidfile: logdebugx(PACKAGE "-" VERSION " starting"); ctx.options |= DHCPCD_STARTED; -#ifdef HAVE_SETPROCTITLE setproctitle("%s%s%s", ctx.options & DHCPCD_MASTER ? "[master]" : argv[optind], ctx.options & DHCPCD_IPV4 ? " [ip4]" : "", ctx.options & DHCPCD_IPV6 ? " [ip6]" : ""); -#endif if (if_opensockets() == -1) { logerr("%s: if_opensockets", __func__); @@ -2155,6 +2153,9 @@ exit1: loginfox(PACKAGE " exited"); logclose(); free(ctx.logfile); +#ifdef SETPROCTITLE_H + setproctitle_free(); +#endif #ifdef USE_SIGNALS if (ctx.options & DHCPCD_FORKED) _exit(i); /* so atexit won't remove our pidfile */ Index:
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Oct 16 14:54:39 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c dhcpcd.c ipv6.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.27 -r1.28 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.5 -r1.6 src/external/bsd/dhcpcd/dist/src/ipv6.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Oct 11 11:03:59 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.8.in dhcpcd.c if-bsd.c if-options.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/src/bpf.c \ src/external/bsd/dhcpcd/dist/src/dhcp6.c cvs rdiff -u -r1.27 -r1.28 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.3 -r1.4 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in cvs rdiff -u -r1.26 -r1.27 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.13 -r1.14 src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.17 -r1.18 src/external/bsd/dhcpcd/dist/src/if-options.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/bpf.c diff -u src/external/bsd/dhcpcd/dist/src/bpf.c:1.12 src/external/bsd/dhcpcd/dist/src/bpf.c:1.13 --- src/external/bsd/dhcpcd/dist/src/bpf.c:1.12 Wed Aug 21 17:12:19 2019 +++ src/external/bsd/dhcpcd/dist/src/bpf.c Fri Oct 11 11:03:59 2019 @@ -410,13 +410,7 @@ bpf_cmp_hwaddr(struct bpf_insn *bpf, siz #endif #ifdef ARP - static const struct bpf_insn bpf_arp_ether [] = { - /* Ensure packet is at least correct size. */ - BPF_STMT(BPF_LD + BPF_W + BPF_LEN, 0), - BPF_JUMP(BPF_JMP + BPF_JGE + BPF_K, sizeof(struct ether_arp), 1, 0), - BPF_STMT(BPF_RET + BPF_K, 0), - /* Check this is an ARP packet. */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, offsetof(struct ether_header, ether_type)), @@ -552,17 +546,8 @@ bpf_arp(struct interface *ifp, int fd) } #endif -#define BPF_M_FHLEN 0 -#define BPF_M_IPHLEN 1 -#define BPF_M_IPLEN 2 -#define BPF_M_UDP 3 -#define BPF_M_UDPLEN 4 - #ifdef ARPHRD_NONE static const struct bpf_insn bpf_bootp_none[] = { - /* Set the frame header length to zero. */ - BPF_STMT(BPF_LD + BPF_IMM, 0), - BPF_STMT(BPF_ST, BPF_M_FHLEN), }; #define BPF_BOOTP_NONE_LEN __arraycount(bpf_bootp_none) #endif @@ -574,13 +559,14 @@ static const struct bpf_insn bpf_bootp_e BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETHERTYPE_IP, 1, 0), BPF_STMT(BPF_RET + BPF_K, 0), - /* Load frame header length into X. */ - BPF_STMT(BPF_LDX + BPF_W + BPF_IMM, sizeof(struct ether_header)), - /* Copy frame header length to memory */ - BPF_STMT(BPF_STX, BPF_M_FHLEN), + /* Advance to the IP header. */ + BPF_STMT(BPF_LDX + BPF_K, sizeof(struct ether_header)), }; #define BPF_BOOTP_ETHER_LEN __arraycount(bpf_bootp_ether) +#define BOOTP_MIN_SIZE sizeof(struct ip) + sizeof(struct udphdr) + \ +sizeof(struct bootp) + static const struct bpf_insn bpf_bootp_filter[] = { /* Make sure it's an IPv4 packet. */ BPF_STMT(BPF_LD + BPF_B + BPF_IND, 0), @@ -588,15 +574,6 @@ static const struct bpf_insn bpf_bootp_f BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0x40, 1, 0), BPF_STMT(BPF_RET + BPF_K, 0), - /* Ensure IP header length is big enough and - * store the IP header length in memory. */ - BPF_STMT(BPF_LD + BPF_B + BPF_IND, 0), - BPF_STMT(BPF_ALU + BPF_AND + BPF_K, 0x0f), - BPF_STMT(BPF_ALU + BPF_MUL + BPF_K, 4), - BPF_JUMP(BPF_JMP + BPF_JGE + BPF_K, sizeof(struct ip), 1, 0), - BPF_STMT(BPF_RET + BPF_K, 0), - BPF_STMT(BPF_ST, BPF_M_IPHLEN), - /* Make sure it's a UDP packet. */ BPF_STMT(BPF_LD + BPF_B + BPF_IND, offsetof(struct ip, ip_p)), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 1, 0), @@ -607,49 +584,17 @@ static const struct bpf_insn bpf_bootp_f BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 0, 1), BPF_STMT(BPF_RET + BPF_K, 0), - /* Store IP length. */ - BPF_STMT(BPF_LD + BPF_H + BPF_IND, offsetof(struct ip, ip_len)), - BPF_STMT(BPF_ST, BPF_M_IPLEN), - /* Advance to the UDP header. */ - BPF_STMT(BPF_LD + BPF_MEM, BPF_M_IPHLEN), + BPF_STMT(BPF_LD + BPF_B + BPF_IND, 0), + BPF_STMT(BPF_ALU + BPF_AND + BPF_K, 0x0f), + BPF_STMT(BPF_ALU + BPF_MUL + BPF_K, 4), BPF_STMT(BPF_ALU + BPF_ADD + BPF_X, 0), BPF_STMT(BPF_MISC + BPF_TAX, 0), - /* Store UDP location */ - BPF_STMT(BPF_STX, BPF_M_UDP), - /* Make sure it's from and to the right port. */ BPF_STMT(BPF_LD + BPF_W + BPF_IND, 0), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, (BOOTPS << 16) + BOOTPC, 1, 0), BPF_STMT(BPF_RET + BPF_K, 0), - - /* Store UDP length. */ - BPF_STMT(BPF_LD + BPF_H + BPF_IND, offsetof(struct udphdr, uh_ulen)), - BPF_STMT(BPF_ST, BPF_M_UDPLEN), - - /* Ensure that UDP length + IP header length == IP length */ - /* Copy IP header length to X. */ - BPF_STMT(BPF_LDX + BPF_MEM, BPF_M_IPHLEN), - /* Add UDP length (A) to IP header length (X). */ - BPF_STMT(BPF_ALU + BPF_ADD + BPF_X, 0), - /* Store result in X. */ - BPF_STMT(BPF_MISC + BPF_TAX, 0), - /* Copy IP length to A. */ - BPF_STMT(BPF_LD + BPF_MEM, BPF_M_IPLEN), - /* Ensure X == A. */ - BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_X, 0, 1, 0), - BPF_STMT(BPF_RET + BPF_K, 0), - - /* Advance to the BOOTP packet. */ - BPF_STMT(BPF_LD + BPF_MEM, BPF_M_UDP), - BPF_STMT(BPF_ALU + BPF_ADD + BPF_K,
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Oct 11 11:03:59 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.8.in dhcpcd.c if-bsd.c if-options.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/external/bsd/dhcpcd/dist/src/bpf.c \ src/external/bsd/dhcpcd/dist/src/dhcp6.c cvs rdiff -u -r1.27 -r1.28 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.3 -r1.4 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in cvs rdiff -u -r1.26 -r1.27 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.13 -r1.14 src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.17 -r1.18 src/external/bsd/dhcpcd/dist/src/if-options.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Sep 13 11:54:03 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/external/bsd/dhcpcd/dist/src/dhcp.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.26 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.27 --- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.26 Fri Sep 13 11:01:50 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcp.c Fri Sep 13 11:54:03 2019 @@ -3264,7 +3264,13 @@ valid_udp_packet(void *packet, size_t pl if (from != NULL) from->s_addr = ip->ip_src.s_addr; + /* Check we have the IP header */ ip_hlen = (size_t)ip->ip_hl * 4; + if (ip_hlen > plen) { + errno = ENOBUFS; + return -1; + } + if (in_cksum(ip, ip_hlen, NULL) != 0) { errno = EINVAL; return -1;
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Sep 13 11:54:03 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/external/bsd/dhcpcd/dist/src/dhcp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist
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
CVS commit: src/external/bsd/dhcpcd/dist
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
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Sep 4 13:28:57 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c dhcp6.c dhcpcd.8.in dhcpcd.c if-bsd.c ipv6.c ipv6.h ipv6nd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/external/bsd/dhcpcd/dist/src/dhcp.c \ src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.11 -r1.12 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in cvs rdiff -u -r1.3 -r1.4 src/external/bsd/dhcpcd/dist/src/ipv6.c cvs rdiff -u -r1.4 -r1.5 src/external/bsd/dhcpcd/dist/src/ipv6.h cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/src/ipv6nd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Sep 4 13:28:57 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c dhcp6.c dhcpcd.8.in dhcpcd.c if-bsd.c ipv6.c ipv6.h ipv6nd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/external/bsd/dhcpcd/dist/src/dhcp.c \ src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.11 -r1.12 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in cvs rdiff -u -r1.3 -r1.4 src/external/bsd/dhcpcd/dist/src/ipv6.c cvs rdiff -u -r1.4 -r1.5 src/external/bsd/dhcpcd/dist/src/ipv6.h cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/src/ipv6nd.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.24 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.25 --- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.24 Wed Aug 21 17:12:19 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcp.c Wed Sep 4 13:28:56 2019 @@ -1176,11 +1176,8 @@ read_lease(struct interface *ifp, struct bytes = dhcp_read_lease_fd(fd, (void **)); if (fd_opened) close(fd); - if (bytes == 0) { - free(lease); - logerr("%s: dhcp_read_lease_fd", __func__); + if (bytes == 0) return 0; - } /* Ensure the packet is at lease BOOTP sized * with a vendor area of 4 octets @@ -1584,7 +1581,7 @@ eexit: } static uint16_t -in_cksum(void *data, size_t len, uint32_t *isum) +in_cksum(const void *data, size_t len, uint32_t *isum) { const uint16_t *word = data; uint32_t sum = isum != NULL ? *isum : 0; @@ -1593,7 +1590,7 @@ in_cksum(void *data, size_t len, uint32_ sum += *word++; if (len == 1) - sum += *(const uint8_t *)word; + sum += htons((uint16_t)(*(const uint8_t *)word << 8)); if (isum != NULL) *isum = sum; @@ -2237,7 +2234,7 @@ dhcp_bind(struct interface *ifp) ipv4_applyaddr(ifp); #ifdef IP_PKTINFO - /* Close the BPF filter as we can now receive the DHCP renew messages + /* Close the BPF filter as we can now receive DHCP messages * on a UDP socket. */ if (state->udp_fd == -1 || (state->old != NULL && state->old->yiaddr != state->new->yiaddr)) @@ -2246,9 +2243,15 @@ dhcp_bind(struct interface *ifp) /* If not in master mode, open an address specific socket. */ if (ctx->udp_fd == -1) { state->udp_fd = dhcp_openudp(ifp); - if (state->udp_fd == -1) + if (state->udp_fd == -1) { logerr(__func__); - else +/* Address sharing without master mode is + * not supported. It's also possible another + * DHCP client could be running which is + * even worse. + * We still need to work, so re-open BPF. */ +dhcp_openbpf(ifp); + } else eloop_event_add(ctx->eloop, state->udp_fd, dhcp_handleifudp, ifp); } @@ -3293,7 +3296,8 @@ valid_udp_packet(void *packet, size_t pl pseudo_ip.ip_len = udp->uh_ulen; csum = 0; in_cksum(_ip, sizeof(pseudo_ip), ); - if (in_cksum(udp, ntohs(udp->uh_ulen), ) != uh_sum) { + csum = in_cksum(udp, ntohs(udp->uh_ulen), ); + if (csum != uh_sum) { errno = EINVAL; return -1; } @@ -3662,6 +3666,7 @@ static void dhcp_start1(void *arg) { struct interface *ifp = arg; + struct dhcpcd_ctx *ctx = ifp->ctx; struct if_options *ifo = ifp->options; struct dhcp_state *state; struct stat st; @@ -3672,17 +3677,19 @@ dhcp_start1(void *arg) return; /* Listen on *.*.*.*:bootpc so that the kernel never sends an - * ICMP port unreachable message back to the DHCP server */ - if (ifp->ctx->udp_fd == -1) { - ifp->ctx->udp_fd = dhcp_openudp(NULL); - if (ifp->ctx->udp_fd == -1) { + * ICMP port unreachable message back to the DHCP server. + * Only do this in master mode so we don't swallow messages + * for dhcpcd running on another interface. */ + if (ctx->udp_fd == -1 && ctx->options & DHCPCD_MASTER) { + ctx->udp_fd = dhcp_openudp(NULL); + if (ctx->udp_fd == -1) { /* Don't log an error if some other process * is handling this. */ if (errno != EADDRINUSE) logerr("%s: dhcp_openudp", __func__); } else - eloop_event_add(ifp->ctx->eloop, - ifp->ctx->udp_fd, dhcp_handleudp, ifp->ctx); + eloop_event_add(ctx->eloop, + ctx->udp_fd, dhcp_handleudp, ctx); } if (dhcp_init(ifp) == -1) { Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.24 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.25 --- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.24 Wed Aug 21 17:12:19 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c Wed Sep 4 13:28:56 2019 @@ -950,12 +950,7 @@ dhcpcd_prestartinterface(void *arg) if ((!(ifp->ctx->options & DHCPCD_MASTER) || ifp->options->options & DHCPCD_IF_UP) && - if_up(ifp) == -1 -#ifdef __sun - /* Interface could not yet be plumbed. */ - &&
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Aug 21 17:12:19 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcpcd.c if-bsd.c if-options.c ipv6.h Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/external/bsd/dhcpcd/dist/src/bpf.c cvs rdiff -u -r1.23 -r1.24 src/external/bsd/dhcpcd/dist/src/dhcp.c \ src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.16 -r1.17 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.3 -r1.4 src/external/bsd/dhcpcd/dist/src/ipv6.h 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/bpf.c diff -u src/external/bsd/dhcpcd/dist/src/bpf.c:1.11 src/external/bsd/dhcpcd/dist/src/bpf.c:1.12 --- src/external/bsd/dhcpcd/dist/src/bpf.c:1.11 Tue Jul 30 10:25:03 2019 +++ src/external/bsd/dhcpcd/dist/src/bpf.c Wed Aug 21 17:12:19 2019 @@ -558,6 +558,15 @@ bpf_arp(struct interface *ifp, int fd) #define BPF_M_UDP 3 #define BPF_M_UDPLEN 4 +#ifdef ARPHRD_NONE +static const struct bpf_insn bpf_bootp_none[] = { + /* Set the frame header length to zero. */ + BPF_STMT(BPF_LD + BPF_IMM, 0), + BPF_STMT(BPF_ST, BPF_M_FHLEN), +}; +#define BPF_BOOTP_NONE_LEN __arraycount(bpf_bootp_none) +#endif + static const struct bpf_insn bpf_bootp_ether[] = { /* Make sure this is an IP packet. */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, @@ -665,6 +674,12 @@ bpf_bootp(struct interface *ifp, int fd) bp = bpf; /* Check frame header. */ switch(ifp->family) { +#ifdef ARPHRD_NONE + case ARPHRD_NONE: + memcpy(bp, bpf_bootp_none, sizeof(bpf_bootp_none)); + bp += BPF_BOOTP_NONE_LEN; + break; +#endif case ARPHRD_ETHER: memcpy(bp, bpf_bootp_ether, sizeof(bpf_bootp_ether)); bp += BPF_BOOTP_ETHER_LEN; Index: src/external/bsd/dhcpcd/dist/src/dhcp.c diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.23 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.24 --- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.23 Tue Jul 30 10:25:03 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcp.c Wed Aug 21 17:12:19 2019 @@ -1584,24 +1584,24 @@ eexit: } static uint16_t -checksum(const void *data, size_t len) +in_cksum(void *data, size_t len, uint32_t *isum) { - const uint8_t *addr = data; - uint32_t sum = 0; + const uint16_t *word = data; + uint32_t sum = isum != NULL ? *isum : 0; - while (len > 1) { - sum += (uint32_t)(addr[0] * 256 + addr[1]); - addr += 2; - len -= 2; - } + for (; len > 1; len -= sizeof(*word)) + sum += *word++; if (len == 1) - sum += (uint32_t)(*addr * 256); + sum += *(const uint8_t *)word; + + if (isum != NULL) + *isum = sum; sum = (sum >> 16) + (sum & 0x); sum += (sum >> 16); - return (uint16_t)~htons((uint16_t)sum); + return (uint16_t)~sum; } static struct bootp_pkt * @@ -1639,14 +1639,16 @@ dhcp_makeudppacket(size_t *sz, const uin udp->uh_dport = htons(BOOTPS); udp->uh_ulen = htons((uint16_t)(sizeof(*udp) + length)); ip->ip_len = udp->uh_ulen; - udp->uh_sum = checksum(udpp, sizeof(*ip) + sizeof(*udp) + length); + udp->uh_sum = in_cksum(udpp, sizeof(*ip) + sizeof(*udp) + length, NULL); ip->ip_v = IPVERSION; ip->ip_hl = sizeof(*ip) >> 2; ip->ip_id = (uint16_t)arc4random_uniform(UINT16_MAX); ip->ip_ttl = IPDEFTTL; ip->ip_len = htons((uint16_t)(sizeof(*ip) + sizeof(*udp) + length)); - ip->ip_sum = checksum(ip, sizeof(*ip)); + ip->ip_sum = in_cksum(ip, sizeof(*ip), NULL); + if (ip->ip_sum == 0) + ip->ip_sum = 0x; /* RFC 768 */ *sz = sizeof(*ip) + sizeof(*udp) + length; return udpp; @@ -2363,7 +2365,10 @@ dhcp_arp_address(struct interface *ifp) return 0; } #else - if (ifp->options->options & DHCPCD_ARP && ia == NULL) { + if (!(ifp->flags & IFF_NOARP) && + ifp->options->options & DHCPCD_ARP && + ia == NULL) + { struct arp_state *astate; struct dhcp_lease l; @@ -3236,10 +3241,15 @@ valid_udp_packet(void *packet, size_t pl unsigned int flags) { struct ip *ip = packet; - char ip_hlv = *(char *)ip; + struct ip pseudo_ip = { + .ip_p = IPPROTO_UDP, + .ip_src = ip->ip_src, + .ip_dst = ip->ip_dst + }; size_t ip_hlen; uint16_t ip_len, uh_sum; struct udphdr *udp; + uint32_t csum; if (plen < sizeof(*ip)) { if (from != NULL) @@ -3252,13 +3262,13 @@ valid_udp_packet(void *packet, size_t pl from->s_addr = ip->ip_src.s_addr; ip_hlen = (size_t)ip->ip_hl * 4; - if (checksum(ip, ip_hlen) != 0) { + if (in_cksum(ip, ip_hlen, NULL) != 0) { errno = EINVAL; return -1; } - ip_len = ntohs(ip->ip_len); /* Check we have a payload */ + ip_len = ntohs(ip->ip_len); if (ip_len <= ip_hlen + sizeof(*udp)) { errno = ERANGE; return -1; @@ -3272,28 +3282,21 @@ valid_udp_packet(void *packet, size_t pl if (flags & BPF_PARTIALCSUM) return 0; - udp = (struct udphdr *)((char *)ip + ip_hlen); + /* UDP checksum is based on a pseudo IP
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Aug 21 17:12:19 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcpcd.c if-bsd.c if-options.c ipv6.h Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/external/bsd/dhcpcd/dist/src/bpf.c cvs rdiff -u -r1.23 -r1.24 src/external/bsd/dhcpcd/dist/src/dhcp.c \ src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.16 -r1.17 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.3 -r1.4 src/external/bsd/dhcpcd/dist/src/ipv6.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Tue Jul 30 10:25:03 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.c if-bsd.c if-options.c ipv6.c ipv6.h ipv6nd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/src/bpf.c \ src/external/bsd/dhcpcd/dist/src/dhcp6.c cvs rdiff -u -r1.22 -r1.23 src/external/bsd/dhcpcd/dist/src/dhcp.c \ src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.9 -r1.10 src/external/bsd/dhcpcd/dist/src/if-bsd.c \ src/external/bsd/dhcpcd/dist/src/ipv6nd.c cvs rdiff -u -r1.15 -r1.16 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/src/ipv6.c \ src/external/bsd/dhcpcd/dist/src/ipv6.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Tue Jul 30 10:25:03 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.c if-bsd.c if-options.c ipv6.c ipv6.h ipv6nd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/src/bpf.c \ src/external/bsd/dhcpcd/dist/src/dhcp6.c cvs rdiff -u -r1.22 -r1.23 src/external/bsd/dhcpcd/dist/src/dhcp.c \ src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.9 -r1.10 src/external/bsd/dhcpcd/dist/src/if-bsd.c \ src/external/bsd/dhcpcd/dist/src/ipv6nd.c cvs rdiff -u -r1.15 -r1.16 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/src/ipv6.c \ src/external/bsd/dhcpcd/dist/src/ipv6.h 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/bpf.c diff -u src/external/bsd/dhcpcd/dist/src/bpf.c:1.10 src/external/bsd/dhcpcd/dist/src/bpf.c:1.11 --- src/external/bsd/dhcpcd/dist/src/bpf.c:1.10 Wed Jul 24 09:57:43 2019 +++ src/external/bsd/dhcpcd/dist/src/bpf.c Tue Jul 30 10:25:03 2019 @@ -93,7 +93,7 @@ bpf_frame_header_len(const struct interf } } -static const uint8_t etherbroadcastaddr[] = +static const uint8_t etherbcastaddr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; int @@ -104,7 +104,7 @@ bpf_frame_bcast(const struct interface * case ARPHRD_ETHER: return memcmp(frame + offsetof(struct ether_header, ether_dhost), - etherbroadcastaddr, sizeof(etherbroadcastaddr)); + etherbcastaddr, sizeof(etherbcastaddr)); default: return -1; } @@ -552,6 +552,12 @@ bpf_arp(struct interface *ifp, int fd) } #endif +#define BPF_M_FHLEN 0 +#define BPF_M_IPHLEN 1 +#define BPF_M_IPLEN 2 +#define BPF_M_UDP 3 +#define BPF_M_UDPLEN 4 + static const struct bpf_insn bpf_bootp_ether[] = { /* Make sure this is an IP packet. */ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, @@ -561,16 +567,26 @@ static const struct bpf_insn bpf_bootp_e /* Load frame header length into X. */ BPF_STMT(BPF_LDX + BPF_W + BPF_IMM, sizeof(struct ether_header)), - /* Copy to M0. */ - BPF_STMT(BPF_STX, 0), + /* Copy frame header length to memory */ + BPF_STMT(BPF_STX, BPF_M_FHLEN), }; #define BPF_BOOTP_ETHER_LEN __arraycount(bpf_bootp_ether) static const struct bpf_insn bpf_bootp_filter[] = { - /* Make sure it's an optionless IPv4 packet. */ + /* Make sure it's an IPv4 packet. */ + BPF_STMT(BPF_LD + BPF_B + BPF_IND, 0), + BPF_STMT(BPF_ALU + BPF_AND + BPF_K, 0xf0), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0x40, 1, 0), + BPF_STMT(BPF_RET + BPF_K, 0), + + /* Ensure IP header length is big enough and + * store the IP header length in memory. */ BPF_STMT(BPF_LD + BPF_B + BPF_IND, 0), - BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0x45, 1, 0), + BPF_STMT(BPF_ALU + BPF_AND + BPF_K, 0x0f), + BPF_STMT(BPF_ALU + BPF_MUL + BPF_K, 4), + BPF_JUMP(BPF_JMP + BPF_JGE + BPF_K, sizeof(struct ip), 1, 0), BPF_STMT(BPF_RET + BPF_K, 0), + BPF_STMT(BPF_ST, BPF_M_IPHLEN), /* Make sure it's a UDP packet. */ BPF_STMT(BPF_LD + BPF_B + BPF_IND, offsetof(struct ip, ip_p)), @@ -582,39 +598,42 @@ static const struct bpf_insn bpf_bootp_f BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 0, 1), BPF_STMT(BPF_RET + BPF_K, 0), - /* Store IP location in M1. */ + /* Store IP length. */ BPF_STMT(BPF_LD + BPF_H + BPF_IND, offsetof(struct ip, ip_len)), - BPF_STMT(BPF_ST, 1), - - /* Store IP length in M2. */ - BPF_STMT(BPF_LD + BPF_H + BPF_IND, offsetof(struct ip, ip_len)), - BPF_STMT(BPF_ST, 2), + BPF_STMT(BPF_ST, BPF_M_IPLEN), /* Advance to the UDP header. */ - BPF_STMT(BPF_MISC + BPF_TXA, 0), - BPF_STMT(BPF_ALU + BPF_ADD + BPF_K, sizeof(struct ip)), + BPF_STMT(BPF_LD + BPF_MEM, BPF_M_IPHLEN), + BPF_STMT(BPF_ALU + BPF_ADD + BPF_X, 0), BPF_STMT(BPF_MISC + BPF_TAX, 0), - /* Store X in M3. */ - BPF_STMT(BPF_STX, 3), + /* Store UDP location */ + BPF_STMT(BPF_STX, BPF_M_UDP), /* Make sure it's from and to the right port. */ BPF_STMT(BPF_LD + BPF_W + BPF_IND, 0), BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, (BOOTPS << 16) + BOOTPC, 1, 0), BPF_STMT(BPF_RET + BPF_K, 0), - /* Store UDP length in X. */ + /* Store UDP length. */ BPF_STMT(BPF_LD + BPF_H + BPF_IND, offsetof(struct udphdr, uh_ulen)), + BPF_STMT(BPF_ST, BPF_M_UDPLEN), + + /* Ensure that UDP length + IP header length == IP length */ + /* Copy IP header length to X. */ + BPF_STMT(BPF_LDX + BPF_MEM, BPF_M_IPHLEN), + /* Add UDP length (A) to IP header length (X). */ + BPF_STMT(BPF_ALU + BPF_ADD + BPF_X, 0), + /* Store result in X. */ BPF_STMT(BPF_MISC + BPF_TAX, 0), - /* Copy IP length in M2 to A. */ - BPF_STMT(BPF_LD + BPF_MEM, 2), - /* Ensure IP length - IP header size == UDP length. */ - BPF_STMT(BPF_ALU + BPF_SUB + BPF_K, sizeof(struct ip)), + /* Copy IP length to A. */ + BPF_STMT(BPF_LD + BPF_MEM, BPF_M_IPLEN), + /* Ensure X == A. */ BPF_JUMP(BPF_JMP +
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Jul 26 10:53:45 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp6.c ipv6.c ipv6.h ipv6nd.c Log Message: As dhcpcd no longer supports IPv4 address advertisement for SMALL builds, remove the equivalent IPv6 functionality. This shouldn't be an issue as this is only used for IPv6 address sharing, which only the NetBSD kernel currently supports. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/external/bsd/dhcpcd/dist/src/dhcp6.c cvs rdiff -u -r1.1.1.17 -r1.2 src/external/bsd/dhcpcd/dist/src/ipv6.c cvs rdiff -u -r1.1.1.11 -r1.2 src/external/bsd/dhcpcd/dist/src/ipv6.h cvs rdiff -u -r1.8 -r1.9 src/external/bsd/dhcpcd/dist/src/ipv6nd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Jul 26 10:53:45 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp6.c ipv6.c ipv6.h ipv6nd.c Log Message: As dhcpcd no longer supports IPv4 address advertisement for SMALL builds, remove the equivalent IPv6 functionality. This shouldn't be an issue as this is only used for IPv6 address sharing, which only the NetBSD kernel currently supports. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/external/bsd/dhcpcd/dist/src/dhcp6.c cvs rdiff -u -r1.1.1.17 -r1.2 src/external/bsd/dhcpcd/dist/src/ipv6.c cvs rdiff -u -r1.1.1.11 -r1.2 src/external/bsd/dhcpcd/dist/src/ipv6.h cvs rdiff -u -r1.8 -r1.9 src/external/bsd/dhcpcd/dist/src/ipv6nd.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/dhcp6.c diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.9 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.10 --- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.9 Wed Jul 24 09:57:43 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcp6.c Fri Jul 26 10:53:45 2019 @@ -1523,7 +1523,9 @@ dhcp6_dadcallback(void *arg) if (valid) dhcpcd_daemonise(ifp->ctx); } +#ifdef ND6_ADVERTISE ipv6nd_advertise(ia); +#endif } } } @@ -3927,16 +3929,20 @@ dhcp6_free(struct interface *ifp) void dhcp6_abort(struct interface *ifp) { +#ifdef ND6_ADVERTISE struct dhcp6_state *state; struct ipv6_addr *ia; +#endif eloop_timeout_delete(ifp->ctx->eloop, dhcp6_start1, ifp); +#ifdef ND6_ADVERTISE state = D6_STATE(ifp); if (state == NULL) return; TAILQ_FOREACH(ia, >addrs, next) { ipv6nd_advertise(ia); } +#endif } void Index: src/external/bsd/dhcpcd/dist/src/ipv6.c diff -u src/external/bsd/dhcpcd/dist/src/ipv6.c:1.1.1.17 src/external/bsd/dhcpcd/dist/src/ipv6.c:1.2 --- src/external/bsd/dhcpcd/dist/src/ipv6.c:1.1.1.17 Wed Jul 24 09:54:54 2019 +++ src/external/bsd/dhcpcd/dist/src/ipv6.c Fri Jul 26 10:53:45 2019 @@ -616,8 +616,10 @@ ipv6_deleteaddr(struct ipv6_addr *ia) } } +#ifdef ND6_ADVERTISE /* Advertise the address if it exists on another interface. */ ipv6nd_advertise(ia); +#endif } static int @@ -625,8 +627,10 @@ ipv6_addaddr1(struct ipv6_addr *ia, cons { struct interface *ifp; uint32_t pltime, vltime; - bool vltime_was_zero; __printflike(1, 2) void (*logfunc)(const char *, ...); +#ifdef ND6_ADVERTISE + bool vltime_was_zero; +#endif #ifdef __sun struct ipv6_state *state; struct ipv6_addr *ia2; @@ -694,7 +698,9 @@ ipv6_addaddr1(struct ipv6_addr *ia, cons " seconds", ifp->name, ia->prefix_pltime, ia->prefix_vltime); +#ifdef ND6_ADVERTISE vltime_was_zero = ia->prefix_vltime == 0; +#endif if (if_address6(RTM_NEWADDR, ia) == -1) { logerr(__func__); /* Restore real pltime and vltime */ @@ -758,9 +764,11 @@ ipv6_addaddr1(struct ipv6_addr *ia, cons } #endif +#ifdef ND6_ADVERTISE /* Re-advertise the preferred address to be safe. */ if (!vltime_was_zero) ipv6nd_advertise(ia); +#endif return 0; } @@ -1081,9 +1089,11 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx, case RTM_DELADDR: if (ia != NULL) { TAILQ_REMOVE(>addrs, ia, next); +#ifdef ND6_ADVERTISE /* Advertise the address if it exists on * another interface. */ ipv6nd_advertise(ia); +#endif /* We'll free it at the end of the function. */ } break; Index: src/external/bsd/dhcpcd/dist/src/ipv6.h diff -u src/external/bsd/dhcpcd/dist/src/ipv6.h:1.1.1.11 src/external/bsd/dhcpcd/dist/src/ipv6.h:1.2 --- src/external/bsd/dhcpcd/dist/src/ipv6.h:1.1.1.11 Wed Jul 24 09:54:54 2019 +++ src/external/bsd/dhcpcd/dist/src/ipv6.h Fri Jul 26 10:53:45 2019 @@ -149,6 +149,10 @@ # define IN6_IFF_DETACHED 0 #endif +#ifndef SMALL +# define ND6_ADVERTISE +#endif + #ifdef INET6 TAILQ_HEAD(ipv6_addrhead, ipv6_addr); struct ipv6_addr { Index: src/external/bsd/dhcpcd/dist/src/ipv6nd.c diff -u src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.8 src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.9 --- src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.8 Wed Jul 24 09:57:43 2019 +++ src/external/bsd/dhcpcd/dist/src/ipv6nd.c Fri Jul 26 10:53:45 2019 @@ -389,6 +389,7 @@ ipv6nd_sendrsprobe(void *arg) } } +#ifdef ND6_ADVERTISE static void ipv6nd_sendadvertisement(void *arg) { @@ -526,6 +527,7 @@ ipv6nd_advertise(struct ipv6_addr *ia) eloop_timeout_delete(ctx->eloop, ipv6nd_sendadvertisement, iaf); ipv6nd_sendadvertisement(iaf); } +#endif /* ND6_ADVERTISE */ static void ipv6nd_expire(void *arg) @@ -908,7 +910,9 @@ try_script: return; } } +#ifdef ND6_ADVERTISE ipv6nd_advertise(ia); +#endif } }
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Jul 26 10:47:29 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c Log Message: Allow dhcpcd to be built without ARP support for SMALL builds. This is fine because the kernel supports RFC 5227 which dhcpcd uses instead to detect and act on address duplication. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/external/bsd/dhcpcd/dist/src/dhcp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Jul 26 10:47:29 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c Log Message: Allow dhcpcd to be built without ARP support for SMALL builds. This is fine because the kernel supports RFC 5227 which dhcpcd uses instead to detect and act on address duplication. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/external/bsd/dhcpcd/dist/src/dhcp.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.21 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.22 --- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.21 Thu Jul 25 08:55:18 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcp.c Fri Jul 26 10:47:29 2019 @@ -2329,7 +2329,9 @@ dhcp_arp_new(struct interface *ifp, stru return astate; } #endif +#endif /* ARP */ +#if defined(ARP) || defined(KERNEL_RFC5227) static int dhcp_arp_address(struct interface *ifp) { @@ -2417,7 +2419,7 @@ dhcp_static(struct interface *ifp) ia ? >addr : >req_addr, ia ? >mask : >req_mask); if (state->offer_len) -#ifdef ARP +#if defined(ARP) || defined(KERNEL_RFC5227) dhcp_arp_bind(ifp); #else dhcp_bind(ifp); @@ -3210,7 +3212,7 @@ rapidcommit: lease->frominfo = 0; eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); -#ifdef ARP +#if defined(ARP) || defined(KERNEL_RFC5227) dhcp_arp_bind(ifp); #else dhcp_bind(ifp);
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Jul 26 10:39:29 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcpcd.8.in Log Message: Replace hook example 10-wpa_supplicant with 29-lookup-hostname. Fixes PR install/54351. To generate a diff of this commit: cvs rdiff -u -r1.1.1.13 -r1.2 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in 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/dhcpcd.8.in diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.1.1.13 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.2 --- src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in:1.1.1.13 Wed Jul 24 09:54:51 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in Fri Jul 26 10:39:29 2019 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 23, 2019 +.Dd July 25, 2019 .Dt DHCPCD 8 .Os .Sh NAME @@ -234,12 +234,11 @@ and need to be copied to .Pa @HOOKDIR@ if you intend to use them. For example, you could install -.Pa 10-wpa_supplicant +.Pa 29-lookup-hostname so that .Nm -can ensure that -.Xr wpa_supplicant 8 -is always running on a hot-plugged wireless interface. +can lookup the hostname of the IP address in DNS if no hostname +is given by the lease and one is not already set. .Ss Fine tuning You can fine-tune the behaviour of .Nm @@ -404,10 +403,6 @@ is specified then this applies to all in If .Nm is not running, then it starts up as normal. -This may also cause -.Xr wpa_supplicant 8 -to reload its configuration for each interface as well if the -relevant hook script has been installed. .It Fl N , Fl Fl renew Op Ar interface Notifies .Nm
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Fri Jul 26 10:39:29 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcpcd.8.in Log Message: Replace hook example 10-wpa_supplicant with 29-lookup-hostname. Fixes PR install/54351. To generate a diff of this commit: cvs rdiff -u -r1.1.1.13 -r1.2 src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Thu Jul 25 08:55:18 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c dhcpcd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.21 -r1.22 src/external/bsd/dhcpcd/dist/src/dhcpcd.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.20 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.21 --- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.20 Wed Jul 24 09:57:43 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcp.c Thu Jul 25 08:55:18 2019 @@ -127,7 +127,7 @@ static const char * const dhcp_params[] static int dhcp_openbpf(struct interface *); static void dhcp_start1(void *); -#ifdef ARP +#if defined(ARP) && (!defined(KERNEL_RFC5227) || defined(ARPING)) static void dhcp_arp_found(struct arp_state *, const struct arp_msg *); #endif static void dhcp_handledhcp(struct interface *, struct bootp *, size_t, @@ -1958,6 +1958,7 @@ dhcp_rebind(void *arg) send_rebind(ifp); } +#if defined(ARP) || defined(IN_IFF_DUPLICATED) static void dhcp_finish_dad(struct interface *ifp, struct in_addr *ia) { @@ -2026,19 +2027,22 @@ dhcp_addr_duplicated(struct interface *i eloop_timeout_add_sec(ifp->ctx->eloop, DHCP_RAND_MAX, dhcp_discover, ifp); } +#endif -#ifdef ARP +#if defined(ARP) && (!defined(KERNEL_RFC5227) || defined(ARPING)) static void dhcp_arp_not_found(struct arp_state *astate) { struct interface *ifp; +#ifdef ARPING struct dhcp_state *state; struct if_options *ifo; +#endif ifp = astate->iface; +#ifdef ARPING state = D_STATE(ifp); ifo = ifp->options; -#ifdef ARPING if (ifo->arping_len && state->arping_index < ifo->arping_len) { /* We didn't find a profile for this * address or hwaddr, so move to the next @@ -2062,12 +2066,11 @@ static void dhcp_arp_found(struct arp_state *astate, const struct arp_msg *amsg) { struct in_addr addr; + struct interface *ifp = astate->iface; #ifdef ARPING - struct interface *ifp; struct dhcp_state *state; struct if_options *ifo; - ifp = astate->iface; state = D_STATE(ifp); ifo = ifp->options; @@ -2093,6 +2096,8 @@ dhcp_arp_found(struct arp_state *astate, dhcpcd_startinterface(ifp); return; } +#else + UNUSED(amsg); #endif addr = astate->addr; @@ -2304,6 +2309,7 @@ dhcp_arp_defend_failed(struct arp_state } #endif +#if !defined(KERNEL_RFC5227) || defined(ARPING) static struct arp_state * dhcp_arp_new(struct interface *ifp, struct in_addr *addr) { @@ -2322,6 +2328,7 @@ dhcp_arp_new(struct interface *ifp, stru #endif return astate; } +#endif static int dhcp_arp_address(struct interface *ifp) Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.21 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.22 --- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.21 Wed Jul 24 09:57:43 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c Thu Jul 25 08:55:18 2019 @@ -1210,9 +1210,11 @@ dhcpcd_handlehwaddr(struct dhcpcd_ctx *c static void if_reboot(struct interface *ifp, int argc, char **argv) { +#ifdef INET unsigned long long oldopts; oldopts = ifp->options->options; +#endif script_runreason(ifp, "RECONFIGURE"); dhcpcd_initstate1(ifp, argc, argv, 0); #ifdef INET @@ -2123,6 +2125,12 @@ exit1: } free(ctx.ifaces); } +#ifdef HAVE_OPEN_MEMSTREAM + if (ctx.script_fp) + fclose(ctx.script_fp); +#endif + free(ctx.script_buf); + free(ctx.script_env); free_options(, ifo); rt_dispose(); free(ctx.duid); @@ -2146,11 +2154,5 @@ exit1: if (ctx.options & DHCPCD_FORKED) _exit(i); /* so atexit won't remove our pidfile */ #endif -#ifdef HAVE_OPEN_MEMSTREAM - if (ctx.script_fp) - fclose(ctx.script_fp); -#endif - free(ctx.script_buf); - free(ctx.script_env); return i; }
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Thu Jul 25 08:55:18 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: dhcp.c dhcpcd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.21 -r1.22 src/external/bsd/dhcpcd/dist/src/dhcpcd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Jul 24 15:06:21 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: logerr.c Log Message: Fix SMALL build. To generate a diff of this commit: cvs rdiff -u -r1.1.1.4 -r1.2 src/external/bsd/dhcpcd/dist/src/logerr.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/logerr.c diff -u src/external/bsd/dhcpcd/dist/src/logerr.c:1.1.1.4 src/external/bsd/dhcpcd/dist/src/logerr.c:1.2 --- src/external/bsd/dhcpcd/dist/src/logerr.c:1.1.1.4 Wed Jul 24 09:54:55 2019 +++ src/external/bsd/dhcpcd/dist/src/logerr.c Wed Jul 24 15:06:21 2019 @@ -209,6 +209,7 @@ vlogmessage(int pri, const char *fmt, va #ifdef SMALL vsyslog(pri, fmt, args); + return len; #else if (ctx->log_file == NULL) { vsyslog(pri, fmt, args);
CVS commit: src/external/bsd/dhcpcd/dist/src
Module Name:src Committed By: roy Date: Wed Jul 24 15:06:21 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/src: logerr.c Log Message: Fix SMALL build. To generate a diff of this commit: cvs rdiff -u -r1.1.1.4 -r1.2 src/external/bsd/dhcpcd/dist/src/logerr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Wed Jul 24 09:57:43 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/hooks: 20-resolv.conf 50-ntp.conf src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.c if-bsd.c if-options.c ipv6nd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf \ src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf cvs rdiff -u -r1.9 -r1.10 src/external/bsd/dhcpcd/dist/src/bpf.c cvs rdiff -u -r1.19 -r1.20 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.8 -r1.9 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.20 -r1.21 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.7 -r1.8 src/external/bsd/dhcpcd/dist/src/ipv6nd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Wed Jul 24 09:57:43 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/hooks: 20-resolv.conf 50-ntp.conf src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcp6.c dhcpcd.c if-bsd.c if-options.c ipv6nd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf \ src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf cvs rdiff -u -r1.9 -r1.10 src/external/bsd/dhcpcd/dist/src/bpf.c cvs rdiff -u -r1.19 -r1.20 src/external/bsd/dhcpcd/dist/src/dhcp.c cvs rdiff -u -r1.8 -r1.9 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.20 -r1.21 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.14 -r1.15 src/external/bsd/dhcpcd/dist/src/if-options.c cvs rdiff -u -r1.7 -r1.8 src/external/bsd/dhcpcd/dist/src/ipv6nd.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/hooks/20-resolv.conf diff -u src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.2 src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.3 --- src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf:1.2 Sat Sep 22 13:17:46 2018 +++ src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf Wed Jul 24 09:57:43 2019 @@ -19,6 +19,7 @@ build_resolv_conf() interfaces=$(list_interfaces "$resolv_conf_dir") # Build the resolv.conf + header= if [ -n "$interfaces" ]; then # Build the header for x in ${interfaces}; do @@ -69,30 +70,26 @@ build_resolv_conf() } # Extract any ND DNS options from the RA -# For now, we ignore the lifetime of the DNS options unless they -# are absent or zero. -# In this case they are removed from consideration. -# See draft-gont-6man-slaac-dns-config-issues-01 for issues -# regarding DNS option lifetime in ND messages. +# Obey the lifetimes eval_nd_dns() { - eval ltime=\$nd${i}_rdnss${j}_lifetime - if [ -z "$ltime" ] || [ "$ltime" = 0 ]; then - rdnss= - else + + eval rdnsstime=\$nd${i}_rdnss${j}_lifetime + [ -z "$rdnsstime" ] && return 1 + ltime=$(($rdnsstime - $offset)) + if [ "$ltime" -gt 0 ]; then eval rdnss=\$nd${i}_rdnss${j}_servers + [ -n "$rdnss" ] && new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss" fi - eval ltime=\$nd${i}_dnssl${j}_lifetime - if [ -z "$ltime" ] || [ "$ltime" = 0 ]; then - dnssl= - else + + eval dnssltime=\$nd${i}_dnssl${j}_lifetime + [ -z "$dnssltime" ] && return 1 + ltime=$(($dnssltime - $offset)) + if [ "$ltime" -gt 0 ]; then eval dnssl=\$nd${i}_dnssl${j}_search + [ -n "$dnssl" ] && new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl" fi - [ -z "${rdnss}${dnssl}" ] && return 1 - - [ -n "$rdnss" ] && new_rdnss="$new_rdnss${new_rdnss:+ }$rdnss" - [ -n "$dnssl" ] && new_dnssl="$new_dnssl${new_dnssl:+ }$dnssl" j=$(($j + 1)) return 0 } @@ -106,12 +103,16 @@ add_resolv_conf() i=1 j=1 while true; do + eval acquired=\$nd${i}_acquired + [ -z "$acquired" ] && break + eval now=\$nd${i}_now + [ -z "$now" ] && break + offset=$(($now - $acquired)) while true; do eval_nd_dns || break done i=$(($i + 1)) j=1 - eval_nd_dns || break done [ -n "$new_rdnss" ] && \ new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$new_rdnss" Index: src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf diff -u src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf:1.2 src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf:1.3 --- src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf:1.2 Sat Sep 22 13:17:46 2018 +++ src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf Wed Jul 24 09:57:43 2019 @@ -62,6 +62,7 @@ build_ntp_conf() # Build a list of interfaces interfaces=$(list_interfaces "$ntp_conf_dir") + header= servers= if [ -n "$interfaces" ]; then # Build the header Index: src/external/bsd/dhcpcd/dist/src/bpf.c diff -u src/external/bsd/dhcpcd/dist/src/bpf.c:1.9 src/external/bsd/dhcpcd/dist/src/bpf.c:1.10 --- src/external/bsd/dhcpcd/dist/src/bpf.c:1.9 Sat May 4 09:42:15 2019 +++ src/external/bsd/dhcpcd/dist/src/bpf.c Wed Jul 24 09:57:43 2019 @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ /* * dhcpcd: BPF arp and bootp filtering * Copyright (c) 2006-2019 Roy Marples @@ -84,7 +85,7 @@ size_t bpf_frame_header_len(const struct interface *ifp) { - switch(ifp->family) { + switch (ifp->family) { case ARPHRD_ETHER: return sizeof(struct ether_header); default: @@ -92,6 +93,23 @@ bpf_frame_header_len(const struct interf } } +static const uint8_t etherbroadcastaddr[] = +{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + +int +bpf_frame_bcast(const struct interface *ifp, const char *frame) +{ + + switch (ifp->family) { + case ARPHRD_ETHER: + return memcmp(frame + + offsetof(struct ether_header, ether_dhost), + etherbroadcastaddr, sizeof(etherbroadcastaddr)); + default: + return -1; + } +} + #ifndef __linux__ /* Linux is a special snowflake
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Wed Jun 26 17:47:47 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/hooks: 30-hostname src/external/bsd/dhcpcd/dist/src: dhcp6.c dhcpcd.c if-bsd.c ipv6nd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/hooks/30-hostname cvs rdiff -u -r1.7 -r1.8 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.19 -r1.20 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/src/ipv6nd.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/hooks/30-hostname diff -u src/external/bsd/dhcpcd/dist/hooks/30-hostname:1.2 src/external/bsd/dhcpcd/dist/hooks/30-hostname:1.3 --- src/external/bsd/dhcpcd/dist/hooks/30-hostname:1.2 Sat Sep 22 13:17:46 2018 +++ src/external/bsd/dhcpcd/dist/hooks/30-hostname Wed Jun 26 17:47:47 2019 @@ -80,7 +80,7 @@ need_hostname() set_hostname_vars if [ -n "$old_fqdn" ]; then - if ${hfqdn} || ! ${hsort}; then + if ${hfqdn} || ! ${hshort}; then [ "$hostname" = "$old_fqdn" ] else [ "$hostname" = "${old_fqdn%%.*}" ] Index: src/external/bsd/dhcpcd/dist/src/dhcp6.c diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.7 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.8 --- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.7 Sat May 4 09:42:15 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcp6.c Wed Jun 26 17:47:47 2019 @@ -3783,6 +3783,8 @@ dhcp6_start(struct interface *ifp, enum /* No DHCPv6 config, no existing state * so nothing to do. */ return 0; + case DH6S_INFORM: + break; default: init_state = DH6S_INIT; break; @@ -3935,21 +3937,6 @@ dhcp6_free(struct interface *ifp) } void -dhcp6_dropnondelegates(struct interface *ifp) -{ - -#ifndef SMALL - if (dhcp6_hasprefixdelegation(ifp)) - return; -#endif - if (D6_CSTATE(ifp) == NULL) - return; - - loginfox("%s: dropping DHCPv6 due to no valid routers", ifp->name); - dhcp6_drop(ifp, "EXPIRE6"); -} - -void dhcp6_abort(struct interface *ifp) { struct dhcp6_state *state; Index: src/external/bsd/dhcpcd/dist/src/if-bsd.c diff -u src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.7 src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.8 --- src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.7 Sat May 4 09:42:15 2019 +++ src/external/bsd/dhcpcd/dist/src/if-bsd.c Wed Jun 26 17:47:47 2019 @@ -1063,7 +1063,7 @@ if_rtm(struct dhcpcd_ctx *ctx, const str return 0; if (if_copyrt(ctx, , rtm) == -1) - return -1; + return errno == ENOTSUP ? 0 : -1; #ifdef INET6 /* @@ -1305,7 +1305,8 @@ if_dispatch(struct dhcpcd_ctx *ctx, cons return if_ifa(ctx, (const void *)rtm); #ifdef RTM_DESYNC case RTM_DESYNC: - return dhcpcd_linkoverflow(ctx); + dhcpcd_linkoverflow(ctx); + return 0; #endif } @@ -1325,7 +1326,9 @@ if_handlelink(struct dhcpcd_ctx *ctx) return -1; if (len == 0) return 0; - if (len < rtm.hdr.rtm_msglen) { + if ((size_t)len < offsetof(struct rt_msghdr, rtm_index) || + len < rtm.hdr.rtm_msglen) + { errno = EINVAL; return -1; } Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.19 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.20 --- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.19 Sat May 4 09:42:15 2019 +++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c Wed Jun 26 17:47:47 2019 @@ -1081,8 +1081,7 @@ dhcpcd_handlelink(void *arg) dhcpcd_linkoverflow(ctx); return; } - if (errno != ENOTSUP) - logerr(__func__); + logerr(__func__); } } Index: src/external/bsd/dhcpcd/dist/src/ipv6nd.c diff -u src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.6 src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.7 --- src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.6 Fri Apr 26 14:34:10 2019 +++ src/external/bsd/dhcpcd/dist/src/ipv6nd.c Wed Jun 26 17:47:47 2019 @@ -382,9 +382,6 @@ ipv6nd_sendrsprobe(void *arg) else { logwarnx("%s: no IPv6 Routers available", ifp->name); ipv6nd_drop(ifp); -#ifdef DHCP6 - dhcp6_dropnondelegates(ifp); -#endif } } @@ -1525,9 +1522,6 @@ ipv6nd_expirera(void *arg) struct timespec now, lt, expire, next; bool expired, valid, validone; struct ipv6_addr *ia; -#ifdef DHCP6 - bool anyvalid = false; -#endif ifp = arg; clock_gettime(CLOCK_MONOTONIC, ); @@ -1603,10 +1597,6 @@ ipv6nd_expirera(void *arg) * as well punt it. */ if (!valid && !validone) ipv6nd_free_ra(rap); -#ifdef DHCP6 - else - anyvalid = true; -#endif } if (timespecisset()) @@ -1616,12 +1606,6 @@ ipv6nd_expirera(void *arg) rt_build(ifp->ctx, AF_INET6); script_runreason(ifp, "ROUTERADVERT"); } - -#ifdef DHCP6 - /* No valid routers? Kill any DHCPv6. */ - if (!anyvalid) - dhcp6_dropnondelegates(ifp); -#endif } void
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Wed Jun 26 17:47:47 UTC 2019 Modified Files: src/external/bsd/dhcpcd/dist/hooks: 30-hostname src/external/bsd/dhcpcd/dist/src: dhcp6.c dhcpcd.c if-bsd.c ipv6nd.c Log Message: Sync To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/hooks/30-hostname cvs rdiff -u -r1.7 -r1.8 src/external/bsd/dhcpcd/dist/src/dhcp6.c \ src/external/bsd/dhcpcd/dist/src/if-bsd.c cvs rdiff -u -r1.19 -r1.20 src/external/bsd/dhcpcd/dist/src/dhcpcd.c cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/src/ipv6nd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/external/bsd/dhcpcd/dist/hooks
On 22/09/2018 14:17, Robert Elz wrote: Module Name:src Committed By: kre Date: Sat Sep 22 13:17:46 UTC 2018 Modified Files: src/external/bsd/dhcpcd/dist/hooks: 20-resolv.conf 29-lookup-hostname 30-hostname 50-ntp.conf 50-yp.conf 50-ypbind.in dhcpcd-run-hooks.in Log Message: PR install/53622 (probably) When used as part of a network based install kernel, the SMALL "test" (aka [) does not support -a or -o, so rewrite these scripts to avoid using that. Don't forget that dhcpcd calls resolvconf which does the same thing as the hooks here. Roy
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 04.08.2018 05:44, Robert Elz wrote: > Date:Sat, 4 Aug 2018 04:24:01 +0200 > From:Kamil Rytarowski > Message-ID: <568544f4-36d5-853e-cdf8-248f84fad...@gmx.com> > > | I haven't changed any optimization or similar flags for the builds. > > Then why did the ssh example start giving "perhaps used uninit" warnings > when it had not before?Something changed. I can refer to the opinion of Joerg (expressed on the NetBSD mailing lists) that reporting uninitiated variables are one of the biggest bugs in GCC. I will leave tracking it down to someone with knowledge of GCC code generation algorithms, and push a patch to OpenSSH. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Sat, 4 Aug 2018 04:24:01 +0200 From:Kamil Rytarowski Message-ID: <568544f4-36d5-853e-cdf8-248f84fad...@gmx.com> | I haven't changed any optimization or similar flags for the builds. Then why did the ssh example start giving "perhaps used uninit" warnings when it had not before?Something changed. | Freshly crashed pmax kernel due to integer overflow is a kernel (or | virtualization) bug, but it's also a definition of UB, that it can crash | the computer. I don't know the circumstances of that one, but sure, overflow can cause all kinds of problems, and if it actually occurs, almost anything is possible, depending upon just what the code is doing. I'm not sure what your point is here, no-one is suggesting that real bugs not get fixed. | The dhcpcd one was fixed first in upstream dhcpcd before landing it to src/. "fixed" is the wrong word, as there neither is, nor ever was, any bug there to "fix". You apparently silenced a bogus sanitiser induced warning. That is not a "fix". kre
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 04.08.2018 03:23, Robert Elz wrote: > Date:Sat, 4 Aug 2018 02:15:15 +0200 > From:Kamil Rytarowski > Message-ID: > > > | In general there shall not be a relation between -O level and > | sanitizers. Sanitizers do not need -O0 or -g for operation. > > That's fine. But are you doing compiles that way? (necessary or not) > I haven't changed any optimization or similar flags for the builds. > | GCC also enables more warnings for UBSan that have to be addressed in > | order to compile the source, as the code would be UB anyway (like > | changing the signedness bit with a shift operation). > > Sure, some of those, even though they're not really problems, are easy > to fix in a totally harmless way. That's fine. The UB is a technical C > issue, not really anything that ever fails in those cases though. > Freshly crashed pmax kernel due to integer overflow is a kernel (or virtualization) bug, but it's also a definition of UB, that it can crash the computer. > | And regarding utility of the Undefined Behavior Sanitizer and coverage > | of new tests.. we have just caught a bug on pmax that an integer > | overflow crashed the kernel: > > Sure, no-one is saying that the extra work is not worth while. Just that > you are sometimes fixing non-problems (and causing code churn to do > it - particularly when the code being changed comes from upstream ... in > the dhcpcd case that is not such an issue, as if needed, Roy will fix that > as well, but why would anyone expect the openbsd people to alter ssh > to fix a non problem ?) > Some Undefined Behavior fixes were pulled by FreeBSD (at least one of them merged McKusick!). Regarding the OpenSSH case, I'm in touch with some of their developers and concluded to push it to one of their mailinglist. One of the UB patches was already merged by the OpenBSD project (in tmux). I will go the same way with other patches and submit them upstream, even if some are cautious. The dhcpcd one was fixed first in upstream dhcpcd before landing it to src/. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Sat, 4 Aug 2018 02:15:15 +0200 From:Kamil Rytarowski Message-ID: | In general there shall not be a relation between -O level and | sanitizers. Sanitizers do not need -O0 or -g for operation. That's fine. But are you doing compiles that way? (necessary or not) | GCC is known for reporting uninitialized variables and I wouldn't blame | sanitizers for it. I wasn't. The one (which isn't) in the ssh code has been there for ages, and has compiled successfully, for ages There has to be a reason why it only needed action yesterday. | We just initialize them to tune it down and this is the current practice. Yes, I know - some of them are real potential problems, even if the circumstances that lead to the problem are so unlikely that we never see them in real life - others take knowledge about the environment the compiler does not have, or just require flow analysis more complex than it is reasonable to expect of the compiler, in order to know that there is not actually a problem.The real bugs we fix, obviously. The ones the compiler cannot detect are not bugs we deal with as you said. But when the compiler is able to detect there is no problem, but we are simply preventing it doing so, we fix the way we use the compiler. | GCC also enables more warnings for UBSan that have to be addressed in | order to compile the source, as the code would be UB anyway (like | changing the signedness bit with a shift operation). Sure, some of those, even though they're not really problems, are easy to fix in a totally harmless way. That's fine. The UB is a technical C issue, not really anything that ever fails in those cases though. There has (is currently) an issue with posix, where a current bug resulution requires abs(INT_MIN) to be INT_MIN (ie: abs(n) can end up < 0). In C that's undefined. POSIX requires 2's complement however (unlike C) and can rely upon what happens with 0 - INT_MAX even if C says that is undefined.Some people like it, others do not... (what the end result will be I have no idea.) | I don't agree with strong opinions against cautious warnings/errors from | a compiler. Sure, but when the warning goes off, we need to analyse the issue and see what the actual problem is, not just blindly do whatever makes the compiler stop issuing the warning. |They are there for purpose and dhcpcd could be really broken | with the same code, but with a different context. No, it could not. The only possible issue was if the packet was invalid (too short a len) but that was not what the warning was about (and could not have been, as there was nothing undefined if that happened, just an unwanted result). | And regarding utility of the Undefined Behavior Sanitizer and coverage | of new tests.. we have just caught a bug on pmax that an integer | overflow crashed the kernel: Sure, no-one is saying that the extra work is not worth while. Just that you are sometimes fixing non-problems (and causing code churn to do it - particularly when the code being changed comes from upstream ... in the dhcpcd case that is not such an issue, as if needed, Roy will fix that as well, but why would anyone expect the openbsd people to alter ssh to fix a non problem ?) Once again, please do not change code to fix gcc warnings unless you get the same warning with the code compiled with -O2 (or more). kre
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 04.08.2018 01:31, Robert Elz wrote: > Kamil: assuming you agree that this is a reasonable analysis, I'd suggest > no more code changes based upon gcc warnings issued this way. In general there shall not be a relation between -O level and sanitizers. Sanitizers do not need -O0 or -g for operation. UBSan does not need disabled optimization for reporting issues in exact location in the code. It also does not need debug information (DWARF or similar)... however a runtime might make use of the additional data to print more verbose messages or stacktraces. GCC is known for reporting uninitialized variables and I wouldn't blame sanitizers for it. We just initialize them to tune it down and this is the current practice. GCC also enables more warnings for UBSan that have to be addressed in order to compile the source, as the code would be UB anyway (like changing the signedness bit with a shift operation). I don't agree with strong opinions against cautious warnings/errors from a compiler. They are there for purpose and dhcpcd could be really broken with the same code, but with a different context. And regarding utility of the Undefined Behavior Sanitizer and coverage of new tests.. we have just caught a bug on pmax that an integer overflow crashed the kernel: UB caused to crash pmax.. divrem_overflow_signed_div: pexpect reported EOF - VMM exited unexpectedly signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 18:08:24 +0300, Valery Ushakov wrote: > On Fri, Aug 03, 2018 at 15:54:24 +0200, Martin Husemann wrote: > > > On Fri, Aug 03, 2018 at 08:28:55PM +0700, Robert Elz wrote: > > > Where is the signed arithmetic that was supposedly a probem? > > > > Ah, stupid C integer promotion rules. uint16_t is promoted to int > > here, not unsigned int or size_t. > > Hmm, i don't think that's true. Nah, you are right. "THEN" is the important word here. But as it transpired in another branch of this thread the problem was something entirely different... > 6.3.1.8 Usual arithmetic conversions > > ... > Otherwise, the integer promotions are performed on both > operands. Then the following rules are applied to the > promoted operands: -uwe
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 07:46:01PM +0100, Roy Marples wrote: > We could split the term, but merely storing the result of htons in it's own > variable creates a larger binary for no good reason as i see it. > I suspect that the compiler will generate the same code anyway when using a local variable for intermediate results, feel free to write the cost as you find most legible :-)
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Fri, 3 Aug 2018 19:46:01 +0100 From:Roy Marples Message-ID: | Considering both methods work and the result of htons is a uint16_t (but | is this always guaranteed?) ntohs() (not that it matters) and "always" is a big word, but that is how it is defined by POSIX, so it should be something that we can rely upon. | is this just an over-zealous compiler warning? Not so much over zealous, as just plain lazy... (given Kamil's most recent message): | conversion to 'long unsigned int' from 'int' may change the sign of the | result [-Werror=sign-conversion] | *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); | ^ That's not the overflow on subtract that you said before, and for this one I can see how the cast can help ... but that's just sheer laziness on the part of the compiler. The "int" which is there was created by the compiler, it knows (or should know) that the underlying value is in the rangs [0..65535] and cannot possibly have its sign changed when it is converted to long unsigned int. It would be more understandable if the int appeared somewhere earlier, but here this is all in this one expression, one type promotion on top of another. Get the idiot compiler fixed, and then remove the cast. In the meantime, at least mark it with a comment indicating that the cast should not be needed, and is there purely to appease gcc. kre
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03.08.2018 20:49, Roy Marples wrote: > On 03/08/2018 15:22, Robert Elz wrote: >> Whether there need to be any attention to the possibility >> of a malformed packet I will leave for Roy to decide (I am >> assuming probably not) but that added cast just looks to be >> a bandaid for a broken compiler (sanitiser). > > The contents are verified further up the stack. > I'm inclined to agree it's a dodgy compiler warning, but I'm not really > an expert here. > > Roy I've repeated the compiler error as I forgot the exact error message (it was fixed in a local branch a while ago): /public/src.git/external/bsd/dhcpcd/dist/src/dhcp.c: In function 'get_udp_data': /public/src.git/external/bsd/dhcpcd/dist/src/dhcp.c:3270:29: error: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Werror=sign-conversion] *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); ^ http://netbsd.org/~kamil/patch-00068-dhcpcd-get_udp_data.txt signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03/08/2018 15:22, Robert Elz wrote: Whether there need to be any attention to the possibility of a malformed packet I will leave for Roy to decide (I am assuming probably not) but that added cast just looks to be a bandaid for a broken compiler (sanitiser). The contents are verified further up the stack. I'm inclined to agree it's a dodgy compiler warning, but I'm not really an expert here. Roy
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03/08/2018 14:02, Martin Husemann wrote: On Fri, Aug 03, 2018 at 02:47:53PM +0200, Kamil Rytarowski wrote: Further if there ever was a potential problem from this line ... *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); then *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); It was a build time error generated by GCC. The compiler detected that both sizeof() could be large enough to overflow the result returned from ntohs(3). And overflowing a signed integer is Undefined Behavior. But we do not do this here. This change points to the compiler that the code is safe. What exactly makes the code safe now? If ntohs(p->ip.ip_len) < (sizeof(p->ip) + sizeof(p->udp)) then we are now in even more serious trouble. Does splitting the term help? uint16_t hdr_size = sizeof(p->ip) - sizeof(p->udp); uint16_t pkt_size = ntohs(p->ip.ip_len); KASSERT(pkt_size > hdr_size); *len = pkt_size > hdr_size ? pkt_size-hdr_size : 0; or something like that? We could split the term, but merely storing the result of htons in it's own variable creates a larger binary for no good reason as i see it. Considering both methods work and the result of htons is a uint16_t (but is this always guaranteed?) is this just an over-zealous compiler warning? Roy
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 15:54:24 +0200, Martin Husemann wrote: > On Fri, Aug 03, 2018 at 08:28:55PM +0700, Robert Elz wrote: > > Where is the signed arithmetic that was supposedly a probem? > > Ah, stupid C integer promotion rules. uint16_t is promoted to int > here, not unsigned int or size_t. Hmm, i don't think that's true. 6.3.1.8 Usual arithmetic conversions ... Otherwise, the integer promotions are performed on both operands. Then the following rules are applied to the promoted operands: If both operands have the same type, then no further conversion is needed. Otherwise, if both operands have signed integer types or both have unsigned integer types, the operand with the type of lesser integer conversion rank is converted to the type of the operand with greater rank. ntohs returns unsigned uint16_t, sizeof returns unsigned size_t, so uint16_t, that has "lesser integer convertion rank" (i.e. it's smaller) should be converted to size_t automagically. -uwe
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Fri, 3 Aug 2018 15:54:24 +0200 From:Martin Husemann Message-ID: <20180803135424.gc23...@mail.duskware.de> | Ah, stupid C integer promotion rules. uint16_t is promoted to int | here, not unsigned int or size_t. Even with that, there should be no problem, in signed - unsigned the '-' should be an unsigned - and the result should be unsigned. There is no signed arithmetic being done here to cause an undefined result. That's the same rule that makes strlen(s) + 1 be a size_t rather than a ssize_t or whatever. Otherwise we'd need to be adding casts to every operation like that, just in case strlen(s) == MAX_INT and the " +1 " would cause overflow, and undefined operation.No thanks. Whether there need to be any attention to the possibility of a malformed packet I will leave for Roy to decide (I am assuming probably not) but that added cast just looks to be a bandaid for a broken compiler (sanitiser). kre
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 08:28:55PM +0700, Robert Elz wrote: > Where is the signed arithmetic that was supposedly a probem? Ah, stupid C integer promotion rules. uint16_t is promoted to int here, not unsigned int or size_t. The cast makes all operands the same type and no promotion happens. Martin
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Fri, 3 Aug 2018 15:02:28 +0200 From:Martin Husemann Message-ID: <20180803130227.ga23...@mail.duskware.de> | What exactly makes the code safe now? If ntohs(p->ip.ip_len) < | (sizeof(p->ip) + sizeof(p->udp)) then we are now in even more serious | trouble. Actually, not more serious, the same serious as before. If adding that cast change anything at all, the compiler isn't working as it should. If the values haven't been verieied, they should be. If they have been verified, there is no problem and nothing needs fixing (except possibly the santiizer). In a later message ... | Overflow (underflow) of an unsigned value is defined and GCC stops | deducing whether there might be a problem. But it always was unsigned, ntohs() returns an unsigned result. Further even if it was signed, doesn't combining a signed value and an unsigned one with an arithmetic op result in an unsigned operation? Where is the signed arithmetic that was supposedly a probem? kre
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03.08.2018 15:20, Martin Husemann wrote: > On Fri, Aug 03, 2018 at 03:18:18PM +0200, Kamil Rytarowski wrote: >> The change was indicating to the compiler that code is safe, without >> changing the algorithm. > > I don't get why. > > Martin > Overflow (underflow) of an unsigned value is defined and GCC stops deducing whether there might be a problem. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 03:18:18PM +0200, Kamil Rytarowski wrote: > The change was indicating to the compiler that code is safe, without > changing the algorithm. I don't get why. Martin
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03.08.2018 15:02, Martin Husemann wrote: > On Fri, Aug 03, 2018 at 02:47:53PM +0200, Kamil Rytarowski wrote: >>> Further if there ever was a potential problem from this line ... >>> >>> *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); >>> then >>> *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); > >> It was a build time error generated by GCC. The compiler detected that >> both sizeof() could be large enough to overflow the result returned from >> ntohs(3). And overflowing a signed integer is Undefined Behavior. > > But we do not do this here. > >> This change points to the compiler that the code is safe. > > What exactly makes the code safe now? If ntohs(p->ip.ip_len) < > (sizeof(p->ip) + sizeof(p->udp)) then we are now in even more serious > trouble. > The change was indicating to the compiler that code is safe, without changing the algorithm. > Does splitting the term help? > > uint16_t hdr_size = sizeof(p->ip) - sizeof(p->udp); + > uint16_t pkt_size = ntohs(p->ip.ip_len); > KASSERT(pkt_size > hdr_size); > *len = pkt_size > hdr_size ? pkt_size-hdr_size : 0; > > or something like that? > This looks like a safer approach, but I will defer it to Roy to decide what to do. Previously we have agreed with the (size_t) case. > Martin > signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 02:47:53PM +0200, Kamil Rytarowski wrote: > > Further if there ever was a potential problem from this line ... > > > > *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); > > then > > *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); > It was a build time error generated by GCC. The compiler detected that > both sizeof() could be large enough to overflow the result returned from > ntohs(3). And overflowing a signed integer is Undefined Behavior. But we do not do this here. > This change points to the compiler that the code is safe. What exactly makes the code safe now? If ntohs(p->ip.ip_len) < (sizeof(p->ip) + sizeof(p->udp)) then we are now in even more serious trouble. Does splitting the term help? uint16_t hdr_size = sizeof(p->ip) - sizeof(p->udp); uint16_t pkt_size = ntohs(p->ip.ip_len); KASSERT(pkt_size > hdr_size); *len = pkt_size > hdr_size ? pkt_size-hdr_size : 0; or something like that? Martin
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03.08.2018 12:26, Robert Elz wrote: > Date:Fri, 3 Aug 2018 02:17:33 + > From:"Kamil Rytarowski" > Message-ID: <20180803021733.b2002f...@cvs.netbsd.org> > > | GCC with -fsanitize=undefiend detects a potential overflow in the code. > | Cast the return value of ntohs(3) to size_t. > > I don't understand the point of this change, and I believe it to > be wrong and misguided. > > Further if there ever was a potential problem from this line ... > > *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); > then > *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); > > will not fix it. The possible problem being if ip_len < 28 (the sum of the > two sizeof's).While I didn't check this code, that possibility is usually > verified elsewhere, and even if not, adding the cast changes nothing, the > result is still bogus (that is, at best, the change could be masking a real > bug, though that's unlikely.) > > This looks to be (somehow) determining that the result of ntohs(ip_len) > might somehow be negative (or something, I'm not really sure what is > being believed is happening) but the ntohs() result is (in all cases here) > a uint16_t (either because the result is literally the arg, which is that > type, > or because it is the result of bswap16() which is declared that way.) > > The sizeof() ops make the expression at least a size_t - so unless size_t > and uint16_t are the same (which might happen on a pdp-11 or similar, > though even there it is unlikely I suspect) the narrower one needs to be > promoted - whether the ntohs() result is implicitly promoted to size_t, or > explicitly cast cannot make any difference, can it? > > So what exactly is being fixed here? Which behaviour is supposedly undefined? > It was a build time error generated by GCC. The compiler detected that both sizeof() could be large enough to overflow the result returned from ntohs(3). And overflowing a signed integer is Undefined Behavior. This change points to the compiler that the code is safe. > kre > signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Fri, 3 Aug 2018 02:17:33 + From:"Kamil Rytarowski" Message-ID: <20180803021733.b2002f...@cvs.netbsd.org> | GCC with -fsanitize=undefiend detects a potential overflow in the code. | Cast the return value of ntohs(3) to size_t. I don't understand the point of this change, and I believe it to be wrong and misguided. Further if there ever was a potential problem from this line ... *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); then *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); will not fix it. The possible problem being if ip_len < 28 (the sum of the two sizeof's).While I didn't check this code, that possibility is usually verified elsewhere, and even if not, adding the cast changes nothing, the result is still bogus (that is, at best, the change could be masking a real bug, though that's unlikely.) This looks to be (somehow) determining that the result of ntohs(ip_len) might somehow be negative (or something, I'm not really sure what is being believed is happening) but the ntohs() result is (in all cases here) a uint16_t (either because the result is literally the arg, which is that type, or because it is the result of bswap16() which is declared that way.) The sizeof() ops make the expression at least a size_t - so unless size_t and uint16_t are the same (which might happen on a pdp-11 or similar, though even there it is unlikely I suspect) the narrower one needs to be promoted - whether the ntohs() result is implicitly promoted to size_t, or explicitly cast cannot make any difference, can it? So what exactly is being fixed here? Which behaviour is supposedly undefined? kre
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Sat Feb 27 15:52:29 UTC 2010 Update of /cvsroot/src/external/bsd/dhcpcd/dist In directory ivanova.netbsd.org:/tmp/cvs-serv22160 Log Message: Import dhcpcd-5.2.0 with the following changes from dhcpcd-5.1.5: * VendorID is now dhcpcd-$version:$OS-$version:$machine:$platform * IPv4LL address range can now be used in DHCP requests * sysctl net.ipv4.conf.$iface.promote_secondaries enabled on Linux This resolves a long standing issue of changing ip on the same subnet. * IPv4LL correctly resets the DHCP timer. Status: Vendor Tag: roy Release Tags: dhcpcd-5-2-0 U src/external/bsd/dhcpcd/dist/arp.c U src/external/bsd/dhcpcd/dist/bind.c U src/external/bsd/dhcpcd/dist/common.c U src/external/bsd/dhcpcd/dist/control.c U src/external/bsd/dhcpcd/dist/dhcp.c U src/external/bsd/dhcpcd/dist/dhcpcd.c U src/external/bsd/dhcpcd/dist/duid.c U src/external/bsd/dhcpcd/dist/eloop.c U src/external/bsd/dhcpcd/dist/if-options.c U src/external/bsd/dhcpcd/dist/if-pref.c U src/external/bsd/dhcpcd/dist/ipv4ll.c U src/external/bsd/dhcpcd/dist/net.c U src/external/bsd/dhcpcd/dist/signals.c U src/external/bsd/dhcpcd/dist/configure.c U src/external/bsd/dhcpcd/dist/bpf.c U src/external/bsd/dhcpcd/dist/if-bsd.c N src/external/bsd/dhcpcd/dist/platform-bsd.c U src/external/bsd/dhcpcd/dist/dhcpcd.conf U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in U src/external/bsd/dhcpcd/dist/dhcpcd.8.in U src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in U src/external/bsd/dhcpcd/dist/arp.h U src/external/bsd/dhcpcd/dist/bind.h U src/external/bsd/dhcpcd/dist/bpf-filter.h U src/external/bsd/dhcpcd/dist/common.h U src/external/bsd/dhcpcd/dist/config.h U src/external/bsd/dhcpcd/dist/configure.h U src/external/bsd/dhcpcd/dist/control.h U src/external/bsd/dhcpcd/dist/defs.h U src/external/bsd/dhcpcd/dist/dhcp.h U src/external/bsd/dhcpcd/dist/dhcpcd.h U src/external/bsd/dhcpcd/dist/duid.h U src/external/bsd/dhcpcd/dist/eloop.h U src/external/bsd/dhcpcd/dist/if-options.h U src/external/bsd/dhcpcd/dist/if-pref.h U src/external/bsd/dhcpcd/dist/ipv4ll.h U src/external/bsd/dhcpcd/dist/net.h N src/external/bsd/dhcpcd/dist/platform.h U src/external/bsd/dhcpcd/dist/signals.h U src/external/bsd/dhcpcd/dist/compat/getline.c U src/external/bsd/dhcpcd/dist/compat/getline.h U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ypbind No conflicts created by this import
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Sat Feb 27 15:52:29 UTC 2010 Update of /cvsroot/src/external/bsd/dhcpcd/dist In directory ivanova.netbsd.org:/tmp/cvs-serv22160 Log Message: Import dhcpcd-5.2.0 with the following changes from dhcpcd-5.1.5: * VendorID is now dhcpcd-$version:$OS-$version:$machine:$platform * IPv4LL address range can now be used in DHCP requests * sysctl net.ipv4.conf.$iface.promote_secondaries enabled on Linux This resolves a long standing issue of changing ip on the same subnet. * IPv4LL correctly resets the DHCP timer. Status: Vendor Tag: roy Release Tags: dhcpcd-5-2-0 U src/external/bsd/dhcpcd/dist/arp.c U src/external/bsd/dhcpcd/dist/bind.c U src/external/bsd/dhcpcd/dist/common.c U src/external/bsd/dhcpcd/dist/control.c U src/external/bsd/dhcpcd/dist/dhcp.c U src/external/bsd/dhcpcd/dist/dhcpcd.c U src/external/bsd/dhcpcd/dist/duid.c U src/external/bsd/dhcpcd/dist/eloop.c U src/external/bsd/dhcpcd/dist/if-options.c U src/external/bsd/dhcpcd/dist/if-pref.c U src/external/bsd/dhcpcd/dist/ipv4ll.c U src/external/bsd/dhcpcd/dist/net.c U src/external/bsd/dhcpcd/dist/signals.c U src/external/bsd/dhcpcd/dist/configure.c U src/external/bsd/dhcpcd/dist/bpf.c U src/external/bsd/dhcpcd/dist/if-bsd.c N src/external/bsd/dhcpcd/dist/platform-bsd.c U src/external/bsd/dhcpcd/dist/dhcpcd.conf U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in U src/external/bsd/dhcpcd/dist/dhcpcd.8.in U src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in U src/external/bsd/dhcpcd/dist/arp.h U src/external/bsd/dhcpcd/dist/bind.h U src/external/bsd/dhcpcd/dist/bpf-filter.h U src/external/bsd/dhcpcd/dist/common.h U src/external/bsd/dhcpcd/dist/config.h U src/external/bsd/dhcpcd/dist/configure.h U src/external/bsd/dhcpcd/dist/control.h U src/external/bsd/dhcpcd/dist/defs.h U src/external/bsd/dhcpcd/dist/dhcp.h U src/external/bsd/dhcpcd/dist/dhcpcd.h U src/external/bsd/dhcpcd/dist/duid.h U src/external/bsd/dhcpcd/dist/eloop.h U src/external/bsd/dhcpcd/dist/if-options.h U src/external/bsd/dhcpcd/dist/if-pref.h U src/external/bsd/dhcpcd/dist/ipv4ll.h U src/external/bsd/dhcpcd/dist/net.h N src/external/bsd/dhcpcd/dist/platform.h U src/external/bsd/dhcpcd/dist/signals.h U src/external/bsd/dhcpcd/dist/compat/getline.c U src/external/bsd/dhcpcd/dist/compat/getline.h U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ypbind No conflicts created by this import
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Sat Feb 27 16:02:27 UTC 2010 Update of /cvsroot/src/external/bsd/dhcpcd/dist In directory ivanova.netbsd.org:/tmp/cvs-serv12631 Log Message: Import dhcpcd-5.2.1 for a build fix Status: Vendor Tag: roy Release Tags: dhcpcd-5-2-1 U src/external/bsd/dhcpcd/dist/arp.c U src/external/bsd/dhcpcd/dist/bind.c U src/external/bsd/dhcpcd/dist/common.c U src/external/bsd/dhcpcd/dist/control.c U src/external/bsd/dhcpcd/dist/dhcp.c U src/external/bsd/dhcpcd/dist/dhcpcd.c U src/external/bsd/dhcpcd/dist/duid.c U src/external/bsd/dhcpcd/dist/eloop.c U src/external/bsd/dhcpcd/dist/if-options.c U src/external/bsd/dhcpcd/dist/if-pref.c U src/external/bsd/dhcpcd/dist/ipv4ll.c U src/external/bsd/dhcpcd/dist/net.c U src/external/bsd/dhcpcd/dist/signals.c U src/external/bsd/dhcpcd/dist/configure.c U src/external/bsd/dhcpcd/dist/bpf.c U src/external/bsd/dhcpcd/dist/if-bsd.c U src/external/bsd/dhcpcd/dist/platform-bsd.c U src/external/bsd/dhcpcd/dist/dhcpcd.conf U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in U src/external/bsd/dhcpcd/dist/dhcpcd.8.in U src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in U src/external/bsd/dhcpcd/dist/arp.h U src/external/bsd/dhcpcd/dist/bind.h U src/external/bsd/dhcpcd/dist/bpf-filter.h U src/external/bsd/dhcpcd/dist/common.h U src/external/bsd/dhcpcd/dist/config.h U src/external/bsd/dhcpcd/dist/configure.h U src/external/bsd/dhcpcd/dist/control.h U src/external/bsd/dhcpcd/dist/defs.h U src/external/bsd/dhcpcd/dist/dhcp.h U src/external/bsd/dhcpcd/dist/dhcpcd.h U src/external/bsd/dhcpcd/dist/duid.h U src/external/bsd/dhcpcd/dist/eloop.h U src/external/bsd/dhcpcd/dist/if-options.h U src/external/bsd/dhcpcd/dist/if-pref.h U src/external/bsd/dhcpcd/dist/ipv4ll.h U src/external/bsd/dhcpcd/dist/net.h U src/external/bsd/dhcpcd/dist/platform.h U src/external/bsd/dhcpcd/dist/signals.h U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ypbind No conflicts created by this import
CVS commit: src/external/bsd/dhcpcd/dist
Module Name:src Committed By: roy Date: Sat Feb 27 16:02:27 UTC 2010 Update of /cvsroot/src/external/bsd/dhcpcd/dist In directory ivanova.netbsd.org:/tmp/cvs-serv12631 Log Message: Import dhcpcd-5.2.1 for a build fix Status: Vendor Tag: roy Release Tags: dhcpcd-5-2-1 U src/external/bsd/dhcpcd/dist/arp.c U src/external/bsd/dhcpcd/dist/bind.c U src/external/bsd/dhcpcd/dist/common.c U src/external/bsd/dhcpcd/dist/control.c U src/external/bsd/dhcpcd/dist/dhcp.c U src/external/bsd/dhcpcd/dist/dhcpcd.c U src/external/bsd/dhcpcd/dist/duid.c U src/external/bsd/dhcpcd/dist/eloop.c U src/external/bsd/dhcpcd/dist/if-options.c U src/external/bsd/dhcpcd/dist/if-pref.c U src/external/bsd/dhcpcd/dist/ipv4ll.c U src/external/bsd/dhcpcd/dist/net.c U src/external/bsd/dhcpcd/dist/signals.c U src/external/bsd/dhcpcd/dist/configure.c U src/external/bsd/dhcpcd/dist/bpf.c U src/external/bsd/dhcpcd/dist/if-bsd.c U src/external/bsd/dhcpcd/dist/platform-bsd.c U src/external/bsd/dhcpcd/dist/dhcpcd.conf U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in U src/external/bsd/dhcpcd/dist/dhcpcd.8.in U src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in U src/external/bsd/dhcpcd/dist/arp.h U src/external/bsd/dhcpcd/dist/bind.h U src/external/bsd/dhcpcd/dist/bpf-filter.h U src/external/bsd/dhcpcd/dist/common.h U src/external/bsd/dhcpcd/dist/config.h U src/external/bsd/dhcpcd/dist/configure.h U src/external/bsd/dhcpcd/dist/control.h U src/external/bsd/dhcpcd/dist/defs.h U src/external/bsd/dhcpcd/dist/dhcp.h U src/external/bsd/dhcpcd/dist/dhcpcd.h U src/external/bsd/dhcpcd/dist/duid.h U src/external/bsd/dhcpcd/dist/eloop.h U src/external/bsd/dhcpcd/dist/if-options.h U src/external/bsd/dhcpcd/dist/if-pref.h U src/external/bsd/dhcpcd/dist/ipv4ll.h U src/external/bsd/dhcpcd/dist/net.h U src/external/bsd/dhcpcd/dist/platform.h U src/external/bsd/dhcpcd/dist/signals.h U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ypbind No conflicts created by this import