Pull up the following, requested by pettai in ticket #495: external/bsd/dhcpcd/dist/arp.c up to 1.9 external/bsd/dhcpcd/dist/arp.h up to 1.8 external/bsd/dhcpcd/dist/auth.c up to 1.8 external/bsd/dhcpcd/dist/auth.h up to 1.8 external/bsd/dhcpcd/dist/common.c up to 1.8 external/bsd/dhcpcd/dist/common.h up to 1.7 external/bsd/dhcpcd/dist/control.c up to 1.7 external/bsd/dhcpcd/dist/control.h up to 1.7 external/bsd/dhcpcd/dist/defs.h up to 1.14 external/bsd/dhcpcd/dist/dev.h up to 1.7 external/bsd/dhcpcd/dist/dhcp-common.c up to 1.7 external/bsd/dhcpcd/dist/dhcp-common.h up to 1.7 external/bsd/dhcpcd/dist/dhcp.c up to 1.27 external/bsd/dhcpcd/dist/dhcp.h up to 1.7 external/bsd/dhcpcd/dist/dhcp6.c up to 1.9 external/bsd/dhcpcd/dist/dhcp6.h up to 1.7 external/bsd/dhcpcd/dist/dhcpcd-definitions.conf up to 1.7 external/bsd/dhcpcd/dist/dhcpcd-embedded.c up to 1.7 external/bsd/dhcpcd/dist/dhcpcd-embedded.c.in up to 1.1.1.2 external/bsd/dhcpcd/dist/dhcpcd-embedded.h up to 1.7 external/bsd/dhcpcd/dist/dhcpcd-embedded.h.in up to 1.1.1.3 external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in up to 1.13 external/bsd/dhcpcd/dist/dhcpcd.8.in up to 1.40 external/bsd/dhcpcd/dist/dhcpcd.c up to 1.22 external/bsd/dhcpcd/dist/dhcpcd.conf.5.in up to 1.18 external/bsd/dhcpcd/dist/dhcpcd.h up to 1.9 external/bsd/dhcpcd/dist/duid.c up to 1.7 external/bsd/dhcpcd/dist/duid.h up to 1.7 external/bsd/dhcpcd/dist/eloop.c up to 1.8 external/bsd/dhcpcd/dist/eloop.h up to 1.7 external/bsd/dhcpcd/dist/if-bsd.c up to 1.17 external/bsd/dhcpcd/dist/if-options.c up to 1.20 external/bsd/dhcpcd/dist/if-options.h up to 1.8 external/bsd/dhcpcd/dist/if.c up to 1.11 external/bsd/dhcpcd/dist/if.h up to 1.8 external/bsd/dhcpcd/dist/ipv4.c up to 1.11 external/bsd/dhcpcd/dist/ipv4.h up to 1.8 external/bsd/dhcpcd/dist/ipv4ll.c up to 1.8 external/bsd/dhcpcd/dist/ipv6.c up to 1.8 external/bsd/dhcpcd/dist/ipv6.h up to 1.10 external/bsd/dhcpcd/dist/ipv6nd.c up to 1.20 external/bsd/dhcpcd/dist/ipv6nd.h up to 1.9 external/bsd/dhcpcd/dist/script.c up to 1.17 external/bsd/dhcpcd/dist/crypt/crypt.h up to 1.6 external/bsd/dhcpcd/dist/crypt/hmac_md5.c up to 1.6 doc/3RDPARTY 1.1198 Import dhcpcd version 6.7.1.diff -r1.1145.2.7 -r1.1145.2.8 src/doc/3RDPARTY
(martin)
--- src/doc/3RDPARTY 2015/01/27 08:14:03 1.1145.2.7
+++ src/doc/3RDPARTY 2015/02/05 15:13:12 1.1145.2.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: 3RDPARTY,v 1.1145.2.7 2015/01/27 08:14:03 martin Exp $ | 1 | # $NetBSD: 3RDPARTY,v 1.1145.2.8 2015/02/05 15:13:12 martin Exp $ | |
2 | # | 2 | # | |
3 | # This file contains a list of the software that has been integrated into | 3 | # This file contains a list of the software that has been integrated into | |
4 | # NetBSD where we are not the primary maintainer. | 4 | # NetBSD where we are not the primary maintainer. | |
5 | # | 5 | # | |
6 | # When you make changes to this software, be sure to discuss it with the | 6 | # When you make changes to this software, be sure to discuss it with the | |
7 | # maintainer and contribute your patches. Divergence from the official | 7 | # maintainer and contribute your patches. Divergence from the official | |
8 | # sources is not desirable, and should be avoided as much as possible. | 8 | # sources is not desirable, and should be avoided as much as possible. | |
9 | # | 9 | # | |
10 | # When importing, please deal with the RCS IDs in this way: | 10 | # When importing, please deal with the RCS IDs in this way: | |
11 | # 1. Preserve the RCS IDs in the files by removing the $ signs from | 11 | # 1. Preserve the RCS IDs in the files by removing the $ signs from | |
12 | # the IDs before you do the import. | 12 | # the IDs before you do the import. | |
13 | # 2. After the import, add NetBSD RCS IDs to all of the files. | 13 | # 2. After the import, add NetBSD RCS IDs to all of the files. | |
14 | # | 14 | # | |
@@ -295,28 +295,28 @@ Maintainer: mellon | @@ -295,28 +295,28 @@ Maintainer: mellon | |||
295 | Archive Site: ftp://ftp.isc.org/isc/dhcp/ | 295 | Archive Site: ftp://ftp.isc.org/isc/dhcp/ | |
296 | Home Page: http://www.isc.org/software/dhcp/ | 296 | Home Page: http://www.isc.org/software/dhcp/ | |
297 | Mailing List: dhcp-server@isc.org | 297 | Mailing List: dhcp-server@isc.org | |
298 | Mailing List: dhcp-client@isc.org | 298 | Mailing List: dhcp-client@isc.org | |
299 | Mailing List: dhcp-announce@isc.org | 299 | Mailing List: dhcp-announce@isc.org | |
300 | Mailing List: dhcp-bugs@isc.org | 300 | Mailing List: dhcp-bugs@isc.org | |
301 | Responsible: mellon | 301 | Responsible: mellon | |
302 | License: BSD (3-clause) | 302 | License: BSD (3-clause) | |
303 | Location: external/bsd/dhcp | 303 | Location: external/bsd/dhcp | |
304 | Notes: | 304 | Notes: | |
305 | Use the dhcp2netbsd script. | 305 | Use the dhcp2netbsd script. | |
306 | 306 | |||
307 | Package: dhcpcd | 307 | Package: dhcpcd | |
308 | Version: 6.4.3 | 308 | Version: 6.7.1 | |
309 | Current Vers: 6.4.3 | 309 | Current Vers: 6.7.1 | |
310 | Maintainer: roy | 310 | Maintainer: roy | |
311 | Archive Site: ftp://roy.marples.name/pub/dhcpcd/ | 311 | Archive Site: ftp://roy.marples.name/pub/dhcpcd/ | |
312 | Home Page: http://roy.marples.name/projects/dhcpcd/ | 312 | Home Page: http://roy.marples.name/projects/dhcpcd/ | |
313 | Mailing List: dhcpcd-discuss@marples.name | 313 | Mailing List: dhcpcd-discuss@marples.name | |
314 | License: BSD (2-clause) | 314 | License: BSD (2-clause) | |
315 | Location: external/bsd/dhcpcd/dist | 315 | Location: external/bsd/dhcpcd/dist | |
316 | Notes: | 316 | Notes: | |
317 | Please submit all changes to the author. | 317 | Please submit all changes to the author. | |
318 | The distribution doesn't include the Linux specific bits or build system. | 318 | The distribution doesn't include the Linux specific bits or build system. | |
319 | 319 | |||
320 | Package: diffutils | 320 | Package: diffutils | |
321 | Version: 2.8.1 | 321 | Version: 2.8.1 | |
322 | Current Vers: 3.3 | 322 | Current Vers: 3.3 |
--- src/external/bsd/dhcpcd/dist/Attic/arp.c 2014/12/29 16:18:04 1.1.1.13.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/arp.c 2015/02/05 15:13:12 1.1.1.13.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: arp.c,v 1.1.1.13.2.1 2014/12/29 16:18:04 martin Exp $"); | 2 | __RCSID("$NetBSD: arp.c,v 1.1.1.13.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/dhcp6.c 2014/12/29 16:18:04 1.1.1.13.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcp6.c 2015/02/05 15:13:12 1.1.1.13.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: dhcp6.c,v 1.1.1.13.2.1 2014/12/29 16:18:04 martin Exp $"); | 2 | __RCSID("$NetBSD: dhcp6.c,v 1.1.1.13.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -1729,26 +1729,27 @@ dhcp6_findna(struct interface *ifp, uint | @@ -1729,26 +1729,27 @@ dhcp6_findna(struct interface *ifp, uint | |||
1729 | a = dhcp6_iffindaddr(ifp, &iap->addr, 0); | 1729 | a = dhcp6_iffindaddr(ifp, &iap->addr, 0); | |
1730 | if (a == NULL) { | 1730 | if (a == NULL) { | |
1731 | a = calloc(1, sizeof(*a)); | 1731 | a = calloc(1, sizeof(*a)); | |
1732 | if (a == NULL) { | 1732 | if (a == NULL) { | |
1733 | syslog(LOG_ERR, "%s: %m", __func__); | 1733 | syslog(LOG_ERR, "%s: %m", __func__); | |
1734 | break; | 1734 | break; | |
1735 | } | 1735 | } | |
1736 | a->iface = ifp; | 1736 | a->iface = ifp; | |
1737 | a->flags = IPV6_AF_NEW | IPV6_AF_ONLINK; | 1737 | a->flags = IPV6_AF_NEW | IPV6_AF_ONLINK; | |
1738 | a->dadcallback = dhcp6_dadcallback; | 1738 | a->dadcallback = dhcp6_dadcallback; | |
1739 | a->ia_type = ot; | 1739 | a->ia_type = ot; | |
1740 | memcpy(a->iaid, iaid, sizeof(a->iaid)); | 1740 | memcpy(a->iaid, iaid, sizeof(a->iaid)); | |
1741 | a->addr = iap->addr; | 1741 | a->addr = iap->addr; | |
1742 | a->created = *acquired; | |||
1742 | 1743 | |||
1743 | /* | 1744 | /* | |
1744 | * RFC 5942 Section 5 | 1745 | * RFC 5942 Section 5 | |
1745 | * We cannot assume any prefix length, nor tie the | 1746 | * We cannot assume any prefix length, nor tie the | |
1746 | * address to an existing one as it could expire | 1747 | * address to an existing one as it could expire | |
1747 | * before the address. | 1748 | * before the address. | |
1748 | * As such we just give it a 128 prefix. | 1749 | * As such we just give it a 128 prefix. | |
1749 | */ | 1750 | */ | |
1750 | a->prefix_len = 128; | 1751 | a->prefix_len = 128; | |
1751 | ipv6_makeprefix(&a->prefix, &a->addr, a->prefix_len); | 1752 | ipv6_makeprefix(&a->prefix, &a->addr, a->prefix_len); | |
1752 | ia = inet_ntop(AF_INET6, &a->addr, | 1753 | ia = inet_ntop(AF_INET6, &a->addr, | |
1753 | iabuf, sizeof(iabuf)); | 1754 | iabuf, sizeof(iabuf)); | |
1754 | snprintf(a->saddr, sizeof(a->saddr), | 1755 | snprintf(a->saddr, sizeof(a->saddr), | |
@@ -1811,26 +1812,27 @@ dhcp6_findpd(struct interface *ifp, cons | @@ -1811,26 +1812,27 @@ dhcp6_findpd(struct interface *ifp, cons | |||
1811 | pdp = (const struct dhcp6_pd_addr *)D6_COPTION_DATA(o); | 1812 | pdp = (const struct dhcp6_pd_addr *)D6_COPTION_DATA(o); | |
1812 | TAILQ_FOREACH(a, &state->addrs, next) { | 1813 | TAILQ_FOREACH(a, &state->addrs, next) { | |
1813 | if (IN6_ARE_ADDR_EQUAL(&a->prefix, &pdp->prefix)) | 1814 | if (IN6_ARE_ADDR_EQUAL(&a->prefix, &pdp->prefix)) | |
1814 | break; | 1815 | break; | |
1815 | } | 1816 | } | |
1816 | if (a == NULL) { | 1817 | if (a == NULL) { | |
1817 | a = calloc(1, sizeof(*a)); | 1818 | a = calloc(1, sizeof(*a)); | |
1818 | if (a == NULL) { | 1819 | if (a == NULL) { | |
1819 | syslog(LOG_ERR, "%s: %m", __func__); | 1820 | syslog(LOG_ERR, "%s: %m", __func__); | |
1820 | break; | 1821 | break; | |
1821 | } | 1822 | } | |
1822 | a->iface = ifp; | 1823 | a->iface = ifp; | |
1823 | a->flags = IPV6_AF_NEW | IPV6_AF_DELEGATEDPFX; | 1824 | a->flags = IPV6_AF_NEW | IPV6_AF_DELEGATEDPFX; | |
1825 | a->created = *acquired; | |||
1824 | a->dadcallback = dhcp6_dadcallback; | 1826 | a->dadcallback = dhcp6_dadcallback; | |
1825 | a->ia_type = D6_OPTION_IA_PD; | 1827 | a->ia_type = D6_OPTION_IA_PD; | |
1826 | memcpy(a->iaid, iaid, sizeof(a->iaid)); | 1828 | memcpy(a->iaid, iaid, sizeof(a->iaid)); | |
1827 | a->prefix = pdp->prefix; | 1829 | a->prefix = pdp->prefix; | |
1828 | a->prefix_len = pdp->prefix_len; | 1830 | a->prefix_len = pdp->prefix_len; | |
1829 | ia = inet_ntop(AF_INET6, &a->prefix, | 1831 | ia = inet_ntop(AF_INET6, &a->prefix, | |
1830 | iabuf, sizeof(iabuf)); | 1832 | iabuf, sizeof(iabuf)); | |
1831 | snprintf(a->saddr, sizeof(a->saddr), | 1833 | snprintf(a->saddr, sizeof(a->saddr), | |
1832 | "%s/%d", ia, a->prefix_len); | 1834 | "%s/%d", ia, a->prefix_len); | |
1833 | TAILQ_INSERT_TAIL(&state->addrs, a, next); | 1835 | TAILQ_INSERT_TAIL(&state->addrs, a, next); | |
1834 | } else { | 1836 | } else { | |
1835 | if (!(a->flags & IPV6_AF_DELEGATEDPFX)) | 1837 | if (!(a->flags & IPV6_AF_DELEGATEDPFX)) | |
1836 | a->flags |= IPV6_AF_NEW | IPV6_AF_DELEGATEDPFX; | 1838 | a->flags |= IPV6_AF_NEW | IPV6_AF_DELEGATEDPFX; | |
@@ -2277,45 +2279,46 @@ dhcp6_ifdelegateaddr(struct interface *i | @@ -2277,45 +2279,46 @@ dhcp6_ifdelegateaddr(struct interface *i | |||
2277 | return NULL; | 2279 | return NULL; | |
2278 | 2280 | |||
2279 | 2281 | |||
2280 | a = calloc(1, sizeof(*a)); | 2282 | a = calloc(1, sizeof(*a)); | |
2281 | if (a == NULL) { | 2283 | if (a == NULL) { | |
2282 | syslog(LOG_ERR, "%s: %m", __func__); | 2284 | syslog(LOG_ERR, "%s: %m", __func__); | |
2283 | return NULL; | 2285 | return NULL; | |
2284 | } | 2286 | } | |
2285 | a->iface = ifp; | 2287 | a->iface = ifp; | |
2286 | a->flags = IPV6_AF_NEW | IPV6_AF_ONLINK; | 2288 | a->flags = IPV6_AF_NEW | IPV6_AF_ONLINK; | |
2287 | a->dadcallback = dhcp6_dadcallback; | 2289 | a->dadcallback = dhcp6_dadcallback; | |
2288 | a->delegating_iface = ifs; | 2290 | a->delegating_iface = ifs; | |
2289 | memcpy(&a->iaid, &prefix->iaid, sizeof(a->iaid)); | 2291 | memcpy(&a->iaid, &prefix->iaid, sizeof(a->iaid)); | |
2290 | a->acquired = prefix->acquired; | 2292 | a->created = a->acquired = prefix->acquired; | |
2291 | a->prefix_pltime = prefix->prefix_pltime; | 2293 | a->prefix_pltime = prefix->prefix_pltime; | |
2292 | a->prefix_vltime = prefix->prefix_vltime; | 2294 | a->prefix_vltime = prefix->prefix_vltime; | |
2293 | a->prefix = addr; | 2295 | a->prefix = addr; | |
2294 | a->prefix_len = (uint8_t)pfxlen; | 2296 | a->prefix_len = (uint8_t)pfxlen; | |
2295 | 2297 | |||
2296 | /* Wang a 1 at the end as the prefix could be >64 | 2298 | /* Wang a 1 at the end as the prefix could be >64 | |
2297 | * making SLAAC impossible. */ | 2299 | * making SLAAC impossible. */ | |
2298 | a->addr = a->prefix; | 2300 | a->addr = a->prefix; | |
2299 | a->addr.s6_addr[sizeof(a->addr.s6_addr) - 1] += 1; | 2301 | a->addr.s6_addr[sizeof(a->addr.s6_addr) - 1] += 1; | |
2300 | 2302 | |||
2301 | state = D6_STATE(ifp); | 2303 | state = D6_STATE(ifp); | |
2302 | /* Remove any exiting address */ | 2304 | /* Remove any exiting address */ | |
2303 | TAILQ_FOREACH_SAFE(ap, &state->addrs, next, apn) { | 2305 | TAILQ_FOREACH_SAFE(ap, &state->addrs, next, apn) { | |
2304 | if (IN6_ARE_ADDR_EQUAL(&ap->addr, &a->addr)) { | 2306 | if (IN6_ARE_ADDR_EQUAL(&ap->addr, &a->addr)) { | |
2305 | TAILQ_REMOVE(&state->addrs, ap, next); | 2307 | TAILQ_REMOVE(&state->addrs, ap, next); | |
2306 | /* Keep our flags */ | 2308 | /* Keep our flags */ | |
2307 | a->flags |= ap->flags; | 2309 | a->flags |= ap->flags; | |
2308 | a->flags &= ~IPV6_AF_NEW; | 2310 | a->flags &= ~IPV6_AF_NEW; | |
2311 | a->created = ap->created; | |||
2309 | free(ap); | 2312 | free(ap); | |
2310 | } | 2313 | } | |
2311 | } | 2314 | } | |
2312 | 2315 | |||
2313 | sa = inet_ntop(AF_INET6, &a->addr, sabuf, sizeof(sabuf)); | 2316 | sa = inet_ntop(AF_INET6, &a->addr, sabuf, sizeof(sabuf)); | |
2314 | snprintf(a->saddr, sizeof(a->saddr), "%s/%d", sa, a->prefix_len); | 2317 | snprintf(a->saddr, sizeof(a->saddr), "%s/%d", sa, a->prefix_len); | |
2315 | TAILQ_INSERT_TAIL(&state->addrs, a, next); | 2318 | TAILQ_INSERT_TAIL(&state->addrs, a, next); | |
2316 | return a; | 2319 | return a; | |
2317 | } | 2320 | } | |
2318 | 2321 | |||
2319 | static void | 2322 | static void | |
2320 | dhcp6_script_try_run(struct interface *ifp, int delegated) | 2323 | dhcp6_script_try_run(struct interface *ifp, int delegated) | |
2321 | { | 2324 | { | |
@@ -2676,26 +2679,34 @@ dhcp6_handledata(void *arg) | @@ -2676,26 +2679,34 @@ dhcp6_handledata(void *arg) | |||
2676 | ifo = ifp->options; | 2679 | ifo = ifp->options; | |
2677 | for (i = 0, opt = dhcpcd_ctx->dhcp6_opts; | 2680 | for (i = 0, opt = dhcpcd_ctx->dhcp6_opts; | |
2678 | i < dhcpcd_ctx->dhcp6_opts_len; | 2681 | i < dhcpcd_ctx->dhcp6_opts_len; | |
2679 | i++, opt++) | 2682 | i++, opt++) | |
2680 | { | 2683 | { | |
2681 | if (has_option_mask(ifo->requiremask6, opt->option) && | 2684 | if (has_option_mask(ifo->requiremask6, opt->option) && | |
2682 | dhcp6_getmoption(opt->option, r, len) == NULL) | 2685 | dhcp6_getmoption(opt->option, r, len) == NULL) | |
2683 | { | 2686 | { | |
2684 | syslog(LOG_WARNING, | 2687 | syslog(LOG_WARNING, | |
2685 | "%s: reject DHCPv6 (no option %s) from %s", | 2688 | "%s: reject DHCPv6 (no option %s) from %s", | |
2686 | ifp->name, opt->var, ctx->sfrom); | 2689 | ifp->name, opt->var, ctx->sfrom); | |
2687 | return; | 2690 | return; | |
2688 | } | 2691 | } | |
2692 | if (has_option_mask(ifo->rejectmask6, opt->option) && | |||
2693 | dhcp6_getmoption(opt->option, r, len)) | |||
2694 | { | |||
2695 | syslog(LOG_WARNING, | |||
2696 | "%s: reject DHCPv6 (option %s) from %s", | |||
2697 | ifp->name, opt->var, ctx->sfrom); | |||
2698 | return; | |||
2699 | } | |||
2689 | } | 2700 | } | |
2690 | 2701 | |||
2691 | /* Authenticate the message */ | 2702 | /* Authenticate the message */ | |
2692 | auth = dhcp6_getmoption(D6_OPTION_AUTH, r, len); | 2703 | auth = dhcp6_getmoption(D6_OPTION_AUTH, r, len); | |
2693 | if (auth) { | 2704 | if (auth) { | |
2694 | if (dhcp_auth_validate(&state->auth, &ifo->auth, | 2705 | if (dhcp_auth_validate(&state->auth, &ifo->auth, | |
2695 | (uint8_t *)r, len, 6, r->type, | 2706 | (uint8_t *)r, len, 6, r->type, | |
2696 | D6_COPTION_DATA(auth), ntohs(auth->len)) == NULL) | 2707 | D6_COPTION_DATA(auth), ntohs(auth->len)) == NULL) | |
2697 | { | 2708 | { | |
2698 | syslog(LOG_DEBUG, "dhcp_auth_validate: %m"); | 2709 | syslog(LOG_DEBUG, "dhcp_auth_validate: %m"); | |
2699 | syslog(LOG_ERR, "%s: authentication failed from %s", | 2710 | syslog(LOG_ERR, "%s: authentication failed from %s", | |
2700 | ifp->name, ctx->sfrom); | 2711 | ifp->name, ctx->sfrom); | |
2701 | return; | 2712 | return; | |
@@ -3282,27 +3293,27 @@ dhcp6_freedrop(struct interface *ifp, in | @@ -3282,27 +3293,27 @@ dhcp6_freedrop(struct interface *ifp, in | |||
3282 | TAILQ_REMOVE(ifp->ctx->ifaces, ifpx, next); | 3293 | TAILQ_REMOVE(ifp->ctx->ifaces, ifpx, next); | |
3283 | if_free(ifpx); | 3294 | if_free(ifpx); | |
3284 | } | 3295 | } | |
3285 | 3296 | |||
3286 | if (ifp->ctx->eloop) | 3297 | if (ifp->ctx->eloop) | |
3287 | eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); | 3298 | eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); | |
3288 | 3299 | |||
3289 | if (dropdele) | 3300 | if (dropdele) | |
3290 | dhcp6_delete_delegates(ifp); | 3301 | dhcp6_delete_delegates(ifp); | |
3291 | 3302 | |||
3292 | state = D6_STATE(ifp); | 3303 | state = D6_STATE(ifp); | |
3293 | if (state) { | 3304 | if (state) { | |
3294 | dhcp_auth_reset(&state->auth); | 3305 | dhcp_auth_reset(&state->auth); | |
3295 | if (options & DHCPCD_RELEASE) { | 3306 | if (drop && options & DHCPCD_RELEASE) { | |
3296 | if (ifp->carrier == LINK_UP) | 3307 | if (ifp->carrier == LINK_UP) | |
3297 | dhcp6_startrelease(ifp); | 3308 | dhcp6_startrelease(ifp); | |
3298 | unlink(state->leasefile); | 3309 | unlink(state->leasefile); | |
3299 | } | 3310 | } | |
3300 | dhcp6_freedrop_addrs(ifp, drop, NULL); | 3311 | dhcp6_freedrop_addrs(ifp, drop, NULL); | |
3301 | free(state->old); | 3312 | free(state->old); | |
3302 | state->old = state->new; | 3313 | state->old = state->new; | |
3303 | state->old_len = state->new_len; | 3314 | state->old_len = state->new_len; | |
3304 | state->new = NULL; | 3315 | state->new = NULL; | |
3305 | state->new_len = 0; | 3316 | state->new_len = 0; | |
3306 | if (drop && state->old && | 3317 | if (drop && state->old && | |
3307 | (options & | 3318 | (options & | |
3308 | (DHCPCD_EXITING | DHCPCD_PERSISTENT)) != | 3319 | (DHCPCD_EXITING | DHCPCD_PERSISTENT)) != |
--- src/external/bsd/dhcpcd/dist/Attic/arp.h 2014/12/29 16:18:04 1.1.1.4.4.1
+++ src/external/bsd/dhcpcd/dist/Attic/arp.h 2015/02/05 15:13:12 1.1.1.4.4.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: arp.h,v 1.1.1.4.4.1 2014/12/29 16:18:04 martin Exp $ */ | 1 | /* $NetBSD: arp.h,v 1.1.1.4.4.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -67,16 +67,16 @@ struct arp_state { | @@ -67,16 +67,16 @@ struct arp_state { | |||
67 | }; | 67 | }; | |
68 | TAILQ_HEAD(arp_statehead, arp_state); | 68 | TAILQ_HEAD(arp_statehead, arp_state); | |
69 | 69 | |||
70 | #ifdef INET | 70 | #ifdef INET | |
71 | void arp_report_conflicted(const struct arp_state *, const struct arp_msg *); | 71 | void arp_report_conflicted(const struct arp_state *, const struct arp_msg *); | |
72 | void arp_announce(struct arp_state *); | 72 | void arp_announce(struct arp_state *); | |
73 | void arp_probe(struct arp_state *); | 73 | void arp_probe(struct arp_state *); | |
74 | struct arp_state *arp_new(struct interface *); | 74 | struct arp_state *arp_new(struct interface *); | |
75 | void arp_cancel(struct arp_state *); | 75 | void arp_cancel(struct arp_state *); | |
76 | void arp_free(struct arp_state *); | 76 | void arp_free(struct arp_state *); | |
77 | void arp_free_but(struct arp_state *); | 77 | void arp_free_but(struct arp_state *); | |
78 | void arp_close(struct interface *); | 78 | void arp_close(struct interface *); | |
79 | #else | 79 | #else | |
80 | #define arp_close(a) | 80 | #define arp_close(a) {} | |
81 | #endif | 81 | #endif | |
82 | #endif | 82 | #endif |
--- src/external/bsd/dhcpcd/dist/Attic/auth.c 2014/12/29 16:18:04 1.1.1.4.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/auth.c 2015/02/05 15:13:12 1.1.1.4.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: auth.c,v 1.1.1.4.2.1 2014/12/29 16:18:04 martin Exp $"); | 2 | __RCSID("$NetBSD: auth.c,v 1.1.1.4.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/dev.h 2014/12/29 16:18:04 1.1.1.4.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dev.h 2015/02/05 15:13:12 1.1.1.4.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: dev.h,v 1.1.1.4.2.1 2014/12/29 16:18:04 martin Exp $ */ | 1 | /* $NetBSD: dev.h,v 1.1.1.4.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
15 | * | 15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
--- src/external/bsd/dhcpcd/dist/Attic/dhcpcd-embedded.h 2014/12/29 16:18:04 1.1.1.4.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcpcd-embedded.h 2015/02/05 15:13:12 1.1.1.4.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: dhcpcd-embedded.h,v 1.1.1.4.2.1 2014/12/29 16:18:04 martin Exp $ */ | 1 | /* $NetBSD: dhcpcd-embedded.h,v 1.1.1.4.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/ipv6nd.h 2014/12/29 16:18:05 1.1.1.4.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/ipv6nd.h 2015/02/05 15:13:12 1.1.1.4.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: ipv6nd.h,v 1.1.1.4.2.1 2014/12/29 16:18:05 martin Exp $ */ | 1 | /* $NetBSD: ipv6nd.h,v 1.1.1.4.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -93,20 +93,20 @@ void ipv6nd_freedrop_ra(struct ra *, int | @@ -93,20 +93,20 @@ void ipv6nd_freedrop_ra(struct ra *, int | |||
93 | #define ipv6nd_drop_ra(ra) ipv6nd_freedrop_ra((ra), 1) | 93 | #define ipv6nd_drop_ra(ra) ipv6nd_freedrop_ra((ra), 1) | |
94 | ssize_t ipv6nd_free(struct interface *); | 94 | ssize_t ipv6nd_free(struct interface *); | |
95 | void ipv6nd_expirera(void *arg); | 95 | void ipv6nd_expirera(void *arg); | |
96 | int ipv6nd_hasra(const struct interface *); | 96 | int ipv6nd_hasra(const struct interface *); | |
97 | int ipv6nd_hasradhcp(const struct interface *); | 97 | int ipv6nd_hasradhcp(const struct interface *); | |
98 | void ipv6nd_handleifa(struct dhcpcd_ctx *, int, | 98 | void ipv6nd_handleifa(struct dhcpcd_ctx *, int, | |
99 | const char *, const struct in6_addr *, int); | 99 | const char *, const struct in6_addr *, int); | |
100 | int ipv6nd_dadcompleted(const struct interface *); | 100 | int ipv6nd_dadcompleted(const struct interface *); | |
101 | void ipv6nd_drop(struct interface *); | 101 | void ipv6nd_drop(struct interface *); | |
102 | void ipv6nd_neighbour(struct dhcpcd_ctx *, struct in6_addr *, int); | 102 | void ipv6nd_neighbour(struct dhcpcd_ctx *, struct in6_addr *, int); | |
103 | #else | 103 | #else | |
104 | #define ipv6nd_startrs(a) {} | 104 | #define ipv6nd_startrs(a) {} | |
105 | #define ipv6nd_findaddr(a, b, c) (0) | 105 | #define ipv6nd_findaddr(a, b, c) (0) | |
106 | #define ipv6nd_free(a) | 106 | #define ipv6nd_free(a) {} | |
107 | #define ipv6nd_hasra(a) (0) | 107 | #define ipv6nd_hasra(a) (0) | |
108 | #define ipv6nd_dadcompleted(a) (0) | 108 | #define ipv6nd_dadcompleted(a) (0) | |
109 | #define ipv6nd_drop(a) | 109 | #define ipv6nd_drop(a) {} | |
110 | #endif | 110 | #endif | |
111 | 111 | |||
112 | #endif | 112 | #endif |
--- src/external/bsd/dhcpcd/dist/Attic/auth.h 2014/12/29 16:18:04 1.1.1.2.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/auth.h 2015/02/05 15:13:12 1.1.1.2.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: auth.h,v 1.1.1.2.2.1 2014/12/29 16:18:04 martin Exp $ */ | 1 | /* $NetBSD: auth.h,v 1.1.1.2.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/common.c 2014/12/29 16:18:04 1.1.1.15.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/common.c 2015/02/05 15:13:12 1.1.1.15.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: common.c,v 1.1.1.15.2.1 2014/12/29 16:18:04 martin Exp $"); | 2 | __RCSID("$NetBSD: common.c,v 1.1.1.15.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/common.h 2014/12/29 16:18:04 1.1.1.11.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/common.h 2015/02/05 15:13:12 1.1.1.11.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: common.h,v 1.1.1.11.2.1 2014/12/29 16:18:04 martin Exp $ */ | 1 | /* $NetBSD: common.h,v 1.1.1.11.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/ipv6.c 2014/12/29 16:18:05 1.1.1.11.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/ipv6.c 2015/02/05 15:13:12 1.1.1.11.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: ipv6.c,v 1.1.1.11.2.1 2014/12/29 16:18:05 martin Exp $"); | 2 | __RCSID("$NetBSD: ipv6.c,v 1.1.1.11.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -28,93 +28,115 @@ | @@ -28,93 +28,115 @@ | |||
28 | * SUCH DAMAGE. | 28 | * SUCH DAMAGE. | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | #include <sys/param.h> | 31 | #include <sys/param.h> | |
32 | #include <sys/types.h> | 32 | #include <sys/types.h> | |
33 | #include <sys/socket.h> | 33 | #include <sys/socket.h> | |
34 | #include <sys/stat.h> | 34 | #include <sys/stat.h> | |
35 | 35 | |||
36 | #include <net/if.h> | 36 | #include <net/if.h> | |
37 | #include <net/route.h> | 37 | #include <net/route.h> | |
38 | #include <netinet/in.h> | 38 | #include <netinet/in.h> | |
39 | #include <netinet/if_ether.h> | 39 | #include <netinet/if_ether.h> | |
40 | 40 | |||
41 | #ifdef __linux__ | 41 | #ifndef __linux__ | |
42 | /* Match Linux defines to BSD */ | 42 | # ifndef __QNX__ | |
43 | # ifdef IFA_F_OPTIMISTIC | 43 | # include <sys/endian.h> | |
44 | # define IN6_IFF_TENTATIVE (IFA_F_TENTATIVE | IFA_F_OPTIMISTIC) | |||
45 | # else | |||
46 | # define IN6_IFF_TENTATIVE (IFA_F_TENTATIVE | 0x04) | |||
47 | # endif | |||
48 | # ifdef IF_F_DADFAILED | |||
49 | # define IN6_IFF_DUPLICATED IFA_F_DADFAILED | |||
50 | # else | |||
51 | # define IN6_IFF_DUPLICATED 0x08 | |||
52 | # endif | 44 | # endif | |
53 | # define IN6_IFF_DETACHED 0 | |||
54 | #else | |||
55 | # include <sys/endian.h> | |||
56 | # include <net/if.h> | 45 | # include <net/if.h> | |
57 | #ifdef __FreeBSD__ /* Needed so that including netinet6/in6_var.h works */ | 46 | # ifdef __FreeBSD__ /* Needed so that including netinet6/in6_var.h works */ | |
58 | # include <net/if_var.h> | 47 | # include <net/if_var.h> | |
59 | #endif | 48 | # endif | |
60 | #ifndef __sun | 49 | # ifndef __sun | |
61 | # include <netinet6/in6_var.h> | 50 | # include <netinet6/in6_var.h> | |
62 | #endif | 51 | # endif | |
63 | #endif | 52 | #endif | |
64 | 53 | |||
65 | #include <errno.h> | 54 | #include <errno.h> | |
66 | #include <ifaddrs.h> | 55 | #include <ifaddrs.h> | |
67 | #include <inttypes.h> | 56 | #include <inttypes.h> | |
68 | #include <stdlib.h> | 57 | #include <stdlib.h> | |
69 | #include <string.h> | 58 | #include <string.h> | |
70 | #include <syslog.h> | 59 | #include <syslog.h> | |
71 | #include <unistd.h> | 60 | #include <unistd.h> | |
72 | 61 | |||
62 | #define ELOOP_QUEUE 7 | |||
73 | #include "common.h" | 63 | #include "common.h" | |
74 | #include "dhcpcd.h" | 64 | #include "dhcpcd.h" | |
75 | #include "dhcp6.h" | 65 | #include "dhcp6.h" | |
76 | #include "eloop.h" | 66 | #include "eloop.h" | |
77 | #include "if.h" | 67 | #include "if.h" | |
78 | #include "ipv6.h" | 68 | #include "ipv6.h" | |
79 | #include "ipv6nd.h" | 69 | #include "ipv6nd.h" | |
80 | 70 | |||
71 | #ifdef HAVE_MD5_H | |||
72 | # ifndef DEPGEN | |||
73 | # include <md5.h> | |||
74 | # endif | |||
75 | #else | |||
76 | # include "md5.h" | |||
77 | #endif | |||
78 | ||||
81 | #ifdef SHA2_H | 79 | #ifdef SHA2_H | |
82 | # include SHA2_H | 80 | # include SHA2_H | |
83 | #else | 81 | #else | |
84 | # include "sha256.h" | 82 | # include "sha256.h" | |
85 | #endif | 83 | #endif | |
86 | 84 | |||
87 | #ifndef SHA256_DIGEST_LENGTH | 85 | #ifndef SHA256_DIGEST_LENGTH | |
88 | # define SHA256_DIGEST_LENGTH 32 | 86 | # define SHA256_DIGEST_LENGTH 32 | |
89 | #endif | 87 | #endif | |
90 | 88 | |||
91 | #ifdef IPV6_POLLADDRFLAG | 89 | #ifdef IPV6_POLLADDRFLAG | |
92 | # warning kernel does not report IPv6 address flag changes | 90 | # warning kernel does not report IPv6 address flag changes | |
93 | # warning polling tentative address flags periodically instead | 91 | # warning polling tentative address flags periodically instead | |
94 | #endif | 92 | #endif | |
95 | 93 | |||
94 | #ifdef __linux__ | |||
95 | /* Match Linux defines to BSD */ | |||
96 | # define IN6_IFF_TEMPORARY IFA_F_TEMPORARY | |||
97 | # ifdef IFA_F_OPTIMISTIC | |||
98 | # define IN6_IFF_TENTATIVE (IFA_F_TENTATIVE | IFA_F_OPTIMISTIC) | |||
99 | # else | |||
100 | # define IN6_IFF_TENTATIVE (IFA_F_TENTATIVE | 0x04) | |||
101 | # endif | |||
102 | # ifdef IF_F_DADFAILED | |||
103 | # define IN6_IFF_DUPLICATED IFA_F_DADFAILED | |||
104 | # else | |||
105 | # define IN6_IFF_DUPLICATED 0x08 | |||
106 | # endif | |||
107 | # define IN6_IFF_DETACHED 0 | |||
108 | #endif | |||
109 | ||||
96 | #define IN6_IFF_NOTUSEABLE \ | 110 | #define IN6_IFF_NOTUSEABLE \ | |
97 | (IN6_IFF_TENTATIVE | IN6_IFF_DUPLICATED | IN6_IFF_DETACHED) | 111 | (IN6_IFF_TENTATIVE | IN6_IFF_DUPLICATED | IN6_IFF_DETACHED) | |
98 | 112 | |||
99 | /* Hackery at it's finest. */ | 113 | /* Hackery at it's finest. */ | |
100 | #ifndef s6_addr32 | 114 | #ifndef s6_addr32 | |
101 | # ifdef __sun | 115 | # ifdef __sun | |
102 | # define s6_addr32 _S6_un._S6_u32 | 116 | # define s6_addr32 _S6_un._S6_u32 | |
103 | # else | 117 | # else | |
104 | # define s6_addr32 __u6_addr.__u6_addr32 | 118 | # define s6_addr32 __u6_addr.__u6_addr32 | |
105 | # endif | 119 | # endif | |
106 | #endif | 120 | #endif | |
107 | 121 | |||
122 | ||||
123 | #ifdef IPV6_MANAGETEMPADDR | |||
124 | static void ipv6_regentempifid(void *); | |||
125 | static void ipv6_regentempaddr(void *); | |||
126 | #else | |||
127 | #define ipv6_regentempifid(a) {} | |||
128 | #endif | |||
129 | ||||
108 | struct ipv6_ctx * | 130 | struct ipv6_ctx * | |
109 | ipv6_init(struct dhcpcd_ctx *dhcpcd_ctx) | 131 | ipv6_init(struct dhcpcd_ctx *dhcpcd_ctx) | |
110 | { | 132 | { | |
111 | struct ipv6_ctx *ctx; | 133 | struct ipv6_ctx *ctx; | |
112 | 134 | |||
113 | if (dhcpcd_ctx->ipv6) | 135 | if (dhcpcd_ctx->ipv6) | |
114 | return dhcpcd_ctx->ipv6; | 136 | return dhcpcd_ctx->ipv6; | |
115 | 137 | |||
116 | ctx = calloc(1, sizeof(*ctx)); | 138 | ctx = calloc(1, sizeof(*ctx)); | |
117 | if (ctx == NULL) | 139 | if (ctx == NULL) | |
118 | return NULL; | 140 | return NULL; | |
119 | 141 | |||
120 | ctx->routes = malloc(sizeof(*ctx->routes)); | 142 | ctx->routes = malloc(sizeof(*ctx->routes)); | |
@@ -141,26 +163,27 @@ ipv6_init(struct dhcpcd_ctx *dhcpcd_ctx) | @@ -141,26 +163,27 @@ ipv6_init(struct dhcpcd_ctx *dhcpcd_ctx) | |||
141 | ctx->rcvhdr.msg_namelen = sizeof(ctx->from); | 163 | ctx->rcvhdr.msg_namelen = sizeof(ctx->from); | |
142 | ctx->rcvhdr.msg_iov = ctx->rcviov; | 164 | ctx->rcvhdr.msg_iov = ctx->rcviov; | |
143 | ctx->rcvhdr.msg_iovlen = 1; | 165 | ctx->rcvhdr.msg_iovlen = 1; | |
144 | ctx->rcvhdr.msg_control = ctx->rcvbuf; | 166 | ctx->rcvhdr.msg_control = ctx->rcvbuf; | |
145 | // controllen is set at recieve | 167 | // controllen is set at recieve | |
146 | //ctx->rcvhdr.msg_controllen = sizeof(ctx->rcvbuf); | 168 | //ctx->rcvhdr.msg_controllen = sizeof(ctx->rcvbuf); | |
147 | ctx->rcviov[0].iov_base = ctx->ansbuf; | 169 | ctx->rcviov[0].iov_base = ctx->ansbuf; | |
148 | ctx->rcviov[0].iov_len = sizeof(ctx->ansbuf); | 170 | ctx->rcviov[0].iov_len = sizeof(ctx->ansbuf); | |
149 | 171 | |||
150 | ctx->nd_fd = -1; | 172 | ctx->nd_fd = -1; | |
151 | ctx->dhcp_fd = -1; | 173 | ctx->dhcp_fd = -1; | |
152 | 174 | |||
153 | dhcpcd_ctx->ipv6 = ctx; | 175 | dhcpcd_ctx->ipv6 = ctx; | |
176 | ||||
154 | return ctx; | 177 | return ctx; | |
155 | } | 178 | } | |
156 | 179 | |||
157 | ssize_t | 180 | ssize_t | |
158 | ipv6_printaddr(char *s, size_t sl, const uint8_t *d, const char *ifname) | 181 | ipv6_printaddr(char *s, size_t sl, const uint8_t *d, const char *ifname) | |
159 | { | 182 | { | |
160 | char buf[INET6_ADDRSTRLEN]; | 183 | char buf[INET6_ADDRSTRLEN]; | |
161 | const char *p; | 184 | const char *p; | |
162 | size_t l; | 185 | size_t l; | |
163 | 186 | |||
164 | p = inet_ntop(AF_INET6, d, buf, sizeof(buf)); | 187 | p = inet_ntop(AF_INET6, d, buf, sizeof(buf)); | |
165 | if (p == NULL) | 188 | if (p == NULL) | |
166 | return -1; | 189 | return -1; | |
@@ -560,27 +583,27 @@ ipv6_userprefix( | @@ -560,27 +583,27 @@ ipv6_userprefix( | |||
560 | void | 583 | void | |
561 | ipv6_checkaddrflags(void *arg) | 584 | ipv6_checkaddrflags(void *arg) | |
562 | { | 585 | { | |
563 | struct ipv6_addr *ap; | 586 | struct ipv6_addr *ap; | |
564 | int ifa_flags; | 587 | int ifa_flags; | |
565 | 588 | |||
566 | ap = arg; | 589 | ap = arg; | |
567 | ifa_flags = if_addrflags6(&ap->addr, ap->iface); | 590 | ifa_flags = if_addrflags6(&ap->addr, ap->iface); | |
568 | if (ifa_flags == -1) | 591 | if (ifa_flags == -1) | |
569 | syslog(LOG_ERR, "%s: if_addrflags6: %m", ap->iface->name); | 592 | syslog(LOG_ERR, "%s: if_addrflags6: %m", ap->iface->name); | |
570 | else if (!(ifa_flags & IN6_IFF_TENTATIVE)) { | 593 | else if (!(ifa_flags & IN6_IFF_TENTATIVE)) { | |
571 | ipv6_handleifa(ap->iface->ctx, RTM_NEWADDR, | 594 | ipv6_handleifa(ap->iface->ctx, RTM_NEWADDR, | |
572 | ap->iface->ctx->ifaces, ap->iface->name, | 595 | ap->iface->ctx->ifaces, ap->iface->name, | |
573 | &ap->addr, ifa_flags); | 596 | &ap->addr, ap->prefix_len, ifa_flags); | |
574 | } else { | 597 | } else { | |
575 | struct timeval tv; | 598 | struct timeval tv; | |
576 | 599 | |||
577 | ms_to_tv(&tv, RETRANS_TIMER / 2); | 600 | ms_to_tv(&tv, RETRANS_TIMER / 2); | |
578 | eloop_timeout_add_tv(ap->iface->ctx->eloop, &tv, | 601 | eloop_timeout_add_tv(ap->iface->ctx->eloop, &tv, | |
579 | ipv6_checkaddrflags, ap); | 602 | ipv6_checkaddrflags, ap); | |
580 | } | 603 | } | |
581 | } | 604 | } | |
582 | #endif | 605 | #endif | |
583 | 606 | |||
584 | 607 | |||
585 | static void | 608 | static void | |
586 | ipv6_deleteaddr(struct ipv6_addr *addr) | 609 | ipv6_deleteaddr(struct ipv6_addr *addr) | |
@@ -600,102 +623,124 @@ ipv6_deleteaddr(struct ipv6_addr *addr) | @@ -600,102 +623,124 @@ ipv6_deleteaddr(struct ipv6_addr *addr) | |||
600 | TAILQ_REMOVE(&state->addrs, ap, next); | 623 | TAILQ_REMOVE(&state->addrs, ap, next); | |
601 | free(ap); | 624 | free(ap); | |
602 | break; | 625 | break; | |
603 | } | 626 | } | |
604 | } | 627 | } | |
605 | } | 628 | } | |
606 | 629 | |||
607 | int | 630 | int | |
608 | ipv6_addaddr(struct ipv6_addr *ap, const struct timeval *now) | 631 | ipv6_addaddr(struct ipv6_addr *ap, const struct timeval *now) | |
609 | { | 632 | { | |
610 | struct interface *ifp; | 633 | struct interface *ifp; | |
611 | struct ipv6_state *state; | 634 | struct ipv6_state *state; | |
612 | struct ipv6_addr *nap; | 635 | struct ipv6_addr *nap; | |
613 | struct timeval n; | |||
614 | uint32_t pltime, vltime; | 636 | uint32_t pltime, vltime; | |
615 | 637 | |||
616 | /* Ensure no other interface has this address */ | 638 | /* Ensure no other interface has this address */ | |
617 | TAILQ_FOREACH(ifp, ap->iface->ctx->ifaces, next) { | 639 | TAILQ_FOREACH(ifp, ap->iface->ctx->ifaces, next) { | |
618 | if (ifp == ap->iface || strcmp(ifp->name, ap->iface->name) == 0) | 640 | if (ifp == ap->iface || strcmp(ifp->name, ap->iface->name) == 0) | |
619 | continue; | 641 | continue; | |
620 | state = IPV6_STATE(ifp); | 642 | state = IPV6_STATE(ifp); | |
621 | if (state == NULL) | 643 | if (state == NULL) | |
622 | continue; | 644 | continue; | |
623 | TAILQ_FOREACH(nap, &state->addrs, next) { | 645 | TAILQ_FOREACH(nap, &state->addrs, next) { | |
624 | if (IN6_ARE_ADDR_EQUAL(&nap->addr, &ap->addr)) { | 646 | if (IN6_ARE_ADDR_EQUAL(&nap->addr, &ap->addr)) { | |
625 | ipv6_deleteaddr(nap); | 647 | ipv6_deleteaddr(nap); | |
626 | break; | 648 | break; | |
627 | } | 649 | } | |
628 | } | 650 | } | |
629 | } | 651 | } | |
630 | 652 | |||
653 | if (!(ap->flags & IPV6_AF_DADCOMPLETED) && | |||
654 | ipv6_iffindaddr(ap->iface, &ap->addr)) | |||
655 | ap->flags |= IPV6_AF_DADCOMPLETED; | |||
656 | ||||
657 | syslog(ap->flags & IPV6_AF_NEW ? LOG_INFO : LOG_DEBUG, | |||
658 | "%s: adding address %s", ap->iface->name, ap->saddr); | |||
659 | if (ap->prefix_pltime == ND6_INFINITE_LIFETIME && | |||
660 | ap->prefix_vltime == ND6_INFINITE_LIFETIME) | |||
661 | syslog(LOG_DEBUG, | |||
662 | "%s: pltime infinity, vltime infinity", | |||
663 | ap->iface->name); | |||
664 | else if (ap->prefix_pltime == ND6_INFINITE_LIFETIME) | |||
665 | syslog(LOG_DEBUG, | |||
666 | "%s: pltime infinity, vltime %"PRIu32" seconds", | |||
667 | ap->iface->name, ap->prefix_vltime); | |||
668 | else if (ap->prefix_vltime == ND6_INFINITE_LIFETIME) | |||
669 | syslog(LOG_DEBUG, | |||
670 | "%s: pltime %"PRIu32"seconds, vltime infinity", | |||
671 | ap->iface->name, ap->prefix_pltime); | |||
672 | else | |||
673 | syslog(LOG_DEBUG, | |||
674 | "%s: pltime %"PRIu32" seconds, vltime %"PRIu32" seconds", | |||
675 | ap->iface->name, ap->prefix_pltime, ap->prefix_vltime); | |||
676 | ||||
631 | /* Adjust plftime and vltime based on acquired time */ | 677 | /* Adjust plftime and vltime based on acquired time */ | |
632 | pltime = ap->prefix_pltime; | 678 | pltime = ap->prefix_pltime; | |
633 | vltime = ap->prefix_vltime; | 679 | vltime = ap->prefix_vltime; | |
634 | if (timerisset(&ap->acquired) && | 680 | if (timerisset(&ap->acquired) && | |
635 | (ap->prefix_pltime != ND6_INFINITE_LIFETIME || | 681 | (ap->prefix_pltime != ND6_INFINITE_LIFETIME || | |
636 | ap->prefix_vltime != ND6_INFINITE_LIFETIME)) | 682 | ap->prefix_vltime != ND6_INFINITE_LIFETIME)) | |
637 | { | 683 | { | |
684 | struct timeval n; | |||
685 | ||||
638 | if (now == NULL) { | 686 | if (now == NULL) { | |
639 | get_monotonic(&n); | 687 | get_monotonic(&n); | |
640 | now = &n; | 688 | now = &n; | |
641 | } | 689 | } | |
642 | timersub(now, &ap->acquired, &n); | 690 | timersub(now, &ap->acquired, &n); | |
643 | if (ap->prefix_pltime != ND6_INFINITE_LIFETIME) | 691 | if (ap->prefix_pltime != ND6_INFINITE_LIFETIME) | |
644 | ap->prefix_pltime -= n.tv_sec; | 692 | ap->prefix_pltime -= (uint32_t)n.tv_sec; | |
645 | if (ap->prefix_vltime != ND6_INFINITE_LIFETIME) | 693 | if (ap->prefix_vltime != ND6_INFINITE_LIFETIME) | |
646 | ap->prefix_vltime -= n.tv_sec; | 694 | ap->prefix_vltime -= (uint32_t)n.tv_sec; | |
647 | } | 695 | } | |
648 | 696 | |||
649 | syslog(ap->flags & IPV6_AF_NEW ? LOG_INFO : LOG_DEBUG, | |||
650 | "%s: adding address %s", ap->iface->name, ap->saddr); | |||
651 | if (!(ap->flags & IPV6_AF_DADCOMPLETED) && | |||
652 | ipv6_iffindaddr(ap->iface, &ap->addr)) | |||
653 | ap->flags |= IPV6_AF_DADCOMPLETED; | |||
654 | if (if_addaddress6(ap) == -1) { | 697 | if (if_addaddress6(ap) == -1) { | |
655 | syslog(LOG_ERR, "if_addaddress6: %m"); | 698 | syslog(LOG_ERR, "if_addaddress6: %m"); | |
699 | #if 0 | |||
700 | syslog(LOG_DEBUG, | |||
701 | "%s: adj pltime %"PRIu32" seconds, " | |||
702 | "vltime %"PRIu32" seconds", | |||
703 | ap->iface->name, ap->prefix_pltime, ap->prefix_vltime); | |||
704 | #endif | |||
656 | /* Restore real pltime and vltime */ | 705 | /* Restore real pltime and vltime */ | |
657 | ap->prefix_pltime = pltime; | 706 | ap->prefix_pltime = pltime; | |
658 | ap->prefix_vltime = vltime; | 707 | ap->prefix_vltime = vltime; | |
659 | return -1; | 708 | return -1; | |
660 | } | 709 | } | |
661 | 710 | |||
711 | #ifdef IPV6_MANAGETEMPADDR | |||
712 | /* RFC4941 Section 3.4 */ | |||
713 | if (ap->flags & IPV6_AF_TEMPORARY && | |||
714 | ap->prefix_pltime && | |||
715 | ap->prefix_vltime && | |||
716 | ap->iface->options->options & DHCPCD_IPV6RA_OWN && | |||
717 | ip6_use_tempaddr(ap->iface->name)) | |||
718 | eloop_timeout_add_sec(ap->iface->ctx->eloop, | |||
719 | (time_t)ap->prefix_pltime - REGEN_ADVANCE, | |||
720 | ipv6_regentempaddr, ap); | |||
721 | #endif | |||
722 | ||||
662 | /* Restore real pltime and vltime */ | 723 | /* Restore real pltime and vltime */ | |
663 | ap->prefix_pltime = pltime; | 724 | ap->prefix_pltime = pltime; | |
664 | ap->prefix_vltime = vltime; | 725 | ap->prefix_vltime = vltime; | |
726 | ||||
665 | ap->flags &= ~IPV6_AF_NEW; | 727 | ap->flags &= ~IPV6_AF_NEW; | |
666 | ap->flags |= IPV6_AF_ADDED; | 728 | ap->flags |= IPV6_AF_ADDED; | |
667 | if (ap->delegating_iface) | 729 | if (ap->delegating_iface) | |
668 | ap->flags |= IPV6_AF_DELEGATED; | 730 | ap->flags |= IPV6_AF_DELEGATED; | |
669 | if (ap->iface->options->options & DHCPCD_IPV6RA_OWN && | 731 | if (ap->iface->options->options & DHCPCD_IPV6RA_OWN && | |
670 | ipv6_removesubnet(ap->iface, ap) == -1) | 732 | ipv6_removesubnet(ap->iface, ap) == -1) | |
671 | syslog(LOG_ERR,"ipv6_removesubnet: %m"); | 733 | syslog(LOG_ERR,"ipv6_removesubnet: %m"); | |
672 | if (ap->prefix_pltime == ND6_INFINITE_LIFETIME && | |||
673 | ap->prefix_vltime == ND6_INFINITE_LIFETIME) | |||
674 | syslog(LOG_DEBUG, | |||
675 | "%s: vltime infinity, pltime infinity", | |||
676 | ap->iface->name); | |||
677 | else if (ap->prefix_pltime == ND6_INFINITE_LIFETIME) | |||
678 | syslog(LOG_DEBUG, | |||
679 | "%s: vltime %"PRIu32" seconds, pltime infinity", | |||
680 | ap->iface->name, ap->prefix_vltime); | |||
681 | else if (ap->prefix_vltime == ND6_INFINITE_LIFETIME) | |||
682 | syslog(LOG_DEBUG, | |||
683 | "%s: vltime infinity, pltime %"PRIu32"seconds", | |||
684 | ap->iface->name, ap->prefix_pltime); | |||
685 | else | |||
686 | syslog(LOG_DEBUG, | |||
687 | "%s: vltime %"PRIu32" seconds, pltime %"PRIu32" seconds", | |||
688 | ap->iface->name, ap->prefix_vltime, ap->prefix_pltime); | |||
689 | 734 | |||
690 | #ifdef IPV6_POLLADDRFLAG | 735 | #ifdef IPV6_POLLADDRFLAG | |
691 | eloop_timeout_delete(ap->iface->ctx->eloop, | 736 | eloop_timeout_delete(ap->iface->ctx->eloop, | |
692 | ipv6_checkaddrflags, ap); | 737 | ipv6_checkaddrflags, ap); | |
693 | if (!(ap->flags & IPV6_AF_DADCOMPLETED)) { | 738 | if (!(ap->flags & IPV6_AF_DADCOMPLETED)) { | |
694 | struct timeval tv; | 739 | struct timeval tv; | |
695 | 740 | |||
696 | ms_to_tv(&tv, RETRANS_TIMER / 2); | 741 | ms_to_tv(&tv, RETRANS_TIMER / 2); | |
697 | eloop_timeout_add_tv(ap->iface->ctx->eloop, | 742 | eloop_timeout_add_tv(ap->iface->ctx->eloop, | |
698 | &tv, ipv6_checkaddrflags, ap); | 743 | &tv, ipv6_checkaddrflags, ap); | |
699 | } | 744 | } | |
700 | #endif | 745 | #endif | |
701 | 746 | |||
@@ -783,74 +828,86 @@ ipv6_addaddrs(struct ipv6_addrhead *addr | @@ -783,74 +828,86 @@ ipv6_addaddrs(struct ipv6_addrhead *addr | |||
783 | } | 828 | } | |
784 | 829 | |||
785 | void | 830 | void | |
786 | ipv6_freedrop_addrs(struct ipv6_addrhead *addrs, int drop, | 831 | ipv6_freedrop_addrs(struct ipv6_addrhead *addrs, int drop, | |
787 | const struct interface *ifd) | 832 | const struct interface *ifd) | |
788 | { | 833 | { | |
789 | struct ipv6_addr *ap, *apn, *apf; | 834 | struct ipv6_addr *ap, *apn, *apf; | |
790 | struct timeval now; | 835 | struct timeval now; | |
791 | 836 | |||
792 | timerclear(&now); | 837 | timerclear(&now); | |
793 | TAILQ_FOREACH_SAFE(ap, addrs, next, apn) { | 838 | TAILQ_FOREACH_SAFE(ap, addrs, next, apn) { | |
794 | if (ifd && ap->delegating_iface != ifd) | 839 | if (ifd && ap->delegating_iface != ifd) | |
795 | continue; | 840 | continue; | |
796 | TAILQ_REMOVE(addrs, ap, next); | 841 | if (drop != 2) | |
842 | TAILQ_REMOVE(addrs, ap, next); | |||
797 | eloop_q_timeout_delete(ap->iface->ctx->eloop, 0, NULL, ap); | 843 | eloop_q_timeout_delete(ap->iface->ctx->eloop, 0, NULL, ap); | |
798 | if (drop && ap->flags & IPV6_AF_ADDED && | 844 | if (drop && ap->flags & IPV6_AF_ADDED && | |
799 | (ap->iface->options->options & | 845 | (ap->iface->options->options & | |
800 | (DHCPCD_EXITING | DHCPCD_PERSISTENT)) != | 846 | (DHCPCD_EXITING | DHCPCD_PERSISTENT)) != | |
801 | (DHCPCD_EXITING | DHCPCD_PERSISTENT)) | 847 | (DHCPCD_EXITING | DHCPCD_PERSISTENT)) | |
802 | { | 848 | { | |
849 | if (drop == 2) | |||
850 | TAILQ_REMOVE(addrs, ap, next); | |||
803 | /* Find the same address somewhere else */ | 851 | /* Find the same address somewhere else */ | |
804 | apf = ipv6_findaddr(ap->iface->ctx, &ap->addr, 0); | 852 | apf = ipv6_findaddr(ap->iface->ctx, &ap->addr, 0); | |
805 | if (apf == NULL || | 853 | if (apf == NULL || | |
806 | (apf->iface != ap->iface && | 854 | (apf->iface != ap->iface && | |
807 | strcmp(apf->iface->name, ap->iface->name))) | 855 | strcmp(apf->iface->name, ap->iface->name))) | |
808 | ipv6_deleteaddr(ap); | 856 | ipv6_deleteaddr(ap); | |
809 | if (!(ap->iface->options->options & | 857 | if (!(ap->iface->options->options & | |
810 | DHCPCD_EXITING) && apf) | 858 | DHCPCD_EXITING) && apf) | |
811 | { | 859 | { | |
812 | if (!timerisset(&now)) | 860 | if (!timerisset(&now)) | |
813 | get_monotonic(&now); | 861 | get_monotonic(&now); | |
814 | ipv6_addaddr(apf, &now); | 862 | ipv6_addaddr(apf, &now); | |
815 | } | 863 | } | |
864 | if (drop == 2) | |||
865 | free(ap); | |||
816 | } | 866 | } | |
817 | free(ap); | 867 | if (drop != 2) | |
868 | free(ap); | |||
818 | } | 869 | } | |
819 | } | 870 | } | |
820 | 871 | |||
821 | static struct ipv6_state * | 872 | static struct ipv6_state * | |
822 | ipv6_getstate(struct interface *ifp) | 873 | ipv6_getstate(struct interface *ifp) | |
823 | { | 874 | { | |
824 | struct ipv6_state *state; | 875 | struct ipv6_state *state; | |
825 | 876 | |||
826 | state = IPV6_STATE(ifp); | 877 | state = IPV6_STATE(ifp); | |
827 | if (state == NULL) { | 878 | if (state == NULL) { | |
828 | ifp->if_data[IF_DATA_IPV6] = malloc(sizeof(*state)); | 879 | ifp->if_data[IF_DATA_IPV6] = calloc(1, sizeof(*state)); | |
829 | state = IPV6_STATE(ifp); | 880 | state = IPV6_STATE(ifp); | |
830 | if (state == NULL) { | 881 | if (state == NULL) { | |
831 | syslog(LOG_ERR, "%s: %m", __func__); | 882 | syslog(LOG_ERR, "%s: %m", __func__); | |
832 | return NULL; | 883 | return NULL; | |
833 | } | 884 | } | |
834 | TAILQ_INIT(&state->addrs); | 885 | TAILQ_INIT(&state->addrs); | |
835 | TAILQ_INIT(&state->ll_callbacks); | 886 | TAILQ_INIT(&state->ll_callbacks); | |
887 | ||||
888 | /* Regenerate new ids */ | |||
889 | if (ifp->options && | |||
890 | ifp->options->options & DHCPCD_IPV6RA_OWN && | |||
891 | ip6_use_tempaddr(ifp->name)) | |||
892 | ipv6_regentempifid(ifp); | |||
836 | } | 893 | } | |
837 | return state; | 894 | return state; | |
838 | } | 895 | } | |
839 | 896 | |||
840 | void | 897 | void | |
841 | ipv6_handleifa(struct dhcpcd_ctx *ctx, | 898 | ipv6_handleifa(struct dhcpcd_ctx *ctx, | |
842 | int cmd, struct if_head *ifs, const char *ifname, | 899 | int cmd, struct if_head *ifs, const char *ifname, | |
843 | const struct in6_addr *addr, int flags) | 900 | const struct in6_addr *addr, uint8_t prefix_len, int flags) | |
844 | { | 901 | { | |
845 | struct interface *ifp; | 902 | struct interface *ifp; | |
846 | struct ipv6_state *state; | 903 | struct ipv6_state *state; | |
847 | struct ipv6_addr *ap; | 904 | struct ipv6_addr *ap; | |
848 | struct ll_callback *cb; | 905 | struct ll_callback *cb; | |
849 | 906 | |||
850 | #if 0 | 907 | #if 0 | |
851 | char buf[INET6_ADDRSTRLEN]; | 908 | char buf[INET6_ADDRSTRLEN]; | |
852 | inet_ntop(AF_INET6, &addr->s6_addr, | 909 | inet_ntop(AF_INET6, &addr->s6_addr, | |
853 | buf, INET6_ADDRSTRLEN); | 910 | buf, INET6_ADDRSTRLEN); | |
854 | syslog(LOG_DEBUG, "%s: cmd %d addr %s flags %d", | 911 | syslog(LOG_DEBUG, "%s: cmd %d addr %s flags %d", | |
855 | ifname, cmd, buf, flags); | 912 | ifname, cmd, buf, flags); | |
856 | #endif | 913 | #endif | |
@@ -878,36 +935,70 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx, | @@ -878,36 +935,70 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx, | |||
878 | if (IN6_ARE_ADDR_EQUAL(&ap->addr, addr)) | 935 | if (IN6_ARE_ADDR_EQUAL(&ap->addr, addr)) | |
879 | break; | 936 | break; | |
880 | } | 937 | } | |
881 | 938 | |||
882 | switch (cmd) { | 939 | switch (cmd) { | |
883 | case RTM_DELADDR: | 940 | case RTM_DELADDR: | |
884 | if (ap) { | 941 | if (ap) { | |
885 | TAILQ_REMOVE(&state->addrs, ap, next); | 942 | TAILQ_REMOVE(&state->addrs, ap, next); | |
886 | free(ap); | 943 | free(ap); | |
887 | } | 944 | } | |
888 | break; | 945 | break; | |
889 | case RTM_NEWADDR: | 946 | case RTM_NEWADDR: | |
890 | if (ap == NULL) { | 947 | if (ap == NULL) { | |
948 | char buf[INET6_ADDRSTRLEN]; | |||
949 | const char *cbp; | |||
950 | ||||
891 | ap = calloc(1, sizeof(*ap)); | 951 | ap = calloc(1, sizeof(*ap)); | |
892 | ap->iface = ifp; | 952 | ap->iface = ifp; | |
893 | ap->addr = *addr; | 953 | ap->addr = *addr; | |
894 | inet_ntop(AF_INET6, &addr->s6_addr, | 954 | ap->prefix_len = prefix_len; | |
895 | ap->saddr, sizeof(ap->saddr)); | 955 | ipv6_makeprefix(&ap->prefix, &ap->addr, | |
956 | ap->prefix_len); | |||
957 | cbp = inet_ntop(AF_INET6, &addr->s6_addr, | |||
958 | buf, sizeof(buf)); | |||
959 | if (cbp) | |||
960 | snprintf(ap->saddr, sizeof(ap->saddr), | |||
961 | "%s/%d", cbp, prefix_len); | |||
962 | if (if_getlifetime6(ap) == -1) { | |||
963 | /* No support or address vanished. | |||
964 | * Either way, just set a deprecated | |||
965 | * infinite time lifetime and continue. | |||
966 | * This is fine because we only want | |||
967 | * to know this when trying to extend | |||
968 | * temporary addresses. | |||
969 | * As we can't extend infinite, we'll | |||
970 | * create a new temporary address. */ | |||
971 | ap->prefix_pltime = 0; | |||
972 | ap->prefix_vltime = | |||
973 | ND6_INFINITE_LIFETIME; | |||
974 | } | |||
975 | /* This is a minor regression against RFC 4941 | |||
976 | * because the kernel only knows when the | |||
977 | * lifetimes were last updated, not when the | |||
978 | * address was initially created. | |||
979 | * Provided dhcpcd is not restarted, this | |||
980 | * won't be a problem. | |||
981 | * If we don't like it, we can always | |||
982 | * pretend lifetimes are infinite and always | |||
983 | * generate a new temporary address on | |||
984 | * restart. */ | |||
985 | ap->acquired = ap->created; | |||
896 | TAILQ_INSERT_TAIL(&state->addrs, | 986 | TAILQ_INSERT_TAIL(&state->addrs, | |
897 | ap, next); | 987 | ap, next); | |
898 | } | 988 | } | |
899 | ap->addr_flags = flags; | 989 | ap->addr_flags = flags; | |
900 | 990 | if (ap->addr_flags & IN6_IFF_TEMPORARY) | ||
991 | ap->flags |= IPV6_AF_TEMPORARY; | |||
901 | if (IN6_IS_ADDR_LINKLOCAL(&ap->addr)) { | 992 | if (IN6_IS_ADDR_LINKLOCAL(&ap->addr)) { | |
902 | #ifdef IPV6_POLLADDRFLAG | 993 | #ifdef IPV6_POLLADDRFLAG | |
903 | if (ap->addr_flags & IN6_IFF_TENTATIVE) { | 994 | if (ap->addr_flags & IN6_IFF_TENTATIVE) { | |
904 | struct timeval tv; | 995 | struct timeval tv; | |
905 | 996 | |||
906 | ms_to_tv(&tv, RETRANS_TIMER / 2); | 997 | ms_to_tv(&tv, RETRANS_TIMER / 2); | |
907 | eloop_timeout_add_tv( | 998 | eloop_timeout_add_tv( | |
908 | ap->iface->ctx->eloop, | 999 | ap->iface->ctx->eloop, | |
909 | &tv, ipv6_checkaddrflags, ap); | 1000 | &tv, ipv6_checkaddrflags, ap); | |
910 | break; | 1001 | break; | |
911 | } | 1002 | } | |
912 | #endif | 1003 | #endif | |
913 | 1004 | |||
@@ -943,65 +1034,51 @@ ipv6_iffindaddr(const struct interface * | @@ -943,65 +1034,51 @@ ipv6_iffindaddr(const struct interface * | |||
943 | if (IN6_IS_ADDR_LINKLOCAL(&ap->addr) && | 1034 | if (IN6_IS_ADDR_LINKLOCAL(&ap->addr) && | |
944 | !(ap->addr_flags & IN6_IFF_NOTUSEABLE)) | 1035 | !(ap->addr_flags & IN6_IFF_NOTUSEABLE)) | |
945 | return ap; | 1036 | return ap; | |
946 | } else { | 1037 | } else { | |
947 | if (IN6_ARE_ADDR_EQUAL(&ap->addr, addr) && | 1038 | if (IN6_ARE_ADDR_EQUAL(&ap->addr, addr) && | |
948 | !(ap->addr_flags & IN6_IFF_TENTATIVE)) | 1039 | !(ap->addr_flags & IN6_IFF_TENTATIVE)) | |
949 | return ap; | 1040 | return ap; | |
950 | } | 1041 | } | |
951 | } | 1042 | } | |
952 | } | 1043 | } | |
953 | return NULL; | 1044 | return NULL; | |
954 | } | 1045 | } | |
955 | 1046 | |||
956 | int ipv6_addlinklocalcallback(struct interface *ifp, | 1047 | int | |
1048 | ipv6_addlinklocalcallback(struct interface *ifp, | |||
957 | void (*callback)(void *), void *arg) | 1049 | void (*callback)(void *), void *arg) | |
958 | { | 1050 | { | |
959 | struct ipv6_state *state; | 1051 | struct ipv6_state *state; | |
960 | struct ll_callback *cb; | 1052 | struct ll_callback *cb; | |
961 | 1053 | |||
962 | state = ipv6_getstate(ifp); | 1054 | state = ipv6_getstate(ifp); | |
963 | TAILQ_FOREACH(cb, &state->ll_callbacks, next) { | 1055 | TAILQ_FOREACH(cb, &state->ll_callbacks, next) { | |
964 | if (cb->callback == callback && cb->arg == arg) | 1056 | if (cb->callback == callback && cb->arg == arg) | |
965 | break; | 1057 | break; | |
966 | } | 1058 | } | |
967 | if (cb == NULL) { | 1059 | if (cb == NULL) { | |
968 | cb = malloc(sizeof(*cb)); | 1060 | cb = malloc(sizeof(*cb)); | |
969 | if (cb == NULL) { | 1061 | if (cb == NULL) { | |
970 | syslog(LOG_ERR, "%s: %m", __func__); | 1062 | syslog(LOG_ERR, "%s: %m", __func__); | |
971 | return -1; | 1063 | return -1; | |
972 | } | 1064 | } | |
973 | cb->callback = callback; | 1065 | cb->callback = callback; | |
974 | cb->arg = arg; | 1066 | cb->arg = arg; | |
975 | TAILQ_INSERT_TAIL(&state->ll_callbacks, cb, next); | 1067 | TAILQ_INSERT_TAIL(&state->ll_callbacks, cb, next); | |
976 | } | 1068 | } | |
977 | return 0; | 1069 | return 0; | |
978 | } | 1070 | } | |
979 | 1071 | |||
980 | void | |||
981 | ipv6_free_ll_callbacks(struct interface *ifp) | |||
982 | { | |||
983 | struct ipv6_state *state; | |||
984 | struct ll_callback *cb; | |||
985 | ||||
986 | state = IPV6_STATE(ifp); | |||
987 | if (state) { | |||
988 | while ((cb = TAILQ_FIRST(&state->ll_callbacks))) { | |||
989 | TAILQ_REMOVE(&state->ll_callbacks, cb, next); | |||
990 | free(cb); | |||
991 | } | |||
992 | } | |||
993 | } | |||
994 | ||||
995 | static struct ipv6_addr * | 1072 | static struct ipv6_addr * | |
996 | ipv6_newlinklocal(struct interface *ifp) | 1073 | ipv6_newlinklocal(struct interface *ifp) | |
997 | { | 1074 | { | |
998 | struct ipv6_addr *ap; | 1075 | struct ipv6_addr *ap; | |
999 | 1076 | |||
1000 | ap = calloc(1, sizeof(*ap)); | 1077 | ap = calloc(1, sizeof(*ap)); | |
1001 | if (ap != NULL) { | 1078 | if (ap != NULL) { | |
1002 | ap->iface = ifp; | 1079 | ap->iface = ifp; | |
1003 | ap->prefix.s6_addr32[0] = htonl(0xfe800000); | 1080 | ap->prefix.s6_addr32[0] = htonl(0xfe800000); | |
1004 | ap->prefix.s6_addr32[1] = 0; | 1081 | ap->prefix.s6_addr32[1] = 0; | |
1005 | ap->prefix_len = 64; | 1082 | ap->prefix_len = 64; | |
1006 | ap->dadcounter = 0; | 1083 | ap->dadcounter = 0; | |
1007 | ap->prefix_pltime = ND6_INFINITE_LIFETIME; | 1084 | ap->prefix_pltime = ND6_INFINITE_LIFETIME; | |
@@ -1131,61 +1208,77 @@ ipv6_start(struct interface *ifp) | @@ -1131,61 +1208,77 @@ ipv6_start(struct interface *ifp) | |||
1131 | 1208 | |||
1132 | /* We can't assign a link-locak address to this, | 1209 | /* We can't assign a link-locak address to this, | |
1133 | * the ppp process has to. */ | 1210 | * the ppp process has to. */ | |
1134 | if (ifp->flags & IFF_POINTOPOINT) | 1211 | if (ifp->flags & IFF_POINTOPOINT) | |
1135 | return 0; | 1212 | return 0; | |
1136 | 1213 | |||
1137 | state = IPV6_CSTATE(ifp); | 1214 | state = IPV6_CSTATE(ifp); | |
1138 | if (state) { | 1215 | if (state) { | |
1139 | TAILQ_FOREACH(ap, &state->addrs, next) { | 1216 | TAILQ_FOREACH(ap, &state->addrs, next) { | |
1140 | if (IN6_IS_ADDR_LINKLOCAL(&ap->addr) && | 1217 | if (IN6_IS_ADDR_LINKLOCAL(&ap->addr) && | |
1141 | !(ap->addr_flags & IN6_IFF_DUPLICATED)) | 1218 | !(ap->addr_flags & IN6_IFF_DUPLICATED)) | |
1142 | break; | 1219 | break; | |
1143 | } | 1220 | } | |
1221 | /* Regenerate new ids */ | |||
1222 | if (ifp->options->options & DHCPCD_IPV6RA_OWN && | |||
1223 | ip6_use_tempaddr(ifp->name)) | |||
1224 | ipv6_regentempifid(ifp); | |||
1144 | } else | 1225 | } else | |
1145 | ap = NULL; | 1226 | ap = NULL; | |
1146 | 1227 | |||
1147 | if (ap == NULL && ipv6_addlinklocal(ifp) == -1) | 1228 | if (ap == NULL && ipv6_addlinklocal(ifp) == -1) | |
1148 | return -1; | 1229 | return -1; | |
1149 | return 0; | 1230 | return 0; | |
1150 | } | 1231 | } | |
1151 | 1232 | |||
1152 | void | 1233 | void | |
1153 | ipv6_free(struct interface *ifp) | 1234 | ipv6_freedrop(struct interface *ifp, int drop) | |
1154 | { | 1235 | { | |
1155 | struct ipv6_state *state; | 1236 | struct ipv6_state *state; | |
1156 | struct ipv6_addr *ap; | 1237 | struct ll_callback *cb; | |
1157 | 1238 | |||
1158 | if (ifp) { | 1239 | if (ifp == NULL) | |
1159 | ipv6_free_ll_callbacks(ifp); | 1240 | return; | |
1160 | state = IPV6_STATE(ifp); | 1241 | ||
1161 | if (state) { | 1242 | if ((state = IPV6_STATE(ifp)) == NULL) | |
1162 | while ((ap = TAILQ_FIRST(&state->addrs))) { | 1243 | return; | |
1163 | TAILQ_REMOVE(&state->addrs, ap, next); | 1244 | ||
1164 | free(ap); | 1245 | ipv6_freedrop_addrs(&state->addrs, drop ? 2 : 0, NULL); | |
1165 | } | 1246 | ||
1166 | free(state); | 1247 | /* Becuase we need to cache the addresses we don't control, | |
1167 | ifp->if_data[IF_DATA_IPV6] = NULL; | 1248 | * we only free the state on when NOT dropping addresses. */ | |
1249 | if (drop == 0) { | |||
1250 | while ((cb = TAILQ_FIRST(&state->ll_callbacks))) { | |||
1251 | TAILQ_REMOVE(&state->ll_callbacks, cb, next); | |||
1252 | free(cb); | |||
1168 | } | 1253 | } | |
1254 | free(state); | |||
1255 | ifp->if_data[IF_DATA_IPV6] = NULL; | |||
1256 | eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); | |||
1169 | } | 1257 | } | |
1170 | } | 1258 | } | |
1171 | 1259 | |||
1172 | void | 1260 | void | |
1173 | ipv6_ctxfree(struct dhcpcd_ctx *ctx) | 1261 | ipv6_ctxfree(struct dhcpcd_ctx *ctx) | |
1174 | { | 1262 | { | |
1263 | struct rt6 *rt; | |||
1175 | 1264 | |||
1176 | if (ctx->ipv6 == NULL) | 1265 | if (ctx->ipv6 == NULL) | |
1177 | return; | 1266 | return; | |
1178 | 1267 | |||
1268 | while ((rt = TAILQ_FIRST(ctx->ipv6->routes))) { | |||
1269 | TAILQ_REMOVE(ctx->ipv6->routes, rt, next); | |||
1270 | free(rt); | |||
1271 | } | |||
1179 | free(ctx->ipv6->routes); | 1272 | free(ctx->ipv6->routes); | |
1180 | free(ctx->ipv6->ra_routers); | 1273 | free(ctx->ipv6->ra_routers); | |
1181 | free(ctx->ipv6); | 1274 | free(ctx->ipv6); | |
1182 | } | 1275 | } | |
1183 | 1276 | |||
1184 | int | 1277 | int | |
1185 | ipv6_handleifa_addrs(int cmd, | 1278 | ipv6_handleifa_addrs(int cmd, | |
1186 | struct ipv6_addrhead *addrs, const struct in6_addr *addr, int flags) | 1279 | struct ipv6_addrhead *addrs, const struct in6_addr *addr, int flags) | |
1187 | { | 1280 | { | |
1188 | struct ipv6_addr *ap, *apn; | 1281 | struct ipv6_addr *ap, *apn; | |
1189 | uint8_t found, alldadcompleted; | 1282 | uint8_t found, alldadcompleted; | |
1190 | 1283 | |||
1191 | alldadcompleted = 1; | 1284 | alldadcompleted = 1; | |
@@ -1218,26 +1311,393 @@ ipv6_handleifa_addrs(int cmd, | @@ -1218,26 +1311,393 @@ ipv6_handleifa_addrs(int cmd, | |||
1218 | if (ap->dadcallback) | 1311 | if (ap->dadcallback) | |
1219 | ap->dadcallback(ap); | 1312 | ap->dadcallback(ap); | |
1220 | /* We need to set this here in-case the | 1313 | /* We need to set this here in-case the | |
1221 | * dadcallback function checks it */ | 1314 | * dadcallback function checks it */ | |
1222 | ap->flags |= IPV6_AF_DADCOMPLETED; | 1315 | ap->flags |= IPV6_AF_DADCOMPLETED; | |
1223 | } | 1316 | } | |
1224 | break; | 1317 | break; | |
1225 | } | 1318 | } | |
1226 | } | 1319 | } | |
1227 | 1320 | |||
1228 | return alldadcompleted ? found : 0; | 1321 | return alldadcompleted ? found : 0; | |
1229 | } | 1322 | } | |
1230 | 1323 | |||
1324 | #ifdef IPV6_MANAGETEMPADDR | |||
1325 | static const struct ipv6_addr * | |||
1326 | ipv6_findaddrid(struct dhcpcd_ctx *ctx, uint8_t *addr) | |||
1327 | { | |||
1328 | const struct interface *ifp; | |||
1329 | const struct ipv6_state *state; | |||
1330 | const struct ipv6_addr *ia; | |||
1331 | ||||
1332 | TAILQ_FOREACH(ifp, ctx->ifaces, next) { | |||
1333 | if ((state = IPV6_CSTATE(ifp))) { | |||
1334 | TAILQ_FOREACH(ia, &state->addrs, next) { | |||
1335 | if (memcmp(&ia->addr.s6_addr[8], addr, 8) == 0) | |||
1336 | return ia; | |||
1337 | } | |||
1338 | } | |||
1339 | } | |||
1340 | return NULL; | |||
1341 | } | |||
1342 | ||||
1343 | static const uint8_t nullid[8]; | |||
1344 | static const uint8_t anycastid[8] = { | |||
1345 | 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80 }; | |||
1346 | static const uint8_t isatapid[4] = { 0x00, 0x00, 0x5e, 0xfe }; | |||
1347 | ||||
1348 | static void | |||
1349 | ipv6_regen_desync(struct interface *ifp, int force) | |||
1350 | { | |||
1351 | struct ipv6_state *state; | |||
1352 | time_t max; | |||
1353 | ||||
1354 | state = IPV6_STATE(ifp); | |||
1355 | ||||
1356 | /* RFC4941 Section 5 states that DESYNC_FACTOR must never be | |||
1357 | * greater than TEMP_VALID_LIFETIME - REGEN_ADVANCE. | |||
1358 | * I believe this is an error and it should be never be greateter than | |||
1359 | * TEMP_PREFERRED_LIFETIME - REGEN_ADVANCE. */ | |||
1360 | max = ip6_temp_preferred_lifetime(ifp->name) - REGEN_ADVANCE; | |||
1361 | if (state->desync_factor && !force && state->desync_factor < max) | |||
1362 | return; | |||
1363 | if (state->desync_factor == 0) | |||
1364 | state->desync_factor = | |||
1365 | (time_t)arc4random_uniform(MIN(MAX_DESYNC_FACTOR, | |||
1366 | (uint32_t)max)); | |||
1367 | max = ip6_temp_preferred_lifetime(ifp->name) - | |||
1368 | state->desync_factor - REGEN_ADVANCE; | |||
1369 | eloop_timeout_add_sec(ifp->ctx->eloop, max, ipv6_regentempifid, ifp); | |||
1370 | } | |||
1371 | ||||
1372 | void | |||
1373 | ipv6_gentempifid(struct interface *ifp) | |||
1374 | { | |||
1375 | struct ipv6_state *state; | |||
1376 | MD5_CTX md5; | |||
1377 | uint8_t seed[16], digest[16]; | |||
1378 | int retry; | |||
1379 | ||||
1380 | state = IPV6_STATE(ifp); | |||
1381 | retry = 0; | |||
1382 | if (memcmp(nullid, state->randomseed0, sizeof(nullid)) == 0) { | |||
1383 | uint32_t r; | |||
1384 | ||||
1385 | r = arc4random(); | |||
1386 | memcpy(seed, &r, sizeof(r)); | |||
1387 | r = arc4random(); | |||
1388 | memcpy(seed + sizeof(r), &r, sizeof(r)); | |||
1389 | } else | |||
1390 | memcpy(seed, state->randomseed0, sizeof(state->randomseed0)); | |||
1391 | ||||
1392 | memcpy(seed + sizeof(state->randomseed0), | |||
1393 | state->randomseed1, sizeof(state->randomseed1)); | |||
1394 | ||||
1395 | again: | |||
1396 | /* RFC4941 Section 3.2.1.1 | |||
1397 | * Take the left-most 64bits and set bit 6 to zero */ | |||
1398 | MD5Init(&md5); | |||
1399 | MD5Update(&md5, seed, sizeof(seed)); | |||
1400 | MD5Final(digest, &md5); | |||
1401 | ||||
1402 | /* RFC4941 Section 3.2.1.1 | |||
1403 | * Take the left-most 64bits and set bit 6 to zero */ | |||
1404 | memcpy(state->randomid, digest, sizeof(state->randomid)); | |||
1405 | state->randomid[0] &= ~EUI64_UBIT; | |||
1406 | ||||
1407 | /* RFC4941 Section 3.2.1.4 | |||
1408 | * Reject reserved or existing id's */ | |||
1409 | if (memcmp(nullid, state->randomid, sizeof(nullid)) == 0 || | |||
1410 | (memcmp(anycastid, state->randomid, 7) == 0 && | |||
1411 | (anycastid[7] & state->randomid[7]) == anycastid[7]) || | |||
1412 | memcmp(isatapid, state->randomid, sizeof(isatapid)) == 0 || | |||
1413 | ipv6_findaddrid(ifp->ctx, state->randomid)) | |||
1414 | { | |||
1415 | if (++retry < GEN_TEMPID_RETRY_MAX) { | |||
1416 | memcpy(seed, digest + 8, 8); | |||
1417 | goto again; | |||
1418 | } | |||
1419 | memset(state->randomid, 0, sizeof(state->randomid)); | |||
1420 | } | |||
1421 | ||||
1422 | /* RFC4941 Section 3.2.1.6 | |||
1423 | * Save the right-most 64bits of the digest */ | |||
1424 | memcpy(state->randomseed0, digest + 8, | |||
1425 | sizeof(state->randomseed0)); | |||
1426 | } | |||
1427 | ||||
1428 | /* RFC4941 Section 3.3.7 */ | |||
1429 | static void | |||
1430 | ipv6_tempdadcallback(void *arg) | |||
1431 | { | |||
1432 | struct ipv6_addr *ia = arg; | |||
1433 | ||||
1434 | if (ia->flags & IPV6_AF_DUPLICATED) { | |||
1435 | struct ipv6_addr *ia1; | |||
1436 | struct timeval tv; | |||
1437 | ||||
1438 | if (++ia->dadcounter == TEMP_IDGEN_RETRIES) { | |||
1439 | syslog(LOG_ERR, | |||
1440 | "%s: too many duplicate temporary addresses", | |||
1441 | ia->iface->name); | |||
1442 | return; | |||
1443 | } | |||
1444 | get_monotonic(&tv); | |||
1445 | if ((ia1 = ipv6_createtempaddr(ia, &tv)) == NULL) | |||
1446 | syslog(LOG_ERR, "ipv6_createtempaddr: %m"); | |||
1447 | else | |||
1448 | ia1->dadcounter = ia->dadcounter; | |||
1449 | ipv6_deleteaddr(ia); | |||
1450 | if (ia1) | |||
1451 | ipv6_addaddr(ia1, &ia1->acquired); | |||
1452 | } | |||
1453 | } | |||
1454 | ||||
1455 | struct ipv6_addr * | |||
1456 | ipv6_createtempaddr(struct ipv6_addr *ia0, const struct timeval *now) | |||
1457 | { | |||
1458 | struct ipv6_state *state; | |||
1459 | const struct ipv6_state *cstate; | |||
1460 | int genid; | |||
1461 | struct in6_addr addr, mask; | |||
1462 | uint32_t randid[2]; | |||
1463 | const struct interface *ifp; | |||
1464 | const struct ipv6_addr *ap; | |||
1465 | struct ipv6_addr *ia; | |||
1466 | uint32_t i, trylimit; | |||
1467 | char buf[INET6_ADDRSTRLEN]; | |||
1468 | const char *cbp; | |||
1469 | ||||
1470 | trylimit = TEMP_IDGEN_RETRIES; | |||
1471 | state = IPV6_STATE(ia0->iface); | |||
1472 | genid = 0; | |||
1473 | ||||
1474 | addr = ia0->addr; | |||
1475 | ipv6_mask(&mask, ia0->prefix_len); | |||
1476 | /* clear the old ifid */ | |||
1477 | for (i = 0; i < 4; i++) | |||
1478 | addr.s6_addr32[i] &= mask.s6_addr32[i]; | |||
1479 | ||||
1480 | again: | |||
1481 | if (memcmp(state->randomid, nullid, sizeof(nullid)) == 0) | |||
1482 | genid = 1; | |||
1483 | if (genid) { | |||
1484 | memcpy(state->randomseed1, &ia0->addr.s6_addr[8], | |||
1485 | sizeof(state->randomseed1)); | |||
1486 | ipv6_gentempifid(ia0->iface); | |||
1487 | if (memcmp(state->randomid, nullid, sizeof(nullid)) == 0) { | |||
1488 | errno = EFAULT; | |||
1489 | return NULL; | |||
1490 | } | |||
1491 | } | |||
1492 | memcpy(&randid[0], state->randomid, sizeof(randid[0])); | |||
1493 | memcpy(&randid[1], state->randomid + sizeof(randid[1]), | |||
1494 | sizeof(randid[2])); | |||
1495 | addr.s6_addr32[2] |= randid[0] & ~mask.s6_addr32[2]; | |||
1496 | addr.s6_addr32[3] |= randid[1] & ~mask.s6_addr32[3]; | |||
1497 | ||||
1498 | /* Ensure we don't already have it */ | |||
1499 | TAILQ_FOREACH(ifp, ia0->iface->ctx->ifaces, next) { | |||
1500 | cstate = IPV6_CSTATE(ifp); | |||
1501 | if (cstate) { | |||
1502 | TAILQ_FOREACH(ap, &cstate->addrs, next) { | |||
1503 | if (IN6_ARE_ADDR_EQUAL(&ap->addr, &addr)) { | |||
1504 | if (--trylimit == 0) { | |||
1505 | errno = EEXIST; | |||
1506 | return NULL; | |||
1507 | } | |||
1508 | genid = 1; | |||
1509 | goto again; | |||
1510 | } | |||
1511 | } | |||
1512 | } | |||
1513 | } | |||
1514 | ||||
1515 | if ((ia = calloc(1, sizeof(*ia))) == NULL) | |||
1516 | return NULL; | |||
1517 | ||||
1518 | ia->iface = ia0->iface; | |||
1519 | ia->addr = addr; | |||
1520 | /* Must be made tentative, for our DaD to work */ | |||
1521 | ia->addr_flags = IN6_IFF_TENTATIVE; | |||
1522 | ia->dadcallback = ipv6_tempdadcallback; | |||
1523 | ia->flags = IPV6_AF_NEW | IPV6_AF_AUTOCONF | IPV6_AF_TEMPORARY; | |||
1524 | ia->prefix = ia0->prefix; | |||
1525 | ia->prefix_len = ia0->prefix_len; | |||
1526 | ia->created = ia->acquired = now ? *now : ia0->acquired; | |||
1527 | ||||
1528 | /* Ensure desync is still valid */ | |||
1529 | ipv6_regen_desync(ia->iface, 0); | |||
1530 | ||||
1531 | /* RFC4941 Section 3.3.4 */ | |||
1532 | i = (uint32_t)(ip6_temp_preferred_lifetime(ia0->iface->name) - | |||
1533 | state->desync_factor); | |||
1534 | ia->prefix_pltime = MIN(ia0->prefix_pltime, i); | |||
1535 | i = (uint32_t)ip6_temp_valid_lifetime(ia0->iface->name); | |||
1536 | ia->prefix_vltime = MIN(ia0->prefix_vltime, i); | |||
1537 | if (ia->prefix_pltime <= REGEN_ADVANCE || | |||
1538 | ia->prefix_pltime > ia0->prefix_vltime) | |||
1539 | { | |||
1540 | errno = EINVAL; | |||
1541 | free(ia); | |||
1542 | return NULL; | |||
1543 | } | |||
1544 | ||||
1545 | cbp = inet_ntop(AF_INET6, &ia->addr, buf, sizeof(buf)); | |||
1546 | if (cbp) | |||
1547 | snprintf(ia->saddr, sizeof(ia->saddr), "%s/%d", | |||
1548 | cbp, ia->prefix_len); | |||
1549 | else | |||
1550 | ia->saddr[0] = '\0'; | |||
1551 | ||||
1552 | TAILQ_INSERT_TAIL(&state->addrs, ia, next); | |||
1553 | return ia; | |||
1554 | } | |||
1555 | ||||
1556 | void | |||
1557 | ipv6_settempstale(struct interface *ifp) | |||
1558 | { | |||
1559 | struct ipv6_state *state; | |||
1560 | struct ipv6_addr *ia; | |||
1561 | ||||
1562 | state = IPV6_STATE(ifp); | |||
1563 | TAILQ_FOREACH(ia, &state->addrs, next) { | |||
1564 | if (ia->flags & IPV6_AF_TEMPORARY) | |||
1565 | ia->flags |= IPV6_AF_STALE; | |||
1566 | } | |||
1567 | } | |||
1568 | ||||
1569 | struct ipv6_addr * | |||
1570 | ipv6_settemptime(struct ipv6_addr *ia, int flags) | |||
1571 | { | |||
1572 | struct ipv6_state *state; | |||
1573 | struct ipv6_addr *ap, *first; | |||
1574 | ||||
1575 | state = IPV6_STATE(ia->iface); | |||
1576 | first = NULL; | |||
1577 | TAILQ_FOREACH_REVERSE(ap, &state->addrs, ipv6_addrhead, next) { | |||
1578 | if (ap->flags & IPV6_AF_TEMPORARY && | |||
1579 | ap->prefix_pltime && | |||
1580 | IN6_ARE_ADDR_EQUAL(&ia->prefix, &ap->prefix)) | |||
1581 | { | |||
1582 | time_t max, ext; | |||
1583 | ||||
1584 | if (flags == 0) { | |||
1585 | if (ap->prefix_pltime - | |||
1586 | (uint32_t)(ia->acquired.tv_sec - | |||
1587 | ap->acquired.tv_sec) | |||
1588 | < REGEN_ADVANCE) | |||
1589 | continue; | |||
1590 | ||||
1591 | return ap; | |||
1592 | } | |||
1593 | ||||
1594 | if (!(ap->flags & IPV6_AF_ADDED)) | |||
1595 | ap->flags |= IPV6_AF_NEW | IPV6_AF_AUTOCONF; | |||
1596 | ap->flags &= ~IPV6_AF_STALE; | |||
1597 | ||||
1598 | /* RFC4941 Section 3.4 | |||
1599 | * Deprecated prefix, deprecate the temporary address */ | |||
1600 | if (ia->prefix_pltime == 0) { | |||
1601 | ap->prefix_pltime = 0; | |||
1602 | goto valid; | |||
1603 | } | |||
1604 | ||||
1605 | /* Ensure desync is still valid */ | |||
1606 | ipv6_regen_desync(ap->iface, 0); | |||
1607 | ||||
1608 | /* RFC4941 Section 3.3.2 | |||
1609 | * Extend temporary times, but ensure that they | |||
1610 | * never last beyond the system limit. */ | |||
1611 | ext = ia->acquired.tv_sec + (time_t)ia->prefix_pltime; | |||
1612 | max = ap->created.tv_sec + | |||
1613 | ip6_temp_preferred_lifetime(ap->iface->name) - | |||
1614 | state->desync_factor; | |||
1615 | if (ext < max) | |||
1616 | ap->prefix_pltime = ia->prefix_pltime; | |||
1617 | else | |||
1618 | ap->prefix_pltime = | |||
1619 | (uint32_t)(max - ia->acquired.tv_sec); | |||
1620 | ||||
1621 | valid: | |||
1622 | ext = ia->acquired.tv_sec + (time_t)ia->prefix_vltime; | |||
1623 | max = ap->created.tv_sec + | |||
1624 | ip6_temp_valid_lifetime(ap->iface->name); | |||
1625 | if (ext < max) | |||
1626 | ap->prefix_vltime = ia->prefix_vltime; | |||
1627 | else | |||
1628 | ap->prefix_vltime = | |||
1629 | (uint32_t)(max - ia->acquired.tv_sec); | |||
1630 | ||||
1631 | /* Just extend the latest matching prefix */ | |||
1632 | ap->acquired = ia->acquired; | |||
1633 | ||||
1634 | /* If extending return the last match as | |||
1635 | * it's the most current. | |||
1636 | * If deprecating, deprecate any other addresses we | |||
1637 | * may have, although this should not be needed */ | |||
1638 | if (ia->prefix_pltime) | |||
1639 | return ap; | |||
1640 | if (first == NULL) | |||
1641 | first = ap; | |||
1642 | } | |||
1643 | } | |||
1644 | return first; | |||
1645 | } | |||
1646 | ||||
1647 | void | |||
1648 | ipv6_addtempaddrs(struct interface *ifp, const struct timeval *now) | |||
1649 | { | |||
1650 | struct ipv6_state *state; | |||
1651 | struct ipv6_addr *ia; | |||
1652 | ||||
1653 | state = IPV6_STATE(ifp); | |||
1654 | TAILQ_FOREACH(ia, &state->addrs, next) { | |||
1655 | if (ia->flags & IPV6_AF_TEMPORARY && | |||
1656 | !(ia->flags & IPV6_AF_STALE)) | |||
1657 | ipv6_addaddr(ia, now); | |||
1658 | } | |||
1659 | } | |||
1660 | ||||
1661 | static void | |||
1662 | ipv6_regentempaddr(void *arg) | |||
1663 | { | |||
1664 | struct ipv6_addr *ia = arg, *ia1; | |||
1665 | struct timeval tv; | |||
1666 | ||||
1667 | syslog(LOG_DEBUG, "%s: regen temp addr %s", | |||
1668 | ia->iface->name, ia->saddr); | |||
1669 | get_monotonic(&tv); | |||
1670 | ia1 = ipv6_createtempaddr(ia, &tv); | |||
1671 | if (ia1) | |||
1672 | ipv6_addaddr(ia1, &tv); | |||
1673 | else | |||
1674 | syslog(LOG_ERR, "ipv6_createtempaddr: %m"); | |||
1675 | } | |||
1676 | ||||
1677 | static void | |||
1678 | ipv6_regentempifid(void *arg) | |||
1679 | { | |||
1680 | struct interface *ifp = arg; | |||
1681 | struct ipv6_state *state; | |||
1682 | ||||
1683 | state = IPV6_STATE(ifp); | |||
1684 | if (memcmp(state->randomid, nullid, sizeof(state->randomid))) | |||
1685 | ipv6_gentempifid(ifp); | |||
1686 | ||||
1687 | ipv6_regen_desync(ifp, 1); | |||
1688 | } | |||
1689 | #endif /* IPV6_MANAGETEMPADDR */ | |||
1690 | ||||
1231 | static struct rt6 * | 1691 | static struct rt6 * | |
1232 | find_route6(struct rt6_head *rts, const struct rt6 *r) | 1692 | find_route6(struct rt6_head *rts, const struct rt6 *r) | |
1233 | { | 1693 | { | |
1234 | struct rt6 *rt; | 1694 | struct rt6 *rt; | |
1235 | 1695 | |||
1236 | TAILQ_FOREACH(rt, rts, next) { | 1696 | TAILQ_FOREACH(rt, rts, next) { | |
1237 | if (IN6_ARE_ADDR_EQUAL(&rt->dest, &r->dest) && | 1697 | if (IN6_ARE_ADDR_EQUAL(&rt->dest, &r->dest) && | |
1238 | #if HAVE_ROUTE_METRIC | 1698 | #if HAVE_ROUTE_METRIC | |
1239 | (r->iface == NULL || rt->iface == NULL || | 1699 | (r->iface == NULL || rt->iface == NULL || | |
1240 | rt->iface->metric == r->iface->metric) && | 1700 | rt->iface->metric == r->iface->metric) && | |
1241 | #endif | 1701 | #endif | |
1242 | IN6_ARE_ADDR_EQUAL(&rt->net, &r->net)) | 1702 | IN6_ARE_ADDR_EQUAL(&rt->net, &r->net)) | |
1243 | return rt; | 1703 | return rt; |
--- src/external/bsd/dhcpcd/dist/Attic/control.c 2014/12/29 16:18:04 1.1.1.7.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/control.c 2015/02/05 15:13:12 1.1.1.7.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: control.c,v 1.1.1.7.2.1 2014/12/29 16:18:04 martin Exp $"); | 2 | __RCSID("$NetBSD: control.c,v 1.1.1.7.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/dhcp-common.c 2014/12/29 16:18:04 1.1.1.7.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcp-common.c 2015/02/05 15:13:12 1.1.1.7.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: dhcp-common.c,v 1.1.1.7.2.1 2014/12/29 16:18:04 martin Exp $"); | 2 | __RCSID("$NetBSD: dhcp-common.c,v 1.1.1.7.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/dhcp6.h 2014/12/29 16:18:04 1.1.1.7.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcp6.h 2015/02/05 15:13:12 1.1.1.7.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: dhcp6.h,v 1.1.1.7.2.1 2014/12/29 16:18:04 martin Exp $ */ | 1 | /* $NetBSD: dhcp6.h,v 1.1.1.7.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -238,24 +238,24 @@ struct ipv6_addr *dhcp6_findaddr(struct | @@ -238,24 +238,24 @@ struct ipv6_addr *dhcp6_findaddr(struct | |||
238 | size_t dhcp6_find_delegates(struct interface *); | 238 | size_t dhcp6_find_delegates(struct interface *); | |
239 | int dhcp6_start(struct interface *, enum DH6S); | 239 | int dhcp6_start(struct interface *, enum DH6S); | |
240 | void dhcp6_reboot(struct interface *); | 240 | void dhcp6_reboot(struct interface *); | |
241 | ssize_t dhcp6_env(char **, const char *, const struct interface *, | 241 | ssize_t dhcp6_env(char **, const char *, const struct interface *, | |
242 | const struct dhcp6_message *, size_t); | 242 | const struct dhcp6_message *, size_t); | |
243 | void dhcp6_free(struct interface *); | 243 | void dhcp6_free(struct interface *); | |
244 | void dhcp6_handleifa(struct dhcpcd_ctx *, int, const char *, | 244 | void dhcp6_handleifa(struct dhcpcd_ctx *, int, const char *, | |
245 | const struct in6_addr *addr, int); | 245 | const struct in6_addr *addr, int); | |
246 | int dhcp6_dadcompleted(const struct interface *); | 246 | int dhcp6_dadcompleted(const struct interface *); | |
247 | void dhcp6_drop(struct interface *, const char *); | 247 | void dhcp6_drop(struct interface *, const char *); | |
248 | int dhcp6_dump(struct interface *); | 248 | int dhcp6_dump(struct interface *); | |
249 | #else | 249 | #else | |
250 | #define dhcp6_findaddr(a, b, c) (0) | 250 | #define dhcp6_findaddr(a, b, c) (0) | |
251 | #define dhcp6_find_delegates(a) | 251 | #define dhcp6_find_delegates(a) {} | |
252 | #define dhcp6_start(a, b) (0) | 252 | #define dhcp6_start(a, b) (0) | |
253 | #define dhcp6_reboot(a) | 253 | #define dhcp6_reboot(a) {} | |
254 | #define dhcp6_env(a, b, c, d, e) | 254 | #define dhcp6_env(a, b, c, d, e) {} | |
255 | #define dhcp6_free(a) | 255 | #define dhcp6_free(a) {} | |
256 | #define dhcp6_dadcompleted(a) (0) | 256 | #define dhcp6_dadcompleted(a) (0) | |
257 | #define dhcp6_drop(a, b) | 257 | #define dhcp6_drop(a, b) {} | |
258 | #define dhcp6_dump(a) (-1) | 258 | #define dhcp6_dump(a) (-1) | |
259 | #endif | 259 | #endif | |
260 | 260 | |||
261 | #endif | 261 | #endif |
--- src/external/bsd/dhcpcd/dist/Attic/dhcpcd-embedded.c 2014/12/29 16:18:04 1.1.1.7.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcpcd-embedded.c 2015/02/05 15:13:12 1.1.1.7.2.2
@@ -1,25 +1,25 @@ | @@ -1,25 +1,25 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: dhcpcd-embedded.c,v 1.1.1.7.2.1 2014/12/29 16:18:04 martin Exp $"); | 2 | __RCSID("$NetBSD: dhcpcd-embedded.c,v 1.1.1.7.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * DO NOT EDIT | 5 | * DO NOT EDIT | |
6 | * Automatically generated from dhcpcd-embedded.conf | 6 | * Automatically generated from dhcpcd-embedded.conf | |
7 | * Ths allows us to simply generate DHCP structure without any C programming | 7 | * Ths allows us to simply generate DHCP structure without any C programming | |
8 | */ | 8 | */ | |
9 | 9 | |||
10 | /* | 10 | /* | |
11 | * dhcpcd - DHCP client daemon | 11 | * dhcpcd - DHCP client daemon | |
12 | * Copyright (c) 2006-2013 Roy Marples <roy@marples.name> | 12 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
13 | * All rights reserved | 13 | * All rights reserved | |
14 | 14 | |||
15 | * Redistribution and use in source and binary forms, with or without | 15 | * Redistribution and use in source and binary forms, with or without | |
16 | * modification, are permitted provided that the following conditions | 16 | * modification, are permitted provided that the following conditions | |
17 | * are met: | 17 | * are met: | |
18 | * 1. Redistributions of source code must retain the above copyright | 18 | * 1. Redistributions of source code must retain the above copyright | |
19 | * notice, this list of conditions and the following disclaimer. | 19 | * notice, this list of conditions and the following disclaimer. | |
20 | * 2. Redistributions in binary form must reproduce the above copyright | 20 | * 2. Redistributions in binary form must reproduce the above copyright | |
21 | * notice, this list of conditions and the following disclaimer in the | 21 | * notice, this list of conditions and the following disclaimer in the | |
22 | * documentation and/or other materials provided with the distribution. | 22 | * documentation and/or other materials provided with the distribution. | |
23 | * | 23 | * | |
24 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 24 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/ipv4.c 2014/12/29 16:18:05 1.1.1.7.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/ipv4.c 2015/02/05 15:13:12 1.1.1.7.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: ipv4.c,v 1.1.1.7.2.1 2014/12/29 16:18:05 martin Exp $"); | 2 | __RCSID("$NetBSD: ipv4.c,v 1.1.1.7.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/control.h 2014/12/29 16:18:04 1.1.1.5.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/control.h 2015/02/05 15:13:12 1.1.1.5.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: control.h,v 1.1.1.5.2.1 2014/12/29 16:18:04 martin Exp $ */ | 1 | /* $NetBSD: control.h,v 1.1.1.5.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/dhcp-common.h 2014/12/29 16:18:04 1.1.1.5.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcp-common.h 2015/02/05 15:13:12 1.1.1.5.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: dhcp-common.h,v 1.1.1.5.2.1 2014/12/29 16:18:04 martin Exp $ */ | 1 | /* $NetBSD: dhcp-common.h,v 1.1.1.5.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/dhcpcd-definitions.conf 2014/12/29 16:18:04 1.1.1.5.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcpcd-definitions.conf 2015/02/05 15:13:12 1.1.1.5.2.2
@@ -1,16 +1,16 @@ | @@ -1,16 +1,16 @@ | |||
1 | # $NetBSD: dhcpcd-definitions.conf,v 1.1.1.5.2.1 2014/12/29 16:18:04 martin Exp $ | 1 | # $NetBSD: dhcpcd-definitions.conf,v 1.1.1.5.2.2 2015/02/05 15:13:12 martin Exp $ | |
2 | 2 | |||
3 | # Copyright (c) 2006-2014 Roy Marples | 3 | # Copyright (c) 2006-2015 Roy Marples | |
4 | # All rights reserved | 4 | # All rights reserved | |
5 | 5 | |||
6 | # DHCP option definitions for dhcpcd(8) | 6 | # DHCP option definitions for dhcpcd(8) | |
7 | # These are used to translate DHCP options into shell variables | 7 | # These are used to translate DHCP options into shell variables | |
8 | # for use in dhcpcd-run-hooks(8) | 8 | # for use in dhcpcd-run-hooks(8) | |
9 | # See dhcpcd.conf(5) for details | 9 | # See dhcpcd.conf(5) for details | |
10 | 10 | |||
11 | ############################################################################## | 11 | ############################################################################## | |
12 | # DHCP RFC2132 options unless otheriwse stated | 12 | # DHCP RFC2132 options unless otheriwse stated | |
13 | define 1 request ipaddress subnet_mask | 13 | define 1 request ipaddress subnet_mask | |
14 | # RFC3442 states that the CSR has to come before all other routes | 14 | # RFC3442 states that the CSR has to come before all other routes | |
15 | # For completeness we also specify static routes then routers | 15 | # For completeness we also specify static routes then routers | |
16 | define 121 rfc3442 classless_static_routes | 16 | define 121 rfc3442 classless_static_routes |
--- src/external/bsd/dhcpcd/dist/Attic/ipv4.h 2014/12/29 16:18:05 1.1.1.5.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/ipv4.h 2015/02/05 15:13:12 1.1.1.5.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: ipv4.h,v 1.1.1.5.2.1 2014/12/29 16:18:05 martin Exp $ */ | 1 | /* $NetBSD: ipv4.h,v 1.1.1.5.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/defs.h 2014/12/29 16:18:04 1.1.1.41.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/defs.h 2015/02/05 15:13:12 1.1.1.41.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: defs.h,v 1.1.1.41.2.1 2014/12/29 16:18:04 martin Exp $ */ | 1 | /* $NetBSD: defs.h,v 1.1.1.41.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
15 | * | 15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #ifndef CONFIG_H | 29 | #ifndef CONFIG_H | |
30 | #define CONFIG_H | 30 | #define CONFIG_H | |
31 | 31 | |||
32 | #define PACKAGE "dhcpcd" | 32 | #define PACKAGE "dhcpcd" | |
33 | #define VERSION "6.6.7" | 33 | #define VERSION "6.7.1" | |
34 | 34 | |||
35 | #ifndef CONFIG | 35 | #ifndef CONFIG | |
36 | # define CONFIG SYSCONFDIR "/" PACKAGE ".conf" | 36 | # define CONFIG SYSCONFDIR "/" PACKAGE ".conf" | |
37 | #endif | 37 | #endif | |
38 | #ifndef SCRIPT | 38 | #ifndef SCRIPT | |
39 | # define SCRIPT LIBEXECDIR "/" PACKAGE "-run-hooks" | 39 | # define SCRIPT LIBEXECDIR "/" PACKAGE "-run-hooks" | |
40 | #endif | 40 | #endif | |
41 | #ifndef DEVDIR | 41 | #ifndef DEVDIR | |
42 | # define DEVDIR LIBDIR "/" PACKAGE "/dev" | 42 | # define DEVDIR LIBDIR "/" PACKAGE "/dev" | |
43 | #endif | 43 | #endif | |
44 | #ifndef DUID | 44 | #ifndef DUID | |
45 | # define DUID SYSCONFDIR "/" PACKAGE ".duid" | 45 | # define DUID SYSCONFDIR "/" PACKAGE ".duid" | |
46 | #endif | 46 | #endif |
--- src/external/bsd/dhcpcd/dist/Attic/dhcp.c 2014/12/29 16:18:04 1.15.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcp.c 2015/02/05 15:13:12 1.15.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: dhcp.c,v 1.15.2.1 2014/12/29 16:18:04 martin Exp $"); | 2 | __RCSID("$NetBSD: dhcp.c,v 1.15.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -2479,26 +2479,36 @@ dhcp_handledhcp(struct interface *iface, | @@ -2479,26 +2479,36 @@ dhcp_handledhcp(struct interface *iface, | |||
2479 | } | 2479 | } | |
2480 | 2480 | |||
2481 | /* Ensure it's the right transaction */ | 2481 | /* Ensure it's the right transaction */ | |
2482 | if (state->xid != ntohl(dhcp->xid)) { | 2482 | if (state->xid != ntohl(dhcp->xid)) { | |
2483 | syslog(LOG_DEBUG, | 2483 | syslog(LOG_DEBUG, | |
2484 | "%s: wrong xid 0x%x (expecting 0x%x) from %s", | 2484 | "%s: wrong xid 0x%x (expecting 0x%x) from %s", | |
2485 | iface->name, ntohl(dhcp->xid), state->xid, | 2485 | iface->name, ntohl(dhcp->xid), state->xid, | |
2486 | inet_ntoa(*from)); | 2486 | inet_ntoa(*from)); | |
2487 | return; | 2487 | return; | |
2488 | } | 2488 | } | |
2489 | /* reset the message counter */ | 2489 | /* reset the message counter */ | |
2490 | state->interval = 0; | 2490 | state->interval = 0; | |
2491 | 2491 | |||
2492 | /* Ensure that no reject options are present */ | |||
2493 | for (i = 1; i < 255; i++) { | |||
2494 | if (has_option_mask(ifo->rejectmask, i) && | |||
2495 | get_option_uint8(iface->ctx, &tmp, dhcp, (uint8_t)i) == 0) | |||
2496 | { | |||
2497 | log_dhcp(LOG_WARNING, "reject DHCP", iface, dhcp, from); | |||
2498 | return; | |||
2499 | } | |||
2500 | } | |||
2501 | ||||
2492 | if (type == DHCP_NAK) { | 2502 | if (type == DHCP_NAK) { | |
2493 | /* For NAK, only check if we require the ServerID */ | 2503 | /* For NAK, only check if we require the ServerID */ | |
2494 | if (has_option_mask(ifo->requiremask, DHO_SERVERID) && | 2504 | if (has_option_mask(ifo->requiremask, DHO_SERVERID) && | |
2495 | get_option_addr(iface->ctx, &addr, dhcp, DHO_SERVERID) == -1) | 2505 | get_option_addr(iface->ctx, &addr, dhcp, DHO_SERVERID) == -1) | |
2496 | { | 2506 | { | |
2497 | log_dhcp(LOG_WARNING, "reject NAK", iface, dhcp, from); | 2507 | log_dhcp(LOG_WARNING, "reject NAK", iface, dhcp, from); | |
2498 | return; | 2508 | return; | |
2499 | } | 2509 | } | |
2500 | 2510 | |||
2501 | /* We should restart on a NAK */ | 2511 | /* We should restart on a NAK */ | |
2502 | log_dhcp(LOG_WARNING, "NAK:", iface, dhcp, from); | 2512 | log_dhcp(LOG_WARNING, "NAK:", iface, dhcp, from); | |
2503 | if ((msg = get_option_string(iface->ctx, dhcp, DHO_MESSAGE))) { | 2513 | if ((msg = get_option_string(iface->ctx, dhcp, DHO_MESSAGE))) { | |
2504 | syslog(LOG_WARNING, "%s: message: %s", | 2514 | syslog(LOG_WARNING, "%s: message: %s", | |
@@ -2515,26 +2525,43 @@ dhcp_handledhcp(struct interface *iface, | @@ -2515,26 +2525,43 @@ dhcp_handledhcp(struct interface *iface, | |||
2515 | /* If we constantly get NAKS then we should slowly back off */ | 2525 | /* If we constantly get NAKS then we should slowly back off */ | |
2516 | eloop_timeout_add_sec(iface->ctx->eloop, | 2526 | eloop_timeout_add_sec(iface->ctx->eloop, | |
2517 | state->nakoff, dhcp_discover, iface); | 2527 | state->nakoff, dhcp_discover, iface); | |
2518 | if (state->nakoff == 0) | 2528 | if (state->nakoff == 0) | |
2519 | state->nakoff = 1; | 2529 | state->nakoff = 1; | |
2520 | else { | 2530 | else { | |
2521 | state->nakoff *= 2; | 2531 | state->nakoff *= 2; | |
2522 | if (state->nakoff > NAKOFF_MAX) | 2532 | if (state->nakoff > NAKOFF_MAX) | |
2523 | state->nakoff = NAKOFF_MAX; | 2533 | state->nakoff = NAKOFF_MAX; | |
2524 | } | 2534 | } | |
2525 | return; | 2535 | return; | |
2526 | } | 2536 | } | |
2527 | 2537 | |||
2538 | /* Ensure that all required options are present */ | |||
2539 | for (i = 1; i < 255; i++) { | |||
2540 | if (has_option_mask(ifo->requiremask, i) && | |||
2541 | get_option_uint8(iface->ctx, &tmp, dhcp, (uint8_t)i) != 0) | |||
2542 | { | |||
2543 | /* If we are bootp, then ignore the need for serverid. | |||
2544 | * To ignore bootp, require dhcp_message_type. | |||
2545 | * However, nothing really stops bootp from providing | |||
2546 | * DHCP style options as well so the above isn't | |||
2547 | * always true. */ | |||
2548 | if (type == 0 && i == DHO_SERVERID) | |||
2549 | continue; | |||
2550 | log_dhcp(LOG_WARNING, "reject DHCP", iface, dhcp, from); | |||
2551 | return; | |||
2552 | } | |||
2553 | } | |||
2554 | ||||
2528 | /* DHCP Auto-Configure, RFC 2563 */ | 2555 | /* DHCP Auto-Configure, RFC 2563 */ | |
2529 | if (type == DHCP_OFFER && dhcp->yiaddr == 0) { | 2556 | if (type == DHCP_OFFER && dhcp->yiaddr == 0) { | |
2530 | log_dhcp(LOG_WARNING, "no address given", iface, dhcp, from); | 2557 | log_dhcp(LOG_WARNING, "no address given", iface, dhcp, from); | |
2531 | if ((msg = get_option_string(iface->ctx, dhcp, DHO_MESSAGE))) { | 2558 | if ((msg = get_option_string(iface->ctx, dhcp, DHO_MESSAGE))) { | |
2532 | syslog(LOG_WARNING, "%s: message: %s", | 2559 | syslog(LOG_WARNING, "%s: message: %s", | |
2533 | iface->name, msg); | 2560 | iface->name, msg); | |
2534 | free(msg); | 2561 | free(msg); | |
2535 | } | 2562 | } | |
2536 | if ((state->state == DHS_DISCOVER || | 2563 | if ((state->state == DHS_DISCOVER || | |
2537 | state->state == DHS_IPV4LL_BOUND) && | 2564 | state->state == DHS_IPV4LL_BOUND) && | |
2538 | get_option_uint8(iface->ctx, &tmp, dhcp, | 2565 | get_option_uint8(iface->ctx, &tmp, dhcp, | |
2539 | DHO_AUTOCONFIGURE) == 0) | 2566 | DHO_AUTOCONFIGURE) == 0) | |
2540 | { | 2567 | { | |
@@ -2561,40 +2588,26 @@ dhcp_handledhcp(struct interface *iface, | @@ -2561,40 +2588,26 @@ dhcp_handledhcp(struct interface *iface, | |||
2561 | else | 2588 | else | |
2562 | ipv4ll_start(iface); | 2589 | ipv4ll_start(iface); | |
2563 | break; | 2590 | break; | |
2564 | default: | 2591 | default: | |
2565 | syslog(LOG_ERR, | 2592 | syslog(LOG_ERR, | |
2566 | "%s: unknown auto configuration option %d", | 2593 | "%s: unknown auto configuration option %d", | |
2567 | iface->name, tmp); | 2594 | iface->name, tmp); | |
2568 | break; | 2595 | break; | |
2569 | } | 2596 | } | |
2570 | } | 2597 | } | |
2571 | return; | 2598 | return; | |
2572 | } | 2599 | } | |
2573 | 2600 | |||
2574 | /* Ensure that all required options are present */ | |||
2575 | for (i = 1; i < 255; i++) { | |||
2576 | if (has_option_mask(ifo->requiremask, i) && | |||
2577 | get_option_uint8(iface->ctx, &tmp, dhcp, (uint8_t)i) != 0) | |||
2578 | { | |||
2579 | /* If we are bootp, then ignore the need for serverid. | |||
2580 | * To ignore bootp, require dhcp_message_type. */ | |||
2581 | if (type == 0 && i == DHO_SERVERID) | |||
2582 | continue; | |||
2583 | log_dhcp(LOG_WARNING, "reject DHCP", iface, dhcp, from); | |||
2584 | return; | |||
2585 | } | |||
2586 | } | |||
2587 | ||||
2588 | /* Ensure that the address offered is valid */ | 2601 | /* Ensure that the address offered is valid */ | |
2589 | if ((type == 0 || type == DHCP_OFFER || type == DHCP_ACK) && | 2602 | if ((type == 0 || type == DHCP_OFFER || type == DHCP_ACK) && | |
2590 | (dhcp->ciaddr == INADDR_ANY || dhcp->ciaddr == INADDR_BROADCAST) && | 2603 | (dhcp->ciaddr == INADDR_ANY || dhcp->ciaddr == INADDR_BROADCAST) && | |
2591 | (dhcp->yiaddr == INADDR_ANY || dhcp->yiaddr == INADDR_BROADCAST)) | 2604 | (dhcp->yiaddr == INADDR_ANY || dhcp->yiaddr == INADDR_BROADCAST)) | |
2592 | { | 2605 | { | |
2593 | log_dhcp(LOG_WARNING, "reject invalid address", | 2606 | log_dhcp(LOG_WARNING, "reject invalid address", | |
2594 | iface, dhcp, from); | 2607 | iface, dhcp, from); | |
2595 | return; | 2608 | return; | |
2596 | } | 2609 | } | |
2597 | 2610 | |||
2598 | if ((type == 0 || type == DHCP_OFFER) && | 2611 | if ((type == 0 || type == DHCP_OFFER) && | |
2599 | (state->state == DHS_DISCOVER || state->state == DHS_IPV4LL_BOUND)) | 2612 | (state->state == DHS_DISCOVER || state->state == DHS_IPV4LL_BOUND)) | |
2600 | { | 2613 | { | |
@@ -2869,27 +2882,34 @@ dhcp_open(struct interface *ifp) | @@ -2869,27 +2882,34 @@ dhcp_open(struct interface *ifp) | |||
2869 | 2882 | |||
2870 | if (ifp->ctx->packet == NULL) { | 2883 | if (ifp->ctx->packet == NULL) { | |
2871 | ifp->ctx->packet = malloc(udp_dhcp_len); | 2884 | ifp->ctx->packet = malloc(udp_dhcp_len); | |
2872 | if (ifp->ctx->packet == NULL) { | 2885 | if (ifp->ctx->packet == NULL) { | |
2873 | syslog(LOG_ERR, "%s: %m", __func__); | 2886 | syslog(LOG_ERR, "%s: %m", __func__); | |
2874 | return -1; | 2887 | return -1; | |
2875 | } | 2888 | } | |
2876 | } | 2889 | } | |
2877 | 2890 | |||
2878 | state = D_STATE(ifp); | 2891 | state = D_STATE(ifp); | |
2879 | if (state->raw_fd == -1) { | 2892 | if (state->raw_fd == -1) { | |
2880 | state->raw_fd = if_openrawsocket(ifp, ETHERTYPE_IP); | 2893 | state->raw_fd = if_openrawsocket(ifp, ETHERTYPE_IP); | |
2881 | if (state->raw_fd == -1) { | 2894 | if (state->raw_fd == -1) { | |
2882 | syslog(LOG_ERR, "%s: %s: %m", __func__, ifp->name); | 2895 | if (errno == ENOENT) { | |
2896 | syslog(LOG_ERR, "%s not found", if_pfname); | |||
2897 | /* May as well disable IPv4 entirely at | |||
2898 | * this point as we really need it. */ | |||
2899 | ifp->options->options &= ~DHCPCD_IPV4; | |||
2900 | } else | |||
2901 | syslog(LOG_ERR, "%s: %s: %m", | |||
2902 | __func__, ifp->name); | |||
2883 | return -1; | 2903 | return -1; | |
2884 | } | 2904 | } | |
2885 | eloop_event_add(ifp->ctx->eloop, | 2905 | eloop_event_add(ifp->ctx->eloop, | |
2886 | state->raw_fd, dhcp_handlepacket, ifp, NULL, NULL); | 2906 | state->raw_fd, dhcp_handlepacket, ifp, NULL, NULL); | |
2887 | } | 2907 | } | |
2888 | return 0; | 2908 | return 0; | |
2889 | } | 2909 | } | |
2890 | 2910 | |||
2891 | int | 2911 | int | |
2892 | dhcp_dump(struct interface *ifp) | 2912 | dhcp_dump(struct interface *ifp) | |
2893 | { | 2913 | { | |
2894 | struct dhcp_state *state; | 2914 | struct dhcp_state *state; | |
2895 | 2915 |
--- src/external/bsd/dhcpcd/dist/Attic/dhcp.h 2014/12/29 16:18:04 1.1.1.20.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcp.h 2015/02/05 15:13:12 1.1.1.20.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: dhcp.h,v 1.1.1.20.2.1 2014/12/29 16:18:04 martin Exp $ */ | 1 | /* $NetBSD: dhcp.h,v 1.1.1.20.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -282,23 +282,23 @@ void dhcp_handleifa(int, struct interfac | @@ -282,23 +282,23 @@ void dhcp_handleifa(int, struct interfac | |||
282 | void dhcp_drop(struct interface *, const char *); | 282 | void dhcp_drop(struct interface *, const char *); | |
283 | void dhcp_start(struct interface *); | 283 | void dhcp_start(struct interface *); | |
284 | void dhcp_stop(struct interface *); | 284 | void dhcp_stop(struct interface *); | |
285 | void dhcp_decline(struct interface *); | 285 | void dhcp_decline(struct interface *); | |
286 | void dhcp_discover(void *); | 286 | void dhcp_discover(void *); | |
287 | void dhcp_inform(struct interface *); | 287 | void dhcp_inform(struct interface *); | |
288 | void dhcp_probe(struct interface *); | 288 | void dhcp_probe(struct interface *); | |
289 | void dhcp_bind(struct interface *, struct arp_state *); | 289 | void dhcp_bind(struct interface *, struct arp_state *); | |
290 | void dhcp_reboot_newopts(struct interface *, unsigned long long); | 290 | void dhcp_reboot_newopts(struct interface *, unsigned long long); | |
291 | void dhcp_close(struct interface *); | 291 | void dhcp_close(struct interface *); | |
292 | void dhcp_free(struct interface *); | 292 | void dhcp_free(struct interface *); | |
293 | int dhcp_dump(struct interface *); | 293 | int dhcp_dump(struct interface *); | |
294 | #else | 294 | #else | |
295 | #define dhcp_drop(a, b) | 295 | #define dhcp_drop(a, b) {} | |
296 | #define dhcp_start(a) {} | 296 | #define dhcp_start(a) {} | |
297 | #define dhcp_reboot(a, b) b = b | 297 | #define dhcp_reboot(a, b) (b = b) | |
298 | #define dhcp_reboot_newopts(a, b) | 298 | #define dhcp_reboot_newopts(a, b) (b = b) | |
299 | #define dhcp_close(a) | 299 | #define dhcp_close(a) {} | |
300 | #define dhcp_free(a) | 300 | #define dhcp_free(a) {} | |
301 | #define dhcp_dump(a) -1 | 301 | #define dhcp_dump(a) (-1) | |
302 | #endif | 302 | #endif | |
303 | 303 | |||
304 | #endif | 304 | #endif |
--- src/external/bsd/dhcpcd/dist/Attic/dhcpcd-embedded.c.in 2014/06/14 20:51:06 1.1.1.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcpcd-embedded.c.in 2015/02/05 15:13:12 1.1.1.1.4.1
@@ -1,22 +1,22 @@ | @@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* | |
2 | * DO NOT EDIT | 2 | * DO NOT EDIT | |
3 | * Automatically generated from dhcpcd-embedded.conf | 3 | * Automatically generated from dhcpcd-embedded.conf | |
4 | * Ths allows us to simply generate DHCP structure without any C programming | 4 | * Ths allows us to simply generate DHCP structure without any C programming | |
5 | */ | 5 | */ | |
6 | 6 | |||
7 | /* | 7 | /* | |
8 | * dhcpcd - DHCP client daemon | 8 | * dhcpcd - DHCP client daemon | |
9 | * Copyright (c) 2006-2013 Roy Marples <roy@marples.name> | 9 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
10 | * All rights reserved | 10 | * All rights reserved | |
11 | 11 | |||
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
15 | * 1. Redistributions of source code must retain the above copyright | 15 | * 1. Redistributions of source code must retain the above copyright | |
16 | * notice, this list of conditions and the following disclaimer. | 16 | * notice, this list of conditions and the following disclaimer. | |
17 | * 2. Redistributions in binary form must reproduce the above copyright | 17 | * 2. Redistributions in binary form must reproduce the above copyright | |
18 | * notice, this list of conditions and the following disclaimer in the | 18 | * notice, this list of conditions and the following disclaimer in the | |
19 | * documentation and/or other materials provided with the distribution. | 19 | * documentation and/or other materials provided with the distribution. | |
20 | * | 20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/dhcpcd-embedded.h.in 2014/01/15 20:36:32 1.1.1.2
+++ src/external/bsd/dhcpcd/dist/Attic/dhcpcd-embedded.h.in 2015/02/05 15:13:12 1.1.1.2.6.1
@@ -1,16 +1,16 @@ | @@ -1,16 +1,16 @@ | |||
1 | /* | 1 | /* | |
2 | * dhcpcd - DHCP client daemon | 2 | * dhcpcd - DHCP client daemon | |
3 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 3 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
4 | * All rights reserved | 4 | * All rights reserved | |
5 | 5 | |||
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/dhcpcd-run-hooks.8.in 2014/12/29 16:18:05 1.5.4.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcpcd-run-hooks.8.in 2015/02/05 15:13:12 1.5.4.2
@@ -1,15 +1,15 @@ | @@ -1,15 +1,15 @@ | |||
1 | .\" $NetBSD: dhcpcd-run-hooks.8.in,v 1.5.4.1 2014/12/29 16:18:05 martin Exp $ | 1 | .\" $NetBSD: dhcpcd-run-hooks.8.in,v 1.5.4.2 2015/02/05 15:13:12 martin Exp $ | |
2 | .\" Copyright (c) 2006-2014 Roy Marples | 2 | .\" Copyright (c) 2006-2015 Roy Marples | |
3 | .\" All rights reserved | 3 | .\" All rights reserved | |
4 | .\" | 4 | .\" | |
5 | .\" Redistribution and use in source and binary forms, with or without | 5 | .\" Redistribution and use in source and binary forms, with or without | |
6 | .\" modification, are permitted provided that the following conditions | 6 | .\" modification, are permitted provided that the following conditions | |
7 | .\" are met: | 7 | .\" are met: | |
8 | .\" 1. Redistributions of source code must retain the above copyright | 8 | .\" 1. Redistributions of source code must retain the above copyright | |
9 | .\" notice, this list of conditions and the following disclaimer. | 9 | .\" notice, this list of conditions and the following disclaimer. | |
10 | .\" 2. Redistributions in binary form must reproduce the above copyright | 10 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
11 | .\" notice, this list of conditions and the following disclaimer in the | 11 | .\" notice, this list of conditions and the following disclaimer in the | |
12 | .\" documentation and/or other materials provided with the distribution. | 12 | .\" documentation and/or other materials provided with the distribution. | |
13 | .\" | 13 | .\" | |
14 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 14 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
15 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/dhcpcd.8.in 2014/12/29 16:18:05 1.29.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcpcd.8.in 2015/02/05 15:13:12 1.29.2.2
@@ -1,39 +1,39 @@ | @@ -1,39 +1,39 @@ | |||
1 | .\" $NetBSD: dhcpcd.8.in,v 1.29.2.1 2014/12/29 16:18:05 martin Exp $ | 1 | .\" $NetBSD: dhcpcd.8.in,v 1.29.2.2 2015/02/05 15:13:12 martin Exp $ | |
2 | .\" Copyright (c) 2006-2014 Roy Marples | 2 | .\" Copyright (c) 2006-2015 Roy Marples | |
3 | .\" All rights reserved | 3 | .\" All rights reserved | |
4 | .\" | 4 | .\" | |
5 | .\" Redistribution and use in source and binary forms, with or without | 5 | .\" Redistribution and use in source and binary forms, with or without | |
6 | .\" modification, are permitted provided that the following conditions | 6 | .\" modification, are permitted provided that the following conditions | |
7 | .\" are met: | 7 | .\" are met: | |
8 | .\" 1. Redistributions of source code must retain the above copyright | 8 | .\" 1. Redistributions of source code must retain the above copyright | |
9 | .\" notice, this list of conditions and the following disclaimer. | 9 | .\" notice, this list of conditions and the following disclaimer. | |
10 | .\" 2. Redistributions in binary form must reproduce the above copyright | 10 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
11 | .\" notice, this list of conditions and the following disclaimer in the | 11 | .\" notice, this list of conditions and the following disclaimer in the | |
12 | .\" documentation and/or other materials provided with the distribution. | 12 | .\" documentation and/or other materials provided with the distribution. | |
13 | .\" | 13 | .\" | |
14 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 14 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
15 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
16 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 16 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
17 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 17 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
18 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 18 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
19 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
20 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 20 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
21 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 21 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
22 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 22 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
23 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 23 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
24 | .\" SUCH DAMAGE. | 24 | .\" SUCH DAMAGE. | |
25 | .\" | 25 | .\" | |
26 | .Dd November 26, 2014 | 26 | .Dd January 15, 2015 | |
27 | .Dt DHCPCD 8 | 27 | .Dt DHCPCD 8 | |
28 | .Os | 28 | .Os | |
29 | .Sh NAME | 29 | .Sh NAME | |
30 | .Nm dhcpcd | 30 | .Nm dhcpcd | |
31 | .Nd a DHCP client | 31 | .Nd a DHCP client | |
32 | .Sh SYNOPSIS | 32 | .Sh SYNOPSIS | |
33 | .Nm | 33 | .Nm | |
34 | .Op Fl 46ABbDdEGgHJKLMpqTV | 34 | .Op Fl 46ABbDdEGgHJKLMpqTV | |
35 | .Op Fl C , Fl Fl nohook Ar hook | 35 | .Op Fl C , Fl Fl nohook Ar hook | |
36 | .Op Fl c , Fl Fl script Ar script | 36 | .Op Fl c , Fl Fl script Ar script | |
37 | .Op Fl e , Fl Fl env Ar value | 37 | .Op Fl e , Fl Fl env Ar value | |
38 | .Op Fl F , Fl Fl fqdn Ar FQDN | 38 | .Op Fl F , Fl Fl fqdn Ar FQDN | |
39 | .Op Fl f , Fl Fl config Ar file | 39 | .Op Fl f , Fl Fl config Ar file | |
@@ -113,26 +113,34 @@ and | @@ -113,26 +113,34 @@ and | |||
113 | options. | 113 | options. | |
114 | .Pp | 114 | .Pp | |
115 | .Nm | 115 | .Nm | |
116 | is also an implementation of the BOOTP client specified in | 116 | is also an implementation of the BOOTP client specified in | |
117 | .Li RFC 951 . | 117 | .Li RFC 951 . | |
118 | .Pp | 118 | .Pp | |
119 | .Nm | 119 | .Nm | |
120 | is also an implementation of the IPv6 Router Solicitor as specified in | 120 | is also an implementation of the IPv6 Router Solicitor as specified in | |
121 | .Li RFC 4861 | 121 | .Li RFC 4861 | |
122 | and | 122 | and | |
123 | .Li RFC 6106 . | 123 | .Li RFC 6106 . | |
124 | .Pp | 124 | .Pp | |
125 | .Nm | 125 | .Nm | |
126 | is also an implementation of the IPv6 Privacy Extensions to AutoConf as | |||
127 | specified in | |||
128 | .Li RFC 4941 . | |||
129 | This feature needs to be enabled in the kernel and | |||
130 | .Nm | |||
131 | will start using it. | |||
132 | .Pp | |||
133 | .Nm | |||
126 | is also an implemenation of the DHCPv6 client as specified in | 134 | is also an implemenation of the DHCPv6 client as specified in | |
127 | .Li RFC 3315 . | 135 | .Li RFC 3315 . | |
128 | By default, | 136 | By default, | |
129 | .Nm | 137 | .Nm | |
130 | only starts DHCPv6 when instructed to do so by an IPV6 Router Advertisement. | 138 | only starts DHCPv6 when instructed to do so by an IPV6 Router Advertisement. | |
131 | If no Identity Association is configured, | 139 | If no Identity Association is configured, | |
132 | then a Non-temporary Address is requested. | 140 | then a Non-temporary Address is requested. | |
133 | .Ss Local Link configuration | 141 | .Ss Local Link configuration | |
134 | If | 142 | If | |
135 | .Nm | 143 | .Nm | |
136 | failed to obtain a lease, it probes for a valid IPv4LL address | 144 | failed to obtain a lease, it probes for a valid IPv4LL address | |
137 | .Po | 145 | .Po | |
138 | aka ZeroConf, aka APIPA | 146 | aka ZeroConf, aka APIPA | |
@@ -692,20 +700,20 @@ Control socket to per interface daemon. | @@ -692,20 +700,20 @@ Control socket to per interface daemon. | |||
692 | .El | 700 | .El | |
693 | .Sh SEE ALSO | 701 | .Sh SEE ALSO | |
694 | .Xr fnmatch 3 , | 702 | .Xr fnmatch 3 , | |
695 | .Xr if_nametoindex 3 , | 703 | .Xr if_nametoindex 3 , | |
696 | .Xr dhcpcd.conf 5 , | 704 | .Xr dhcpcd.conf 5 , | |
697 | .Xr resolv.conf 5 , | 705 | .Xr resolv.conf 5 , | |
698 | .Xr dhcpcd-run-hooks 8 , | 706 | .Xr dhcpcd-run-hooks 8 , | |
699 | .Xr resolvconf 8 | 707 | .Xr resolvconf 8 | |
700 | .Sh STANDARDS | 708 | .Sh STANDARDS | |
701 | RFC\ 951, RFC\ 1534, RFC\ 2104, RFC\ 2131, RFC\ 2132, RFC\ 2563, RFC\ 2855, | 709 | RFC\ 951, RFC\ 1534, RFC\ 2104, RFC\ 2131, RFC\ 2132, RFC\ 2563, RFC\ 2855, | |
702 | RFC\ 3004, RFC\ 3118, RFC\ 3203, RFC\ 3315, RFC\ 3361, RFC\ 3633, RFC\ 3396, | 710 | RFC\ 3004, RFC\ 3118, RFC\ 3203, RFC\ 3315, RFC\ 3361, RFC\ 3633, RFC\ 3396, | |
703 | RFC\ 3397, RFC\ 3442, RFC\ 3495, RFC\ 3925, RFC\ 3927, RFC\ 4039, RFC\ 4075, | 711 | RFC\ 3397, RFC\ 3442, RFC\ 3495, RFC\ 3925, RFC\ 3927, RFC\ 4039, RFC\ 4075, | |
704 | RFC\ 4242, RFC\ 4361, RFC\ 4390, RFC\ 4702, RFC\ 4074, RFC\ 4861, RFC\ 4833, | 712 | RFC\ 4242, RFC\ 4361, RFC\ 4390, RFC\ 4702, RFC\ 4074, RFC\ 4861, RFC\ 4833, | |
705 | RFC\ 5227, RFC\ 5942, RFC\ 5969, RFC\ 6106, RFC\ 6334, RFC\ 6603, RFC\ 6704, | 713 | RFC\ 4941, RFC\ 5227, RFC\ 5942, RFC\ 5969, RFC\ 6106, RFC\ 6334, RFC\ 6603, | |
706 | RFC\ 7217. | 714 | RFC\ 6704, RFC\ 7217. | |
707 | .Sh AUTHORS | 715 | .Sh AUTHORS | |
708 | .An Roy Marples Aq Mt roy@marples.name | 716 | .An Roy Marples Aq Mt roy@marples.name | |
709 | .Sh BUGS | 717 | .Sh BUGS | |
710 | Please report them to | 718 | Please report them to | |
711 | .Lk http://roy.marples.name/projects/dhcpcd | 719 | .Lk http://roy.marples.name/projects/dhcpcd |
--- src/external/bsd/dhcpcd/dist/Attic/dhcpcd.c 2014/12/29 17:27:28 1.7.2.2
+++ src/external/bsd/dhcpcd/dist/Attic/dhcpcd.c 2015/02/05 15:13:12 1.7.2.3
@@ -1,44 +1,44 @@ | @@ -1,44 +1,44 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: dhcpcd.c,v 1.7.2.2 2014/12/29 17:27:28 martin Exp $"); | 2 | __RCSID("$NetBSD: dhcpcd.c,v 1.7.2.3 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
28 | * SUCH DAMAGE. | 28 | * SUCH DAMAGE. | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | const char dhcpcd_copyright[] = "Copyright (c) 2006-2014 Roy Marples"; | 31 | const char dhcpcd_copyright[] = "Copyright (c) 2006-2015 Roy Marples"; | |
32 | 32 | |||
33 | #define _WITH_DPRINTF /* Stop FreeBSD bitching */ | 33 | #define _WITH_DPRINTF /* Stop FreeBSD bitching */ | |
34 | 34 | |||
35 | #include <sys/file.h> | 35 | #include <sys/file.h> | |
36 | #include <sys/socket.h> | 36 | #include <sys/socket.h> | |
37 | #include <sys/stat.h> | 37 | #include <sys/stat.h> | |
38 | #include <sys/time.h> | 38 | #include <sys/time.h> | |
39 | #include <sys/types.h> | 39 | #include <sys/types.h> | |
40 | #include <sys/uio.h> | 40 | #include <sys/uio.h> | |
41 | 41 | |||
42 | #include <ctype.h> | 42 | #include <ctype.h> | |
43 | #include <errno.h> | 43 | #include <errno.h> | |
44 | #include <fcntl.h> | 44 | #include <fcntl.h> | |
@@ -310,26 +310,27 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx) | @@ -310,26 +310,27 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx) | |||
310 | } | 310 | } | |
311 | 311 | |||
312 | static void | 312 | static void | |
313 | stop_interface(struct interface *ifp) | 313 | stop_interface(struct interface *ifp) | |
314 | { | 314 | { | |
315 | struct dhcpcd_ctx *ctx; | 315 | struct dhcpcd_ctx *ctx; | |
316 | 316 | |||
317 | ctx = ifp->ctx; | 317 | ctx = ifp->ctx; | |
318 | syslog(LOG_INFO, "%s: removing interface", ifp->name); | 318 | syslog(LOG_INFO, "%s: removing interface", ifp->name); | |
319 | ifp->options->options |= DHCPCD_STOPPING; | 319 | ifp->options->options |= DHCPCD_STOPPING; | |
320 | 320 | |||
321 | dhcp6_drop(ifp, NULL); | 321 | dhcp6_drop(ifp, NULL); | |
322 | ipv6nd_drop(ifp); | 322 | ipv6nd_drop(ifp); | |
323 | ipv6_drop(ifp); | |||
323 | dhcp_drop(ifp, "STOP"); | 324 | dhcp_drop(ifp, "STOP"); | |
324 | arp_close(ifp); | 325 | arp_close(ifp); | |
325 | if (ifp->options->options & DHCPCD_DEPARTED) | 326 | if (ifp->options->options & DHCPCD_DEPARTED) | |
326 | script_runreason(ifp, "DEPARTED"); | 327 | script_runreason(ifp, "DEPARTED"); | |
327 | else | 328 | else | |
328 | script_runreason(ifp, "STOPPED"); | 329 | script_runreason(ifp, "STOPPED"); | |
329 | 330 | |||
330 | /* Delete all timeouts for the interfaces */ | 331 | /* Delete all timeouts for the interfaces */ | |
331 | eloop_q_timeout_delete(ctx->eloop, 0, NULL, ifp); | 332 | eloop_q_timeout_delete(ctx->eloop, 0, NULL, ifp); | |
332 | 333 | |||
333 | /* Remove the interface from our list */ | 334 | /* Remove the interface from our list */ | |
334 | TAILQ_REMOVE(ifp->ctx->ifaces, ifp, next); | 335 | TAILQ_REMOVE(ifp->ctx->ifaces, ifp, next); | |
335 | if_free(ifp); | 336 | if_free(ifp); | |
@@ -378,27 +379,27 @@ configure_interface1(struct interface *i | @@ -378,27 +379,27 @@ configure_interface1(struct interface *i | |||
378 | ifo->options |= DHCPCD_IPV6RA_OWN; | 379 | ifo->options |= DHCPCD_IPV6RA_OWN; | |
379 | 380 | |||
380 | /* We want to disable kernel interface RA as early as possible. */ | 381 | /* We want to disable kernel interface RA as early as possible. */ | |
381 | if (ifo->options & DHCPCD_IPV6RS) { | 382 | if (ifo->options & DHCPCD_IPV6RS) { | |
382 | /* If not doing any DHCP, disable the RDNSS requirement. */ | 383 | /* If not doing any DHCP, disable the RDNSS requirement. */ | |
383 | if (!(ifo->options & (DHCPCD_DHCP | DHCPCD_DHCP6))) | 384 | if (!(ifo->options & (DHCPCD_DHCP | DHCPCD_DHCP6))) | |
384 | ifo->options &= ~DHCPCD_IPV6RA_REQRDNSS; | 385 | ifo->options &= ~DHCPCD_IPV6RA_REQRDNSS; | |
385 | ra_global = if_checkipv6(ifp->ctx, NULL, | 386 | ra_global = if_checkipv6(ifp->ctx, NULL, | |
386 | ifp->ctx->options & DHCPCD_IPV6RA_OWN ? 1 : 0); | 387 | ifp->ctx->options & DHCPCD_IPV6RA_OWN ? 1 : 0); | |
387 | ra_iface = if_checkipv6(ifp->ctx, ifp, | 388 | ra_iface = if_checkipv6(ifp->ctx, ifp, | |
388 | ifp->options->options & DHCPCD_IPV6RA_OWN ? 1 : 0); | 389 | ifp->options->options & DHCPCD_IPV6RA_OWN ? 1 : 0); | |
389 | if (ra_global == -1 || ra_iface == -1) | 390 | if (ra_global == -1 || ra_iface == -1) | |
390 | ifo->options &= ~DHCPCD_IPV6RS; | 391 | ifo->options &= ~DHCPCD_IPV6RS; | |
391 | else if (ra_iface == 0) | 392 | else if (ra_iface == 0 && !(ifp->ctx->options & DHCPCD_TEST)) | |
392 | ifo->options |= DHCPCD_IPV6RA_OWN; | 393 | ifo->options |= DHCPCD_IPV6RA_OWN; | |
393 | } | 394 | } | |
394 | 395 | |||
395 | /* If we haven't specified a ClientID and our hardware address | 396 | /* If we haven't specified a ClientID and our hardware address | |
396 | * length is greater than DHCP_CHADDR_LEN then we enforce a ClientID | 397 | * length is greater than DHCP_CHADDR_LEN then we enforce a ClientID | |
397 | * of the hardware address family and the hardware address. | 398 | * of the hardware address family and the hardware address. | |
398 | * If there is no hardware address and no ClientID set, | 399 | * If there is no hardware address and no ClientID set, | |
399 | * force a DUID based ClientID. */ | 400 | * force a DUID based ClientID. */ | |
400 | if (ifp->hwlen > DHCP_CHADDR_LEN) | 401 | if (ifp->hwlen > DHCP_CHADDR_LEN) | |
401 | ifo->options |= DHCPCD_CLIENTID; | 402 | ifo->options |= DHCPCD_CLIENTID; | |
402 | else if (ifp->hwlen == 0 && !(ifo->options & DHCPCD_CLIENTID)) | 403 | else if (ifp->hwlen == 0 && !(ifo->options & DHCPCD_CLIENTID)) | |
403 | ifo->options |= DHCPCD_CLIENTID | DHCPCD_DUID; | 404 | ifo->options |= DHCPCD_CLIENTID | DHCPCD_DUID; | |
404 | 405 | |||
@@ -595,48 +596,47 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx * | @@ -595,48 +596,47 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx * | |||
595 | eloop_timeout_delete(ifp->ctx->eloop, dhcpcd_pollup, ifp); | 596 | eloop_timeout_delete(ifp->ctx->eloop, dhcpcd_pollup, ifp); | |
596 | 597 | |||
597 | if (carrier == LINK_UNKNOWN) { | 598 | if (carrier == LINK_UNKNOWN) { | |
598 | if (errno != ENOTTY) /* For example a PPP link on BSD */ | 599 | if (errno != ENOTTY) /* For example a PPP link on BSD */ | |
599 | syslog(LOG_ERR, "%s: carrier_status: %m", ifname); | 600 | syslog(LOG_ERR, "%s: carrier_status: %m", ifname); | |
600 | } else if (carrier == LINK_DOWN || (ifp->flags & IFF_UP) == 0) { | 601 | } else if (carrier == LINK_DOWN || (ifp->flags & IFF_UP) == 0) { | |
601 | if (ifp->carrier != LINK_DOWN) { | 602 | if (ifp->carrier != LINK_DOWN) { | |
602 | if (ifp->carrier == LINK_UP) | 603 | if (ifp->carrier == LINK_UP) | |
603 | syslog(LOG_INFO, "%s: carrier lost", ifp->name); | 604 | syslog(LOG_INFO, "%s: carrier lost", ifp->name); | |
604 | ifp->carrier = LINK_DOWN; | 605 | ifp->carrier = LINK_DOWN; | |
605 | script_runreason(ifp, "NOCARRIER"); | 606 | script_runreason(ifp, "NOCARRIER"); | |
606 | dhcp6_drop(ifp, "EXPIRE6"); | 607 | dhcp6_drop(ifp, "EXPIRE6"); | |
607 | ipv6nd_drop(ifp); | 608 | ipv6nd_drop(ifp); | |
608 | /* Don't blindly delete our knowledge of LL addresses. | 609 | ipv6_drop(ifp); | |
609 | * We need to listen to what the kernel does with | |||
610 | * them as some OS's will remove, mark tentative or | |||
611 | * do nothing. */ | |||
612 | ipv6_free_ll_callbacks(ifp); | |||
613 | dhcp_drop(ifp, "EXPIRE"); | 610 | dhcp_drop(ifp, "EXPIRE"); | |
614 | arp_close(ifp); | 611 | arp_close(ifp); | |
615 | } | 612 | } | |
616 | } else if (carrier == LINK_UP && ifp->flags & IFF_UP) { | 613 | } else if (carrier == LINK_UP && ifp->flags & IFF_UP) { | |
617 | if (ifp->carrier != LINK_UP) { | 614 | if (ifp->carrier != LINK_UP) { | |
618 | syslog(LOG_INFO, "%s: carrier acquired", ifp->name); | 615 | syslog(LOG_INFO, "%s: carrier acquired", ifp->name); | |
619 | ifp->carrier = LINK_UP; | 616 | ifp->carrier = LINK_UP; | |
620 | #if !defined(__linux__) && !defined(__NetBSD__) | 617 | #if !defined(__linux__) && !defined(__NetBSD__) | |
621 | /* BSD does not emit RTM_NEWADDR or RTM_CHGADDR when the | 618 | /* BSD does not emit RTM_NEWADDR or RTM_CHGADDR when the | |
622 | * hardware address changes so we have to go | 619 | * hardware address changes so we have to go | |
623 | * through the disovery process to work it out. */ | 620 | * through the disovery process to work it out. */ | |
624 | dhcpcd_handleinterface(ctx, 0, ifp->name); | 621 | dhcpcd_handleinterface(ctx, 0, ifp->name); | |
625 | #endif | 622 | #endif | |
626 | if (ifp->wireless) | 623 | if (ifp->wireless) | |
627 | if_getssid(ifp); | 624 | if_getssid(ifp); | |
628 | configure_interface(ifp, ctx->argc, ctx->argv); | 625 | dhcpcd_initstate(ifp); | |
629 | script_runreason(ifp, "CARRIER"); | 626 | script_runreason(ifp, "CARRIER"); | |
627 | /* RFC4941 Section 3.5 */ | |||
628 | if (ifp->options->options & DHCPCD_IPV6RA_OWN) | |||
629 | ipv6_gentempifid(ifp); | |||
630 | dhcpcd_startinterface(ifp); | 630 | dhcpcd_startinterface(ifp); | |
631 | } | 631 | } | |
632 | } | 632 | } | |
633 | } | 633 | } | |
634 | 634 | |||
635 | static void | 635 | static void | |
636 | warn_iaid_conflict(struct interface *ifp, uint8_t *iaid) | 636 | warn_iaid_conflict(struct interface *ifp, uint8_t *iaid) | |
637 | { | 637 | { | |
638 | struct interface *ifn; | 638 | struct interface *ifn; | |
639 | size_t i; | 639 | size_t i; | |
640 | 640 | |||
641 | TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) { | 641 | TAILQ_FOREACH(ifn, ifp->ctx->ifaces, next) { | |
642 | if (ifn == ifp) | 642 | if (ifn == ifp) | |
@@ -897,26 +897,30 @@ dhcpcd_handleinterface(void *arg, int ac | @@ -897,26 +897,30 @@ dhcpcd_handleinterface(void *arg, int ac | |||
897 | } | 897 | } | |
898 | 898 | |||
899 | /* If running off an interface list, check it's in it. */ | 899 | /* If running off an interface list, check it's in it. */ | |
900 | if (ctx->ifc && action != 2) { | 900 | if (ctx->ifc && action != 2) { | |
901 | for (i = 0; i < ctx->ifc; i++) | 901 | for (i = 0; i < ctx->ifc; i++) | |
902 | if (strcmp(ctx->ifv[i], ifname) == 0) | 902 | if (strcmp(ctx->ifv[i], ifname) == 0) | |
903 | break; | 903 | break; | |
904 | if (i >= ctx->ifc) | 904 | if (i >= ctx->ifc) | |
905 | return 0; | 905 | return 0; | |
906 | } | 906 | } | |
907 | 907 | |||
908 | i = -1; | 908 | i = -1; | |
909 | ifs = if_discover(ctx, -1, UNCONST(argv)); | 909 | ifs = if_discover(ctx, -1, UNCONST(argv)); | |
910 | if (ifs == NULL) { | |||
911 | syslog(LOG_ERR, "%s: if_discover: %m", __func__); | |||
912 | return -1; | |||
913 | } | |||
910 | TAILQ_FOREACH_SAFE(ifp, ifs, next, ifn) { | 914 | TAILQ_FOREACH_SAFE(ifp, ifs, next, ifn) { | |
911 | if (strcmp(ifp->name, ifname) != 0) | 915 | if (strcmp(ifp->name, ifname) != 0) | |
912 | continue; | 916 | continue; | |
913 | i = 0; | 917 | i = 0; | |
914 | /* Check if we already have the interface */ | 918 | /* Check if we already have the interface */ | |
915 | iff = if_find(ctx, ifp->name); | 919 | iff = if_find(ctx, ifp->name); | |
916 | if (iff) { | 920 | if (iff) { | |
917 | syslog(LOG_DEBUG, "%s: interface updated", iff->name); | 921 | syslog(LOG_DEBUG, "%s: interface updated", iff->name); | |
918 | /* The flags and hwaddr could have changed */ | 922 | /* The flags and hwaddr could have changed */ | |
919 | iff->flags = ifp->flags; | 923 | iff->flags = ifp->flags; | |
920 | iff->hwlen = ifp->hwlen; | 924 | iff->hwlen = ifp->hwlen; | |
921 | if (ifp->hwlen != 0) | 925 | if (ifp->hwlen != 0) | |
922 | memcpy(iff->hwaddr, ifp->hwaddr, iff->hwlen); | 926 | memcpy(iff->hwaddr, ifp->hwaddr, iff->hwlen); | |
@@ -997,28 +1001,30 @@ reload_config(struct dhcpcd_ctx *ctx) | @@ -997,28 +1001,30 @@ reload_config(struct dhcpcd_ctx *ctx) | |||
997 | if (ctx->options & DHCPCD_DAEMONISED) | 1001 | if (ctx->options & DHCPCD_DAEMONISED) | |
998 | ifo->options |= DHCPCD_DAEMONISED; | 1002 | ifo->options |= DHCPCD_DAEMONISED; | |
999 | ctx->options = ifo->options; | 1003 | ctx->options = ifo->options; | |
1000 | free_options(ifo); | 1004 | free_options(ifo); | |
1001 | } | 1005 | } | |
1002 | 1006 | |||
1003 | static void | 1007 | static void | |
1004 | reconf_reboot(struct dhcpcd_ctx *ctx, int action, int argc, char **argv, int oi) | 1008 | reconf_reboot(struct dhcpcd_ctx *ctx, int action, int argc, char **argv, int oi) | |
1005 | { | 1009 | { | |
1006 | struct if_head *ifs; | 1010 | struct if_head *ifs; | |
1007 | struct interface *ifn, *ifp; | 1011 | struct interface *ifn, *ifp; | |
1008 | 1012 | |||
1009 | ifs = if_discover(ctx, argc - oi, argv + oi); | 1013 | ifs = if_discover(ctx, argc - oi, argv + oi); | |
1010 | if (ifs == NULL) | 1014 | if (ifs == NULL) { | |
1015 | syslog(LOG_ERR, "%s: if_discover: %m", __func__); | |||
1011 | return; | 1016 | return; | |
1017 | } | |||
1012 | 1018 | |||
1013 | while ((ifp = TAILQ_FIRST(ifs))) { | 1019 | while ((ifp = TAILQ_FIRST(ifs))) { | |
1014 | TAILQ_REMOVE(ifs, ifp, next); | 1020 | TAILQ_REMOVE(ifs, ifp, next); | |
1015 | ifn = if_find(ctx, ifp->name); | 1021 | ifn = if_find(ctx, ifp->name); | |
1016 | if (ifn) { | 1022 | if (ifn) { | |
1017 | if (action) | 1023 | if (action) | |
1018 | if_reboot(ifn, argc, argv); | 1024 | if_reboot(ifn, argc, argv); | |
1019 | else | 1025 | else | |
1020 | ipv4_applyaddr(ifn); | 1026 | ipv4_applyaddr(ifn); | |
1021 | if_free(ifp); | 1027 | if_free(ifp); | |
1022 | } else { | 1028 | } else { | |
1023 | TAILQ_INSERT_TAIL(ctx->ifaces, ifp, next); | 1029 | TAILQ_INSERT_TAIL(ctx->ifaces, ifp, next); | |
1024 | dhcpcd_initstate1(ifp, argc, argv); | 1030 | dhcpcd_initstate1(ifp, argc, argv); | |
@@ -1504,28 +1510,30 @@ main(int argc, char **argv) | @@ -1504,28 +1510,30 @@ main(int argc, char **argv) | |||
1504 | syslog(LOG_ERR, "%s: %m", __func__); | 1510 | syslog(LOG_ERR, "%s: %m", __func__); | |
1505 | goto exit_failure; | 1511 | goto exit_failure; | |
1506 | } | 1512 | } | |
1507 | 1513 | |||
1508 | if (ctx.options & DHCPCD_DUMPLEASE) { | 1514 | if (ctx.options & DHCPCD_DUMPLEASE) { | |
1509 | if (optind != argc - 1) { | 1515 | if (optind != argc - 1) { | |
1510 | syslog(LOG_ERR, "dumplease requires an interface"); | 1516 | syslog(LOG_ERR, "dumplease requires an interface"); | |
1511 | goto exit_failure; | 1517 | goto exit_failure; | |
1512 | } | 1518 | } | |
1513 | i = 0; | 1519 | i = 0; | |
1514 | /* We need to try and find the interface so we can | 1520 | /* We need to try and find the interface so we can | |
1515 | * load the hardware address to compare automated IAID */ | 1521 | * load the hardware address to compare automated IAID */ | |
1516 | ctx.ifaces = if_discover(&ctx, 1, argv + optind); | 1522 | ctx.ifaces = if_discover(&ctx, 1, argv + optind); | |
1517 | if (ctx.ifaces == NULL) | 1523 | if (ctx.ifaces == NULL) { | |
1524 | syslog(LOG_ERR, "if_discover: %m"); | |||
1518 | goto exit_failure; | 1525 | goto exit_failure; | |
1526 | } | |||
1519 | ifp = TAILQ_FIRST(ctx.ifaces); | 1527 | ifp = TAILQ_FIRST(ctx.ifaces); | |
1520 | if (ifp == NULL) { | 1528 | if (ifp == NULL) { | |
1521 | ifp = calloc(1, sizeof(*ifp)); | 1529 | ifp = calloc(1, sizeof(*ifp)); | |
1522 | if (ifp == NULL) { | 1530 | if (ifp == NULL) { | |
1523 | syslog(LOG_ERR, "%s: %m", __func__); | 1531 | syslog(LOG_ERR, "%s: %m", __func__); | |
1524 | goto exit_failure; | 1532 | goto exit_failure; | |
1525 | } | 1533 | } | |
1526 | strlcpy(ifp->name, argv[optind], sizeof(ifp->name)); | 1534 | strlcpy(ifp->name, argv[optind], sizeof(ifp->name)); | |
1527 | ifp->ctx = &ctx; | 1535 | ifp->ctx = &ctx; | |
1528 | TAILQ_INSERT_HEAD(ctx.ifaces, ifp, next); | 1536 | TAILQ_INSERT_HEAD(ctx.ifaces, ifp, next); | |
1529 | } | 1537 | } | |
1530 | configure_interface(ifp, ctx.argc, ctx.argv); | 1538 | configure_interface(ifp, ctx.argc, ctx.argv); | |
1531 | if (ctx.options & DHCPCD_PFXDLGONLY) | 1539 | if (ctx.options & DHCPCD_PFXDLGONLY) | |
@@ -1697,32 +1705,36 @@ main(int argc, char **argv) | @@ -1697,32 +1705,36 @@ main(int argc, char **argv) | |||
1697 | if (ctx.link_fd == -1) | 1705 | if (ctx.link_fd == -1) | |
1698 | syslog(LOG_ERR, "open_link_socket: %m"); | 1706 | syslog(LOG_ERR, "open_link_socket: %m"); | |
1699 | else | 1707 | else | |
1700 | eloop_event_add(ctx.eloop, ctx.link_fd, | 1708 | eloop_event_add(ctx.eloop, ctx.link_fd, | |
1701 | handle_link, &ctx, NULL, NULL); | 1709 | handle_link, &ctx, NULL, NULL); | |
1702 | 1710 | |||
1703 | /* Start any dev listening plugin which may want to | 1711 | /* Start any dev listening plugin which may want to | |
1704 | * change the interface name provided by the kernel */ | 1712 | * change the interface name provided by the kernel */ | |
1705 | if ((ctx.options & (DHCPCD_MASTER | DHCPCD_DEV)) == | 1713 | if ((ctx.options & (DHCPCD_MASTER | DHCPCD_DEV)) == | |
1706 | (DHCPCD_MASTER | DHCPCD_DEV)) | 1714 | (DHCPCD_MASTER | DHCPCD_DEV)) | |
1707 | dev_start(&ctx); | 1715 | dev_start(&ctx); | |
1708 | 1716 | |||
1709 | ctx.ifaces = if_discover(&ctx, ctx.ifc, ctx.ifv); | 1717 | ctx.ifaces = if_discover(&ctx, ctx.ifc, ctx.ifv); | |
1718 | if (ctx.ifaces == NULL) { | |||
1719 | syslog(LOG_ERR, "if_discover: %m"); | |||
1720 | goto exit_failure; | |||
1721 | } | |||
1710 | for (i = 0; i < ctx.ifc; i++) { | 1722 | for (i = 0; i < ctx.ifc; i++) { | |
1711 | if (if_find(&ctx, ctx.ifv[i]) == NULL) | 1723 | if (if_find(&ctx, ctx.ifv[i]) == NULL) | |
1712 | syslog(LOG_ERR, "%s: interface not found or invalid", | 1724 | syslog(LOG_ERR, "%s: interface not found or invalid", | |
1713 | ctx.ifv[i]); | 1725 | ctx.ifv[i]); | |
1714 | } | 1726 | } | |
1715 | if (ctx.ifaces == NULL || TAILQ_FIRST(ctx.ifaces) == NULL) { | 1727 | if (TAILQ_FIRST(ctx.ifaces) == NULL) { | |
1716 | if (ctx.ifc == 0) | 1728 | if (ctx.ifc == 0) | |
1717 | syslog(LOG_ERR, "no valid interfaces found"); | 1729 | syslog(LOG_ERR, "no valid interfaces found"); | |
1718 | else | 1730 | else | |
1719 | goto exit_failure; | 1731 | goto exit_failure; | |
1720 | if (!(ctx.options & DHCPCD_LINK)) { | 1732 | if (!(ctx.options & DHCPCD_LINK)) { | |
1721 | syslog(LOG_ERR, | 1733 | syslog(LOG_ERR, | |
1722 | "aborting as link detection is disabled"); | 1734 | "aborting as link detection is disabled"); | |
1723 | goto exit_failure; | 1735 | goto exit_failure; | |
1724 | } | 1736 | } | |
1725 | } | 1737 | } | |
1726 | 1738 | |||
1727 | TAILQ_FOREACH(ifp, ctx.ifaces, next) { | 1739 | TAILQ_FOREACH(ifp, ctx.ifaces, next) { | |
1728 | dhcpcd_initstate1(ifp, argc, argv); | 1740 | dhcpcd_initstate1(ifp, argc, argv); |
--- src/external/bsd/dhcpcd/dist/Attic/dhcpcd.conf.5.in 2014/12/29 16:18:05 1.10.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcpcd.conf.5.in 2015/02/05 15:13:12 1.10.2.2
@@ -1,39 +1,39 @@ | @@ -1,39 +1,39 @@ | |||
1 | .\" $NetBSD: dhcpcd.conf.5.in,v 1.10.2.1 2014/12/29 16:18:05 martin Exp $ | 1 | .\" $NetBSD: dhcpcd.conf.5.in,v 1.10.2.2 2015/02/05 15:13:12 martin Exp $ | |
2 | .\" Copyright (c) 2006-2014 Roy Marples | 2 | .\" Copyright (c) 2006-2015 Roy Marples | |
3 | .\" All rights reserved | 3 | .\" All rights reserved | |
4 | .\" | 4 | .\" | |
5 | .\" Redistribution and use in source and binary forms, with or without | 5 | .\" Redistribution and use in source and binary forms, with or without | |
6 | .\" modification, are permitted provided that the following conditions | 6 | .\" modification, are permitted provided that the following conditions | |
7 | .\" are met: | 7 | .\" are met: | |
8 | .\" 1. Redistributions of source code must retain the above copyright | 8 | .\" 1. Redistributions of source code must retain the above copyright | |
9 | .\" notice, this list of conditions and the following disclaimer. | 9 | .\" notice, this list of conditions and the following disclaimer. | |
10 | .\" 2. Redistributions in binary form must reproduce the above copyright | 10 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
11 | .\" notice, this list of conditions and the following disclaimer in the | 11 | .\" notice, this list of conditions and the following disclaimer in the | |
12 | .\" documentation and/or other materials provided with the distribution. | 12 | .\" documentation and/or other materials provided with the distribution. | |
13 | .\" | 13 | .\" | |
14 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 14 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
15 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
16 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 16 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
17 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 17 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
18 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 18 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
19 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
20 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 20 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
21 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 21 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
22 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 22 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
23 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 23 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
24 | .\" SUCH DAMAGE. | 24 | .\" SUCH DAMAGE. | |
25 | .\" | 25 | .\" | |
26 | .Dd December 13, 2014 | 26 | .Dd January 20, 2015 | |
27 | .Dt DHCPCD.CONF 5 | 27 | .Dt DHCPCD.CONF 5 | |
28 | .Os | 28 | .Os | |
29 | .Sh NAME | 29 | .Sh NAME | |
30 | .Nm dhcpcd.conf | 30 | .Nm dhcpcd.conf | |
31 | .Nd dhcpcd configuration file | 31 | .Nd dhcpcd configuration file | |
32 | .Sh DESCRIPTION | 32 | .Sh DESCRIPTION | |
33 | Although | 33 | Although | |
34 | .Nm dhcpcd | 34 | .Nm dhcpcd | |
35 | can do everything from the command line, there are cases where it's just easier | 35 | can do everything from the command line, there are cases where it's just easier | |
36 | to do it once in a configuration file. | 36 | to do it once in a configuration file. | |
37 | Most of the options found in | 37 | Most of the options found in | |
38 | .Xr dhcpcd 8 | 38 | .Xr dhcpcd 8 | |
39 | can be used here. | 39 | can be used here. | |
@@ -335,26 +335,32 @@ Only confgiure IPv6. | @@ -335,26 +335,32 @@ Only confgiure IPv6. | |||
335 | .It Ic fqdn Op disable | ptr | both | 335 | .It Ic fqdn Op disable | ptr | both | |
336 | ptr just asks the DHCP server to update the PTR | 336 | ptr just asks the DHCP server to update the PTR | |
337 | record of the host in DNS whereas both also updates the A record. | 337 | record of the host in DNS whereas both also updates the A record. | |
338 | disable will disable the FQDN option. | 338 | disable will disable the FQDN option. | |
339 | The default is both. | 339 | The default is both. | |
340 | .Nm dhcpcd | 340 | .Nm dhcpcd | |
341 | itself never does any DNS updates. | 341 | itself never does any DNS updates. | |
342 | .Nm dhcpcd | 342 | .Nm dhcpcd | |
343 | encodes the FQDN hostname as specified in | 343 | encodes the FQDN hostname as specified in | |
344 | .Li RFC1035 . | 344 | .Li RFC1035 . | |
345 | .It Ic interface Ar interface | 345 | .It Ic interface Ar interface | |
346 | Subsequent options are only parsed for this | 346 | Subsequent options are only parsed for this | |
347 | .Ar interface . | 347 | .Ar interface . | |
348 | .It Ic ipv6ra_autoconf | |||
349 | Generate SLAAC addresses for each Prefix advertised by a | |||
350 | Router Advertisement message with the Auto flag set. | |||
351 | On by default. | |||
352 | .It Ic ipv6ra_noautoconf | |||
353 | Disables the above option. | |||
348 | .It Ic ipv6ra_fork | 354 | .It Ic ipv6ra_fork | |
349 | By default, when | 355 | By default, when | |
350 | .Nm dhcpcd | 356 | .Nm dhcpcd | |
351 | receives an IPv6 RA, | 357 | receives an IPv6 RA, | |
352 | .Nm dhcpcd | 358 | .Nm dhcpcd | |
353 | will only fork to the background if the RA contains at least one unexpired | 359 | will only fork to the background if the RA contains at least one unexpired | |
354 | RDNSS option and a valid prefix or no DHCPv6 instruction. | 360 | RDNSS option and a valid prefix or no DHCPv6 instruction. | |
355 | Set this option so to make | 361 | Set this option so to make | |
356 | .Nm dhcpcd | 362 | .Nm dhcpcd | |
357 | always fork on an RA. | 363 | always fork on an RA. | |
358 | .It Ic ipv6ra_own | 364 | .It Ic ipv6ra_own | |
359 | Disables kernel IPv6 Router Advertisment processing so dhcpcd can manage | 365 | Disables kernel IPv6 Router Advertisment processing so dhcpcd can manage | |
360 | addresses and routes. | 366 | addresses and routes. | |
@@ -474,26 +480,34 @@ will release the lease prior to stopping | @@ -474,26 +480,34 @@ will release the lease prior to stopping | |||
474 | .It Ic require Ar option | 480 | .It Ic require Ar option | |
475 | Requires the | 481 | Requires the | |
476 | .Ar option | 482 | .Ar option | |
477 | to be present in all DHCP messages, otherwise the message is ignored. | 483 | to be present in all DHCP messages, otherwise the message is ignored. | |
478 | It can be a variable to be used in | 484 | It can be a variable to be used in | |
479 | .Xr dhcpcd-run-hooks 8 | 485 | .Xr dhcpcd-run-hooks 8 | |
480 | or the numerical value. | 486 | or the numerical value. | |
481 | You can specify more options separated by commas, spaces or more require lines. | 487 | You can specify more options separated by commas, spaces or more require lines. | |
482 | To enforce that | 488 | To enforce that | |
483 | .Nm dhcpcd | 489 | .Nm dhcpcd | |
484 | only responds to DHCP servers and not BOOTP servers, you can | 490 | only responds to DHCP servers and not BOOTP servers, you can | |
485 | .Ic require | 491 | .Ic require | |
486 | .Ar dhcp_message_type . | 492 | .Ar dhcp_message_type . | |
493 | This isn't an exact science though because a BOOTP server can send DHCP like | |||
494 | options. | |||
495 | .It Ic reject Ar option | |||
496 | Reject a DHCP message that contains the | |||
497 | .Ar option . | |||
498 | This is useful when you cannot use | |||
499 | .Ic require | |||
500 | to select / de-select BOOTP messages. | |||
487 | .It Ic script Ar script | 501 | .It Ic script Ar script | |
488 | Use | 502 | Use | |
489 | .Ar script | 503 | .Ar script | |
490 | instead of the default | 504 | instead of the default | |
491 | .Pa @SCRIPT@ . | 505 | .Pa @SCRIPT@ . | |
492 | .It Ic ssid Ar ssid | 506 | .It Ic ssid Ar ssid | |
493 | Subsequent options are only parsed for this wireless | 507 | Subsequent options are only parsed for this wireless | |
494 | .Ar ssid . | 508 | .Ar ssid . | |
495 | .It Ic slaac Op Ar hwaddr | Ar private | 509 | .It Ic slaac Op Ar hwaddr | Ar private | |
496 | Selects the interface identifier used for SLAAC generated IPv6 addresses. | 510 | Selects the interface identifier used for SLAAC generated IPv6 addresses. | |
497 | If | 511 | If | |
498 | .Ar private | 512 | .Ar private | |
499 | is used, a RFC7217 address is generated. | 513 | is used, a RFC7217 address is generated. |
--- src/external/bsd/dhcpcd/dist/Attic/ipv6nd.c 2014/12/29 16:18:05 1.10.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/ipv6nd.c 2015/02/05 15:13:12 1.10.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: ipv6nd.c,v 1.10.2.1 2014/12/29 16:18:05 martin Exp $"); | 2 | __RCSID("$NetBSD: ipv6nd.c,v 1.10.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -487,28 +487,28 @@ add_router(struct ipv6_ctx *ctx, struct | @@ -487,28 +487,28 @@ add_router(struct ipv6_ctx *ctx, struct | |||
487 | TAILQ_INSERT_TAIL(ctx->ra_routers, router, next); | 487 | TAILQ_INSERT_TAIL(ctx->ra_routers, router, next); | |
488 | } | 488 | } | |
489 | 489 | |||
490 | static int | 490 | static int | |
491 | ipv6nd_scriptrun(struct ra *rap) | 491 | ipv6nd_scriptrun(struct ra *rap) | |
492 | { | 492 | { | |
493 | int hasdns, hasaddress, pid; | 493 | int hasdns, hasaddress, pid; | |
494 | struct ipv6_addr *ap; | 494 | struct ipv6_addr *ap; | |
495 | const struct ra_opt *rao; | 495 | const struct ra_opt *rao; | |
496 | 496 | |||
497 | hasaddress = 0; | 497 | hasaddress = 0; | |
498 | /* If all addresses have completed DAD run the script */ | 498 | /* If all addresses have completed DAD run the script */ | |
499 | TAILQ_FOREACH(ap, &rap->addrs, next) { | 499 | TAILQ_FOREACH(ap, &rap->addrs, next) { | |
500 | if ((ap->flags & (IPV6_AF_ONLINK | IPV6_AF_AUTOCONF)) == | 500 | if ((ap->flags & (IPV6_AF_AUTOCONF | IPV6_AF_ADDED)) == | |
501 | (IPV6_AF_ONLINK | IPV6_AF_AUTOCONF)) | 501 | (IPV6_AF_AUTOCONF | IPV6_AF_ADDED)) | |
502 | { | 502 | { | |
503 | hasaddress = 1; | 503 | hasaddress = 1; | |
504 | if (!(ap->flags & IPV6_AF_DADCOMPLETED) && | 504 | if (!(ap->flags & IPV6_AF_DADCOMPLETED) && | |
505 | ipv6_iffindaddr(ap->iface, &ap->addr)) | 505 | ipv6_iffindaddr(ap->iface, &ap->addr)) | |
506 | ap->flags |= IPV6_AF_DADCOMPLETED; | 506 | ap->flags |= IPV6_AF_DADCOMPLETED; | |
507 | if ((ap->flags & IPV6_AF_DADCOMPLETED) == 0) { | 507 | if ((ap->flags & IPV6_AF_DADCOMPLETED) == 0) { | |
508 | syslog(LOG_DEBUG, | 508 | syslog(LOG_DEBUG, | |
509 | "%s: waiting for Router Advertisement" | 509 | "%s: waiting for Router Advertisement" | |
510 | " DAD to complete", | 510 | " DAD to complete", | |
511 | rap->iface->name); | 511 | rap->iface->name); | |
512 | return 0; | 512 | return 0; | |
513 | } | 513 | } | |
514 | } | 514 | } | |
@@ -556,28 +556,29 @@ ipv6nd_addaddr(void *arg) | @@ -556,28 +556,29 @@ ipv6nd_addaddr(void *arg) | |||
556 | } | 556 | } | |
557 | 557 | |||
558 | int | 558 | int | |
559 | ipv6nd_dadcompleted(const struct interface *ifp) | 559 | ipv6nd_dadcompleted(const struct interface *ifp) | |
560 | { | 560 | { | |
561 | const struct ra *rap; | 561 | const struct ra *rap; | |
562 | const struct ipv6_addr *ap; | 562 | const struct ipv6_addr *ap; | |
563 | 563 | |||
564 | TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) { | 564 | TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) { | |
565 | if (rap->iface != ifp) | 565 | if (rap->iface != ifp) | |
566 | continue; | 566 | continue; | |
567 | TAILQ_FOREACH(ap, &rap->addrs, next) { | 567 | TAILQ_FOREACH(ap, &rap->addrs, next) { | |
568 | if (ap->flags & IPV6_AF_AUTOCONF && | 568 | if (ap->flags & IPV6_AF_AUTOCONF && | |
569 | ap->flags & IPV6_AF_ADDED && | |||
569 | !(ap->flags & IPV6_AF_DADCOMPLETED)) | 570 | !(ap->flags & IPV6_AF_DADCOMPLETED)) | |
570 | return 0; | 571 | return 0; | |
571 | } | 572 | } | |
572 | } | 573 | } | |
573 | return 1; | 574 | return 1; | |
574 | } | 575 | } | |
575 | 576 | |||
576 | static void | 577 | static void | |
577 | ipv6nd_dadcallback(void *arg) | 578 | ipv6nd_dadcallback(void *arg) | |
578 | { | 579 | { | |
579 | struct ipv6_addr *ap = arg, *rapap; | 580 | struct ipv6_addr *ap = arg, *rapap; | |
580 | struct interface *ifp; | 581 | struct interface *ifp; | |
581 | struct ra *rap; | 582 | struct ra *rap; | |
582 | int wascompleted, found; | 583 | int wascompleted, found; | |
583 | struct timeval tv; | 584 | struct timeval tv; | |
@@ -640,26 +641,27 @@ ipv6nd_dadcallback(void *arg) | @@ -640,26 +641,27 @@ ipv6nd_dadcallback(void *arg) | |||
640 | return; | 641 | return; | |
641 | } | 642 | } | |
642 | } | 643 | } | |
643 | 644 | |||
644 | try_script: | 645 | try_script: | |
645 | if (!wascompleted) { | 646 | if (!wascompleted) { | |
646 | TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) { | 647 | TAILQ_FOREACH(rap, ifp->ctx->ipv6->ra_routers, next) { | |
647 | if (rap->iface != ifp) | 648 | if (rap->iface != ifp) | |
648 | continue; | 649 | continue; | |
649 | wascompleted = 1; | 650 | wascompleted = 1; | |
650 | found = 0; | 651 | found = 0; | |
651 | TAILQ_FOREACH(rapap, &rap->addrs, next) { | 652 | TAILQ_FOREACH(rapap, &rap->addrs, next) { | |
652 | if (rapap->flags & IPV6_AF_AUTOCONF && | 653 | if (rapap->flags & IPV6_AF_AUTOCONF && | |
654 | rapap->flags & IPV6_AF_ADDED && | |||
653 | (rapap->flags & IPV6_AF_DADCOMPLETED) == 0) | 655 | (rapap->flags & IPV6_AF_DADCOMPLETED) == 0) | |
654 | { | 656 | { | |
655 | wascompleted = 0; | 657 | wascompleted = 0; | |
656 | break; | 658 | break; | |
657 | } | 659 | } | |
658 | if (rapap == ap) | 660 | if (rapap == ap) | |
659 | found = 1; | 661 | found = 1; | |
660 | } | 662 | } | |
661 | 663 | |||
662 | if (wascompleted && found) { | 664 | if (wascompleted && found) { | |
663 | syslog(LOG_DEBUG, | 665 | syslog(LOG_DEBUG, | |
664 | "%s: Router Advertisement DAD completed", | 666 | "%s: Router Advertisement DAD completed", | |
665 | rap->iface->name); | 667 | rap->iface->name); | |
@@ -683,26 +685,29 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, st | @@ -683,26 +685,29 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, st | |||
683 | struct nd_opt_dnssl *dnssl; | 685 | struct nd_opt_dnssl *dnssl; | |
684 | uint32_t lifetime, mtuv; | 686 | uint32_t lifetime, mtuv; | |
685 | uint8_t *p, *op; | 687 | uint8_t *p, *op; | |
686 | struct in6_addr addr; | 688 | struct in6_addr addr; | |
687 | char buf[INET6_ADDRSTRLEN]; | 689 | char buf[INET6_ADDRSTRLEN]; | |
688 | const char *cbp; | 690 | const char *cbp; | |
689 | struct ra *rap; | 691 | struct ra *rap; | |
690 | struct nd_opt_hdr *ndo; | 692 | struct nd_opt_hdr *ndo; | |
691 | struct ra_opt *rao; | 693 | struct ra_opt *rao; | |
692 | struct ipv6_addr *ap; | 694 | struct ipv6_addr *ap; | |
693 | char *opt, *opt2, *tmp; | 695 | char *opt, *opt2, *tmp; | |
694 | struct timeval expire; | 696 | struct timeval expire; | |
695 | uint8_t new_rap, new_data; | 697 | uint8_t new_rap, new_data; | |
698 | #ifdef IPV6_MANAGETEMPADDR | |||
699 | uint8_t new_ap; | |||
700 | #endif | |||
696 | 701 | |||
697 | if (len < sizeof(struct nd_router_advert)) { | 702 | if (len < sizeof(struct nd_router_advert)) { | |
698 | syslog(LOG_ERR, "IPv6 RA packet too short from %s", ctx->sfrom); | 703 | syslog(LOG_ERR, "IPv6 RA packet too short from %s", ctx->sfrom); | |
699 | return; | 704 | return; | |
700 | } | 705 | } | |
701 | 706 | |||
702 | if (!IN6_IS_ADDR_LINKLOCAL(&ctx->from.sin6_addr)) { | 707 | if (!IN6_IS_ADDR_LINKLOCAL(&ctx->from.sin6_addr)) { | |
703 | syslog(LOG_ERR, "RA from non local address %s", ctx->sfrom); | 708 | syslog(LOG_ERR, "RA from non local address %s", ctx->sfrom); | |
704 | return; | 709 | return; | |
705 | } | 710 | } | |
706 | 711 | |||
707 | if (ifp == NULL) { | 712 | if (ifp == NULL) { | |
708 | #ifdef DEBUG_RS | 713 | #ifdef DEBUG_RS | |
@@ -718,26 +723,32 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, st | @@ -718,26 +723,32 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, st | |||
718 | #endif | 723 | #endif | |
719 | return; | 724 | return; | |
720 | } | 725 | } | |
721 | 726 | |||
722 | /* We could receive a RA before we sent a RS*/ | 727 | /* We could receive a RA before we sent a RS*/ | |
723 | if (ipv6_linklocal(ifp) == NULL) { | 728 | if (ipv6_linklocal(ifp) == NULL) { | |
724 | #ifdef DEBUG_RS | 729 | #ifdef DEBUG_RS | |
725 | syslog(LOG_DEBUG, "%s: received RA from %s (no link-local)", | 730 | syslog(LOG_DEBUG, "%s: received RA from %s (no link-local)", | |
726 | ifp->name, ctx->sfrom); | 731 | ifp->name, ctx->sfrom); | |
727 | #endif | 732 | #endif | |
728 | return; | 733 | return; | |
729 | } | 734 | } | |
730 | 735 | |||
736 | if (ipv6_iffindaddr(ifp, &ctx->from.sin6_addr)) { | |||
737 | syslog(LOG_DEBUG, "%s: ignoring RA from ourself %s", | |||
738 | ifp->name, ctx->sfrom); | |||
739 | return; | |||
740 | } | |||
741 | ||||
731 | TAILQ_FOREACH(rap, ctx->ra_routers, next) { | 742 | TAILQ_FOREACH(rap, ctx->ra_routers, next) { | |
732 | if (ifp == rap->iface && | 743 | if (ifp == rap->iface && | |
733 | IN6_ARE_ADDR_EQUAL(&rap->from, &ctx->from.sin6_addr)) | 744 | IN6_ARE_ADDR_EQUAL(&rap->from, &ctx->from.sin6_addr)) | |
734 | break; | 745 | break; | |
735 | } | 746 | } | |
736 | 747 | |||
737 | nd_ra = (struct nd_router_advert *)icp; | 748 | nd_ra = (struct nd_router_advert *)icp; | |
738 | 749 | |||
739 | /* We don't want to spam the log with the fact we got an RA every | 750 | /* We don't want to spam the log with the fact we got an RA every | |
740 | * 30 seconds or so, so only spam the log if it's different. */ | 751 | * 30 seconds or so, so only spam the log if it's different. */ | |
741 | if (rap == NULL || (rap->data_len != len || | 752 | if (rap == NULL || (rap->data_len != len || | |
742 | memcmp(rap->data, (unsigned char *)icp, rap->data_len) != 0)) | 753 | memcmp(rap->data, (unsigned char *)icp, rap->data_len) != 0)) | |
743 | { | 754 | { | |
@@ -784,26 +795,27 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, st | @@ -784,26 +795,27 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, st | |||
784 | syslog(LOG_WARNING, "%s: %s router available", | 795 | syslog(LOG_WARNING, "%s: %s router available", | |
785 | ifp->name, rap->sfrom); | 796 | ifp->name, rap->sfrom); | |
786 | rap->lifetime = ntohs(nd_ra->nd_ra_router_lifetime); | 797 | rap->lifetime = ntohs(nd_ra->nd_ra_router_lifetime); | |
787 | if (nd_ra->nd_ra_reachable) { | 798 | if (nd_ra->nd_ra_reachable) { | |
788 | rap->reachable = ntohl(nd_ra->nd_ra_reachable); | 799 | rap->reachable = ntohl(nd_ra->nd_ra_reachable); | |
789 | if (rap->reachable > MAX_REACHABLE_TIME) | 800 | if (rap->reachable > MAX_REACHABLE_TIME) | |
790 | rap->reachable = 0; | 801 | rap->reachable = 0; | |
791 | } | 802 | } | |
792 | if (nd_ra->nd_ra_retransmit) | 803 | if (nd_ra->nd_ra_retransmit) | |
793 | rap->retrans = ntohl(nd_ra->nd_ra_retransmit); | 804 | rap->retrans = ntohl(nd_ra->nd_ra_retransmit); | |
794 | if (rap->lifetime) | 805 | if (rap->lifetime) | |
795 | rap->expired = 0; | 806 | rap->expired = 0; | |
796 | 807 | |||
808 | ipv6_settempstale(ifp); | |||
797 | TAILQ_FOREACH(ap, &rap->addrs, next) { | 809 | TAILQ_FOREACH(ap, &rap->addrs, next) { | |
798 | ap->flags |= IPV6_AF_STALE; | 810 | ap->flags |= IPV6_AF_STALE; | |
799 | } | 811 | } | |
800 | 812 | |||
801 | len -= sizeof(struct nd_router_advert); | 813 | len -= sizeof(struct nd_router_advert); | |
802 | p = ((uint8_t *)icp) + sizeof(struct nd_router_advert); | 814 | p = ((uint8_t *)icp) + sizeof(struct nd_router_advert); | |
803 | lifetime = ~0U; | 815 | lifetime = ~0U; | |
804 | for (; len > 0; p += olen, len -= olen) { | 816 | for (; len > 0; p += olen, len -= olen) { | |
805 | if (len < sizeof(struct nd_opt_hdr)) { | 817 | if (len < sizeof(struct nd_opt_hdr)) { | |
806 | syslog(LOG_ERR, "%s: short option", ifp->name); | 818 | syslog(LOG_ERR, "%s: short option", ifp->name); | |
807 | break; | 819 | break; | |
808 | } | 820 | } | |
809 | ndo = (struct nd_opt_hdr *)p; | 821 | ndo = (struct nd_opt_hdr *)p; | |
@@ -857,74 +869,114 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, st | @@ -857,74 +869,114 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, st | |||
857 | if (!(pi->nd_opt_pi_flags_reserved & | 869 | if (!(pi->nd_opt_pi_flags_reserved & | |
858 | ND_OPT_PI_FLAG_AUTO) && | 870 | ND_OPT_PI_FLAG_AUTO) && | |
859 | !(pi->nd_opt_pi_flags_reserved & | 871 | !(pi->nd_opt_pi_flags_reserved & | |
860 | ND_OPT_PI_FLAG_ONLINK)) | 872 | ND_OPT_PI_FLAG_ONLINK)) | |
861 | continue; | 873 | continue; | |
862 | ap = calloc(1, sizeof(*ap)); | 874 | ap = calloc(1, sizeof(*ap)); | |
863 | if (ap == NULL) | 875 | if (ap == NULL) | |
864 | break; | 876 | break; | |
865 | ap->iface = rap->iface; | 877 | ap->iface = rap->iface; | |
866 | ap->flags = IPV6_AF_NEW; | 878 | ap->flags = IPV6_AF_NEW; | |
867 | ap->prefix_len = pi->nd_opt_pi_prefix_len; | 879 | ap->prefix_len = pi->nd_opt_pi_prefix_len; | |
868 | ap->prefix = pi->nd_opt_pi_prefix; | 880 | ap->prefix = pi->nd_opt_pi_prefix; | |
869 | if (pi->nd_opt_pi_flags_reserved & | 881 | if (pi->nd_opt_pi_flags_reserved & | |
870 | ND_OPT_PI_FLAG_AUTO) | 882 | ND_OPT_PI_FLAG_AUTO && | |
883 | ap->iface->options->options & | |||
884 | DHCPCD_IPV6RA_AUTOCONF) | |||
871 | { | 885 | { | |
872 | ap->flags |= IPV6_AF_AUTOCONF; | 886 | ap->flags |= IPV6_AF_AUTOCONF; | |
873 | ap->dadcounter = | 887 | ap->dadcounter = | |
874 | ipv6_makeaddr(&ap->addr, ifp, | 888 | ipv6_makeaddr(&ap->addr, ifp, | |
875 | &ap->prefix, | 889 | &ap->prefix, | |
876 | pi->nd_opt_pi_prefix_len); | 890 | pi->nd_opt_pi_prefix_len); | |
877 | if (ap->dadcounter == -1) { | 891 | if (ap->dadcounter == -1) { | |
878 | free(ap); | 892 | free(ap); | |
879 | break; | 893 | break; | |
880 | } | 894 | } | |
881 | cbp = inet_ntop(AF_INET6, | 895 | cbp = inet_ntop(AF_INET6, | |
882 | &ap->addr, | 896 | &ap->addr, | |
883 | buf, sizeof(buf)); | 897 | buf, sizeof(buf)); | |
884 | if (cbp) | 898 | if (cbp) | |
885 | snprintf(ap->saddr, | 899 | snprintf(ap->saddr, | |
886 | sizeof(ap->saddr), | 900 | sizeof(ap->saddr), | |
887 | "%s/%d", | 901 | "%s/%d", | |
888 | cbp, ap->prefix_len); | 902 | cbp, ap->prefix_len); | |
889 | else | 903 | else | |
890 | ap->saddr[0] = '\0'; | 904 | ap->saddr[0] = '\0'; | |
891 | } else { | 905 | } else { | |
892 | memset(&ap->addr, 0, sizeof(ap->addr)); | 906 | memset(&ap->addr, 0, sizeof(ap->addr)); | |
893 | ap->saddr[0] = '\0'; | 907 | ap->saddr[0] = '\0'; | |
894 | } | 908 | } | |
895 | ap->dadcallback = ipv6nd_dadcallback; | 909 | ap->dadcallback = ipv6nd_dadcallback; | |
910 | ap->created = ap->acquired = rap->received; | |||
896 | TAILQ_INSERT_TAIL(&rap->addrs, ap, next); | 911 | TAILQ_INSERT_TAIL(&rap->addrs, ap, next); | |
897 | } else | 912 | ||
913 | #ifdef IPV6_MANAGETEMPADDR | |||
914 | /* New address to dhcpcd RA handling. | |||
915 | * If the address already exists and a valid | |||
916 | * temporary address also exists then | |||
917 | * extend the existing one rather than | |||
918 | * create a new one */ | |||
919 | if (ipv6_iffindaddr(ifp, &ap->addr) && | |||
920 | ipv6_settemptime(ap, 0)) | |||
921 | new_ap = 0; | |||
922 | else | |||
923 | new_ap = 1; | |||
924 | #endif | |||
925 | } else { | |||
926 | #ifdef IPV6_MANAGETEMPADDR | |||
927 | new_ap = 0; | |||
928 | #endif | |||
898 | ap->flags &= ~IPV6_AF_STALE; | 929 | ap->flags &= ~IPV6_AF_STALE; | |
930 | ap->acquired = rap->received; | |||
931 | } | |||
899 | if (pi->nd_opt_pi_flags_reserved & | 932 | if (pi->nd_opt_pi_flags_reserved & | |
900 | ND_OPT_PI_FLAG_ONLINK) | 933 | ND_OPT_PI_FLAG_ONLINK) | |
901 | ap->flags |= IPV6_AF_ONLINK; | 934 | ap->flags |= IPV6_AF_ONLINK; | |
902 | ap->acquired = rap->received; | |||
903 | ap->prefix_vltime = | 935 | ap->prefix_vltime = | |
904 | ntohl(pi->nd_opt_pi_valid_time); | 936 | ntohl(pi->nd_opt_pi_valid_time); | |
905 | ap->prefix_pltime = | 937 | ap->prefix_pltime = | |
906 | ntohl(pi->nd_opt_pi_preferred_time); | 938 | ntohl(pi->nd_opt_pi_preferred_time); | |
907 | ap->nsprobes = 0; | 939 | ap->nsprobes = 0; | |
908 | cbp = inet_ntop(AF_INET6, &ap->prefix, buf, sizeof(buf)); | 940 | cbp = inet_ntop(AF_INET6, &ap->prefix, buf, sizeof(buf)); | |
909 | if (cbp) { | 941 | if (cbp) { | |
910 | l = strlen(cbp); | 942 | l = strlen(cbp); | |
911 | opt = malloc(l + 5); | 943 | opt = malloc(l + 5); | |
912 | if (opt) { | 944 | if (opt) { | |
913 | snprintf(opt, l + 5, "%s/%d", cbp, | 945 | snprintf(opt, l + 5, "%s/%d", cbp, | |
914 | ap->prefix_len); | 946 | ap->prefix_len); | |
915 | opt2 = strdup(ap->saddr); | 947 | opt2 = strdup(ap->saddr); | |
916 | } | 948 | } | |
917 | } | 949 | } | |
950 | ||||
951 | #ifdef IPV6_MANAGETEMPADDR | |||
952 | /* RFC4941 Section 3.3.3 */ | |||
953 | if (ap->flags & IPV6_AF_AUTOCONF && | |||
954 | ap->iface->options->options & DHCPCD_IPV6RA_OWN && | |||
955 | ip6_use_tempaddr(ap->iface->name)) | |||
956 | { | |||
957 | if (!new_ap) { | |||
958 | if (ipv6_settemptime(ap, 1) == NULL) | |||
959 | new_ap = 1; | |||
960 | } | |||
961 | if (new_ap && ap->prefix_pltime) { | |||
962 | if (ipv6_createtempaddr(ap, | |||
963 | &ap->acquired) == NULL) | |||
964 | syslog(LOG_ERR, | |||
965 | "ipv6_createtempaddr: %m"); | |||
966 | } | |||
967 | } | |||
968 | #endif | |||
969 | ||||
918 | lifetime = ap->prefix_vltime; | 970 | lifetime = ap->prefix_vltime; | |
919 | break; | 971 | break; | |
920 | 972 | |||
921 | case ND_OPT_MTU: | 973 | case ND_OPT_MTU: | |
922 | mtu = (struct nd_opt_mtu *)(void *)p; | 974 | mtu = (struct nd_opt_mtu *)(void *)p; | |
923 | mtuv = ntohl(mtu->nd_opt_mtu_mtu); | 975 | mtuv = ntohl(mtu->nd_opt_mtu_mtu); | |
924 | if (mtuv < IPV6_MMTU) { | 976 | if (mtuv < IPV6_MMTU) { | |
925 | syslog(LOG_ERR, "%s: invalid MTU %d", | 977 | syslog(LOG_ERR, "%s: invalid MTU %d", | |
926 | ifp->name, mtuv); | 978 | ifp->name, mtuv); | |
927 | break; | 979 | break; | |
928 | } | 980 | } | |
929 | rap->mtu = mtuv; | 981 | rap->mtu = mtuv; | |
930 | snprintf(buf, sizeof(buf), "%d", mtuv); | 982 | snprintf(buf, sizeof(buf), "%d", mtuv); | |
@@ -1056,26 +1108,29 @@ extra_opt: | @@ -1056,26 +1108,29 @@ extra_opt: | |||
1056 | opt = opt2; | 1108 | opt = opt2; | |
1057 | opt2 = NULL; | 1109 | opt2 = NULL; | |
1058 | goto extra_opt; | 1110 | goto extra_opt; | |
1059 | } | 1111 | } | |
1060 | } | 1112 | } | |
1061 | 1113 | |||
1062 | if (new_rap) | 1114 | if (new_rap) | |
1063 | add_router(ifp->ctx->ipv6, rap); | 1115 | add_router(ifp->ctx->ipv6, rap); | |
1064 | if (ifp->ctx->options & DHCPCD_TEST) { | 1116 | if (ifp->ctx->options & DHCPCD_TEST) { | |
1065 | script_runreason(ifp, "TEST"); | 1117 | script_runreason(ifp, "TEST"); | |
1066 | goto handle_flag; | 1118 | goto handle_flag; | |
1067 | } | 1119 | } | |
1068 | ipv6_addaddrs(&rap->addrs); | 1120 | ipv6_addaddrs(&rap->addrs); | |
1121 | #ifdef IPV6_MANAGETEMPADDR | |||
1122 | ipv6_addtempaddrs(ifp, &rap->received); | |||
1123 | #endif | |||
1069 | ipv6_buildroutes(ifp->ctx); | 1124 | ipv6_buildroutes(ifp->ctx); | |
1070 | if (ipv6nd_scriptrun(rap)) | 1125 | if (ipv6nd_scriptrun(rap)) | |
1071 | return; | 1126 | return; | |
1072 | 1127 | |||
1073 | eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); | 1128 | eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); | |
1074 | eloop_timeout_delete(ifp->ctx->eloop, NULL, rap); /* reachable timer */ | 1129 | eloop_timeout_delete(ifp->ctx->eloop, NULL, rap); /* reachable timer */ | |
1075 | 1130 | |||
1076 | handle_flag: | 1131 | handle_flag: | |
1077 | if (!(ifp->options->options & DHCPCD_DHCP6)) | 1132 | if (!(ifp->options->options & DHCPCD_DHCP6)) | |
1078 | goto nodhcp6; | 1133 | goto nodhcp6; | |
1079 | if (rap->flags & ND_RA_FLAG_MANAGED) { | 1134 | if (rap->flags & ND_RA_FLAG_MANAGED) { | |
1080 | if (new_data && dhcp6_start(ifp, DH6S_INIT) == -1) | 1135 | if (new_data && dhcp6_start(ifp, DH6S_INIT) == -1) | |
1081 | syslog(LOG_ERR, "dhcp6_start: %s: %m", ifp->name); | 1136 | syslog(LOG_ERR, "dhcp6_start: %s: %m", ifp->name); |
--- src/external/bsd/dhcpcd/dist/Attic/dhcpcd.h 2014/12/29 16:18:05 1.1.1.19.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/dhcpcd.h 2015/02/05 15:13:12 1.1.1.19.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: dhcpcd.h,v 1.1.1.19.2.1 2014/12/29 16:18:05 martin Exp $ */ | 1 | /* $NetBSD: dhcpcd.h,v 1.1.1.19.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -52,26 +52,29 @@ | @@ -52,26 +52,29 @@ | |||
52 | #define IF_DATA_IPV6 2 | 52 | #define IF_DATA_IPV6 2 | |
53 | #define IF_DATA_IPV6ND 3 | 53 | #define IF_DATA_IPV6ND 3 | |
54 | #define IF_DATA_DHCP6 4 | 54 | #define IF_DATA_DHCP6 4 | |
55 | #define IF_DATA_MAX 5 | 55 | #define IF_DATA_MAX 5 | |
56 | 56 | |||
57 | /* If the interface does not support carrier status (ie PPP), | 57 | /* If the interface does not support carrier status (ie PPP), | |
58 | * dhcpcd can poll it for the relevant flags periodically */ | 58 | * dhcpcd can poll it for the relevant flags periodically */ | |
59 | #define IF_POLL_UP 100 /* milliseconds */ | 59 | #define IF_POLL_UP 100 /* milliseconds */ | |
60 | 60 | |||
61 | struct interface { | 61 | struct interface { | |
62 | struct dhcpcd_ctx *ctx; | 62 | struct dhcpcd_ctx *ctx; | |
63 | TAILQ_ENTRY(interface) next; | 63 | TAILQ_ENTRY(interface) next; | |
64 | char name[IF_NAMESIZE]; | 64 | char name[IF_NAMESIZE]; | |
65 | #ifdef __linux | |||
66 | char alias[IF_NAMESIZE]; | |||
67 | #endif | |||
65 | unsigned int index; | 68 | unsigned int index; | |
66 | unsigned int flags; | 69 | unsigned int flags; | |
67 | sa_family_t family; | 70 | sa_family_t family; | |
68 | #ifdef __FreeBSD__ | 71 | #ifdef __FreeBSD__ | |
69 | struct sockaddr_storage linkaddr; | 72 | struct sockaddr_storage linkaddr; | |
70 | #endif | 73 | #endif | |
71 | unsigned char hwaddr[HWADDR_LEN]; | 74 | unsigned char hwaddr[HWADDR_LEN]; | |
72 | uint8_t hwlen; | 75 | uint8_t hwlen; | |
73 | unsigned int metric; | 76 | unsigned int metric; | |
74 | int carrier; | 77 | int carrier; | |
75 | int wireless; | 78 | int wireless; | |
76 | uint8_t ssid[IF_SSIDSIZE]; | 79 | uint8_t ssid[IF_SSIDSIZE]; | |
77 | unsigned int ssid_len; | 80 | unsigned int ssid_len; |
--- src/external/bsd/dhcpcd/dist/Attic/duid.c 2014/12/29 16:18:05 1.1.1.8.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/duid.c 2015/02/05 15:13:12 1.1.1.8.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: duid.c,v 1.1.1.8.2.1 2014/12/29 16:18:05 martin Exp $"); | 2 | __RCSID("$NetBSD: duid.c,v 1.1.1.8.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/duid.h 2014/12/29 16:18:05 1.1.1.6.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/duid.h 2015/02/05 15:13:12 1.1.1.6.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: duid.h,v 1.1.1.6.2.1 2014/12/29 16:18:05 martin Exp $ */ | 1 | /* $NetBSD: duid.h,v 1.1.1.6.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/eloop.c 2014/12/29 16:18:05 1.1.1.9.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/eloop.c 2015/02/05 15:13:12 1.1.1.9.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: eloop.c,v 1.1.1.9.2.1 2014/12/29 16:18:05 martin Exp $"); | 2 | __RCSID("$NetBSD: eloop.c,v 1.1.1.9.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/eloop.h 2014/12/29 16:18:05 1.1.1.9.4.1
+++ src/external/bsd/dhcpcd/dist/Attic/eloop.h 2015/02/05 15:13:12 1.1.1.9.4.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: eloop.h,v 1.1.1.9.4.1 2014/12/29 16:18:05 martin Exp $ */ | 1 | /* $NetBSD: eloop.h,v 1.1.1.9.4.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/if-bsd.c 2014/12/29 16:18:05 1.7.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/if-bsd.c 2015/02/05 15:13:12 1.7.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: if-bsd.c,v 1.7.2.1 2014/12/29 16:18:05 martin Exp $"); | 2 | __RCSID("$NetBSD: if-bsd.c,v 1.7.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -54,26 +54,27 @@ | @@ -54,26 +54,27 @@ | |||
54 | #include <netinet6/nd6.h> | 54 | #include <netinet6/nd6.h> | |
55 | #ifdef __DragonFly__ | 55 | #ifdef __DragonFly__ | |
56 | # include <netproto/802_11/ieee80211_ioctl.h> | 56 | # include <netproto/802_11/ieee80211_ioctl.h> | |
57 | #elif __APPLE__ | 57 | #elif __APPLE__ | |
58 | /* FIXME: Add apple includes so we can work out SSID */ | 58 | /* FIXME: Add apple includes so we can work out SSID */ | |
59 | #else | 59 | #else | |
60 | # include <net80211/ieee80211.h> | 60 | # include <net80211/ieee80211.h> | |
61 | # include <net80211/ieee80211_ioctl.h> | 61 | # include <net80211/ieee80211_ioctl.h> | |
62 | #endif | 62 | #endif | |
63 | 63 | |||
64 | #include <errno.h> | 64 | #include <errno.h> | |
65 | #include <fcntl.h> | 65 | #include <fcntl.h> | |
66 | #include <fnmatch.h> | 66 | #include <fnmatch.h> | |
67 | #include <paths.h> | |||
67 | #include <stddef.h> | 68 | #include <stddef.h> | |
68 | #include <stdio.h> | 69 | #include <stdio.h> | |
69 | #include <stdlib.h> | 70 | #include <stdlib.h> | |
70 | #include <string.h> | 71 | #include <string.h> | |
71 | #include <syslog.h> | 72 | #include <syslog.h> | |
72 | #include <unistd.h> | 73 | #include <unistd.h> | |
73 | 74 | |||
74 | #if defined(OpenBSD) && OpenBSD >= 201411 | 75 | #if defined(OpenBSD) && OpenBSD >= 201411 | |
75 | /* OpenBSD dropped the global setting from sysctl but left the #define | 76 | /* OpenBSD dropped the global setting from sysctl but left the #define | |
76 | * which causes a EPERM error when trying to use it. | 77 | * which causes a EPERM error when trying to use it. | |
77 | * I think both the error and keeping the define are wrong, so we #undef it. */ | 78 | * I think both the error and keeping the define are wrong, so we #undef it. */ | |
78 | #undef IPV6CTL_ACCEPT_RTADV | 79 | #undef IPV6CTL_ACCEPT_RTADV | |
79 | #endif | 80 | #endif | |
@@ -138,38 +139,40 @@ if_openlinksocket(void) | @@ -138,38 +139,40 @@ if_openlinksocket(void) | |||
138 | close(s); | 139 | close(s); | |
139 | return -1; | 140 | return -1; | |
140 | } | 141 | } | |
141 | if ((flags = fcntl(s, F_GETFL, 0)) == -1 || | 142 | if ((flags = fcntl(s, F_GETFL, 0)) == -1 || | |
142 | fcntl(s, F_SETFL, flags | O_NONBLOCK) == -1) | 143 | fcntl(s, F_SETFL, flags | O_NONBLOCK) == -1) | |
143 | { | 144 | { | |
144 | close(s); | 145 | close(s); | |
145 | return -1; | 146 | return -1; | |
146 | } | 147 | } | |
147 | return s; | 148 | return s; | |
148 | #endif | 149 | #endif | |
149 | } | 150 | } | |
150 | 151 | |||
152 | #if defined(INET) || defined(INET6) | |||
151 | static void | 153 | static void | |
152 | if_linkaddr(struct sockaddr_dl *sdl, const struct interface *ifp) | 154 | if_linkaddr(struct sockaddr_dl *sdl, const struct interface *ifp) | |
153 | { | 155 | { | |
154 | 156 | |||
155 | #ifdef __FreeBSD__ | 157 | #ifdef __FreeBSD__ | |
156 | memcpy(sdl, &ifp->linkaddr, sizeof(*sdl)); | 158 | memcpy(sdl, &ifp->linkaddr, sizeof(*sdl)); | |
157 | sdl->sdl_nlen = sdl->sdl_alen = sdl->sdl_slen = 0; | 159 | sdl->sdl_nlen = sdl->sdl_alen = sdl->sdl_slen = 0; | |
158 | #else | 160 | #else | |
159 | sdl->sdl_len = sizeof(*sdl); | 161 | sdl->sdl_len = sizeof(*sdl); | |
160 | link_addr(ifp->name, sdl); | 162 | link_addr(ifp->name, sdl); | |
161 | #endif | 163 | #endif | |
162 | } | 164 | } | |
165 | #endif | |||
163 | 166 | |||
164 | static int | 167 | static int | |
165 | if_getssid1(const char *ifname, uint8_t *ssid) | 168 | if_getssid1(const char *ifname, uint8_t *ssid) | |
166 | { | 169 | { | |
167 | int s, retval = -1; | 170 | int s, retval = -1; | |
168 | #if defined(SIOCG80211NWID) | 171 | #if defined(SIOCG80211NWID) | |
169 | struct ifreq ifr; | 172 | struct ifreq ifr; | |
170 | struct ieee80211_nwid nwid; | 173 | struct ieee80211_nwid nwid; | |
171 | #elif defined(IEEE80211_IOC_SSID) | 174 | #elif defined(IEEE80211_IOC_SSID) | |
172 | struct ieee80211req ireq; | 175 | struct ieee80211req ireq; | |
173 | char nwid[IEEE80211_NWID_LEN + 1]; | 176 | char nwid[IEEE80211_NWID_LEN + 1]; | |
174 | #endif | 177 | #endif | |
175 | 178 | |||
@@ -250,26 +253,28 @@ if_vimaster(const char *ifname) | @@ -250,26 +253,28 @@ if_vimaster(const char *ifname) | |||
250 | close(s); | 253 | close(s); | |
251 | if (r == -1) | 254 | if (r == -1) | |
252 | return -1; | 255 | return -1; | |
253 | if (ifmr.ifm_status & IFM_AVALID && | 256 | if (ifmr.ifm_status & IFM_AVALID && | |
254 | IFM_TYPE(ifmr.ifm_active) == IFM_IEEE80211) | 257 | IFM_TYPE(ifmr.ifm_active) == IFM_IEEE80211) | |
255 | { | 258 | { | |
256 | if (if_getssid1(ifname, NULL) == -1) | 259 | if (if_getssid1(ifname, NULL) == -1) | |
257 | return 1; | 260 | return 1; | |
258 | } | 261 | } | |
259 | return 0; | 262 | return 0; | |
260 | } | 263 | } | |
261 | 264 | |||
262 | #ifdef INET | 265 | #ifdef INET | |
266 | const char *if_pfname = "Berkley Packet Filter"; | |||
267 | ||||
263 | int | 268 | int | |
264 | if_openrawsocket(struct interface *ifp, int protocol) | 269 | if_openrawsocket(struct interface *ifp, int protocol) | |
265 | { | 270 | { | |
266 | struct dhcp_state *state; | 271 | struct dhcp_state *state; | |
267 | int fd = -1; | 272 | int fd = -1; | |
268 | struct ifreq ifr; | 273 | struct ifreq ifr; | |
269 | int ibuf_len = 0; | 274 | int ibuf_len = 0; | |
270 | size_t buf_len; | 275 | size_t buf_len; | |
271 | struct bpf_version pv; | 276 | struct bpf_version pv; | |
272 | struct bpf_program pf; | 277 | struct bpf_program pf; | |
273 | #ifdef BIOCIMMEDIATE | 278 | #ifdef BIOCIMMEDIATE | |
274 | int flags; | 279 | int flags; | |
275 | #endif | 280 | #endif | |
@@ -606,26 +611,28 @@ if_address6(const struct ipv6_addr *a, i | @@ -606,26 +611,28 @@ if_address6(const struct ipv6_addr *a, i | |||
606 | strlcpy(ifa.ifra_name, a->iface->name, sizeof(ifa.ifra_name)); | 611 | strlcpy(ifa.ifra_name, a->iface->name, sizeof(ifa.ifra_name)); | |
607 | /* | 612 | /* | |
608 | * We should not set IN6_IFF_TENTATIVE as the kernel should be | 613 | * We should not set IN6_IFF_TENTATIVE as the kernel should be | |
609 | * able to work out if it's a new address or not. | 614 | * able to work out if it's a new address or not. | |
610 | * | 615 | * | |
611 | * We should set IN6_IFF_AUTOCONF, but the kernel won't let us. | 616 | * We should set IN6_IFF_AUTOCONF, but the kernel won't let us. | |
612 | * This is probably a safety measure, but still it's not entirely right | 617 | * This is probably a safety measure, but still it's not entirely right | |
613 | * either. | 618 | * either. | |
614 | */ | 619 | */ | |
615 | #if 0 | 620 | #if 0 | |
616 | if (a->autoconf) | 621 | if (a->autoconf) | |
617 | ifa.ifra_flags |= IN6_IFF_AUTOCONF; | 622 | ifa.ifra_flags |= IN6_IFF_AUTOCONF; | |
618 | #endif | 623 | #endif | |
624 | if (a->flags & IPV6_AF_TEMPORARY) | |||
625 | ifa.ifra_flags |= IN6_IFF_TEMPORARY; | |||
619 | 626 | |||
620 | #define ADDADDR(v, addr) { \ | 627 | #define ADDADDR(v, addr) { \ | |
621 | (v)->sin6_family = AF_INET6; \ | 628 | (v)->sin6_family = AF_INET6; \ | |
622 | (v)->sin6_len = sizeof(*v); \ | 629 | (v)->sin6_len = sizeof(*v); \ | |
623 | (v)->sin6_addr = *addr; \ | 630 | (v)->sin6_addr = *addr; \ | |
624 | } | 631 | } | |
625 | 632 | |||
626 | ADDADDR(&ifa.ifra_addr, &a->addr); | 633 | ADDADDR(&ifa.ifra_addr, &a->addr); | |
627 | ifa_scope(&ifa.ifra_addr, a->iface->index); | 634 | ifa_scope(&ifa.ifra_addr, a->iface->index); | |
628 | ipv6_mask(&mask, a->prefix_len); | 635 | ipv6_mask(&mask, a->prefix_len); | |
629 | ADDADDR(&ifa.ifra_prefixmask, &mask); | 636 | ADDADDR(&ifa.ifra_prefixmask, &mask); | |
630 | ifa.ifra_lifetime.ia6t_vltime = a->prefix_vltime; | 637 | ifa.ifra_lifetime.ia6t_vltime = a->prefix_vltime; | |
631 | ifa.ifra_lifetime.ia6t_pltime = a->prefix_pltime; | 638 | ifa.ifra_lifetime.ia6t_pltime = a->prefix_pltime; | |
@@ -775,48 +782,93 @@ if_addrflags6(const struct in6_addr *add | @@ -775,48 +782,93 @@ if_addrflags6(const struct in6_addr *add | |||
775 | flags = -1; | 782 | flags = -1; | |
776 | if (s != -1) { | 783 | if (s != -1) { | |
777 | memset(&ifr6, 0, sizeof(ifr6)); | 784 | memset(&ifr6, 0, sizeof(ifr6)); | |
778 | strncpy(ifr6.ifr_name, ifp->name, sizeof(ifr6.ifr_name)); | 785 | strncpy(ifr6.ifr_name, ifp->name, sizeof(ifr6.ifr_name)); | |
779 | ifr6.ifr_addr.sin6_family = AF_INET6; | 786 | ifr6.ifr_addr.sin6_family = AF_INET6; | |
780 | ifr6.ifr_addr.sin6_addr = *addr; | 787 | ifr6.ifr_addr.sin6_addr = *addr; | |
781 | ifa_scope(&ifr6.ifr_addr, ifp->index); | 788 | ifa_scope(&ifr6.ifr_addr, ifp->index); | |
782 | if (ioctl(s, SIOCGIFAFLAG_IN6, &ifr6) != -1) | 789 | if (ioctl(s, SIOCGIFAFLAG_IN6, &ifr6) != -1) | |
783 | flags = ifr6.ifr_ifru.ifru_flags6; | 790 | flags = ifr6.ifr_ifru.ifru_flags6; | |
784 | close(s); | 791 | close(s); | |
785 | } | 792 | } | |
786 | return flags; | 793 | return flags; | |
787 | } | 794 | } | |
795 | ||||
796 | int | |||
797 | if_getlifetime6(struct ipv6_addr *ia) | |||
798 | { | |||
799 | int s, r; | |||
800 | struct in6_ifreq ifr6; | |||
801 | ||||
802 | s = socket(PF_INET6, SOCK_DGRAM, 0); | |||
803 | r = -1; | |||
804 | if (s != -1) { | |||
805 | memset(&ifr6, 0, sizeof(ifr6)); | |||
806 | strncpy(ifr6.ifr_name, ia->iface->name, sizeof(ifr6.ifr_name)); | |||
807 | ifr6.ifr_addr.sin6_family = AF_INET6; | |||
808 | ifr6.ifr_addr.sin6_addr = ia->addr; | |||
809 | ifa_scope(&ifr6.ifr_addr, ia->iface->index); | |||
810 | if (ioctl(s, SIOCGIFALIFETIME_IN6, &ifr6) != -1) { | |||
811 | time_t t; | |||
812 | struct in6_addrlifetime *lifetime; | |||
813 | ||||
814 | t = time(NULL); | |||
815 | lifetime = &ifr6.ifr_ifru.ifru_lifetime; | |||
816 | ||||
817 | if (lifetime->ia6t_preferred) | |||
818 | ia->prefix_pltime = | |||
819 | (uint32_t)(lifetime->ia6t_preferred - | |||
820 | MIN(t, lifetime->ia6t_preferred)); | |||
821 | else | |||
822 | ia->prefix_pltime = ND6_INFINITE_LIFETIME; | |||
823 | if (lifetime->ia6t_expire) { | |||
824 | ia->prefix_vltime = | |||
825 | (uint32_t)(lifetime->ia6t_expire - | |||
826 | MIN(t, lifetime->ia6t_expire)); | |||
827 | /* Calculate the created time */ | |||
828 | get_monotonic(&ia->created); | |||
829 | ia->created.tv_sec -= | |||
830 | lifetime->ia6t_vltime - ia->prefix_vltime; | |||
831 | } else | |||
832 | ia->prefix_vltime = ND6_INFINITE_LIFETIME; | |||
833 | ||||
834 | r = 0; | |||
835 | } | |||
836 | close(s); | |||
837 | } | |||
838 | return r; | |||
839 | } | |||
788 | #endif | 840 | #endif | |
789 | 841 | |||
790 | int | 842 | int | |
791 | if_managelink(struct dhcpcd_ctx *ctx) | 843 | if_managelink(struct dhcpcd_ctx *ctx) | |
792 | { | 844 | { | |
793 | /* route and ifwatchd like a msg buf size of 2048 */ | 845 | /* route and ifwatchd like a msg buf size of 2048 */ | |
794 | char msg[2048], *p, *e, *cp; | 846 | char msg[2048], *p, *e, *cp; | |
795 | ssize_t bytes; | 847 | ssize_t bytes; | |
796 | struct rt_msghdr *rtm; | 848 | struct rt_msghdr *rtm; | |
797 | struct if_announcemsghdr *ifan; | 849 | struct if_announcemsghdr *ifan; | |
798 | struct if_msghdr *ifm; | 850 | struct if_msghdr *ifm; | |
799 | struct ifa_msghdr *ifam; | 851 | struct ifa_msghdr *ifam; | |
800 | struct sockaddr *sa, *rti_info[RTAX_MAX]; | 852 | struct sockaddr *sa, *rti_info[RTAX_MAX]; | |
801 | int len; | 853 | int len; | |
802 | struct sockaddr_dl sdl; | 854 | struct sockaddr_dl sdl; | |
803 | struct interface *ifp; | 855 | struct interface *ifp; | |
804 | #ifdef INET | 856 | #ifdef INET | |
805 | struct rt rt; | 857 | struct rt rt; | |
806 | #endif | 858 | #endif | |
807 | #ifdef INET6 | 859 | #ifdef INET6 | |
808 | struct rt6 rt6; | 860 | struct rt6 rt6; | |
809 | struct in6_addr ia6; | 861 | struct in6_addr ia6, net6; | |
810 | struct sockaddr_in6 *sin6; | 862 | struct sockaddr_in6 *sin6; | |
811 | int ifa_flags; | 863 | int ifa_flags; | |
812 | #endif | 864 | #endif | |
813 | 865 | |||
814 | bytes = read(ctx->link_fd, msg, sizeof(msg)); | 866 | bytes = read(ctx->link_fd, msg, sizeof(msg)); | |
815 | if (bytes == -1) | 867 | if (bytes == -1) | |
816 | return -1; | 868 | return -1; | |
817 | if (bytes == 0) | 869 | if (bytes == 0) | |
818 | return 0; | 870 | return 0; | |
819 | e = msg + bytes; | 871 | e = msg + bytes; | |
820 | for (p = msg; p < e; p += rtm->rtm_msglen) { | 872 | for (p = msg; p < e; p += rtm->rtm_msglen) { | |
821 | rtm = (struct rt_msghdr *)(void *)p; | 873 | rtm = (struct rt_msghdr *)(void *)p; | |
822 | // Ignore messages generated by us | 874 | // Ignore messages generated by us | |
@@ -962,34 +1014,39 @@ if_managelink(struct dhcpcd_ctx *ctx) | @@ -962,34 +1014,39 @@ if_managelink(struct dhcpcd_ctx *ctx) | |||
962 | COPYOUT(rt.net, rti_info[RTAX_NETMASK]); | 1014 | COPYOUT(rt.net, rti_info[RTAX_NETMASK]); | |
963 | COPYOUT(rt.gate, rti_info[RTAX_BRD]); | 1015 | COPYOUT(rt.gate, rti_info[RTAX_BRD]); | |
964 | ipv4_handleifa(ctx, rtm->rtm_type, | 1016 | ipv4_handleifa(ctx, rtm->rtm_type, | |
965 | NULL, ifp->name, | 1017 | NULL, ifp->name, | |
966 | &rt.dest, &rt.net, &rt.gate); | 1018 | &rt.dest, &rt.net, &rt.gate); | |
967 | break; | 1019 | break; | |
968 | #endif | 1020 | #endif | |
969 | #ifdef INET6 | 1021 | #ifdef INET6 | |
970 | case AF_INET6: | 1022 | case AF_INET6: | |
971 | sin6 = (struct sockaddr_in6*)(void *) | 1023 | sin6 = (struct sockaddr_in6*)(void *) | |
972 | rti_info[RTAX_IFA]; | 1024 | rti_info[RTAX_IFA]; | |
973 | ia6 = sin6->sin6_addr; | 1025 | ia6 = sin6->sin6_addr; | |
974 | DESCOPE(&ia6); | 1026 | DESCOPE(&ia6); | |
1027 | sin6 = (struct sockaddr_in6*)(void *) | |||
1028 | rti_info[RTAX_NETMASK]; | |||
1029 | net6 = sin6->sin6_addr; | |||
1030 | DESCOPE(&net6); | |||
975 | if (rtm->rtm_type == RTM_NEWADDR) { | 1031 | if (rtm->rtm_type == RTM_NEWADDR) { | |
976 | ifa_flags = if_addrflags6(&ia6, ifp); | 1032 | ifa_flags = if_addrflags6(&ia6, ifp); | |
977 | if (ifa_flags == -1) | 1033 | if (ifa_flags == -1) | |
978 | break; | 1034 | break; | |
979 | } else | 1035 | } else | |
980 | ifa_flags = 0; | 1036 | ifa_flags = 0; | |
981 | ipv6_handleifa(ctx, rtm->rtm_type, NULL, | 1037 | ipv6_handleifa(ctx, rtm->rtm_type, NULL, | |
982 | ifp->name, &ia6, ifa_flags); | 1038 | ifp->name, &ia6, ipv6_prefixlen(&net6), | |
1039 | ifa_flags); | |||
983 | break; | 1040 | break; | |
984 | #endif | 1041 | #endif | |
985 | } | 1042 | } | |
986 | break; | 1043 | break; | |
987 | } | 1044 | } | |
988 | } | 1045 | } | |
989 | 1046 | |||
990 | return 0; | 1047 | return 0; | |
991 | } | 1048 | } | |
992 | 1049 | |||
993 | #ifndef SYS_NMLN /* OSX */ | 1050 | #ifndef SYS_NMLN /* OSX */ | |
994 | # define SYS_NMLN 256 | 1051 | # define SYS_NMLN 256 | |
995 | #endif | 1052 | #endif | |
@@ -1025,26 +1082,85 @@ inet6_sysctl(int code, int val, int acti | @@ -1025,26 +1082,85 @@ inet6_sysctl(int code, int val, int acti | |||
1025 | size = sizeof(val); | 1082 | size = sizeof(val); | |
1026 | if (action) { | 1083 | if (action) { | |
1027 | if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), | 1084 | if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), | |
1028 | NULL, 0, &val, size) == -1) | 1085 | NULL, 0, &val, size) == -1) | |
1029 | return -1; | 1086 | return -1; | |
1030 | return 0; | 1087 | return 0; | |
1031 | } | 1088 | } | |
1032 | if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &val, &size, NULL, 0) == -1) | 1089 | if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &val, &size, NULL, 0) == -1) | |
1033 | return -1; | 1090 | return -1; | |
1034 | return val; | 1091 | return val; | |
1035 | } | 1092 | } | |
1036 | #endif | 1093 | #endif | |
1037 | 1094 | |||
1095 | #ifndef IPV6CTL_TEMPVLTIME | |||
1096 | #define get_inet6_sysctlbyname(code) inet6_sysctlbyname(code, 0, 0) | |||
1097 | #define set_inet6_sysctlbyname(code, val) inet6_sysctlbyname(code, val, 1) | |||
1098 | static int | |||
1099 | inet6_sysctlbyname(const char *name, int val, int action) | |||
1100 | { | |||
1101 | size_t size; | |||
1102 | ||||
1103 | size = sizeof(val); | |||
1104 | if (action) { | |||
1105 | if (sysctlbyname(name, NULL, 0, &val, size) == -1) | |||
1106 | return -1; | |||
1107 | return 0; | |||
1108 | } | |||
1109 | if (sysctlbyname(name, &val, &size, NULL, 0) == -1) | |||
1110 | return -1; | |||
1111 | return val; | |||
1112 | } | |||
1113 | #endif | |||
1114 | ||||
1115 | int | |||
1116 | ip6_use_tempaddr(__unused const char *ifname) | |||
1117 | { | |||
1118 | int val; | |||
1119 | ||||
1120 | #ifdef IPV6CTL_USETEMPADDR | |||
1121 | val = get_inet6_sysctl(IPV6CTL_USETEMPADDR); | |||
1122 | #else | |||
1123 | val = get_inet6_sysctlbyname("net.inet6.ip6.use_tempaddr"); | |||
1124 | #endif | |||
1125 | return val == -1 ? TEMP_PREFERRED_LIFETIME : val; | |||
1126 | } | |||
1127 | ||||
1128 | int | |||
1129 | ip6_temp_preferred_lifetime(__unused const char *ifname) | |||
1130 | { | |||
1131 | int val; | |||
1132 | ||||
1133 | #ifdef IPV6CTL_TEMPPLTIME | |||
1134 | val = get_inet6_sysctl(IPV6CTL_TEMPPLTIME); | |||
1135 | #else | |||
1136 | val = get_inet6_sysctlbyname("net.inet6.ip6.temppltime"); | |||
1137 | #endif | |||
1138 | return val < 0 ? TEMP_PREFERRED_LIFETIME : val; | |||
1139 | } | |||
1140 | ||||
1141 | int | |||
1142 | ip6_temp_valid_lifetime(__unused const char *ifname) | |||
1143 | { | |||
1144 | int val; | |||
1145 | ||||
1146 | #ifdef IPV6CTL_TEMPVLTIME | |||
1147 | val = get_inet6_sysctl(IPV6CTL_TEMPVLTIME); | |||
1148 | #else | |||
1149 | val = get_inet6_sysctlbyname("net.inet6.ip6.tempvltime"); | |||
1150 | #endif | |||
1151 | return val < 0 ? TEMP_VALID_LIFETIME : val; | |||
1152 | } | |||
1153 | ||||
1038 | #define del_if_nd6_flag(ifname, flag) if_nd6_flag(ifname, flag, -1) | 1154 | #define del_if_nd6_flag(ifname, flag) if_nd6_flag(ifname, flag, -1) | |
1039 | #define get_if_nd6_flag(ifname, flag) if_nd6_flag(ifname, flag, 0) | 1155 | #define get_if_nd6_flag(ifname, flag) if_nd6_flag(ifname, flag, 0) | |
1040 | #define set_if_nd6_flag(ifname, flag) if_nd6_flag(ifname, flag, 1) | 1156 | #define set_if_nd6_flag(ifname, flag) if_nd6_flag(ifname, flag, 1) | |
1041 | static int | 1157 | static int | |
1042 | if_nd6_flag(const char *ifname, unsigned int flag, int set) | 1158 | if_nd6_flag(const char *ifname, unsigned int flag, int set) | |
1043 | { | 1159 | { | |
1044 | int s, error; | 1160 | int s, error; | |
1045 | struct in6_ndireq nd; | 1161 | struct in6_ndireq nd; | |
1046 | unsigned int oflags; | 1162 | unsigned int oflags; | |
1047 | 1163 | |||
1048 | if ((s = socket(PF_INET6, SOCK_DGRAM, 0)) == -1) | 1164 | if ((s = socket(PF_INET6, SOCK_DGRAM, 0)) == -1) | |
1049 | return -1; | 1165 | return -1; | |
1050 | memset(&nd, 0, sizeof(nd)); | 1166 | memset(&nd, 0, sizeof(nd)); | |
@@ -1176,63 +1292,63 @@ if_checkipv6(struct dhcpcd_ctx *ctx, con | @@ -1176,63 +1292,63 @@ if_checkipv6(struct dhcpcd_ctx *ctx, con | |||
1176 | } | 1292 | } | |
1177 | #endif | 1293 | #endif | |
1178 | 1294 | |||
1179 | #ifdef SIOCGIFXFLAGS | 1295 | #ifdef SIOCGIFXFLAGS | |
1180 | set_ifxflags(ifp, own); | 1296 | set_ifxflags(ifp, own); | |
1181 | #endif | 1297 | #endif | |
1182 | 1298 | |||
1183 | #ifdef ND6_IFF_OVERRIDE_RTADV | 1299 | #ifdef ND6_IFF_OVERRIDE_RTADV | |
1184 | override = get_if_nd6_flag(ifp->name, ND6_IFF_OVERRIDE_RTADV); | 1300 | override = get_if_nd6_flag(ifp->name, ND6_IFF_OVERRIDE_RTADV); | |
1185 | if (override == -1) | 1301 | if (override == -1) | |
1186 | syslog(LOG_ERR, | 1302 | syslog(LOG_ERR, | |
1187 | "%s: get_if_nd6_flag: ND6_IFF_OVERRIDE_RTADV: %m", | 1303 | "%s: get_if_nd6_flag: ND6_IFF_OVERRIDE_RTADV: %m", | |
1188 | ifp->name); | 1304 | ifp->name); | |
1189 | else if (override == 0 && !own) | 1305 | else if (override == 0 && own) { | |
1190 | return 0; | 1306 | if (set_if_nd6_flag(ifp->name, ND6_IFF_OVERRIDE_RTADV) | |
1307 | == -1) | |||
1308 | syslog(LOG_ERR, | |||
1309 | "%s: set_if_nd6_flag: " | |||
1310 | "ND6_IFF_OVERRIDE_RTADV: %m", | |||
1311 | ifp->name); | |||
1312 | else | |||
1313 | override = 1; | |||
1314 | } | |||
1191 | #endif | 1315 | #endif | |
1192 | 1316 | |||
1193 | #ifdef ND6_IFF_ACCEPT_RTADV | 1317 | #ifdef ND6_IFF_ACCEPT_RTADV | |
1194 | ra = get_if_nd6_flag(ifp->name, ND6_IFF_ACCEPT_RTADV); | 1318 | ra = get_if_nd6_flag(ifp->name, ND6_IFF_ACCEPT_RTADV); | |
1195 | if (ra == -1) | 1319 | if (ra == -1) | |
1196 | syslog(LOG_ERR, | 1320 | syslog(LOG_ERR, | |
1197 | "%s: get_if_nd6_flag: ND6_IFF_ACCEPT_RTADV: %m", | 1321 | "%s: get_if_nd6_flag: ND6_IFF_ACCEPT_RTADV: %m", | |
1198 | ifp->name); | 1322 | ifp->name); | |
1199 | else if (ra != 0 && own) { | 1323 | else if (ra != 0 && own) { | |
1200 | syslog(LOG_DEBUG, | 1324 | syslog(LOG_DEBUG, | |
1201 | "%s: disabling Kernel IPv6 RA support", | 1325 | "%s: disabling Kernel IPv6 RA support", | |
1202 | ifp->name); | 1326 | ifp->name); | |
1203 | if (del_if_nd6_flag(ifp->name, ND6_IFF_ACCEPT_RTADV) | 1327 | if (del_if_nd6_flag(ifp->name, ND6_IFF_ACCEPT_RTADV) | |
1204 | == -1) | 1328 | == -1) | |
1205 | { | |||
1206 | syslog(LOG_ERR, | 1329 | syslog(LOG_ERR, | |
1207 | "%s: del_if_nd6_flag: " | 1330 | "%s: del_if_nd6_flag: " | |
1208 | "ND6_IFF_ACCEPT_RTADV: %m", | 1331 | "ND6_IFF_ACCEPT_RTADV: %m", | |
1209 | ifp->name); | 1332 | ifp->name); | |
1210 | return ra; | 1333 | else | |
1211 | } | 1334 | ra = 0; | |
1335 | } else if (ra == 0 && !own) | |||
1336 | syslog(LOG_WARNING, | |||
1337 | "%s: IPv6 kernel autoconf disabled", ifp->name); | |||
1212 | #ifdef ND6_IFF_OVERRIDE_RTADV | 1338 | #ifdef ND6_IFF_OVERRIDE_RTADV | |
1213 | if (override == 0 && | 1339 | if (override == 0 && ra) | |
1214 | set_if_nd6_flag(ifp->name, ND6_IFF_OVERRIDE_RTADV) | 1340 | return ctx->ra_global; | |
1215 | == -1) | |||
1216 | { | |||
1217 | syslog(LOG_ERR, | |||
1218 | "%s: set_if_nd6_flag: " | |||
1219 | "ND6_IFF_OVERRIDE_RTADV: %m", | |||
1220 | ifp->name); | |||
1221 | return ra; | |||
1222 | } | |||
1223 | #endif | 1341 | #endif | |
1224 | return 0; | |||
1225 | } | |||
1226 | return ra; | 1342 | return ra; | |
1227 | #else | 1343 | #else | |
1228 | return ctx->ra_global; | 1344 | return ctx->ra_global; | |
1229 | #endif | 1345 | #endif | |
1230 | } | 1346 | } | |
1231 | 1347 | |||
1232 | #ifdef IPV6CTL_ACCEPT_RTADV | 1348 | #ifdef IPV6CTL_ACCEPT_RTADV | |
1233 | ra = get_inet6_sysctl(IPV6CTL_ACCEPT_RTADV); | 1349 | ra = get_inet6_sysctl(IPV6CTL_ACCEPT_RTADV); | |
1234 | if (ra == -1) | 1350 | if (ra == -1) | |
1235 | /* The sysctl probably doesn't exist, but this isn't an | 1351 | /* The sysctl probably doesn't exist, but this isn't an | |
1236 | * error as such so just log it and continue */ | 1352 | * error as such so just log it and continue */ | |
1237 | syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, | 1353 | syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, | |
1238 | "IPV6CTL_ACCEPT_RTADV: %m"); | 1354 | "IPV6CTL_ACCEPT_RTADV: %m"); |
--- src/external/bsd/dhcpcd/dist/Attic/script.c 2014/12/29 16:18:05 1.7.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/script.c 2015/02/05 15:13:12 1.7.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: script.c,v 1.7.2.1 2014/12/29 16:18:05 martin Exp $"); | 2 | __RCSID("$NetBSD: script.c,v 1.7.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -222,27 +222,29 @@ arraytostr(const char *const *argv, char | @@ -222,27 +222,29 @@ arraytostr(const char *const *argv, char | |||
222 | l = strlen(*ap) + 1; | 222 | l = strlen(*ap) + 1; | |
223 | memcpy(p, *ap, l); | 223 | memcpy(p, *ap, l); | |
224 | p += l; | 224 | p += l; | |
225 | ap++; | 225 | ap++; | |
226 | } | 226 | } | |
227 | return (ssize_t)len; | 227 | return (ssize_t)len; | |
228 | } | 228 | } | |
229 | 229 | |||
230 | static ssize_t | 230 | static ssize_t | |
231 | make_env(const struct interface *ifp, const char *reason, char ***argv) | 231 | make_env(const struct interface *ifp, const char *reason, char ***argv) | |
232 | { | 232 | { | |
233 | char **env, **nenv, *p; | 233 | char **env, **nenv, *p; | |
234 | size_t e, elen, l; | 234 | size_t e, elen, l; | |
235 | #if defined(INET) || defined(INET6) | |||
235 | ssize_t n; | 236 | ssize_t n; | |
237 | #endif | |||
236 | const struct if_options *ifo = ifp->options; | 238 | const struct if_options *ifo = ifp->options; | |
237 | const struct interface *ifp2; | 239 | const struct interface *ifp2; | |
238 | #ifdef INET | 240 | #ifdef INET | |
239 | int dhcp; | 241 | int dhcp; | |
240 | const struct dhcp_state *state; | 242 | const struct dhcp_state *state; | |
241 | #endif | 243 | #endif | |
242 | #ifdef INET6 | 244 | #ifdef INET6 | |
243 | const struct dhcp6_state *d6_state; | 245 | const struct dhcp6_state *d6_state; | |
244 | int dhcp6, ra; | 246 | int dhcp6, ra; | |
245 | #endif | 247 | #endif | |
246 | 248 | |||
247 | #ifdef INET | 249 | #ifdef INET | |
248 | dhcp = 0; | 250 | dhcp = 0; | |
@@ -267,27 +269,29 @@ make_env(const struct interface *ifp, co | @@ -267,27 +269,29 @@ make_env(const struct interface *ifp, co | |||
267 | } | 269 | } | |
268 | #ifdef INET6 | 270 | #ifdef INET6 | |
269 | else if (reason[strlen(reason) - 1] == '6') | 271 | else if (reason[strlen(reason) - 1] == '6') | |
270 | dhcp6 = 1; | 272 | dhcp6 = 1; | |
271 | else if (strcmp(reason, "ROUTERADVERT") == 0) | 273 | else if (strcmp(reason, "ROUTERADVERT") == 0) | |
272 | ra = 1; | 274 | ra = 1; | |
273 | #endif | 275 | #endif | |
274 | else if (strcmp(reason, "PREINIT") == 0 || | 276 | else if (strcmp(reason, "PREINIT") == 0 || | |
275 | strcmp(reason, "CARRIER") == 0 || | 277 | strcmp(reason, "CARRIER") == 0 || | |
276 | strcmp(reason, "NOCARRIER") == 0 || | 278 | strcmp(reason, "NOCARRIER") == 0 || | |
277 | strcmp(reason, "UNKNOWN") == 0 || | 279 | strcmp(reason, "UNKNOWN") == 0 || | |
278 | strcmp(reason, "DEPARTED") == 0 || | 280 | strcmp(reason, "DEPARTED") == 0 || | |
279 | strcmp(reason, "STOPPED") == 0) | 281 | strcmp(reason, "STOPPED") == 0) | |
280 | ; | 282 | { | |
283 | /* This space left intentionally blank */ | |||
284 | } | |||
281 | #ifdef INET | 285 | #ifdef INET | |
282 | else | 286 | else | |
283 | dhcp = 1; | 287 | dhcp = 1; | |
284 | #endif | 288 | #endif | |
285 | 289 | |||
286 | /* When dumping the lease, we only want to report interface and | 290 | /* When dumping the lease, we only want to report interface and | |
287 | reason - the other interface variables are meaningless */ | 291 | reason - the other interface variables are meaningless */ | |
288 | if (ifp->ctx->options & DHCPCD_DUMPLEASE) | 292 | if (ifp->ctx->options & DHCPCD_DUMPLEASE) | |
289 | elen = 2; | 293 | elen = 2; | |
290 | else | 294 | else | |
291 | elen = 13; | 295 | elen = 13; | |
292 | 296 | |||
293 | #define EMALLOC(i, l) if ((env[(i)] = malloc((l))) == NULL) goto eexit; | 297 | #define EMALLOC(i, l) if ((env[(i)] = malloc((l))) == NULL) goto eexit; |
--- src/external/bsd/dhcpcd/dist/Attic/if-options.c 2014/12/29 16:18:05 1.11.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/if-options.c 2015/02/05 15:13:12 1.11.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: if-options.c,v 1.11.2.1 2014/12/29 16:18:05 martin Exp $"); | 2 | __RCSID("$NetBSD: if-options.c,v 1.11.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -86,26 +86,29 @@ | @@ -86,26 +86,29 @@ | |||
86 | #define O_AUTHPROTOCOL O_BASE + 25 | 86 | #define O_AUTHPROTOCOL O_BASE + 25 | |
87 | #define O_AUTHTOKEN O_BASE + 26 | 87 | #define O_AUTHTOKEN O_BASE + 26 | |
88 | #define O_AUTHNOTREQUIRED O_BASE + 27 | 88 | #define O_AUTHNOTREQUIRED O_BASE + 27 | |
89 | #define O_NODHCP O_BASE + 28 | 89 | #define O_NODHCP O_BASE + 28 | |
90 | #define O_NODHCP6 O_BASE + 29 | 90 | #define O_NODHCP6 O_BASE + 29 | |
91 | #define O_DHCP O_BASE + 30 | 91 | #define O_DHCP O_BASE + 30 | |
92 | #define O_DHCP6 O_BASE + 31 | 92 | #define O_DHCP6 O_BASE + 31 | |
93 | #define O_IPV4 O_BASE + 32 | 93 | #define O_IPV4 O_BASE + 32 | |
94 | #define O_IPV6 O_BASE + 33 | 94 | #define O_IPV6 O_BASE + 33 | |
95 | #define O_CONTROLGRP O_BASE + 34 | 95 | #define O_CONTROLGRP O_BASE + 34 | |
96 | #define O_SLAAC O_BASE + 35 | 96 | #define O_SLAAC O_BASE + 35 | |
97 | #define O_GATEWAY O_BASE + 36 | 97 | #define O_GATEWAY O_BASE + 36 | |
98 | #define O_PFXDLGMIX O_BASE + 37 | 98 | #define O_PFXDLGMIX O_BASE + 37 | |
99 | #define O_IPV6RA_AUTOCONF O_BASE + 38 | |||
100 | #define O_IPV6RA_NOAUTOCONF O_BASE + 39 | |||
101 | #define O_REJECT O_BASE + 40 | |||
99 | 102 | |||
100 | const struct option cf_options[] = { | 103 | const struct option cf_options[] = { | |
101 | {"background", no_argument, NULL, 'b'}, | 104 | {"background", no_argument, NULL, 'b'}, | |
102 | {"script", required_argument, NULL, 'c'}, | 105 | {"script", required_argument, NULL, 'c'}, | |
103 | {"debug", no_argument, NULL, 'd'}, | 106 | {"debug", no_argument, NULL, 'd'}, | |
104 | {"env", required_argument, NULL, 'e'}, | 107 | {"env", required_argument, NULL, 'e'}, | |
105 | {"config", required_argument, NULL, 'f'}, | 108 | {"config", required_argument, NULL, 'f'}, | |
106 | {"reconfigure", no_argument, NULL, 'g'}, | 109 | {"reconfigure", no_argument, NULL, 'g'}, | |
107 | {"hostname", optional_argument, NULL, 'h'}, | 110 | {"hostname", optional_argument, NULL, 'h'}, | |
108 | {"vendorclassid", optional_argument, NULL, 'i'}, | 111 | {"vendorclassid", optional_argument, NULL, 'i'}, | |
109 | {"release", no_argument, NULL, 'k'}, | 112 | {"release", no_argument, NULL, 'k'}, | |
110 | {"leasetime", required_argument, NULL, 'l'}, | 113 | {"leasetime", required_argument, NULL, 'l'}, | |
111 | {"metric", required_argument, NULL, 'm'}, | 114 | {"metric", required_argument, NULL, 'm'}, | |
@@ -139,26 +142,28 @@ const struct option cf_options[] = { | @@ -139,26 +142,28 @@ const struct option cf_options[] = { | |||
139 | {"require", required_argument, NULL, 'Q'}, | 142 | {"require", required_argument, NULL, 'Q'}, | |
140 | {"static", required_argument, NULL, 'S'}, | 143 | {"static", required_argument, NULL, 'S'}, | |
141 | {"test", no_argument, NULL, 'T'}, | 144 | {"test", no_argument, NULL, 'T'}, | |
142 | {"dumplease", no_argument, NULL, 'U'}, | 145 | {"dumplease", no_argument, NULL, 'U'}, | |
143 | {"variables", no_argument, NULL, 'V'}, | 146 | {"variables", no_argument, NULL, 'V'}, | |
144 | {"whitelist", required_argument, NULL, 'W'}, | 147 | {"whitelist", required_argument, NULL, 'W'}, | |
145 | {"blacklist", required_argument, NULL, 'X'}, | 148 | {"blacklist", required_argument, NULL, 'X'}, | |
146 | {"denyinterfaces", required_argument, NULL, 'Z'}, | 149 | {"denyinterfaces", required_argument, NULL, 'Z'}, | |
147 | {"arping", required_argument, NULL, O_ARPING}, | 150 | {"arping", required_argument, NULL, O_ARPING}, | |
148 | {"destination", required_argument, NULL, O_DESTINATION}, | 151 | {"destination", required_argument, NULL, O_DESTINATION}, | |
149 | {"fallback", required_argument, NULL, O_FALLBACK}, | 152 | {"fallback", required_argument, NULL, O_FALLBACK}, | |
150 | {"ipv6rs", no_argument, NULL, O_IPV6RS}, | 153 | {"ipv6rs", no_argument, NULL, O_IPV6RS}, | |
151 | {"noipv6rs", no_argument, NULL, O_NOIPV6RS}, | 154 | {"noipv6rs", no_argument, NULL, O_NOIPV6RS}, | |
155 | {"ipv6ra_autoconf", no_argument, NULL, O_IPV6RA_AUTOCONF}, | |||
156 | {"ipv6ra_noautoconf", no_argument, NULL, O_IPV6RA_NOAUTOCONF}, | |||
152 | {"ipv6ra_fork", no_argument, NULL, O_IPV6RA_FORK}, | 157 | {"ipv6ra_fork", no_argument, NULL, O_IPV6RA_FORK}, | |
153 | {"ipv6ra_own", no_argument, NULL, O_IPV6RA_OWN}, | 158 | {"ipv6ra_own", no_argument, NULL, O_IPV6RA_OWN}, | |
154 | {"ipv6ra_own_default", no_argument, NULL, O_IPV6RA_OWN_D}, | 159 | {"ipv6ra_own_default", no_argument, NULL, O_IPV6RA_OWN_D}, | |
155 | {"ipv4only", no_argument, NULL, '4'}, | 160 | {"ipv4only", no_argument, NULL, '4'}, | |
156 | {"ipv6only", no_argument, NULL, '6'}, | 161 | {"ipv6only", no_argument, NULL, '6'}, | |
157 | {"ipv4", no_argument, NULL, O_IPV4}, | 162 | {"ipv4", no_argument, NULL, O_IPV4}, | |
158 | {"noipv4", no_argument, NULL, O_NOIPV4}, | 163 | {"noipv4", no_argument, NULL, O_NOIPV4}, | |
159 | {"ipv6", no_argument, NULL, O_IPV6}, | 164 | {"ipv6", no_argument, NULL, O_IPV6}, | |
160 | {"noipv6", no_argument, NULL, O_NOIPV6}, | 165 | {"noipv6", no_argument, NULL, O_NOIPV6}, | |
161 | {"noalias", no_argument, NULL, O_NOALIAS}, | 166 | {"noalias", no_argument, NULL, O_NOALIAS}, | |
162 | {"iaid", required_argument, NULL, O_IAID}, | 167 | {"iaid", required_argument, NULL, O_IAID}, | |
163 | {"ia_na", no_argument, NULL, O_IA_NA}, | 168 | {"ia_na", no_argument, NULL, O_IA_NA}, | |
164 | {"ia_ta", no_argument, NULL, O_IA_TA}, | 169 | {"ia_ta", no_argument, NULL, O_IA_TA}, | |
@@ -173,26 +178,27 @@ const struct option cf_options[] = { | @@ -173,26 +178,27 @@ const struct option cf_options[] = { | |||
173 | {"vendopt", required_argument, NULL, O_VENDOPT}, | 178 | {"vendopt", required_argument, NULL, O_VENDOPT}, | |
174 | {"vendclass", required_argument, NULL, O_VENDCLASS}, | 179 | {"vendclass", required_argument, NULL, O_VENDCLASS}, | |
175 | {"authprotocol", required_argument, NULL, O_AUTHPROTOCOL}, | 180 | {"authprotocol", required_argument, NULL, O_AUTHPROTOCOL}, | |
176 | {"authtoken", required_argument, NULL, O_AUTHTOKEN}, | 181 | {"authtoken", required_argument, NULL, O_AUTHTOKEN}, | |
177 | {"noauthrequired", no_argument, NULL, O_AUTHNOTREQUIRED}, | 182 | {"noauthrequired", no_argument, NULL, O_AUTHNOTREQUIRED}, | |
178 | {"dhcp", no_argument, NULL, O_DHCP}, | 183 | {"dhcp", no_argument, NULL, O_DHCP}, | |
179 | {"nodhcp", no_argument, NULL, O_NODHCP}, | 184 | {"nodhcp", no_argument, NULL, O_NODHCP}, | |
180 | {"dhcp6", no_argument, NULL, O_DHCP6}, | 185 | {"dhcp6", no_argument, NULL, O_DHCP6}, | |
181 | {"nodhcp6", no_argument, NULL, O_NODHCP6}, | 186 | {"nodhcp6", no_argument, NULL, O_NODHCP6}, | |
182 | {"controlgroup", required_argument, NULL, O_CONTROLGRP}, | 187 | {"controlgroup", required_argument, NULL, O_CONTROLGRP}, | |
183 | {"slaac", required_argument, NULL, O_SLAAC}, | 188 | {"slaac", required_argument, NULL, O_SLAAC}, | |
184 | {"gateway", no_argument, NULL, O_GATEWAY}, | 189 | {"gateway", no_argument, NULL, O_GATEWAY}, | |
185 | {"ia_pd_mix", no_argument, NULL, O_PFXDLGMIX}, | 190 | {"ia_pd_mix", no_argument, NULL, O_PFXDLGMIX}, | |
191 | {"reject", required_argument, NULL, O_REJECT}, | |||
186 | {NULL, 0, NULL, '\0'} | 192 | {NULL, 0, NULL, '\0'} | |
187 | }; | 193 | }; | |
188 | 194 | |||
189 | static int | 195 | static int | |
190 | atoint(const char *s) | 196 | atoint(const char *s) | |
191 | { | 197 | { | |
192 | char *t; | 198 | char *t; | |
193 | long n; | 199 | long n; | |
194 | 200 | |||
195 | errno = 0; | 201 | errno = 0; | |
196 | n = strtol(s, &t, 0); | 202 | n = strtol(s, &t, 0); | |
197 | if ((errno != 0 && n == 0) || s == t || | 203 | if ((errno != 0 && n == 0) || s == t || | |
198 | (errno == ERANGE && (n == LONG_MAX || n == LONG_MIN))) | 204 | (errno == ERANGE && (n == LONG_MAX || n == LONG_MIN))) | |
@@ -516,56 +522,63 @@ parse_addr(__unused struct in_addr *addr | @@ -516,56 +522,63 @@ parse_addr(__unused struct in_addr *addr | |||
516 | { | 522 | { | |
517 | 523 | |||
518 | syslog(LOG_ERR, "No IPv4 support"); | 524 | syslog(LOG_ERR, "No IPv4 support"); | |
519 | return -1; | 525 | return -1; | |
520 | } | 526 | } | |
521 | #endif | 527 | #endif | |
522 | 528 | |||
523 | static const char * | 529 | static const char * | |
524 | set_option_space(struct dhcpcd_ctx *ctx, | 530 | set_option_space(struct dhcpcd_ctx *ctx, | |
525 | const char *arg, | 531 | const char *arg, | |
526 | const struct dhcp_opt **d, size_t *dl, | 532 | const struct dhcp_opt **d, size_t *dl, | |
527 | const struct dhcp_opt **od, size_t *odl, | 533 | const struct dhcp_opt **od, size_t *odl, | |
528 | struct if_options *ifo, | 534 | struct if_options *ifo, | |
529 | uint8_t *request[], uint8_t *require[], uint8_t *no[]) | 535 | uint8_t *request[], uint8_t *require[], uint8_t *no[], uint8_t *reject[]) | |
530 | { | 536 | { | |
531 | 537 | |||
538 | #if !defined(INET) && !defined(INET6) | |||
539 | /* Satisfy use */ | |||
540 | ctx = ctx; | |||
541 | #endif | |||
542 | ||||
532 | #ifdef INET6 | 543 | #ifdef INET6 | |
533 | if (strncmp(arg, "dhcp6_", strlen("dhcp6_")) == 0) { | 544 | if (strncmp(arg, "dhcp6_", strlen("dhcp6_")) == 0) { | |
534 | *d = ctx->dhcp6_opts; | 545 | *d = ctx->dhcp6_opts; | |
535 | *dl = ctx->dhcp6_opts_len; | 546 | *dl = ctx->dhcp6_opts_len; | |
536 | *od = ifo->dhcp6_override; | 547 | *od = ifo->dhcp6_override; | |
537 | *odl = ifo->dhcp6_override_len; | 548 | *odl = ifo->dhcp6_override_len; | |
538 | *request = ifo->requestmask6; | 549 | *request = ifo->requestmask6; | |
539 | *require = ifo->requiremask6; | 550 | *require = ifo->requiremask6; | |
540 | *no = ifo->nomask6; | 551 | *no = ifo->nomask6; | |
552 | *reject = ifo->rejectmask6; | |||
541 | return arg + strlen("dhcp6_"); | 553 | return arg + strlen("dhcp6_"); | |
542 | } | 554 | } | |
543 | #endif | 555 | #endif | |
544 | 556 | |||
545 | #ifdef INET | 557 | #ifdef INET | |
546 | *d = ctx->dhcp_opts; | 558 | *d = ctx->dhcp_opts; | |
547 | *dl = ctx->dhcp_opts_len; | 559 | *dl = ctx->dhcp_opts_len; | |
548 | *od = ifo->dhcp_override; | 560 | *od = ifo->dhcp_override; | |
549 | *odl = ifo->dhcp_override_len; | 561 | *odl = ifo->dhcp_override_len; | |
550 | #else | 562 | #else | |
551 | *d = NULL; | 563 | *d = NULL; | |
552 | *dl = 0; | 564 | *dl = 0; | |
553 | *od = NULL; | 565 | *od = NULL; | |
554 | *odl = 0; | 566 | *odl = 0; | |
555 | #endif | 567 | #endif | |
556 | *request = ifo->requestmask; | 568 | *request = ifo->requestmask; | |
557 | *require = ifo->requiremask; | 569 | *require = ifo->requiremask; | |
558 | *no = ifo->nomask; | 570 | *no = ifo->nomask; | |
571 | *reject = ifo->rejectmask; | |||
559 | return arg; | 572 | return arg; | |
560 | } | 573 | } | |
561 | 574 | |||
562 | void | 575 | void | |
563 | free_dhcp_opt_embenc(struct dhcp_opt *opt) | 576 | free_dhcp_opt_embenc(struct dhcp_opt *opt) | |
564 | { | 577 | { | |
565 | size_t i; | 578 | size_t i; | |
566 | struct dhcp_opt *o; | 579 | struct dhcp_opt *o; | |
567 | 580 | |||
568 | free(opt->var); | 581 | free(opt->var); | |
569 | 582 | |||
570 | for (i = 0, o = opt->embopts; i < opt->embopts_len; i++, o++) | 583 | for (i = 0, o = opt->embopts; i < opt->embopts_len; i++, o++) | |
571 | free_dhcp_opt_embenc(o); | 584 | free_dhcp_opt_embenc(o); | |
@@ -633,27 +646,27 @@ strend(const char *s) | @@ -633,27 +646,27 @@ strend(const char *s) | |||
633 | static int | 646 | static int | |
634 | parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, | 647 | parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, | |
635 | int opt, const char *arg, struct dhcp_opt **ldop, struct dhcp_opt **edop) | 648 | int opt, const char *arg, struct dhcp_opt **ldop, struct dhcp_opt **edop) | |
636 | { | 649 | { | |
637 | int i, t; | 650 | int i, t; | |
638 | long l; | 651 | long l; | |
639 | unsigned long u; | 652 | unsigned long u; | |
640 | char *p = NULL, *fp, *np, **nconf; | 653 | char *p = NULL, *fp, *np, **nconf; | |
641 | ssize_t s; | 654 | ssize_t s; | |
642 | struct in_addr addr, addr2; | 655 | struct in_addr addr, addr2; | |
643 | in_addr_t *naddr; | 656 | in_addr_t *naddr; | |
644 | struct rt *rt; | 657 | struct rt *rt; | |
645 | const struct dhcp_opt *d, *od; | 658 | const struct dhcp_opt *d, *od; | |
646 | uint8_t *request, *require, *no; | 659 | uint8_t *request, *require, *no, *reject; | |
647 | struct dhcp_opt **dop, *ndop; | 660 | struct dhcp_opt **dop, *ndop; | |
648 | size_t *dop_len, dl, odl; | 661 | size_t *dop_len, dl, odl; | |
649 | struct vivco *vivco; | 662 | struct vivco *vivco; | |
650 | struct token *token; | 663 | struct token *token; | |
651 | struct group *grp; | 664 | struct group *grp; | |
652 | #ifdef _REENTRANT | 665 | #ifdef _REENTRANT | |
653 | struct group grpbuf; | 666 | struct group grpbuf; | |
654 | #endif | 667 | #endif | |
655 | #ifdef INET6 | 668 | #ifdef INET6 | |
656 | size_t sl; | 669 | size_t sl; | |
657 | struct if_ia *ia; | 670 | struct if_ia *ia; | |
658 | uint8_t iaid[4]; | 671 | uint8_t iaid[4]; | |
659 | struct if_sla *sla, *slap; | 672 | struct if_sla *sla, *slap; | |
@@ -735,29 +748,41 @@ parse_option(struct dhcpcd_ctx *ctx, con | @@ -735,29 +748,41 @@ parse_option(struct dhcpcd_ctx *ctx, con | |||
735 | syslog(LOG_ERR, "`%s' out of range", arg); | 748 | syslog(LOG_ERR, "`%s' out of range", arg); | |
736 | return -1; | 749 | return -1; | |
737 | } | 750 | } | |
738 | break; | 751 | break; | |
739 | case 'm': | 752 | case 'm': | |
740 | ifo->metric = atoint(arg); | 753 | ifo->metric = atoint(arg); | |
741 | if (ifo->metric < 0) { | 754 | if (ifo->metric < 0) { | |
742 | syslog(LOG_ERR, "metric must be a positive value"); | 755 | syslog(LOG_ERR, "metric must be a positive value"); | |
743 | return -1; | 756 | return -1; | |
744 | } | 757 | } | |
745 | break; | 758 | break; | |
746 | case 'o': | 759 | case 'o': | |
747 | arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo, | 760 | arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo, | |
748 | &request, &require, &no); | 761 | &request, &require, &no, &reject); | |
749 | if (make_option_mask(d, dl, od, odl, request, arg, 1) != 0 || | 762 | if (make_option_mask(d, dl, od, odl, request, arg, 1) != 0 || | |
750 | make_option_mask(d, dl, od, odl, no, arg, -1) != 0) | 763 | make_option_mask(d, dl, od, odl, no, arg, -1) != 0 || | |
764 | make_option_mask(d, dl, od, odl, reject, arg, -1) != 0) | |||
765 | { | |||
766 | syslog(LOG_ERR, "unknown option `%s'", arg); | |||
767 | return -1; | |||
768 | } | |||
769 | break; | |||
770 | case O_REJECT: | |||
771 | arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo, | |||
772 | &request, &require, &no, &reject); | |||
773 | if (make_option_mask(d, dl, od, odl, reject, arg, 1) != 0 || | |||
774 | make_option_mask(d, dl, od, odl, request, arg, -1) != 0 || | |||
775 | make_option_mask(d, dl, od, odl, require, arg, -1) != 0) | |||
751 | { | 776 | { | |
752 | syslog(LOG_ERR, "unknown option `%s'", arg); | 777 | syslog(LOG_ERR, "unknown option `%s'", arg); | |
753 | return -1; | 778 | return -1; | |
754 | } | 779 | } | |
755 | break; | 780 | break; | |
756 | case 'p': | 781 | case 'p': | |
757 | ifo->options |= DHCPCD_PERSISTENT; | 782 | ifo->options |= DHCPCD_PERSISTENT; | |
758 | break; | 783 | break; | |
759 | case 'q': | 784 | case 'q': | |
760 | ifo->options |= DHCPCD_QUIET; | 785 | ifo->options |= DHCPCD_QUIET; | |
761 | break; | 786 | break; | |
762 | case 'r': | 787 | case 'r': | |
763 | if (parse_addr(&ifo->req_addr, NULL, arg) != 0) | 788 | if (parse_addr(&ifo->req_addr, NULL, arg) != 0) | |
@@ -954,41 +979,42 @@ parse_option(struct dhcpcd_ctx *ctx, con | @@ -954,41 +979,42 @@ parse_option(struct dhcpcd_ctx *ctx, con | |||
954 | ifo->options |= DHCPCD_BROADCAST; | 979 | ifo->options |= DHCPCD_BROADCAST; | |
955 | break; | 980 | break; | |
956 | case 'K': | 981 | case 'K': | |
957 | ifo->options &= ~DHCPCD_LINK; | 982 | ifo->options &= ~DHCPCD_LINK; | |
958 | break; | 983 | break; | |
959 | case 'L': | 984 | case 'L': | |
960 | ifo->options &= ~DHCPCD_IPV4LL; | 985 | ifo->options &= ~DHCPCD_IPV4LL; | |
961 | break; | 986 | break; | |
962 | case 'M': | 987 | case 'M': | |
963 | ifo->options |= DHCPCD_MASTER; | 988 | ifo->options |= DHCPCD_MASTER; | |
964 | break; | 989 | break; | |
965 | case 'O': | 990 | case 'O': | |
966 | arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo, | 991 | arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo, | |
967 | &request, &require, &no); | 992 | &request, &require, &no, &reject); | |
968 | if (make_option_mask(d, dl, od, odl, request, arg, -1) != 0 || | 993 | if (make_option_mask(d, dl, od, odl, request, arg, -1) != 0 || | |
969 | make_option_mask(d, dl, od, odl, require, arg, -1) != 0 || | 994 | make_option_mask(d, dl, od, odl, require, arg, -1) != 0 || | |
970 | make_option_mask(d, dl, od, odl, no, arg, 1) != 0) | 995 | make_option_mask(d, dl, od, odl, no, arg, 1) != 0) | |
971 | { | 996 | { | |
972 | syslog(LOG_ERR, "unknown option `%s'", arg); | 997 | syslog(LOG_ERR, "unknown option `%s'", arg); | |
973 | return -1; | 998 | return -1; | |
974 | } | 999 | } | |
975 | break; | 1000 | break; | |
976 | case 'Q': | 1001 | case 'Q': | |
977 | arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo, | 1002 | arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo, | |
978 | &request, &require, &no); | 1003 | &request, &require, &no, &reject); | |
979 | if (make_option_mask(d, dl, od, odl, require, arg, 1) != 0 || | 1004 | if (make_option_mask(d, dl, od, odl, require, arg, 1) != 0 || | |
980 | make_option_mask(d, dl, od, odl, request, arg, 1) != 0 || | 1005 | make_option_mask(d, dl, od, odl, request, arg, 1) != 0 || | |
981 | make_option_mask(d, dl, od, odl, no, arg, -1) != 0) | 1006 | make_option_mask(d, dl, od, odl, no, arg, -1) != 0 || | |
1007 | make_option_mask(d, dl, od, odl, reject, arg, -1) != 0) | |||
982 | { | 1008 | { | |
983 | syslog(LOG_ERR, "unknown option `%s'", arg); | 1009 | syslog(LOG_ERR, "unknown option `%s'", arg); | |
984 | return -1; | 1010 | return -1; | |
985 | } | 1011 | } | |
986 | break; | 1012 | break; | |
987 | case 'S': | 1013 | case 'S': | |
988 | p = strchr(arg, '='); | 1014 | p = strchr(arg, '='); | |
989 | if (p == NULL) { | 1015 | if (p == NULL) { | |
990 | syslog(LOG_ERR, "static assignment required"); | 1016 | syslog(LOG_ERR, "static assignment required"); | |
991 | return -1; | 1017 | return -1; | |
992 | } | 1018 | } | |
993 | p++; | 1019 | p++; | |
994 | if (strncmp(arg, "ip_address=", strlen("ip_address=")) == 0) { | 1020 | if (strncmp(arg, "ip_address=", strlen("ip_address=")) == 0) { | |
@@ -1158,27 +1184,27 @@ parse_option(struct dhcpcd_ctx *ctx, con | @@ -1158,27 +1184,27 @@ parse_option(struct dhcpcd_ctx *ctx, con | |||
1158 | naddr = realloc(ifo->arping, | 1184 | naddr = realloc(ifo->arping, | |
1159 | sizeof(in_addr_t) * (ifo->arping_len + 1)); | 1185 | sizeof(in_addr_t) * (ifo->arping_len + 1)); | |
1160 | if (naddr == NULL) { | 1186 | if (naddr == NULL) { | |
1161 | syslog(LOG_ERR, "%s: %m", __func__); | 1187 | syslog(LOG_ERR, "%s: %m", __func__); | |
1162 | return -1; | 1188 | return -1; | |
1163 | } | 1189 | } | |
1164 | ifo->arping = naddr; | 1190 | ifo->arping = naddr; | |
1165 | ifo->arping[ifo->arping_len++] = addr.s_addr; | 1191 | ifo->arping[ifo->arping_len++] = addr.s_addr; | |
1166 | arg = strskipwhite(fp); | 1192 | arg = strskipwhite(fp); | |
1167 | } | 1193 | } | |
1168 | break; | 1194 | break; | |
1169 | case O_DESTINATION: | 1195 | case O_DESTINATION: | |
1170 | arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo, | 1196 | arg = set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo, | |
1171 | &request, &require, &no); | 1197 | &request, &require, &no, &reject); | |
1172 | if (make_option_mask(d, dl, od, odl, | 1198 | if (make_option_mask(d, dl, od, odl, | |
1173 | ifo->dstmask, arg, 2) != 0) | 1199 | ifo->dstmask, arg, 2) != 0) | |
1174 | { | 1200 | { | |
1175 | if (errno == EINVAL) | 1201 | if (errno == EINVAL) | |
1176 | syslog(LOG_ERR, "option `%s' does not take" | 1202 | syslog(LOG_ERR, "option `%s' does not take" | |
1177 | " an IPv4 address", arg); | 1203 | " an IPv4 address", arg); | |
1178 | else | 1204 | else | |
1179 | syslog(LOG_ERR, "unknown option `%s'", arg); | 1205 | syslog(LOG_ERR, "unknown option `%s'", arg); | |
1180 | return -1; | 1206 | return -1; | |
1181 | } | 1207 | } | |
1182 | break; | 1208 | break; | |
1183 | case O_FALLBACK: | 1209 | case O_FALLBACK: | |
1184 | free(ifo->fallback); | 1210 | free(ifo->fallback); | |
@@ -1204,26 +1230,32 @@ parse_option(struct dhcpcd_ctx *ctx, con | @@ -1204,26 +1230,32 @@ parse_option(struct dhcpcd_ctx *ctx, con | |||
1204 | break; | 1230 | break; | |
1205 | case O_NOIPV6RS: | 1231 | case O_NOIPV6RS: | |
1206 | ifo->options &= ~DHCPCD_IPV6RS; | 1232 | ifo->options &= ~DHCPCD_IPV6RS; | |
1207 | break; | 1233 | break; | |
1208 | case O_IPV6RA_FORK: | 1234 | case O_IPV6RA_FORK: | |
1209 | ifo->options &= ~DHCPCD_IPV6RA_REQRDNSS; | 1235 | ifo->options &= ~DHCPCD_IPV6RA_REQRDNSS; | |
1210 | break; | 1236 | break; | |
1211 | case O_IPV6RA_OWN: | 1237 | case O_IPV6RA_OWN: | |
1212 | ifo->options |= DHCPCD_IPV6RA_OWN; | 1238 | ifo->options |= DHCPCD_IPV6RA_OWN; | |
1213 | break; | 1239 | break; | |
1214 | case O_IPV6RA_OWN_D: | 1240 | case O_IPV6RA_OWN_D: | |
1215 | ifo->options |= DHCPCD_IPV6RA_OWN_DEFAULT; | 1241 | ifo->options |= DHCPCD_IPV6RA_OWN_DEFAULT; | |
1216 | break; | 1242 | break; | |
1243 | case O_IPV6RA_AUTOCONF: | |||
1244 | ifo->options |= DHCPCD_IPV6RA_AUTOCONF; | |||
1245 | break; | |||
1246 | case O_IPV6RA_NOAUTOCONF: | |||
1247 | ifo->options &= ~DHCPCD_IPV6RA_AUTOCONF; | |||
1248 | break; | |||
1217 | case O_NOALIAS: | 1249 | case O_NOALIAS: | |
1218 | ifo->options |= DHCPCD_NOALIAS; | 1250 | ifo->options |= DHCPCD_NOALIAS; | |
1219 | break; | 1251 | break; | |
1220 | #ifdef INET6 | 1252 | #ifdef INET6 | |
1221 | case O_IA_NA: | 1253 | case O_IA_NA: | |
1222 | i = D6_OPTION_IA_NA; | 1254 | i = D6_OPTION_IA_NA; | |
1223 | /* FALLTHROUGH */ | 1255 | /* FALLTHROUGH */ | |
1224 | case O_IA_TA: | 1256 | case O_IA_TA: | |
1225 | if (i == 0) | 1257 | if (i == 0) | |
1226 | i = D6_OPTION_IA_TA; | 1258 | i = D6_OPTION_IA_TA; | |
1227 | /* FALLTHROUGH */ | 1259 | /* FALLTHROUGH */ | |
1228 | case O_IA_PD: | 1260 | case O_IA_PD: | |
1229 | if (i == 0) { | 1261 | if (i == 0) { | |
@@ -2016,27 +2048,28 @@ read_config(struct dhcpcd_ctx *ctx, | @@ -2016,27 +2048,28 @@ read_config(struct dhcpcd_ctx *ctx, | |||
2016 | if (ifo == NULL) { | 2048 | if (ifo == NULL) { | |
2017 | syslog(LOG_ERR, "%s: %m", __func__); | 2049 | syslog(LOG_ERR, "%s: %m", __func__); | |
2018 | return NULL; | 2050 | return NULL; | |
2019 | } | 2051 | } | |
2020 | ifo->options |= DHCPCD_DAEMONISE | DHCPCD_LINK; | 2052 | ifo->options |= DHCPCD_DAEMONISE | DHCPCD_LINK; | |
2021 | #ifdef PLUGIN_DEV | 2053 | #ifdef PLUGIN_DEV | |
2022 | ifo->options |= DHCPCD_DEV; | 2054 | ifo->options |= DHCPCD_DEV; | |
2023 | #endif | 2055 | #endif | |
2024 | #ifdef INET | 2056 | #ifdef INET | |
2025 | ifo->options |= DHCPCD_IPV4 | DHCPCD_DHCP | DHCPCD_IPV4LL; | 2057 | ifo->options |= DHCPCD_IPV4 | DHCPCD_DHCP | DHCPCD_IPV4LL; | |
2026 | ifo->options |= DHCPCD_GATEWAY | DHCPCD_ARP; | 2058 | ifo->options |= DHCPCD_GATEWAY | DHCPCD_ARP; | |
2027 | #endif | 2059 | #endif | |
2028 | #ifdef INET6 | 2060 | #ifdef INET6 | |
2029 | ifo->options |= DHCPCD_IPV6 | DHCPCD_IPV6RS | DHCPCD_IPV6RA_REQRDNSS; | 2061 | ifo->options |= DHCPCD_IPV6 | DHCPCD_IPV6RS; | |
2062 | ifo->options |= DHCPCD_IPV6RA_AUTOCONF | DHCPCD_IPV6RA_REQRDNSS; | |||
2030 | ifo->options |= DHCPCD_DHCP6; | 2063 | ifo->options |= DHCPCD_DHCP6; | |
2031 | #endif | 2064 | #endif | |
2032 | ifo->timeout = DEFAULT_TIMEOUT; | 2065 | ifo->timeout = DEFAULT_TIMEOUT; | |
2033 | ifo->reboot = DEFAULT_REBOOT; | 2066 | ifo->reboot = DEFAULT_REBOOT; | |
2034 | ifo->metric = -1; | 2067 | ifo->metric = -1; | |
2035 | ifo->auth.options |= DHCPCD_AUTH_REQUIRE; | 2068 | ifo->auth.options |= DHCPCD_AUTH_REQUIRE; | |
2036 | TAILQ_INIT(&ifo->auth.tokens); | 2069 | TAILQ_INIT(&ifo->auth.tokens); | |
2037 | 2070 | |||
2038 | vlen = dhcp_vendor((char *)ifo->vendorclassid + 1, | 2071 | vlen = dhcp_vendor((char *)ifo->vendorclassid + 1, | |
2039 | sizeof(ifo->vendorclassid) - 1); | 2072 | sizeof(ifo->vendorclassid) - 1); | |
2040 | ifo->vendorclassid[0] = vlen == -1 ? 0 : (uint8_t)vlen; | 2073 | ifo->vendorclassid[0] = vlen == -1 ? 0 : (uint8_t)vlen; | |
2041 | 2074 | |||
2042 | buf = NULL; | 2075 | buf = NULL; |
--- src/external/bsd/dhcpcd/dist/Attic/if-options.h 2014/12/29 16:18:05 1.1.1.23.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/if-options.h 2015/02/05 15:13:12 1.1.1.23.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: if-options.h,v 1.1.1.23.2.1 2014/12/29 16:18:05 martin Exp $ */ | 1 | /* $NetBSD: if-options.h,v 1.1.1.23.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -98,26 +98,27 @@ | @@ -98,26 +98,27 @@ | |||
98 | #define DHCPCD_STOPPING (1ULL << 41) | 98 | #define DHCPCD_STOPPING (1ULL << 41) | |
99 | #define DHCPCD_DEPARTED (1ULL << 42) | 99 | #define DHCPCD_DEPARTED (1ULL << 42) | |
100 | #define DHCPCD_HOSTNAME_SHORT (1ULL << 43) | 100 | #define DHCPCD_HOSTNAME_SHORT (1ULL << 43) | |
101 | #define DHCPCD_EXITING (1ULL << 44) | 101 | #define DHCPCD_EXITING (1ULL << 44) | |
102 | #define DHCPCD_WAITIP4 (1ULL << 45) | 102 | #define DHCPCD_WAITIP4 (1ULL << 45) | |
103 | #define DHCPCD_WAITIP6 (1ULL << 46) | 103 | #define DHCPCD_WAITIP6 (1ULL << 46) | |
104 | #define DHCPCD_DEV (1ULL << 47) | 104 | #define DHCPCD_DEV (1ULL << 47) | |
105 | #define DHCPCD_IAID (1ULL << 48) | 105 | #define DHCPCD_IAID (1ULL << 48) | |
106 | #define DHCPCD_DHCP (1ULL << 49) | 106 | #define DHCPCD_DHCP (1ULL << 49) | |
107 | #define DHCPCD_DHCP6 (1ULL << 50) | 107 | #define DHCPCD_DHCP6 (1ULL << 50) | |
108 | #define DHCPCD_NOPFXDLG (1ULL << 51) | 108 | #define DHCPCD_NOPFXDLG (1ULL << 51) | |
109 | #define DHCPCD_PFXDLGONLY (1ULL << 52) | 109 | #define DHCPCD_PFXDLGONLY (1ULL << 52) | |
110 | #define DHCPCD_PFXDLGMIX (1ULL << 53) | 110 | #define DHCPCD_PFXDLGMIX (1ULL << 53) | |
111 | #define DHCPCD_IPV6RA_AUTOCONF (1ULL << 54) | |||
111 | 112 | |||
112 | extern const struct option cf_options[]; | 113 | extern const struct option cf_options[]; | |
113 | 114 | |||
114 | struct if_sla { | 115 | struct if_sla { | |
115 | char ifname[IF_NAMESIZE]; | 116 | char ifname[IF_NAMESIZE]; | |
116 | uint32_t sla; | 117 | uint32_t sla; | |
117 | uint8_t prefix_len; | 118 | uint8_t prefix_len; | |
118 | int8_t sla_set; | 119 | int8_t sla_set; | |
119 | }; | 120 | }; | |
120 | 121 | |||
121 | struct if_ia { | 122 | struct if_ia { | |
122 | uint8_t iaid[4]; | 123 | uint8_t iaid[4]; | |
123 | #ifdef INET6 | 124 | #ifdef INET6 | |
@@ -132,29 +133,31 @@ struct if_ia { | @@ -132,29 +133,31 @@ struct if_ia { | |||
132 | }; | 133 | }; | |
133 | 134 | |||
134 | struct vivco { | 135 | struct vivco { | |
135 | size_t len; | 136 | size_t len; | |
136 | uint8_t *data; | 137 | uint8_t *data; | |
137 | }; | 138 | }; | |
138 | 139 | |||
139 | struct if_options { | 140 | struct if_options { | |
140 | uint8_t iaid[4]; | 141 | uint8_t iaid[4]; | |
141 | int metric; | 142 | int metric; | |
142 | uint8_t requestmask[256 / NBBY]; | 143 | uint8_t requestmask[256 / NBBY]; | |
143 | uint8_t requiremask[256 / NBBY]; | 144 | uint8_t requiremask[256 / NBBY]; | |
144 | uint8_t nomask[256 / NBBY]; | 145 | uint8_t nomask[256 / NBBY]; | |
146 | uint8_t rejectmask[256 / NBBY]; | |||
145 | uint8_t requestmask6[(UINT16_MAX + 1) / NBBY]; | 147 | uint8_t requestmask6[(UINT16_MAX + 1) / NBBY]; | |
146 | uint8_t requiremask6[(UINT16_MAX + 1) / NBBY]; | 148 | uint8_t requiremask6[(UINT16_MAX + 1) / NBBY]; | |
147 | uint8_t nomask6[(UINT16_MAX + 1) / NBBY]; | 149 | uint8_t nomask6[(UINT16_MAX + 1) / NBBY]; | |
150 | uint8_t rejectmask6[(UINT16_MAX + 1) / NBBY]; | |||
148 | uint8_t dstmask[256 / NBBY]; | 151 | uint8_t dstmask[256 / NBBY]; | |
149 | uint32_t leasetime; | 152 | uint32_t leasetime; | |
150 | time_t timeout; | 153 | time_t timeout; | |
151 | time_t reboot; | 154 | time_t reboot; | |
152 | unsigned long long options; | 155 | unsigned long long options; | |
153 | 156 | |||
154 | struct in_addr req_addr; | 157 | struct in_addr req_addr; | |
155 | struct in_addr req_mask; | 158 | struct in_addr req_mask; | |
156 | struct rt_head *routes; | 159 | struct rt_head *routes; | |
157 | char **config; | 160 | char **config; | |
158 | 161 | |||
159 | char **environ; | 162 | char **environ; | |
160 | char *script; | 163 | char *script; |
--- src/external/bsd/dhcpcd/dist/Attic/if.c 2014/12/29 16:18:05 1.1.1.3.4.1
+++ src/external/bsd/dhcpcd/dist/Attic/if.c 2015/02/05 15:13:12 1.1.1.3.4.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: if.c,v 1.1.1.3.4.1 2014/12/29 16:18:05 martin Exp $"); | 2 | __RCSID("$NetBSD: if.c,v 1.1.1.3.4.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -63,102 +63,90 @@ | @@ -63,102 +63,90 @@ | |||
63 | #include <syslog.h> | 63 | #include <syslog.h> | |
64 | #include <unistd.h> | 64 | #include <unistd.h> | |
65 | 65 | |||
66 | #include "config.h" | 66 | #include "config.h" | |
67 | #include "common.h" | 67 | #include "common.h" | |
68 | #include "dev.h" | 68 | #include "dev.h" | |
69 | #include "dhcp.h" | 69 | #include "dhcp.h" | |
70 | #include "dhcp6.h" | 70 | #include "dhcp6.h" | |
71 | #include "if.h" | 71 | #include "if.h" | |
72 | #include "if-options.h" | 72 | #include "if-options.h" | |
73 | #include "ipv4.h" | 73 | #include "ipv4.h" | |
74 | #include "ipv6nd.h" | 74 | #include "ipv6nd.h" | |
75 | 75 | |||
76 | #ifdef __QNX__ | |||
77 | /* QNX carries defines for, but does not actually support PF_LINK */ | |||
78 | #undef IFLR_ACTIVE | |||
79 | #endif | |||
80 | ||||
76 | void | 81 | void | |
77 | if_free(struct interface *ifp) | 82 | if_free(struct interface *ifp) | |
78 | { | 83 | { | |
79 | 84 | |||
80 | if (ifp == NULL) | 85 | if (ifp == NULL) | |
81 | return; | 86 | return; | |
82 | ipv4_free(ifp); | 87 | ipv4_free(ifp); | |
83 | dhcp_free(ifp); | 88 | dhcp_free(ifp); | |
84 | ipv6_free(ifp); | |||
85 | dhcp6_free(ifp); | 89 | dhcp6_free(ifp); | |
86 | ipv6nd_free(ifp); | 90 | ipv6nd_free(ifp); | |
91 | ipv6_free(ifp); | |||
87 | free_options(ifp->options); | 92 | free_options(ifp->options); | |
88 | free(ifp); | 93 | free(ifp); | |
89 | } | 94 | } | |
90 | 95 | |||
91 | int | 96 | int | |
92 | if_carrier(struct interface *iface) | 97 | if_carrier(struct interface *iface) | |
93 | { | 98 | { | |
94 | int s, r; | 99 | int s, r; | |
95 | struct ifreq ifr; | 100 | struct ifreq ifr; | |
96 | #ifdef SIOCGIFMEDIA | 101 | #ifdef SIOCGIFMEDIA | |
97 | struct ifmediareq ifmr; | 102 | struct ifmediareq ifmr; | |
98 | #endif | 103 | #endif | |
99 | #ifdef __linux__ | |||
100 | char *p; | |||
101 | #endif | |||
102 | 104 | |||
103 | if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1) | 105 | if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1) | |
104 | return LINK_UNKNOWN; | 106 | return LINK_UNKNOWN; | |
105 | memset(&ifr, 0, sizeof(ifr)); | 107 | memset(&ifr, 0, sizeof(ifr)); | |
106 | strlcpy(ifr.ifr_name, iface->name, sizeof(ifr.ifr_name)); | 108 | strlcpy(ifr.ifr_name, iface->name, sizeof(ifr.ifr_name)); | |
107 | #ifdef __linux__ | |||
108 | /* We can only test the real interface up */ | |||
109 | if ((p = strchr(ifr.ifr_name, ':'))) | |||
110 | *p = '\0'; | |||
111 | #endif | |||
112 | ||||
113 | if (ioctl(s, SIOCGIFFLAGS, &ifr) == -1) { | 109 | if (ioctl(s, SIOCGIFFLAGS, &ifr) == -1) { | |
114 | close(s); | 110 | close(s); | |
115 | return LINK_UNKNOWN; | 111 | return LINK_UNKNOWN; | |
116 | } | 112 | } | |
117 | iface->flags = (unsigned int)ifr.ifr_flags; | 113 | iface->flags = (unsigned int)ifr.ifr_flags; | |
118 | 114 | |||
119 | #ifdef SIOCGIFMEDIA | 115 | #ifdef SIOCGIFMEDIA | |
120 | memset(&ifmr, 0, sizeof(ifmr)); | 116 | memset(&ifmr, 0, sizeof(ifmr)); | |
121 | strlcpy(ifmr.ifm_name, iface->name, sizeof(ifmr.ifm_name)); | 117 | strlcpy(ifmr.ifm_name, iface->name, sizeof(ifmr.ifm_name)); | |
122 | if (ioctl(s, SIOCGIFMEDIA, &ifmr) != -1 && | 118 | if (ioctl(s, SIOCGIFMEDIA, &ifmr) != -1 && | |
123 | ifmr.ifm_status & IFM_AVALID) | 119 | ifmr.ifm_status & IFM_AVALID) | |
124 | r = (ifmr.ifm_status & IFM_ACTIVE) ? LINK_UP : LINK_DOWN; | 120 | r = (ifmr.ifm_status & IFM_ACTIVE) ? LINK_UP : LINK_DOWN; | |
125 | else | 121 | else | |
126 | r = ifr.ifr_flags & IFF_RUNNING ? LINK_UP : LINK_UNKNOWN; | 122 | r = ifr.ifr_flags & IFF_RUNNING ? LINK_UP : LINK_UNKNOWN; | |
127 | #else | 123 | #else | |
128 | r = ifr.ifr_flags & IFF_RUNNING ? LINK_UP : LINK_DOWN; | 124 | r = ifr.ifr_flags & IFF_RUNNING ? LINK_UP : LINK_DOWN; | |
129 | #endif | 125 | #endif | |
130 | close(s); | 126 | close(s); | |
131 | return r; | 127 | return r; | |
132 | } | 128 | } | |
133 | 129 | |||
134 | int | 130 | int | |
135 | if_setflag(struct interface *ifp, short flag) | 131 | if_setflag(struct interface *ifp, short flag) | |
136 | { | 132 | { | |
137 | struct ifreq ifr; | 133 | struct ifreq ifr; | |
138 | int s, r; | 134 | int s, r; | |
139 | #ifdef __linux__ | |||
140 | char *p; | |||
141 | #endif | |||
142 | 135 | |||
143 | if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1) | 136 | if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1) | |
144 | return -1; | 137 | return -1; | |
145 | memset(&ifr, 0, sizeof(ifr)); | 138 | memset(&ifr, 0, sizeof(ifr)); | |
146 | strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); | 139 | strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); | |
147 | #ifdef __linux__ | |||
148 | /* We can only bring the real interface up */ | |||
149 | if ((p = strchr(ifr.ifr_name, ':'))) | |||
150 | *p = '\0'; | |||
151 | #endif | |||
152 | r = -1; | 140 | r = -1; | |
153 | if (ioctl(s, SIOCGIFFLAGS, &ifr) == 0) { | 141 | if (ioctl(s, SIOCGIFFLAGS, &ifr) == 0) { | |
154 | if (flag == 0 || (ifr.ifr_flags & flag) == flag) | 142 | if (flag == 0 || (ifr.ifr_flags & flag) == flag) | |
155 | r = 0; | 143 | r = 0; | |
156 | else { | 144 | else { | |
157 | ifr.ifr_flags |= flag; | 145 | ifr.ifr_flags |= flag; | |
158 | if (ioctl(s, SIOCSIFFLAGS, &ifr) == 0) | 146 | if (ioctl(s, SIOCSIFFLAGS, &ifr) == 0) | |
159 | r = 0; | 147 | r = 0; | |
160 | } | 148 | } | |
161 | ifp->flags = (unsigned int)ifr.ifr_flags; | 149 | ifp->flags = (unsigned int)ifr.ifr_flags; | |
162 | } | 150 | } | |
163 | close(s); | 151 | close(s); | |
164 | return r; | 152 | return r; | |
@@ -183,27 +171,27 @@ if_discover(struct dhcpcd_ctx *ctx, int | @@ -183,27 +171,27 @@ if_discover(struct dhcpcd_ctx *ctx, int | |||
183 | char *p; | 171 | char *p; | |
184 | int i; | 172 | int i; | |
185 | struct if_head *ifs; | 173 | struct if_head *ifs; | |
186 | struct interface *ifp; | 174 | struct interface *ifp; | |
187 | #ifdef __linux__ | 175 | #ifdef __linux__ | |
188 | char ifn[IF_NAMESIZE]; | 176 | char ifn[IF_NAMESIZE]; | |
189 | #endif | 177 | #endif | |
190 | #ifdef INET | 178 | #ifdef INET | |
191 | const struct sockaddr_in *addr; | 179 | const struct sockaddr_in *addr; | |
192 | const struct sockaddr_in *net; | 180 | const struct sockaddr_in *net; | |
193 | const struct sockaddr_in *dst; | 181 | const struct sockaddr_in *dst; | |
194 | #endif | 182 | #endif | |
195 | #ifdef INET6 | 183 | #ifdef INET6 | |
196 | struct sockaddr_in6 *sin6; | 184 | struct sockaddr_in6 *sin6, *net6; | |
197 | int ifa_flags; | 185 | int ifa_flags; | |
198 | #endif | 186 | #endif | |
199 | #ifdef AF_LINK | 187 | #ifdef AF_LINK | |
200 | const struct sockaddr_dl *sdl; | 188 | const struct sockaddr_dl *sdl; | |
201 | #ifdef SIOCGIFPRIORITY | 189 | #ifdef SIOCGIFPRIORITY | |
202 | struct ifreq ifr; | 190 | struct ifreq ifr; | |
203 | int s_inet; | 191 | int s_inet; | |
204 | #endif | 192 | #endif | |
205 | #ifdef IFLR_ACTIVE | 193 | #ifdef IFLR_ACTIVE | |
206 | struct if_laddrreq iflr; | 194 | struct if_laddrreq iflr; | |
207 | int s_link; | 195 | int s_link; | |
208 | #endif | 196 | #endif | |
209 | 197 | |||
@@ -261,26 +249,29 @@ if_discover(struct dhcpcd_ctx *ctx, int | @@ -261,26 +249,29 @@ if_discover(struct dhcpcd_ctx *ctx, int | |||
261 | *p = '\0'; | 249 | *p = '\0'; | |
262 | if (strcmp(ifn, ifa->ifa_name) == 0) | 250 | if (strcmp(ifn, ifa->ifa_name) == 0) | |
263 | break; | 251 | break; | |
264 | #else | 252 | #else | |
265 | if (strcmp(argv[i], ifa->ifa_name) == 0) | 253 | if (strcmp(argv[i], ifa->ifa_name) == 0) | |
266 | break; | 254 | break; | |
267 | #endif | 255 | #endif | |
268 | } | 256 | } | |
269 | if (i == argc) | 257 | if (i == argc) | |
270 | continue; | 258 | continue; | |
271 | p = argv[i]; | 259 | p = argv[i]; | |
272 | } else { | 260 | } else { | |
273 | p = ifa->ifa_name; | 261 | p = ifa->ifa_name; | |
262 | #ifdef __linux__ | |||
263 | strlcpy(ifn, ifa->ifa_name, sizeof(ifn)); | |||
264 | #endif | |||
274 | /* -1 means we're discovering against a specific | 265 | /* -1 means we're discovering against a specific | |
275 | * interface, but we still need the below rules | 266 | * interface, but we still need the below rules | |
276 | * to apply. */ | 267 | * to apply. */ | |
277 | if (argc == -1 && strcmp(argv[0], ifa->ifa_name) != 0) | 268 | if (argc == -1 && strcmp(argv[0], ifa->ifa_name) != 0) | |
278 | continue; | 269 | continue; | |
279 | } | 270 | } | |
280 | for (i = 0; i < ctx->ifdc; i++) | 271 | for (i = 0; i < ctx->ifdc; i++) | |
281 | if (!fnmatch(ctx->ifdv[i], p, 0)) | 272 | if (!fnmatch(ctx->ifdv[i], p, 0)) | |
282 | break; | 273 | break; | |
283 | if (i < ctx->ifdc) | 274 | if (i < ctx->ifdc) | |
284 | continue; | 275 | continue; | |
285 | for (i = 0; i < ctx->ifac; i++) | 276 | for (i = 0; i < ctx->ifac; i++) | |
286 | if (!fnmatch(ctx->ifav[i], p, 0)) | 277 | if (!fnmatch(ctx->ifav[i], p, 0)) | |
@@ -301,27 +292,32 @@ if_discover(struct dhcpcd_ctx *ctx, int | @@ -301,27 +292,32 @@ if_discover(struct dhcpcd_ctx *ctx, int | |||
301 | 292 | |||
302 | if (if_vimaster(p) == 1) { | 293 | if (if_vimaster(p) == 1) { | |
303 | syslog(argc ? LOG_ERR : LOG_DEBUG, | 294 | syslog(argc ? LOG_ERR : LOG_DEBUG, | |
304 | "%s: is a Virtual Interface Master, skipping", p); | 295 | "%s: is a Virtual Interface Master, skipping", p); | |
305 | continue; | 296 | continue; | |
306 | } | 297 | } | |
307 | 298 | |||
308 | ifp = calloc(1, sizeof(*ifp)); | 299 | ifp = calloc(1, sizeof(*ifp)); | |
309 | if (ifp == NULL) { | 300 | if (ifp == NULL) { | |
310 | syslog(LOG_ERR, "%s: %m", __func__); | 301 | syslog(LOG_ERR, "%s: %m", __func__); | |
311 | break; | 302 | break; | |
312 | } | 303 | } | |
313 | ifp->ctx = ctx; | 304 | ifp->ctx = ctx; | |
305 | #ifdef __linux__ | |||
306 | strlcpy(ifp->name, ifn, sizeof(ifp->name)); | |||
307 | strlcpy(ifp->alias, p, sizeof(ifp->alias)); | |||
308 | #else | |||
314 | strlcpy(ifp->name, p, sizeof(ifp->name)); | 309 | strlcpy(ifp->name, p, sizeof(ifp->name)); | |
310 | #endif | |||
315 | ifp->flags = ifa->ifa_flags; | 311 | ifp->flags = ifa->ifa_flags; | |
316 | ifp->carrier = if_carrier(ifp); | 312 | ifp->carrier = if_carrier(ifp); | |
317 | 313 | |||
318 | if (ifa->ifa_addr != NULL) { | 314 | if (ifa->ifa_addr != NULL) { | |
319 | #ifdef AF_LINK | 315 | #ifdef AF_LINK | |
320 | sdl = (const struct sockaddr_dl *)(void *)ifa->ifa_addr; | 316 | sdl = (const struct sockaddr_dl *)(void *)ifa->ifa_addr; | |
321 | 317 | |||
322 | #ifdef IFLR_ACTIVE | 318 | #ifdef IFLR_ACTIVE | |
323 | /* We need to check for active address */ | 319 | /* We need to check for active address */ | |
324 | strlcpy(iflr.iflr_name, ifp->name, | 320 | strlcpy(iflr.iflr_name, ifp->name, | |
325 | sizeof(iflr.iflr_name)); | 321 | sizeof(iflr.iflr_name)); | |
326 | memcpy(&iflr.addr, ifa->ifa_addr, | 322 | memcpy(&iflr.addr, ifa->ifa_addr, | |
327 | MIN(ifa->ifa_addr->sa_len, sizeof(iflr.addr))); | 323 | MIN(ifa->ifa_addr->sa_len, sizeof(iflr.addr))); | |
@@ -493,37 +489,40 @@ if_discover(struct dhcpcd_ctx *ctx, int | @@ -493,37 +489,40 @@ if_discover(struct dhcpcd_ctx *ctx, int | |||
493 | &net->sin_addr, | 489 | &net->sin_addr, | |
494 | dst ? &dst->sin_addr : NULL); | 490 | dst ? &dst->sin_addr : NULL); | |
495 | break; | 491 | break; | |
496 | #endif | 492 | #endif | |
497 | #ifdef INET6 | 493 | #ifdef INET6 | |
498 | case AF_INET6: | 494 | case AF_INET6: | |
499 | TAILQ_FOREACH(ifp, ifs, next) { | 495 | TAILQ_FOREACH(ifp, ifs, next) { | |
500 | if (strcmp(ifp->name, ifa->ifa_name) == 0) | 496 | if (strcmp(ifp->name, ifa->ifa_name) == 0) | |
501 | break; | 497 | break; | |
502 | } | 498 | } | |
503 | if (ifp == NULL) | 499 | if (ifp == NULL) | |
504 | break; /* Should be impossible */ | 500 | break; /* Should be impossible */ | |
505 | sin6 = (struct sockaddr_in6 *)(void *)ifa->ifa_addr; | 501 | sin6 = (struct sockaddr_in6 *)(void *)ifa->ifa_addr; | |
502 | net6 = (struct sockaddr_in6 *)(void *)ifa->ifa_netmask; | |||
506 | #ifdef __KAME__ | 503 | #ifdef __KAME__ | |
507 | if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) | 504 | if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) | |
508 | /* Remove the scope from the address */ | 505 | /* Remove the scope from the address */ | |
509 | sin6->sin6_addr.s6_addr[2] = | 506 | sin6->sin6_addr.s6_addr[2] = | |
510 | sin6->sin6_addr.s6_addr[3] = '\0'; | 507 | sin6->sin6_addr.s6_addr[3] = '\0'; | |
511 | #endif | 508 | #endif | |
512 | ifa_flags = if_addrflags6(&sin6->sin6_addr, ifp); | 509 | ifa_flags = if_addrflags6(&sin6->sin6_addr, ifp); | |
513 | if (ifa_flags != -1) | 510 | if (ifa_flags != -1) | |
514 | ipv6_handleifa(ctx, RTM_NEWADDR, ifs, | 511 | ipv6_handleifa(ctx, RTM_NEWADDR, ifs, | |
515 | ifa->ifa_name, | 512 | ifa->ifa_name, | |
516 | &sin6->sin6_addr, ifa_flags); | 513 | &sin6->sin6_addr, | |
514 | ipv6_prefixlen(&net6->sin6_addr), | |||
515 | ifa_flags); | |||
517 | break; | 516 | break; | |
518 | #endif | 517 | #endif | |
519 | } | 518 | } | |
520 | } | 519 | } | |
521 | 520 | |||
522 | freeifaddrs(ifaddrs); | 521 | freeifaddrs(ifaddrs); | |
523 | 522 | |||
524 | #ifdef SIOCGIFPRIORITY | 523 | #ifdef SIOCGIFPRIORITY | |
525 | close(s_inet); | 524 | close(s_inet); | |
526 | #endif | 525 | #endif | |
527 | #ifdef IFLR_ACTIVE | 526 | #ifdef IFLR_ACTIVE | |
528 | close(s_link); | 527 | close(s_link); | |
529 | #endif | 528 | #endif | |
@@ -531,26 +530,29 @@ if_discover(struct dhcpcd_ctx *ctx, int | @@ -531,26 +530,29 @@ if_discover(struct dhcpcd_ctx *ctx, int | |||
531 | return ifs; | 530 | return ifs; | |
532 | } | 531 | } | |
533 | 532 | |||
534 | static struct interface * | 533 | static struct interface * | |
535 | if_findindexname(struct dhcpcd_ctx *ctx, unsigned int idx, const char *name) | 534 | if_findindexname(struct dhcpcd_ctx *ctx, unsigned int idx, const char *name) | |
536 | { | 535 | { | |
537 | struct interface *ifp; | 536 | struct interface *ifp; | |
538 | 537 | |||
539 | if (ctx != NULL && ctx->ifaces != NULL) { | 538 | if (ctx != NULL && ctx->ifaces != NULL) { | |
540 | TAILQ_FOREACH(ifp, ctx->ifaces, next) { | 539 | TAILQ_FOREACH(ifp, ctx->ifaces, next) { | |
541 | if ((ifp->options == NULL || | 540 | if ((ifp->options == NULL || | |
542 | !(ifp->options->options & DHCPCD_PFXDLGONLY)) && | 541 | !(ifp->options->options & DHCPCD_PFXDLGONLY)) && | |
543 | ((name && strcmp(ifp->name, name) == 0) || | 542 | ((name && strcmp(ifp->name, name) == 0) || | |
543 | #ifdef __linux__ | |||
544 | (name && strcmp(ifp->alias, name) == 0) || | |||
545 | #endif | |||
544 | (!name && ifp->index == idx))) | 546 | (!name && ifp->index == idx))) | |
545 | return ifp; | 547 | return ifp; | |
546 | } | 548 | } | |
547 | } | 549 | } | |
548 | return NULL; | 550 | return NULL; | |
549 | } | 551 | } | |
550 | 552 | |||
551 | struct interface * | 553 | struct interface * | |
552 | if_find(struct dhcpcd_ctx *ctx, const char *name) | 554 | if_find(struct dhcpcd_ctx *ctx, const char *name) | |
553 | { | 555 | { | |
554 | 556 | |||
555 | return if_findindexname(ctx, 0, name); | 557 | return if_findindexname(ctx, 0, name); | |
556 | } | 558 | } |
--- src/external/bsd/dhcpcd/dist/Attic/if.h 2014/12/29 16:18:05 1.1.1.3.4.1
+++ src/external/bsd/dhcpcd/dist/Attic/if.h 2015/02/05 15:13:12 1.1.1.3.4.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: if.h,v 1.1.1.3.4.1 2014/12/29 16:18:05 martin Exp $ */ | 1 | /* $NetBSD: if.h,v 1.1.1.3.4.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -95,51 +95,56 @@ int if_domtu(const char *, short int); | @@ -95,51 +95,56 @@ int if_domtu(const char *, short int); | |||
95 | #define if_getmtu(iface) if_domtu(iface, 0) | 95 | #define if_getmtu(iface) if_domtu(iface, 0) | |
96 | #define if_setmtu(iface, mtu) if_domtu(iface, mtu) | 96 | #define if_setmtu(iface, mtu) if_domtu(iface, mtu) | |
97 | int if_carrier(struct interface *); | 97 | int if_carrier(struct interface *); | |
98 | 98 | |||
99 | /* The below functions are provided by if-KERNEL.c */ | 99 | /* The below functions are provided by if-KERNEL.c */ | |
100 | int if_conf(struct interface *); | 100 | int if_conf(struct interface *); | |
101 | int if_init(struct interface *); | 101 | int if_init(struct interface *); | |
102 | int if_getssid(struct interface *); | 102 | int if_getssid(struct interface *); | |
103 | int if_vimaster(const char *); | 103 | int if_vimaster(const char *); | |
104 | int if_openlinksocket(void); | 104 | int if_openlinksocket(void); | |
105 | int if_managelink(struct dhcpcd_ctx *); | 105 | int if_managelink(struct dhcpcd_ctx *); | |
106 | 106 | |||
107 | #ifdef INET | 107 | #ifdef INET | |
108 | extern const char *if_pfname; | |||
108 | int if_openrawsocket(struct interface *, int); | 109 | int if_openrawsocket(struct interface *, int); | |
109 | ssize_t if_sendrawpacket(const struct interface *, | 110 | ssize_t if_sendrawpacket(const struct interface *, | |
110 | int, const void *, size_t); | 111 | int, const void *, size_t); | |
111 | ssize_t if_readrawpacket(struct interface *, int, void *, size_t, int *); | 112 | ssize_t if_readrawpacket(struct interface *, int, void *, size_t, int *); | |
112 | 113 | |||
113 | int if_address(const struct interface *, | 114 | int if_address(const struct interface *, | |
114 | const struct in_addr *, const struct in_addr *, | 115 | const struct in_addr *, const struct in_addr *, | |
115 | const struct in_addr *, int); | 116 | const struct in_addr *, int); | |
116 | #define if_addaddress(ifp, addr, net, brd) \ | 117 | #define if_addaddress(ifp, addr, net, brd) \ | |
117 | if_address(ifp, addr, net, brd, 1) | 118 | if_address(ifp, addr, net, brd, 1) | |
118 | #define if_deladdress(ifp, addr, net) \ | 119 | #define if_deladdress(ifp, addr, net) \ | |
119 | if_address(ifp, addr, net, NULL, -1) | 120 | if_address(ifp, addr, net, NULL, -1) | |
120 | 121 | |||
121 | int if_route(const struct rt *rt, int); | 122 | int if_route(const struct rt *rt, int); | |
122 | #define if_addroute(rt) if_route(rt, 1) | 123 | #define if_addroute(rt) if_route(rt, 1) | |
123 | #define if_chgroute(rt) if_route(rt, 0) | 124 | #define if_chgroute(rt) if_route(rt, 0) | |
124 | #define if_delroute(rt) if_route(rt, -1) | 125 | #define if_delroute(rt) if_route(rt, -1) | |
125 | #endif | 126 | #endif | |
126 | 127 | |||
127 | #ifdef INET6 | 128 | #ifdef INET6 | |
128 | int if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *, int); | 129 | int if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *, int); | |
130 | int ip6_use_tempaddr(const char *ifname); | |||
131 | int ip6_temp_preferred_lifetime(const char *ifname); | |||
132 | int ip6_temp_valid_lifetime(const char *ifname); | |||
129 | 133 | |||
130 | int if_address6(const struct ipv6_addr *, int); | 134 | int if_address6(const struct ipv6_addr *, int); | |
131 | #define if_addaddress6(a) if_address6(a, 1) | 135 | #define if_addaddress6(a) if_address6(a, 1) | |
132 | #define if_deladdress6(a) if_address6(a, -1) | 136 | #define if_deladdress6(a) if_address6(a, -1) | |
133 | 137 | |||
134 | int if_addrflags6(const struct in6_addr *, const struct interface *); | 138 | int if_addrflags6(const struct in6_addr *, const struct interface *); | |
139 | int if_getlifetime6(struct ipv6_addr *); | |||
135 | 140 | |||
136 | int if_route6(const struct rt6 *rt, int); | 141 | int if_route6(const struct rt6 *rt, int); | |
137 | #define if_addroute6(rt) if_route6(rt, 1) | 142 | #define if_addroute6(rt) if_route6(rt, 1) | |
138 | #define if_chgroute6(rt) if_route6(rt, 0) | 143 | #define if_chgroute6(rt) if_route6(rt, 0) | |
139 | #define if_delroute6(rt) if_route6(rt, -1) | 144 | #define if_delroute6(rt) if_route6(rt, -1) | |
140 | #else | 145 | #else | |
141 | #define if_checkipv6(a, b, c) (-1) | 146 | #define if_checkipv6(a, b, c) (-1) | |
142 | #endif | 147 | #endif | |
143 | 148 | |||
144 | int if_machinearch(char *, size_t); | 149 | int if_machinearch(char *, size_t); | |
145 | #endif | 150 | #endif |
--- src/external/bsd/dhcpcd/dist/Attic/ipv4ll.c 2014/12/29 16:18:05 1.1.1.10.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/ipv4ll.c 2015/02/05 15:13:12 1.1.1.10.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: ipv4ll.c,v 1.1.1.10.2.1 2014/12/29 16:18:05 martin Exp $"); | 2 | __RCSID("$NetBSD: ipv4ll.c,v 1.1.1.10.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/Attic/ipv6.h 2014/12/29 16:18:05 1.1.1.10.2.1
+++ src/external/bsd/dhcpcd/dist/Attic/ipv6.h 2015/02/05 15:13:12 1.1.1.10.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: ipv6.h,v 1.1.1.10.2.1 2014/12/29 16:18:05 martin Exp $ */ | 1 | /* $NetBSD: ipv6.h,v 1.1.1.10.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
@@ -46,55 +46,72 @@ | @@ -46,55 +46,72 @@ | |||
46 | 46 | |||
47 | #define ROUNDUP8(a) (1 + (((a) - 1) | 7)) | 47 | #define ROUNDUP8(a) (1 + (((a) - 1) | 7)) | |
48 | #define ROUNDUP16(a) (1 + (((a) - 1) | 16)) | 48 | #define ROUNDUP16(a) (1 + (((a) - 1) | 16)) | |
49 | 49 | |||
50 | #define EUI64_GBIT 0x01 | 50 | #define EUI64_GBIT 0x01 | |
51 | #define EUI64_UBIT 0x02 | 51 | #define EUI64_UBIT 0x02 | |
52 | #define EUI64_TO_IFID(in6) do {(in6)->s6_addr[8] ^= EUI64_UBIT; } while (0) | 52 | #define EUI64_TO_IFID(in6) do {(in6)->s6_addr[8] ^= EUI64_UBIT; } while (0) | |
53 | #define EUI64_GROUP(in6) ((in6)->s6_addr[8] & EUI64_GBIT) | 53 | #define EUI64_GROUP(in6) ((in6)->s6_addr[8] & EUI64_GBIT) | |
54 | 54 | |||
55 | #ifndef ND6_INFINITE_LIFETIME | 55 | #ifndef ND6_INFINITE_LIFETIME | |
56 | # define ND6_INFINITE_LIFETIME ((uint32_t)~0) | 56 | # define ND6_INFINITE_LIFETIME ((uint32_t)~0) | |
57 | #endif | 57 | #endif | |
58 | 58 | |||
59 | /* RFC4941 constants */ | |||
60 | #define TEMP_VALID_LIFETIME 604800 /* 1 week */ | |||
61 | #define TEMP_PREFERRED_LIFETIME 86400 /* 1 day */ | |||
62 | #define REGEN_ADVANCE 5 /* seconds */ | |||
63 | #define MAX_DESYNC_FACTOR 600 /* 10 minutes */ | |||
64 | ||||
65 | #define TEMP_IDGEN_RETRIES 3 | |||
66 | #define GEN_TEMPID_RETRY_MAX 5 | |||
67 | ||||
59 | /* RFC7217 constants */ | 68 | /* RFC7217 constants */ | |
60 | #define IDGEN_RETRIES 3 | 69 | #define IDGEN_RETRIES 3 | |
61 | #define IDGEN_DELAY 1 /* second */ | 70 | #define IDGEN_DELAY 1 /* second */ | |
62 | 71 | |||
63 | /* | 72 | /* | |
64 | * BSD kernels don't inform userland of DAD results. | 73 | * BSD kernels don't inform userland of DAD results. | |
65 | * See the discussion here: | 74 | * See the discussion here: | |
66 | * http://mail-index.netbsd.org/tech-net/2013/03/15/msg004019.html | 75 | * http://mail-index.netbsd.org/tech-net/2013/03/15/msg004019.html | |
67 | */ | 76 | */ | |
68 | #ifndef __linux__ | 77 | #ifndef __linux__ | |
69 | /* We guard here to avoid breaking a compile on linux ppc-64 headers */ | 78 | /* We guard here to avoid breaking a compile on linux ppc-64 headers */ | |
70 | # include <sys/param.h> | 79 | # include <sys/param.h> | |
71 | #endif | 80 | #endif | |
72 | #ifdef BSD | 81 | #ifdef BSD | |
73 | # define IPV6_POLLADDRFLAG | 82 | # define IPV6_POLLADDRFLAG | |
74 | #endif | 83 | #endif | |
75 | 84 | |||
76 | /* This was fixed in NetBSD */ | 85 | /* This was fixed in NetBSD */ | |
77 | #if defined(__NetBSD_Version__) && __NetBSD_Version__ >= 699002000 | 86 | #if defined(__NetBSD_Version__) && __NetBSD_Version__ >= 699002000 | |
78 | # undef IPV6_POLLADDRFLAG | 87 | # undef IPV6_POLLADDRFLAG | |
79 | #endif | 88 | #endif | |
80 | 89 | |||
90 | /* Linux-3.18 can manage temporary addresses even with RA | |||
91 | * processing disabled. */ | |||
92 | //#undef IFA_F_MANAGETEMPADDR | |||
93 | #ifndef IFA_F_MANAGETEMPADDR | |||
94 | #define IPV6_MANAGETEMPADDR | |||
95 | #endif | |||
96 | ||||
81 | struct ipv6_addr { | 97 | struct ipv6_addr { | |
82 | TAILQ_ENTRY(ipv6_addr) next; | 98 | TAILQ_ENTRY(ipv6_addr) next; | |
83 | struct interface *iface; | 99 | struct interface *iface; | |
84 | struct in6_addr prefix; | 100 | struct in6_addr prefix; | |
85 | uint8_t prefix_len; | 101 | uint8_t prefix_len; | |
86 | uint32_t prefix_vltime; | 102 | uint32_t prefix_vltime; | |
87 | uint32_t prefix_pltime; | 103 | uint32_t prefix_pltime; | |
104 | struct timeval created; | |||
88 | struct timeval acquired; | 105 | struct timeval acquired; | |
89 | struct in6_addr addr; | 106 | struct in6_addr addr; | |
90 | int addr_flags; | 107 | int addr_flags; | |
91 | short flags; | 108 | short flags; | |
92 | char saddr[INET6_ADDRSTRLEN]; | 109 | char saddr[INET6_ADDRSTRLEN]; | |
93 | uint8_t iaid[4]; | 110 | uint8_t iaid[4]; | |
94 | uint16_t ia_type; | 111 | uint16_t ia_type; | |
95 | struct interface *delegating_iface; | 112 | struct interface *delegating_iface; | |
96 | uint8_t prefix_exclude_len; | 113 | uint8_t prefix_exclude_len; | |
97 | struct in6_addr prefix_exclude; | 114 | struct in6_addr prefix_exclude; | |
98 | 115 | |||
99 | void (*dadcallback)(void *); | 116 | void (*dadcallback)(void *); | |
100 | int dadcounter; | 117 | int dadcounter; | |
@@ -105,56 +122,79 @@ struct ipv6_addr { | @@ -105,56 +122,79 @@ struct ipv6_addr { | |||
105 | TAILQ_HEAD(ipv6_addrhead, ipv6_addr); | 122 | TAILQ_HEAD(ipv6_addrhead, ipv6_addr); | |
106 | 123 | |||
107 | #define IPV6_AF_ONLINK 0x0001 | 124 | #define IPV6_AF_ONLINK 0x0001 | |
108 | #define IPV6_AF_NEW 0x0002 | 125 | #define IPV6_AF_NEW 0x0002 | |
109 | #define IPV6_AF_STALE 0x0004 | 126 | #define IPV6_AF_STALE 0x0004 | |
110 | #define IPV6_AF_ADDED 0x0008 | 127 | #define IPV6_AF_ADDED 0x0008 | |
111 | #define IPV6_AF_AUTOCONF 0x0010 | 128 | #define IPV6_AF_AUTOCONF 0x0010 | |
112 | #define IPV6_AF_DUPLICATED 0x0020 | 129 | #define IPV6_AF_DUPLICATED 0x0020 | |
113 | #define IPV6_AF_DADCOMPLETED 0x0040 | 130 | #define IPV6_AF_DADCOMPLETED 0x0040 | |
114 | #define IPV6_AF_DELEGATED 0x0080 | 131 | #define IPV6_AF_DELEGATED 0x0080 | |
115 | #define IPV6_AF_DELEGATEDPFX 0x0100 | 132 | #define IPV6_AF_DELEGATEDPFX 0x0100 | |
116 | #define IPV6_AF_DELEGATEDZERO 0x0200 | 133 | #define IPV6_AF_DELEGATEDZERO 0x0200 | |
117 | #define IPV6_AF_REQUEST 0x0400 | 134 | #define IPV6_AF_REQUEST 0x0400 | |
135 | #define IPV6_AF_TEMPORARY 0X0800 | |||
118 | 136 | |||
119 | struct rt6 { | 137 | struct rt6 { | |
120 | TAILQ_ENTRY(rt6) next; | 138 | TAILQ_ENTRY(rt6) next; | |
121 | struct in6_addr dest; | 139 | struct in6_addr dest; | |
122 | struct in6_addr net; | 140 | struct in6_addr net; | |
123 | struct in6_addr gate; | 141 | struct in6_addr gate; | |
124 | const struct interface *iface; | 142 | const struct interface *iface; | |
125 | unsigned int flags; | 143 | unsigned int flags; | |
126 | unsigned int metric; | 144 | unsigned int metric; | |
127 | unsigned int mtu; | 145 | unsigned int mtu; | |
128 | }; | 146 | }; | |
129 | TAILQ_HEAD(rt6_head, rt6); | 147 | TAILQ_HEAD(rt6_head, rt6); | |
130 | 148 | |||
131 | struct ll_callback { | 149 | struct ll_callback { | |
132 | TAILQ_ENTRY(ll_callback) next; | 150 | TAILQ_ENTRY(ll_callback) next; | |
133 | void (*callback)(void *); | 151 | void (*callback)(void *); | |
134 | void *arg; | 152 | void *arg; | |
135 | }; | 153 | }; | |
136 | TAILQ_HEAD(ll_callback_head, ll_callback); | 154 | TAILQ_HEAD(ll_callback_head, ll_callback); | |
137 | 155 | |||
138 | struct ipv6_state { | 156 | struct ipv6_state { | |
139 | struct ipv6_addrhead addrs; | 157 | struct ipv6_addrhead addrs; | |
140 | struct ll_callback_head ll_callbacks; | 158 | struct ll_callback_head ll_callbacks; | |
159 | ||||
160 | #ifdef IPV6_MANAGETEMPADDR | |||
161 | time_t desync_factor; | |||
162 | uint8_t randomseed0[8]; /* upper 64 bits of MD5 digest */ | |||
163 | uint8_t randomseed1[8]; /* lower 64 bits */ | |||
164 | uint8_t randomid[8]; | |||
165 | #endif | |||
141 | }; | 166 | }; | |
142 | 167 | |||
143 | #define IPV6_STATE(ifp) \ | 168 | #define IPV6_STATE(ifp) \ | |
144 | ((struct ipv6_state *)(ifp)->if_data[IF_DATA_IPV6]) | 169 | ((struct ipv6_state *)(ifp)->if_data[IF_DATA_IPV6]) | |
145 | #define IPV6_CSTATE(ifp) \ | 170 | #define IPV6_CSTATE(ifp) \ | |
146 | ((const struct ipv6_state *)(ifp)->if_data[IF_DATA_IPV6]) | 171 | ((const struct ipv6_state *)(ifp)->if_data[IF_DATA_IPV6]) | |
147 | 172 | |||
173 | /* dhcpcd requires CMSG_SPACE to evaluate to a compile time constant. */ | |||
174 | #ifdef __QNX__ | |||
175 | #undef CMSG_SPACE | |||
176 | #endif | |||
177 | ||||
178 | #ifndef ALIGNBYTES | |||
179 | #define ALIGNBYTES (sizeof(int) - 1) | |||
180 | #endif | |||
181 | #ifndef ALIGN | |||
182 | #define ALIGN(p) (((unsigned int)(p) + ALIGNBYTES) & ~ALIGNBYTES) | |||
183 | #endif | |||
184 | #ifndef CMSG_SPACE | |||
185 | #define CMSG_SPACE(len) (ALIGN(sizeof(struct cmsghdr)) + ALIGN(len)) | |||
186 | #endif | |||
187 | ||||
148 | #define IP6BUFLEN (CMSG_SPACE(sizeof(struct in6_pktinfo)) + \ | 188 | #define IP6BUFLEN (CMSG_SPACE(sizeof(struct in6_pktinfo)) + \ | |
149 | CMSG_SPACE(sizeof(int))) | 189 | CMSG_SPACE(sizeof(int))) | |
150 | 190 | |||
151 | #ifdef INET6 | 191 | #ifdef INET6 | |
152 | struct ipv6_ctx { | 192 | struct ipv6_ctx { | |
153 | struct sockaddr_in6 from; | 193 | struct sockaddr_in6 from; | |
154 | struct msghdr sndhdr; | 194 | struct msghdr sndhdr; | |
155 | struct iovec sndiov[2]; | 195 | struct iovec sndiov[2]; | |
156 | unsigned char sndbuf[CMSG_SPACE(sizeof(struct in6_pktinfo))]; | 196 | unsigned char sndbuf[CMSG_SPACE(sizeof(struct in6_pktinfo))]; | |
157 | struct msghdr rcvhdr; | 197 | struct msghdr rcvhdr; | |
158 | struct iovec rcviov[2]; | 198 | struct iovec rcviov[2]; | |
159 | unsigned char rcvbuf[IP6BUFLEN]; | 199 | unsigned char rcvbuf[IP6BUFLEN]; | |
160 | unsigned char ansbuf[1500]; | 200 | unsigned char ansbuf[1500]; | |
@@ -178,39 +218,55 @@ int ipv6_makestableprivate(struct in6_ad | @@ -178,39 +218,55 @@ int ipv6_makestableprivate(struct in6_ad | |||
178 | int ipv6_makeaddr(struct in6_addr *, const struct interface *, | 218 | int ipv6_makeaddr(struct in6_addr *, const struct interface *, | |
179 | const struct in6_addr *, int); | 219 | const struct in6_addr *, int); | |
180 | int ipv6_makeprefix(struct in6_addr *, const struct in6_addr *, int); | 220 | int ipv6_makeprefix(struct in6_addr *, const struct in6_addr *, int); | |
181 | int ipv6_mask(struct in6_addr *, int); | 221 | int ipv6_mask(struct in6_addr *, int); | |
182 | uint8_t ipv6_prefixlen(const struct in6_addr *); | 222 | uint8_t ipv6_prefixlen(const struct in6_addr *); | |
183 | int ipv6_userprefix( const struct in6_addr *, short prefix_len, | 223 | int ipv6_userprefix( const struct in6_addr *, short prefix_len, | |
184 | uint64_t user_number, struct in6_addr *result, short result_len); | 224 | uint64_t user_number, struct in6_addr *result, short result_len); | |
185 | void ipv6_checkaddrflags(void *); | 225 | void ipv6_checkaddrflags(void *); | |
186 | int ipv6_addaddr(struct ipv6_addr *, const struct timeval *); | 226 | int ipv6_addaddr(struct ipv6_addr *, const struct timeval *); | |
187 | ssize_t ipv6_addaddrs(struct ipv6_addrhead *addrs); | 227 | ssize_t ipv6_addaddrs(struct ipv6_addrhead *addrs); | |
188 | void ipv6_freedrop_addrs(struct ipv6_addrhead *, int, | 228 | void ipv6_freedrop_addrs(struct ipv6_addrhead *, int, | |
189 | const struct interface *); | 229 | const struct interface *); | |
190 | void ipv6_handleifa(struct dhcpcd_ctx *ctx, int, struct if_head *, | 230 | void ipv6_handleifa(struct dhcpcd_ctx *ctx, int, struct if_head *, | |
191 | const char *, const struct in6_addr *, int); | 231 | const char *, const struct in6_addr *, uint8_t, int); | |
192 | int ipv6_handleifa_addrs(int, struct ipv6_addrhead *, | 232 | int ipv6_handleifa_addrs(int, struct ipv6_addrhead *, | |
193 | const struct in6_addr *, int); | 233 | const struct in6_addr *, int); | |
194 | const struct ipv6_addr *ipv6_iffindaddr(const struct interface *, | 234 | const struct ipv6_addr *ipv6_iffindaddr(const struct interface *, | |
195 | const struct in6_addr *); | 235 | const struct in6_addr *); | |
196 | struct ipv6_addr *ipv6_findaddr(struct dhcpcd_ctx *, | 236 | struct ipv6_addr *ipv6_findaddr(struct dhcpcd_ctx *, | |
197 | const struct in6_addr *, short); | 237 | const struct in6_addr *, short); | |
198 | #define ipv6_linklocal(ifp) (ipv6_iffindaddr((ifp), NULL)) | 238 | #define ipv6_linklocal(ifp) (ipv6_iffindaddr((ifp), NULL)) | |
199 | int ipv6_addlinklocalcallback(struct interface *, void (*)(void *), void *); | 239 | int ipv6_addlinklocalcallback(struct interface *, void (*)(void *), void *); | |
200 | void ipv6_free_ll_callbacks(struct interface *); | 240 | void ipv6_freedrop(struct interface *, int); | |
241 | #define ipv6_free(ifp) ipv6_freedrop(ifp, 0) | |||
242 | #define ipv6_drop(ifp) ipv6_freedrop(ifp, 2) | |||
243 | ||||
244 | #ifdef IPV6_MANAGETEMPADDR | |||
245 | void ipv6_gentempifid(struct interface *); | |||
246 | void ipv6_settempstale(struct interface *); | |||
247 | struct ipv6_addr *ipv6_createtempaddr(struct ipv6_addr *, | |||
248 | const struct timeval *); | |||
249 | struct ipv6_addr *ipv6_settemptime(struct ipv6_addr *, int); | |||
250 | void ipv6_addtempaddrs(struct interface *, const struct timeval *); | |||
251 | #else | |||
252 | #define ipv6_gentempifid(a) {} | |||
253 | #define ipv6_settempstale(a) {} | |||
254 | #endif | |||
255 | ||||
201 | int ipv6_start(struct interface *); | 256 | int ipv6_start(struct interface *); | |
202 | void ipv6_free(struct interface *); | |||
203 | void ipv6_ctxfree(struct dhcpcd_ctx *); | 257 | void ipv6_ctxfree(struct dhcpcd_ctx *); | |
204 | int ipv6_routedeleted(struct dhcpcd_ctx *, const struct rt6 *); | 258 | int ipv6_routedeleted(struct dhcpcd_ctx *, const struct rt6 *); | |
205 | int ipv6_removesubnet(struct interface *, struct ipv6_addr *); | 259 | int ipv6_removesubnet(struct interface *, struct ipv6_addr *); | |
206 | void ipv6_buildroutes(struct dhcpcd_ctx *); | 260 | void ipv6_buildroutes(struct dhcpcd_ctx *); | |
207 | 261 | |||
208 | #else | 262 | #else | |
209 | #define ipv6_init(a) NULL | 263 | #define ipv6_init(a) (NULL) | |
210 | #define ipv6_start(a) (-1) | 264 | #define ipv6_start(a) (-1) | |
211 | #define ipv6_free_ll_callbacks(a) | 265 | #define ipv6_free_ll_callbacks(a) {} | |
212 | #define ipv6_free(a) | 266 | #define ipv6_free(a) {} | |
213 | #define ipv6_ctxfree(a) | 267 | #define ipv6_drop(a) {} | |
268 | #define ipv6_ctxfree(a) {} | |||
269 | #define ipv6_gentempifid(a) {} | |||
214 | #endif | 270 | #endif | |
215 | 271 | |||
216 | #endif | 272 | #endif |
--- src/external/bsd/dhcpcd/dist/crypt/Attic/crypt.h 2014/12/29 16:18:05 1.1.1.2.2.1
+++ src/external/bsd/dhcpcd/dist/crypt/Attic/crypt.h 2015/02/05 15:13:12 1.1.1.2.2.2
@@ -1,18 +1,18 @@ | @@ -1,18 +1,18 @@ | |||
1 | /* $NetBSD: crypt.h,v 1.1.1.2.2.1 2014/12/29 16:18:05 martin Exp $ */ | 1 | /* $NetBSD: crypt.h,v 1.1.1.2.2.2 2015/02/05 15:13:12 martin Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * dhcpcd - DHCP client daemon | 4 | * dhcpcd - DHCP client daemon | |
5 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 5 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
6 | * All rights reserved | 6 | * All rights reserved | |
7 | 7 | |||
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * | 16 | * | |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
--- src/external/bsd/dhcpcd/dist/crypt/Attic/hmac_md5.c 2014/12/29 16:18:05 1.1.1.4.2.1
+++ src/external/bsd/dhcpcd/dist/crypt/Attic/hmac_md5.c 2015/02/05 15:13:12 1.1.1.4.2.2
@@ -1,19 +1,19 @@ | @@ -1,19 +1,19 @@ | |||
1 | #include <sys/cdefs.h> | 1 | #include <sys/cdefs.h> | |
2 | __RCSID("$NetBSD: hmac_md5.c,v 1.1.1.4.2.1 2014/12/29 16:18:05 martin Exp $"); | 2 | __RCSID("$NetBSD: hmac_md5.c,v 1.1.1.4.2.2 2015/02/05 15:13:12 martin Exp $"); | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * dhcpcd - DHCP client daemon | 5 | * dhcpcd - DHCP client daemon | |
6 | * Copyright (c) 2006-2014 Roy Marples <roy@marples.name> | 6 | * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> | |
7 | * All rights reserved | 7 | * All rights reserved | |
8 | 8 | |||
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |