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.5.5 with the follow...
details: https://anonhg.NetBSD.org/src/rev/98e8c037d461
branches: trunk
changeset: 778355:98e8c037d461
user: roy <roy%NetBSD.org@localhost>
date: Fri Mar 23 09:39:14 2012 +0000
description:
Import dhcpcd-5.5.5 with the following changes:
* We store the RA against the interface so we can do a comparsion
so we don't spam the log frequently.
* By default only fork on RA if it has a valid RDNSS option
* Add .Lk macros to the man pages
* Use correct event loop calls in RA handling code
* Fix several memory overrun issues
* Use CSR more than once
* Allow operation on Bridge and VLAN interfaces
diffstat:
external/bsd/dhcpcd/dist/defs.h | 2 +-
external/bsd/dhcpcd/dist/dhcp.c | 14 ++-
external/bsd/dhcpcd/dist/dhcp.h | 5 +-
external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu | 15 ++++-
external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname | 25 +++++++-
external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in | 7 +-
external/bsd/dhcpcd/dist/dhcpcd.c | 14 ++-
external/bsd/dhcpcd/dist/dhcpcd.conf.5.in | 17 ++++-
external/bsd/dhcpcd/dist/dhcpcd.h | 5 +-
external/bsd/dhcpcd/dist/if-options.c | 12 ++-
external/bsd/dhcpcd/dist/if-options.h | 65 ++++++++++----------
external/bsd/dhcpcd/dist/ipv6rs.c | 72 +++++++++++++++++++---
external/bsd/dhcpcd/dist/net.c | 22 ++++++-
external/bsd/dhcpcd/dist/platform-bsd.c | 6 +-
external/bsd/dhcpcd/dist/platform.h | 4 +-
15 files changed, 208 insertions(+), 77 deletions(-)
diffs (truncated from 722 to 300 lines):
diff -r d747e949f9da -r 98e8c037d461 external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h Fri Mar 23 09:34:09 2012 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h Fri Mar 23 09:39:14 2012 +0000
@@ -28,7 +28,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "5.5.4"
+#define VERSION "5.5.5"
#ifndef CONFIG
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
diff -r d747e949f9da -r 98e8c037d461 external/bsd/dhcpcd/dist/dhcp.c
--- a/external/bsd/dhcpcd/dist/dhcp.c Fri Mar 23 09:34:09 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.c Fri Mar 23 09:39:14 2012 +0000
@@ -772,7 +772,7 @@
* Otherwise we add static routes and then routers. */
struct rt *
get_option_routes(const struct dhcp_message *dhcp,
- const char *ifname, int *opts)
+ const char *ifname, unsigned long long *opts)
{
const uint8_t *p;
const uint8_t *e;
@@ -787,11 +787,13 @@
p = get_option(dhcp, DHO_MSCSR, &len, NULL);
if (p) {
routes = decode_rfc3442_rt(len, p);
- if (routes && !(*opts & DHCPCD_CSR_WARNED)) {
- syslog(LOG_DEBUG,
- "%s: using Classless Static Routes (RFC3442)",
- ifname);
- *opts |= DHCPCD_CSR_WARNED;
+ if (routes) {
+ if (!(*opts & DHCPCD_CSR_WARNED)) {
+ syslog(LOG_DEBUG,
+ "%s: using Classless Static Routes",
+ ifname);
+ *opts |= DHCPCD_CSR_WARNED;
+ }
return routes;
}
}
diff -r d747e949f9da -r 98e8c037d461 external/bsd/dhcpcd/dist/dhcp.h
--- a/external/bsd/dhcpcd/dist/dhcp.h Fri Mar 23 09:34:09 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.h Fri Mar 23 09:39:14 2012 +0000
@@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2011 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2012 Roy Marples <roy%marples.name@localhost>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
@@ -186,7 +186,8 @@
#define is_bootp(m) (m && \
!IN_LINKLOCAL(htonl((m)->yiaddr)) && \
get_option_uint8(NULL, m, DHO_MESSAGETYPE) == -1)
-struct rt *get_option_routes(const struct dhcp_message *, const char *, int *);
+struct rt *get_option_routes(const struct dhcp_message *, const char *,
+ unsigned long long *);
ssize_t decode_rfc3397(char *, ssize_t, int, const uint8_t *);
ssize_t configure_env(char **, const char *, const struct dhcp_message *,
const struct if_options *);
diff -r d747e949f9da -r 98e8c037d461 external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu
--- a/external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu Fri Mar 23 09:34:09 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu Fri Mar 23 09:39:14 2012 +0000
@@ -2,12 +2,23 @@
mtu_dir="$state_dir/mtu"
+set_mtu()
+{
+ local mtu=$1
+
+ if [ -w /sys/class/net/$interface/mtu ]; then
+ echo "$mtu" >/sys/class/net/$interface/mtu
+ else
+ ifconfig "$interface" mtu "$mtu"
+ fi
+}
+
if [ "$reason" = PREINIT -a -e "$mtu_dir/$interface" ]; then
rm "$mtu_dir/$interface"
elif [ -n "$new_interface_mtu" ] && $if_up; then
# The smalled MTU dhcpcd can work with is 576
if [ "$new_interface_mtu" -ge 576 ]; then
- if ifconfig "$interface" mtu "$new_interface_mtu"; then
+ if set_mtu "$new_interface_mtu"; then
syslog info "$interface: MTU set to $new_interface_mtu"
# Save the MTU so we can restore it later
if [ ! -e "$mtu_dir/$interface" ]; then
@@ -21,7 +32,7 @@
# No MTU in this state, so restore the prior MTU
mtu=$(cat "$mtu_dir/$interface")
syslog info "$interface: MTU restored to $mtu"
- ifconfig "$interface" mtu "$mtu"
+ set_mtu "$mtu"
rm "$mtu_dir/$interface"
fi
fi
diff -r d747e949f9da -r 98e8c037d461 external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname
--- a/external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname Fri Mar 23 09:34:09 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname Fri Mar 23 09:39:14 2012 +0000
@@ -1,12 +1,33 @@
# Set the hostname from DHCP data if required
+# Some systems don't have hostname(1)
+_hostname()
+{
+ local name=
+
+ if [ -z "$1" ]; then
+ if [ -r /proc/sys/kernel/hostname ]; then
+ read name </proc/sys/kernel/hostname && echo "$name"
+ else
+ hostname
+ fi
+ return $?
+ fi
+
+ if [ -w /proc/sys/kernel/hostname ]; then
+ echo "$1" >/proc/sys/kernel/hostname
+ else
+ hostname "$1"
+ fi
+}
+
need_hostname()
{
local hostname=""
case "$force_hostname" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1) ;;
- *) hostname="$(hostname)";;
+ *) hostname="$(_hostname)";;
esac
case "$hostname" in
""|"(none)"|localhost|localhost.localdomain)
@@ -21,7 +42,7 @@
try_hostname()
{
if valid_domainname "$1"; then
- hostname "$1"
+ _hostname "$1"
else
syslog err "Invalid hostname: $1"
fi
diff -r d747e949f9da -r 98e8c037d461 external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in
--- a/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in Fri Mar 23 09:34:09 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in Fri Mar 23 09:39:14 2012 +0000
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2006-2011 Roy Marples
+.\" Copyright (c) 2006-2012 Roy Marples
.\" All rights reserved
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd December 15, 2011
+.Dd March 19, 2012
.Dt DHCPCD-RUN-HOOKS 8 SMM
.Os
.Sh NAME
@@ -136,7 +136,8 @@
.Sh AUTHORS
.An Roy Marples Aq roy%marples.name@localhost
.Sh BUGS
-Please report them to http://roy.marples.name/projects/dhcpcd
+Please report them to
+.Lk http://roy.marples.name/projects/dhcpcd
.Sh SECURITY CONSIDERATIONS
Little validation of DHCP options is done in dhcpcd itself.
Instead, it is up to the hooks to handle any validation needed.
diff -r d747e949f9da -r 98e8c037d461 external/bsd/dhcpcd/dist/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/dhcpcd.c Fri Mar 23 09:34:09 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.c Fri Mar 23 09:39:14 2012 +0000
@@ -80,7 +80,7 @@
#define RELEASE_DELAY_S 0
#define RELEASE_DELAY_NS 10000000
-int options = 0;
+unsigned long long options = 0;
int pidfd = -1;
struct interface *ifaces = NULL;
int ifac = 0;
@@ -828,7 +828,7 @@
if (ifo->options & DHCPCD_CLIENTID)
syslog(LOG_DEBUG, "%s: using ClientID %s", iface->name,
hwaddr_ntoa(iface->clientid + 1, *iface->clientid));
- else
+ else if (iface->hwlen)
syslog(LOG_DEBUG, "%s: using hwaddr %s", iface->name,
hwaddr_ntoa(iface->hwaddr, iface->hwlen));
}
@@ -1162,8 +1162,12 @@
free(iface->state->offer);
iface->state->offer = NULL;
- if (options & DHCPCD_IPV6RS && ifo->options & DHCPCD_IPV6RS)
- ipv6rs_start(iface);
+ if (options & DHCPCD_IPV6RS && ifo->options & DHCPCD_IPV6RS) {
+ if (check_ipv6(iface->name) == 1)
+ ipv6rs_start(iface);
+ else
+ ifo->options &= ~DHCPCD_IPV6RS;
+ }
if (iface->state->arping_index < ifo->arping_len) {
start_arping(iface);
@@ -1993,7 +1997,7 @@
}
#endif
- if (options & DHCPCD_IPV6RS && !check_ipv6())
+ if (options & DHCPCD_IPV6RS && !check_ipv6(NULL))
options &= ~DHCPCD_IPV6RS;
if (options & DHCPCD_IPV6RS) {
ipv6rsfd = ipv6rs_open();
diff -r d747e949f9da -r 98e8c037d461 external/bsd/dhcpcd/dist/dhcpcd.conf.5.in
--- a/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in Fri Mar 23 09:34:09 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in Fri Mar 23 09:39:14 2012 +0000
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2006-2011 Roy Marples
+.\" Copyright (c) 2006-2012 Roy Marples
.\" All rights reserved
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd December 15, 2011
+.Dd March 19, 2012
.Dt DHCPCD.CONF 5 SMM
.Os
.Sh NAME
@@ -144,6 +144,16 @@
.It Ic interface Ar interface
Subsequent options are only parsed for this
.Ar interface .
+.It Ic ipv6ra_fork
+By default, when
+.Nm dhcpcd
+receives an IPv6 RA,
+.Nm dhcpcd
+will only fork to the background if the RA contains at least one unexpired
+RDNSS option.
+Set this option so to make
+.Nm dhcpcd
+always fork on an RA.
.It Ic leasetime Ar seconds
Request a leasetime of
.Ar seconds .
@@ -295,4 +305,5 @@
.Sh AUTHORS
.An Roy Marples Aq roy%marples.name@localhost
.Sh BUGS
-Please report them to http://roy.marples.name/projects/dhcpcd
+Please report them to
+.Lk http://roy.marples.name/projects/dhcpcd
diff -r d747e949f9da -r 98e8c037d461 external/bsd/dhcpcd/dist/dhcpcd.h
--- a/external/bsd/dhcpcd/dist/dhcpcd.h Fri Mar 23 09:34:09 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.h Fri Mar 23 09:39:14 2012 +0000
@@ -92,6 +92,8 @@
struct ra {
struct in6_addr from;
char sfrom[INET6_ADDRSTRLEN];
+ unsigned char *data;
+ ssize_t data_len;
struct timeval received;
uint32_t lifetime;
struct in6_addr prefix;
@@ -100,6 +102,7 @@
uint32_t prefix_pltime;
char sprefix[INET6_ADDRSTRLEN];
struct ra_opt *options;
+ int expired;
struct ra *next;
};
@@ -140,7 +143,7 @@
};
extern int pidfd;
-extern int options;
+extern unsigned long long options;
extern int ifac;
extern char **ifav;
extern int ifdc;
diff -r d747e949f9da -r 98e8c037d461 external/bsd/dhcpcd/dist/if-options.c
--- a/external/bsd/dhcpcd/dist/if-options.c Fri Mar 23 09:34:09 2012 +0000
+++ b/external/bsd/dhcpcd/dist/if-options.c Fri Mar 23 09:39:14 2012 +0000
@@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2011 Roy Marples <roy%marples.name@localhost>
+ * Copyright (c) 2006-2012 Roy Marples <roy%marples.name@localhost>
Home |
Main Index |
Thread Index |
Old Index