Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/dhcpcd/dist/src Sync
details: https://anonhg.NetBSD.org/src/rev/8de2faab0b6d
branches: trunk
changeset: 359107:8de2faab0b6d
user: roy <roy%NetBSD.org@localhost>
date: Mon Jan 29 11:13:06 2018 +0000
description:
Sync
diffstat:
external/bsd/dhcpcd/dist/src/dhcp.c | 9 ++-
external/bsd/dhcpcd/dist/src/dhcpcd.c | 80 +++++++++++-------------------
external/bsd/dhcpcd/dist/src/if-options.c | 22 +++++++-
3 files changed, 55 insertions(+), 56 deletions(-)
diffs (189 lines):
diff -r 5da2d3817e59 -r 8de2faab0b6d external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c Mon Jan 29 11:11:22 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c Mon Jan 29 11:13:06 2018 +0000
@@ -1462,8 +1462,11 @@
if (ifp->options->options & (DHCPCD_STATIC | DHCPCD_INFORM)) {
if (ifp->options->req_addr.s_addr != INADDR_ANY) {
lease->mask = ifp->options->req_mask;
- lease->brd.s_addr =
- lease->addr.s_addr | ~lease->mask.s_addr;
+ if (ifp->options->req_brd.s_addr != INADDR_ANY)
+ lease->brd = ifp->options->req_brd;
+ else
+ lease->brd.s_addr =
+ lease->addr.s_addr | ~lease->mask.s_addr;
} else {
const struct ipv4_addr *ia;
@@ -2076,7 +2079,7 @@
logdebugx("%s: DAD completed for %s",
ifp->name, inet_ntoa(astate->addr));
- if (state->state != DHS_INFORM)
+ if (!(ifo->options & DHCPCD_INFORM))
dhcp_bind(ifp);
#ifndef IN_IFF_TENTATIVE
else {
diff -r 5da2d3817e59 -r 8de2faab0b6d external/bsd/dhcpcd/dist/src/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/src/dhcpcd.c Mon Jan 29 11:11:22 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcpcd.c Mon Jan 29 11:13:06 2018 +0000
@@ -712,8 +712,10 @@
eloop_timeout_delete(ifp->ctx->eloop, dhcpcd_pollup, ifp);
if (carrier == LINK_UNKNOWN) {
- if (errno != ENOTTY) /* For example a PPP link on BSD */
+ if (errno != ENOTTY && errno != ENXIO) {
+ /* Don't log an error if interface departed */
logerr("%s: %s", ifp->name, __func__);
+ }
} else if (carrier == LINK_DOWN || (ifp->flags & IFF_UP) == 0) {
if (ifp->carrier != LINK_DOWN) {
if (ifp->carrier == LINK_UP)
@@ -977,9 +979,8 @@
struct dhcpcd_ctx *ctx;
struct ifaddrs *ifaddrs;
struct if_head *ifs;
- struct interface *ifp, *iff, *ifn;
+ struct interface *ifp, *iff;
const char * const argv[] = { ifname };
- int i;
ctx = arg;
if (action == -1) {
@@ -998,62 +999,41 @@
return 0;
}
- i = -1;
ifs = if_discover(ctx, &ifaddrs, -1, UNCONST(argv));
if (ifs == NULL) {
logerr(__func__);
return -1;
}
- TAILQ_FOREACH_SAFE(ifp, ifs, next, ifn) {
- if (strcmp(ifp->name, ifname) != 0)
- continue;
-
- /* If running off an interface list, check it's in it. */
- if (ctx->ifc || ctx->options & DHCPCD_INACTIVE) {
- for (i = 0; i < ctx->ifc; i++)
- if (strcmp(ctx->ifv[i], ifname) == 0)
- break;
- if (i >= ctx->ifc) {
- ifp->active = IF_INACTIVE;
- ifp->carrier = LINK_UNKNOWN;
- }
- }
-
- i = 0;
- /* Check if we already have the interface */
- iff = if_find(ctx->ifaces, ifp->name);
- if (iff) {
- if (iff->active)
- logdebugx("%s: interface updated", iff->name);
- /* The flags and hwaddr could have changed */
- iff->flags = ifp->flags;
- iff->hwlen = ifp->hwlen;
- if (ifp->hwlen != 0)
- memcpy(iff->hwaddr, ifp->hwaddr, iff->hwlen);
- } else {
- TAILQ_REMOVE(ifs, ifp, next);
- TAILQ_INSERT_TAIL(ctx->ifaces, ifp, next);
- if (!ifp->active)
- continue;
+ ifp = if_find(ifs, ifname);
+ if (ifp == NULL) {
+ /* This can happen if an interface is quickly added
+ * and then removed. */
+ errno = ENOENT;
+ return -1;
+ }
+ /* Check if we already have the interface */
+ iff = if_find(ctx->ifaces, ifp->name);
+ if (iff != NULL) {
+ if (iff->active)
+ logdebugx("%s: interface updated", iff->name);
+ /* The flags and hwaddr could have changed */
+ iff->flags = ifp->flags;
+ iff->hwlen = ifp->hwlen;
+ if (ifp->hwlen != 0)
+ memcpy(iff->hwaddr, ifp->hwaddr, iff->hwlen);
+ } else {
+ TAILQ_REMOVE(ifs, ifp, next);
+ TAILQ_INSERT_TAIL(ctx->ifaces, ifp, next);
+ if (ifp->active) {
logdebugx("%s: interface added", ifp->name);
dhcpcd_initstate(ifp, 0);
run_preinit(ifp);
- iff = ifp;
}
- if (action > 0 && iff->active)
- dhcpcd_prestartinterface(iff);
+ iff = ifp;
}
-
if_learnaddrs(ctx, ifs, &ifaddrs);
-
- /* Now we have learned addresses, start the interface */
- TAILQ_FOREACH_SAFE(ifp, ifs, next, ifn) {
- if (strcmp(ifp->name, ifname) != 0)
- continue;
- iff = if_find(ctx->ifaces, ifp->name);
- if (action > 0 && iff->active)
- dhcpcd_prestartinterface(iff);
- }
+ if (action > 0 && iff->active)
+ dhcpcd_prestartinterface(iff);
/* Free our discovered list */
while ((ifp = TAILQ_FIRST(ifs))) {
@@ -1062,9 +1042,7 @@
}
free(ifs);
- if (i == -1)
- errno = ENOENT;
- return i;
+ return 1;
}
void
diff -r 5da2d3817e59 -r 8de2faab0b6d external/bsd/dhcpcd/dist/src/if-options.c
--- a/external/bsd/dhcpcd/dist/src/if-options.c Mon Jan 29 11:11:22 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/if-options.c Mon Jan 29 11:13:06 2018 +0000
@@ -815,8 +815,21 @@
break;
case 's':
if (arg && *arg != '\0') {
- if (parse_addr(&ifo->req_addr, &ifo->req_mask, arg)
- != 0)
+ /* Strip out a broadcast address */
+ p = strchr(arg, '/');
+ if (p != NULL) {
+ p = strchr(p + 1, '/');
+ if (p != NULL)
+ *p = '\0';
+ }
+ i = parse_addr(&ifo->req_addr, &ifo->req_mask, arg);
+ if (p != NULL) {
+ /* Ensure the original string is preserved */
+ *p++ = '/';
+ if (i == 0)
+ i = parse_addr(&ifo->req_brd, NULL, p);
+ }
+ if (i != 0)
return -1;
} else {
ifo->req_addr.s_addr = 0;
@@ -1060,6 +1073,11 @@
{
if (parse_addr(&ifo->req_mask, NULL, p) != 0)
return -1;
+ } else if (strncmp(arg, "broadcast_address=",
+ strlen("broadcast_address=")) == 0)
+ {
+ if (parse_addr(&ifo->req_brd, NULL, p) != 0)
+ return -1;
} else if (strncmp(arg, "routes=", strlen("routes=")) == 0 ||
strncmp(arg, "static_routes=",
strlen("static_routes=")) == 0 ||
Home |
Main Index |
Thread Index |
Old Index