Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/dhcpcd/dist Import dhcpcd-5.6.6 with the follow...
details: https://anonhg.NetBSD.org/src/rev/1f6c9734e4f1
branches: trunk
changeset: 783400:1f6c9734e4f1
user: roy <roy%NetBSD.org@localhost>
date: Wed Dec 19 09:41:09 2012 +0000
description:
Import dhcpcd-5.6.6 with the following changes:
* Grow -4, --ipv4only and -6, --ipv6only options
* Respect AUTO and ONLINK flags for each prefix in the RA
diffstat:
external/bsd/dhcpcd/dist/defs.h | 2 +-
external/bsd/dhcpcd/dist/dhcpcd.c | 5 +++
external/bsd/dhcpcd/dist/dhcpcd.conf.5.in | 12 +++++--
external/bsd/dhcpcd/dist/if-options.c | 15 ++++++++-
external/bsd/dhcpcd/dist/if-options.h | 3 +-
external/bsd/dhcpcd/dist/ipv6.c | 6 +++
external/bsd/dhcpcd/dist/ipv6.h | 3 +-
external/bsd/dhcpcd/dist/ipv6rs.c | 47 ++++++++++++++++++++++++------
8 files changed, 74 insertions(+), 19 deletions(-)
diffs (265 lines):
diff -r af91a1281930 -r 1f6c9734e4f1 external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h Wed Dec 19 07:54:41 2012 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h Wed Dec 19 09:41:09 2012 +0000
@@ -28,7 +28,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "5.6.4"
+#define VERSION "5.6.6"
#ifndef CONFIG
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
diff -r af91a1281930 -r 1f6c9734e4f1 external/bsd/dhcpcd/dist/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/dhcpcd.c Wed Dec 19 07:54:41 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.c Wed Dec 19 09:41:09 2012 +0000
@@ -819,6 +819,9 @@
free(iface->clientid);
iface->clientid = NULL;
+ if (!(ifo->options & DHCPCD_IPV4))
+ return;
+
if (*ifo->clientid) {
iface->clientid = xmalloc(ifo->clientid[0] + 1);
memcpy(iface->clientid, ifo->clientid, ifo->clientid[0] + 1);
@@ -1206,6 +1209,8 @@
start_static(iface);
return;
}
+ if (!(ifo->options & DHCPCD_IPV4))
+ return;
if (ifo->options & DHCPCD_INFORM) {
start_inform(iface);
return;
diff -r af91a1281930 -r 1f6c9734e4f1 external/bsd/dhcpcd/dist/dhcpcd.conf.5.in
--- a/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in Wed Dec 19 07:54:41 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in Wed Dec 19 09:41:09 2012 +0000
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd May 21, 2012
+.Dd October 11, 2012
.Dt DHCPCD.CONF 5 SMM
.Os
.Sh NAME
@@ -133,6 +133,10 @@
If
.Ar hostname
is a FQDN (ie, contains a .) then it will be encoded as such.
+.It Ic ipv4only
+Only configure IPv4.
+.It Ic ipv6only
+Only configure IPv6.
.It Ic fqdn Op none | ptr | both
none disables FQDN encoding, ptr just asks the DHCP server to update the PTR
record of the host in DNS whereas both also updates the A record.
@@ -154,15 +158,15 @@
Set this option so to make
.Nm dhcpcd
always fork on an RA.
-.It ic ipv6ra_own
+.It Ic ipv6ra_own
Disables kernel IPv6 Router Advertisment processing so dhcpcd can manage
addresses and routes.
-.It ic ipv6ra_own_default
+.It Ic ipv6ra_own_default
Each time dhcpcd receives an IPv6 Router Adveristment, dhcpcd will manage
the default route only.
This allows dhcpcd to prefer an interface for outbound traffic based on metric
and/or user selection rather than the kernel.
-.It ic ipv6rs
+.It Ic ipv6rs
Enables IPv6 Router Advertisment solicitation.
This is on by default, but is documented here in the case where it is disabled
globally but needs to be enabled for one interface.
diff -r af91a1281930 -r 1f6c9734e4f1 external/bsd/dhcpcd/dist/if-options.c
--- a/external/bsd/dhcpcd/dist/if-options.c Wed Dec 19 07:54:41 2012 +0000
+++ b/external/bsd/dhcpcd/dist/if-options.c Wed Dec 19 09:41:09 2012 +0000
@@ -115,6 +115,8 @@
{"ipv6ra_fork", no_argument, NULL, O_IPV6RA_FORK},
{"ipv6ra_own", no_argument, NULL, O_IPV6RA_OWN},
{"ipv6ra_own_default", no_argument, NULL, O_IPV6RA_OWN_D},
+ {"ipv4only", no_argument, NULL, '4'},
+ {"ipv6only", no_argument, NULL, '6'},
{NULL, 0, NULL, '\0'}
};
@@ -731,6 +733,14 @@
case 'Z':
ifdv = splitv(&ifdc, ifdv, arg);
break;
+ case '4':
+ ifo->options &= ~(DHCPCD_IPV6 | DHCPCD_IPV6RS);
+ ifo->options |= DHCPCD_IPV4;
+ break;
+ case '6':
+ ifo->options &= ~DHCPCD_IPV4;
+ ifo->options |= DHCPCD_IPV6 | DHCPCD_IPV6RS;
+ break;
case O_ARPING:
if (parse_addr(&addr, NULL, arg) != 0)
return -1;
@@ -810,9 +820,10 @@
/* Seed our default options */
ifo = xzalloc(sizeof(*ifo));
+ ifo->options |= DHCPCD_IPV4 | DHCPCD_IPV4LL;
ifo->options |= DHCPCD_GATEWAY | DHCPCD_DAEMONISE | DHCPCD_LINK;
- ifo->options |= DHCPCD_ARP | DHCPCD_IPV4LL;
- ifo->options |= DHCPCD_IPV6RS | DHCPCD_IPV6RA_REQRDNSS;
+ ifo->options |= DHCPCD_ARP;
+ ifo->options |= DHCPCD_IPV6 | DHCPCD_IPV6RS | DHCPCD_IPV6RA_REQRDNSS;
ifo->timeout = DEFAULT_TIMEOUT;
ifo->reboot = DEFAULT_REBOOT;
ifo->metric = -1;
diff -r af91a1281930 -r 1f6c9734e4f1 external/bsd/dhcpcd/dist/if-options.h
--- a/external/bsd/dhcpcd/dist/if-options.h Wed Dec 19 07:54:41 2012 +0000
+++ b/external/bsd/dhcpcd/dist/if-options.h Wed Dec 19 09:41:09 2012 +0000
@@ -37,7 +37,7 @@
/* Don't set any optional arguments here so we retain POSIX
* compatibility with getopt */
-#define IF_OPTS "bc:de:f:gh:i:kl:m:no:pqr:s:t:u:v:wxy:z:ABC:DEF:GHI:JKLO:Q:S:TUVW:X:Z:"
+#define IF_OPTS "46bc:de:f:gh:i:kl:m:no:pqr:s:t:u:v:wxy:z:ABC:DEF:GHI:JKLO:Q:S:TUVW:X:Z:"
#define DEFAULT_TIMEOUT 30
#define DEFAULT_REBOOT 5
@@ -83,6 +83,7 @@
#define DHCPCD_IPV6RA_OWN_DEFAULT (1ULL << 34)
#define DHCPCD_IPV4 (1ULL << 35)
#define DHCPCD_FORKED (1ULL << 36)
+#define DHCPCD_IPV6 (1ULL << 37)
extern const struct option cf_options[];
diff -r af91a1281930 -r 1f6c9734e4f1 external/bsd/dhcpcd/dist/ipv6.c
--- a/external/bsd/dhcpcd/dist/ipv6.c Wed Dec 19 07:54:41 2012 +0000
+++ b/external/bsd/dhcpcd/dist/ipv6.c Wed Dec 19 09:41:09 2012 +0000
@@ -384,7 +384,11 @@
#else
if (!find_route6(routes, rt))
#endif
+ {
r = del_route6(rt);
+ if (r == -1 && errno == ESRCH)
+ r = 0;
+ }
free(rt);
}
return r;
@@ -410,6 +414,8 @@
TAILQ_FOREACH(rap, &ipv6_routers, next) {
if (options & DHCPCD_IPV6RA_OWN) {
TAILQ_FOREACH(addr, &rap->addrs, next) {
+ if (!addr->onlink)
+ continue;
rt = make_prefix(rap, addr);
if (rt)
TAILQ_INSERT_TAIL(&dnr, rt, next);
diff -r af91a1281930 -r 1f6c9734e4f1 external/bsd/dhcpcd/dist/ipv6.h
--- a/external/bsd/dhcpcd/dist/ipv6.h Wed Dec 19 07:54:41 2012 +0000
+++ b/external/bsd/dhcpcd/dist/ipv6.h Wed Dec 19 09:41:09 2012 +0000
@@ -46,7 +46,8 @@
uint32_t prefix_vltime;
uint32_t prefix_pltime;
struct in6_addr addr;
- int new;
+ uint8_t onlink;
+ uint8_t new;
char saddr[INET6_ADDRSTRLEN];
};
diff -r af91a1281930 -r 1f6c9734e4f1 external/bsd/dhcpcd/dist/ipv6rs.c
--- a/external/bsd/dhcpcd/dist/ipv6rs.c Wed Dec 19 07:54:41 2012 +0000
+++ b/external/bsd/dhcpcd/dist/ipv6rs.c Wed Dec 19 09:41:09 2012 +0000
@@ -291,6 +291,7 @@
* This is safe because the RA is removed from the list
* before we are called. */
if (drop && (options & DHCPCD_IPV6RA_OWN) &&
+ !IN6_IS_ADDR_UNSPECIFIED(&ap->addr) &&
!ipv6rs_addrexists(ap))
{
syslog(LOG_INFO, "%s: deleting address %s",
@@ -568,21 +569,41 @@
sizeof(ap->prefix.s6_addr)) == 0)
break;
if (ap == NULL) {
+ /* As we haven't added the prefix before
+ * check if we can make an address with it */
+ if (!(pi->nd_opt_pi_flags_reserved &
+ ND_OPT_PI_FLAG_AUTO) &&
+ !(pi->nd_opt_pi_flags_reserved &
+ ND_OPT_PI_FLAG_ONLINK))
+ break;
ap = xmalloc(sizeof(*ap));
ap->new = 1;
+ ap->onlink = 0;
ap->prefix_len = pi->nd_opt_pi_prefix_len;
memcpy(ap->prefix.s6_addr,
pi->nd_opt_pi_prefix.s6_addr,
sizeof(ap->prefix.s6_addr));
- ipv6_makeaddr(&ap->addr, ifp->name,
- &ap->prefix, pi->nd_opt_pi_prefix_len);
- cbp = inet_ntop(AF_INET6, ap->addr.s6_addr,
- ntopbuf, INET6_ADDRSTRLEN);
- if (cbp)
- snprintf(ap->saddr, sizeof(ap->saddr),
- "%s/%d", cbp, ap->prefix_len);
- else
+ if (pi->nd_opt_pi_flags_reserved &
+ ND_OPT_PI_FLAG_AUTO)
+ {
+ ipv6_makeaddr(&ap->addr, ifp->name,
+ &ap->prefix,
+ pi->nd_opt_pi_prefix_len);
+ cbp = inet_ntop(AF_INET6,
+ ap->addr.s6_addr,
+ ntopbuf, INET6_ADDRSTRLEN);
+ if (cbp)
+ snprintf(ap->saddr,
+ sizeof(ap->saddr),
+ "%s/%d",
+ cbp, ap->prefix_len);
+ else
+ ap->saddr[0] = '\0';
+ } else {
+ memset(ap->addr.s6_addr, 0,
+ sizeof(ap->addr.s6_addr));
ap->saddr[0] = '\0';
+ }
TAILQ_INSERT_TAIL(&rap->addrs, ap, next);
} else if (ap->prefix_vltime !=
ntohl(pi->nd_opt_pi_valid_time) ||
@@ -591,6 +612,10 @@
ap->new = 1;
else
ap->new = 0;
+ /* onlink should not change from on to off */
+ if (pi->nd_opt_pi_flags_reserved &
+ ND_OPT_PI_FLAG_ONLINK)
+ ap->onlink = 1;
ap->prefix_vltime =
ntohl(pi->nd_opt_pi_valid_time);
ap->prefix_pltime =
@@ -722,7 +747,8 @@
add_router(rap);
if (options & DHCPCD_IPV6RA_OWN && !(options & DHCPCD_TEST)) {
TAILQ_FOREACH(ap, &rap->addrs, next) {
- if (ap->prefix_vltime == 0)
+ if (ap->prefix_vltime == 0 ||
+ IN6_IS_ADDR_UNSPECIFIED(&ap->addr))
continue;
syslog(ap->new ? LOG_INFO : LOG_DEBUG,
"%s: adding address %s",
@@ -774,7 +800,8 @@
handle_flag:
if (rap->flags & (ND_RA_FLAG_MANAGED | ND_RA_FLAG_OTHER)) {
if (new_data)
- syslog(LOG_WARNING, "%s: no support for DHCPv6 management",
+ syslog(LOG_WARNING,
+ "%s: no support for DHCPv6 management",
ifp->name);
if (options & DHCPCD_TEST)
exit(EXIT_SUCCESS);
Home |
Main Index |
Thread Index |
Old Index