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 Sync
details: https://anonhg.NetBSD.org/src/rev/ade18197155b
branches: trunk
changeset: 332544:ade18197155b
user: roy <roy%NetBSD.org@localhost>
date: Sat Sep 27 01:17:34 2014 +0000
description:
Sync
diffstat:
external/bsd/dhcpcd/dist/dhcp.c | 27 ++++++++++------
external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in | 12 ++++--
external/bsd/dhcpcd/dist/dhcpcd.8.in | 32 ++++++++++++++++++-
external/bsd/dhcpcd/dist/dhcpcd.c | 42 +++++++++++--------------
external/bsd/dhcpcd/dist/if-bsd.c | 42 ++++++++++++++++---------
external/bsd/dhcpcd/dist/script.c | 6 ++-
6 files changed, 105 insertions(+), 56 deletions(-)
diffs (truncated from 350 to 300 lines):
diff -r e7da9c24a801 -r ade18197155b external/bsd/dhcpcd/dist/dhcp.c
--- a/external/bsd/dhcpcd/dist/dhcp.c Sat Sep 27 01:14:51 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.c Sat Sep 27 01:17:34 2014 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.16 2014/09/16 22:27:04 roy Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.17 2014/09/27 01:17:34 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -1204,7 +1204,7 @@
struct dhcp_opt *opt, *vo;
size_t e, i, pl;
char **ep;
- char cidr[4];
+ char cidr[4], safe[(BOOTFILE_LEN * 4) + 1];
uint8_t overl = 0;
uint32_t en;
@@ -1271,11 +1271,16 @@
setvar(&ep, prefix, "network_number", inet_ntoa(addr));
}
- if (*dhcp->bootfile && !(overl & 1))
- setvar(&ep, prefix, "filename", (const char *)dhcp->bootfile);
- if (*dhcp->servername && !(overl & 2))
- setvar(&ep, prefix, "server_name",
- (const char *)dhcp->servername);
+ if (*dhcp->bootfile && !(overl & 1)) {
+ print_string(safe, sizeof(safe),
+ dhcp->bootfile, sizeof(dhcp->bootfile));
+ setvar(&ep, prefix, "filename", safe);
+ }
+ if (*dhcp->servername && !(overl & 2)) {
+ print_string(safe, sizeof(safe),
+ dhcp->servername, sizeof(dhcp->servername));
+ setvar(&ep, prefix, "server_name", safe);
+ }
/* Zero our indexes */
if (env) {
@@ -2184,7 +2189,7 @@
const struct in_addr *from, int ad)
{
const char *tfrom;
- char *a;
+ char *a, sname[sizeof(dhcp->servername) * 4];
struct in_addr addr;
int r;
@@ -2203,12 +2208,14 @@
tfrom = "from";
r = get_option_addr(iface->ctx, &addr, dhcp, DHO_SERVERID);
if (dhcp->servername[0] && r == 0) {
+ print_string(sname, sizeof(sname),
+ dhcp->servername, strlen((const char *)dhcp->servername));
if (a == NULL)
syslog(lvl, "%s: %s %s %s `%s'", iface->name, msg,
- tfrom, inet_ntoa(addr), dhcp->servername);
+ tfrom, inet_ntoa(addr), sname);
else
syslog(lvl, "%s: %s %s %s %s `%s'", iface->name, msg, a,
- tfrom, inet_ntoa(addr), dhcp->servername);
+ tfrom, inet_ntoa(addr), sname);
} else {
if (r != 0) {
tfrom = "via";
diff -r e7da9c24a801 -r ade18197155b external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in
--- a/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in Sat Sep 27 01:14:51 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in Sat Sep 27 01:17:34 2014 +0000
@@ -1,5 +1,5 @@
-.\" $NetBSD: dhcpcd-run-hooks.8.in,v 1.6 2014/09/16 22:27:04 roy Exp $
-.\" Copyright (c) 2006-2013 Roy Marples
+.\" $NetBSD: dhcpcd-run-hooks.8.in,v 1.7 2014/09/27 01:17:34 roy Exp $
+.\" Copyright (c) 2006-2014 Roy Marples
.\" All rights reserved
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd September 12, 2014
+.Dd September 26, 2014
.Dt DHCPCD-RUN-HOOKS 8
.Os
.Sh NAME
@@ -90,6 +90,8 @@
dhcpcd has rebound to a new DHCP server.
.It Dv REBOOT | Dv REBOOT6
dhcpcd successfully requested a lease from a DHCP server.
+.It Dv DELEGATED6
+dhcpcd assigned a delegated prefix to the interface.
.It Dv IPV4LL
dhcpcd failed to contact any DHCP servers but did obtain an IPV4LL address.
.It Dv STATIC
@@ -135,7 +137,7 @@
.Ev $RC_SVCNAME .
The following variables will then be set, along with any protocol supplied
ones.
-.Bl -tag -width Xinterface_order
+.Bl -tag -width xnew_dhcp6_prefix
.It Ev $interface
the name of the interface.
.It Ev $reason
@@ -197,6 +199,8 @@
the name of the SSID the
.Ev interface
was connected to.
+.It Ev $new_dhcp6_prefix
+space separated list of delegated prefixes.
.El
.Sh FILES
When
diff -r e7da9c24a801 -r ade18197155b external/bsd/dhcpcd/dist/dhcpcd.8.in
--- a/external/bsd/dhcpcd/dist/dhcpcd.8.in Sat Sep 27 01:14:51 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.8.in Sat Sep 27 01:17:34 2014 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: dhcpcd.8.in,v 1.30 2014/09/16 22:27:04 roy Exp $
+.\" $NetBSD: dhcpcd.8.in,v 1.31 2014/09/27 01:17:34 roy Exp $
.\" Copyright (c) 2006-2014 Roy Marples
.\" All rights reserved
.\"
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd September 15, 2014
+.Dd September 26, 2014
.Dt DHCPCD 8
.Os
.Sh NAME
@@ -204,6 +204,17 @@
for details on how these scripts work.
.Nm
currently ignores the exit code of the script.
+.Pp
+.Nm
+sanitises each variable passed from the DHCP/RA message by encoding non
+printable characters in escaped octal and escaping the following characters:
+.D1 | \*[Am] \&; \*[Lt] \*[Gt] \&( \&) $ ` \e \*q ' \
+\*[Lt]tab\*[Gt] \*[Lt]newline\*[Gt]
+.Pp
+It is possible to reverse this encoding by passing the variable to
+.Xr unvis 1 ,
+like so:
+.D1 printf \*q%s\*q \*qvariable_name\*q | unvis
.Ss Fine tuning
You can fine-tune the behaviour of
.Nm
@@ -632,6 +643,23 @@
so that
.Nm
knows which process to signal.
+.Pp
+.Nm
+sanitises variables using the
+.Xr svis 3
+function with the
+.Dv VIS_CTYPE
+and
+.Dv VIS_OCTAL
+flags which your libc may provide,
+or it's own compatible one if not.
+Some
+.Xr unvis 1
+implementations may not decode either correctly, depending on how they
+handle VIS_CTYPE in both
+.Xr vis 3
+and
+.Xr unvis 3 .
.Sh FILES
.Bl -ohang
.It Pa @SYSCONFDIR@/dhcpcd.conf
diff -r e7da9c24a801 -r ade18197155b external/bsd/dhcpcd/dist/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/dhcpcd.c Sat Sep 27 01:14:51 2014 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.c Sat Sep 27 01:17:34 2014 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcpcd.c,v 1.9 2014/09/18 20:46:30 roy Exp $");
+ __RCSID("$NetBSD: dhcpcd.c,v 1.10 2014/09/27 01:17:34 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -457,27 +457,23 @@
}
#ifdef INET6
- if (ifo->options & DHCPCD_IPV6) {
- if (ifo->ia == NULL) {
- ifo->ia = malloc(sizeof(*ifo->ia));
- if (ifo->ia == NULL)
- syslog(LOG_ERR, "%s: %m", __func__);
- else {
- ifo->ia_len = 1;
- ifo->ia->ia_type = D6_OPTION_IA_NA;
+ if (ifo->ia == NULL && ifo->options & DHCPCD_IPV6) {
+ ifo->ia = malloc(sizeof(*ifo->ia));
+ if (ifo->ia == NULL)
+ syslog(LOG_ERR, "%s: %m", __func__);
+ else {
+ ifo->ia_len = 1;
+ ifo->ia->ia_type = D6_OPTION_IA_NA;
+ memcpy(ifo->ia->iaid, ifo->iaid, sizeof(ifo->iaid));
+ memset(&ifo->ia->addr, 0, sizeof(ifo->ia->addr));
+ ifo->ia->sla = NULL;
+ ifo->ia->sla_len = 0;
+ }
+ } else {
+ for (i = 0; i < ifo->ia_len; i++) {
+ if (!ifo->ia[i].iaid_set)
memcpy(ifo->ia->iaid, ifo->iaid,
sizeof(ifo->iaid));
- memset(&ifo->ia->addr, 0,
- sizeof(ifo->ia->addr));
- ifo->ia->sla = NULL;
- ifo->ia->sla_len = 0;
- }
- } else {
- for (i = 0; i < ifo->ia_len; i++) {
- if (!ifo->ia[i].iaid_set)
- memcpy(ifo->ia->iaid, ifo->iaid,
- sizeof(ifo->iaid));
- }
}
}
#endif
@@ -1058,7 +1054,7 @@
}
static int
-signal_init(void (*func)(int, siginfo_t *, void *), sigset_t *oldset)
+signal_init(sigset_t *oldset)
{
unsigned int i;
struct sigaction sa;
@@ -1069,7 +1065,7 @@
return -1;
memset(&sa, 0, sizeof(sa));
- sa.sa_sigaction = func;
+ sa.sa_sigaction = handle_signal;
sa.sa_flags = SA_SIGINFO;
sigemptyset(&sa.sa_mask);
@@ -1606,7 +1602,7 @@
ctx.options |= DHCPCD_STARTED;
#ifdef USE_SIGNALS
/* Save signal mask, block and redirect signals to our handler */
- if (signal_init(handle_signal, &ctx.sigset) == -1) {
+ if (signal_init(&ctx.sigset) == -1) {
syslog(LOG_ERR, "signal_setup: %m");
goto exit_failure;
}
diff -r e7da9c24a801 -r ade18197155b external/bsd/dhcpcd/dist/if-bsd.c
--- a/external/bsd/dhcpcd/dist/if-bsd.c Sat Sep 27 01:14:51 2014 +0000
+++ b/external/bsd/dhcpcd/dist/if-bsd.c Sat Sep 27 01:17:34 2014 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: if-bsd.c,v 1.9 2014/09/18 20:46:30 roy Exp $");
+ __RCSID("$NetBSD: if-bsd.c,v 1.10 2014/09/27 01:17:34 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -88,12 +88,12 @@
#endif
#define COPYOUT(sin, sa) \
- sin.s_addr = ((sa) != NULL) ? \
- (((struct sockaddr_in *)(void *)sa)->sin_addr).s_addr : 0
+ if ((sa) && (sa)->sa_family == AF_INET) \
+ (sin) = ((struct sockaddr_in*)(void *)(sa))->sin_addr
#define COPYOUT6(sin, sa) \
- sin.s6_addr = ((sa) != NULL) ? \
- (((struct sockaddr_in6 *)(void *)sa)->sin6_addr).s6_addr : 0
+ if ((sa) && (sa)->sa_family == AF_INET6) \
+ (sin) = ((struct sockaddr_in6*)(void *)(sa))->sin6_addr
#ifndef CLLADDR
# define CLLADDR(s) ((const char *)((s)->sdl_data + (s)->sdl_nlen))
@@ -786,6 +786,7 @@
struct rt rt;
#endif
#ifdef INET6
+ struct rt6 rt6;
struct in6_addr ia6;
struct sockaddr_in6 *sin6;
int ifa_flags;
@@ -849,18 +850,29 @@
break;
cp = (char *)(void *)(rtm + 1);
sa = (struct sockaddr *)(void *)cp;
- if (sa->sa_family != AF_INET)
- break;
+ get_addrs(rtm->rtm_addrs, cp, rti_info);
+ switch (sa->sa_family) {
#ifdef INET
- get_addrs(rtm->rtm_addrs, cp, rti_info);
- memset(&rt, 0, sizeof(rt));
Home |
Main Index |
Thread Index |
Old Index