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.2 with the follow...
details: https://anonhg.NetBSD.org/src/rev/1fc3d5c3797a
branches: trunk
changeset: 773468:1fc3d5c3797a
user: roy <roy%NetBSD.org@localhost>
date: Thu Feb 02 23:35:40 2012 +0000
description:
Import dhcpcd-5.5.2 with the following changes:
* Stop checking IFF_RUNNING in RTM_IFINFO in an unknown link state
* RA expiry now tiggers off the first option if newer than the prefix
* Prefer a DHCP lease over an IPv4LL one
diffstat:
external/bsd/dhcpcd/dist/common.c | 11 ++-
external/bsd/dhcpcd/dist/configure.c | 51 ++++++++++++-----
external/bsd/dhcpcd/dist/configure.h | 6 +-
external/bsd/dhcpcd/dist/defs.h | 4 +-
external/bsd/dhcpcd/dist/dhcp.c | 2 +-
external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf | 6 +-
external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in | 8 --
external/bsd/dhcpcd/dist/dhcpcd.c | 20 ++++--
external/bsd/dhcpcd/dist/if-bsd.c | 15 ++++-
external/bsd/dhcpcd/dist/if-pref.c | 6 +-
external/bsd/dhcpcd/dist/ipv6rs.c | 59 +++++++++++--------
11 files changed, 114 insertions(+), 74 deletions(-)
diffs (truncated from 488 to 300 lines):
diff -r 69dba7c00217 -r 1fc3d5c3797a external/bsd/dhcpcd/dist/common.c
--- a/external/bsd/dhcpcd/dist/common.c Thu Feb 02 22:49:17 2012 +0000
+++ b/external/bsd/dhcpcd/dist/common.c Thu Feb 02 23:35:40 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
@@ -203,10 +203,15 @@
ssize_t
setvar(char ***e, const char *prefix, const char *var, const char *value)
{
- size_t len = strlen(prefix) + strlen(var) + strlen(value) + 4;
+ size_t len = strlen(var) + strlen(value) + 3;
+ if (prefix)
+ len += strlen(prefix) + 1;
**e = xmalloc(len);
- snprintf(**e, len, "%s_%s=%s", prefix, var, value);
+ if (prefix)
+ snprintf(**e, len, "%s_%s=%s", prefix, var, value);
+ else
+ snprintf(**e, len, "%s=%s", var, value);
(*e)++;
return len;
}
diff -r 69dba7c00217 -r 1fc3d5c3797a external/bsd/dhcpcd/dist/configure.c
--- a/external/bsd/dhcpcd/dist/configure.c Thu Feb 02 22:49:17 2012 +0000
+++ b/external/bsd/dhcpcd/dist/configure.c Thu Feb 02 23:35:40 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
@@ -163,7 +163,7 @@
}
static ssize_t
-make_env(const struct interface *iface, char ***argv)
+make_env(const struct interface *iface, const char *reason, char ***argv)
{
char **env, *p;
ssize_t e, elen, l;
@@ -171,9 +171,8 @@
const struct interface *ifp;
int dhcp, ra;
- dhcp = 0;
- ra = 0;
- if (strcmp(iface->state->reason, "ROUTERADVERT") == 0)
+ dhcp = ra = 0;
+ if (strcmp(reason, "ROUTERADVERT") == 0)
ra = 1;
else
dhcp = 1;
@@ -183,16 +182,16 @@
if (options & DHCPCD_DUMPLEASE)
elen = 2;
else
- elen = 8;
+ elen = 10;
/* Make our env */
env = xmalloc(sizeof(char *) * (elen + 1));
e = strlen("interface") + strlen(iface->name) + 2;
env[0] = xmalloc(e);
snprintf(env[0], e, "interface=%s", iface->name);
- e = strlen("reason") + strlen(iface->state->reason) + 2;
+ e = strlen("reason") + strlen(reason) + 2;
env[1] = xmalloc(e);
- snprintf(env[1], e, "reason=%s", iface->state->reason);
+ snprintf(env[1], e, "reason=%s", reason);
if (options & DHCPCD_DUMPLEASE)
goto dumplease;
@@ -222,6 +221,13 @@
e--;
}
*--p = '\0';
+ if ((dhcp && iface->state->new) || (ra && iface->ras)) {
+ env[8] = strdup("if_up=true");
+ env[9] = strdup("if_down=false");
+ } else {
+ env[8] = strdup("if_up=false");
+ env[9] = strdup("if_down=true");
+ }
if (*iface->state->profile) {
e = strlen("profile=") + strlen(iface->state->profile) + 2;
env[elen] = xmalloc(e);
@@ -270,7 +276,7 @@
e = ipv6rs_env(NULL, NULL, iface);
if (e > 0) {
env = xrealloc(env, sizeof(char *) * (elen + e + 1));
- elen += ipv6rs_env(env + elen, "new", iface);
+ elen += ipv6rs_env(env + elen, NULL, iface);
}
}
@@ -293,8 +299,8 @@
return elen;
}
-int
-send_interface(int fd, const struct interface *iface)
+static int
+send_interface1(int fd, const struct interface *iface, const char *reason)
{
char **env, **ep, *s;
ssize_t elen;
@@ -302,7 +308,7 @@
int retval;
retval = 0;
- make_env(iface, &env);
+ make_env(iface, reason, &env);
elen = arraytostr((const char *const *)env, &s);
iov[0].iov_base = &elen;
iov[0].iov_len = sizeof(ssize_t);
@@ -318,7 +324,20 @@
}
int
-run_script(const struct interface *iface)
+send_interface(int fd, const struct interface *iface)
+{
+ int retval = 0;
+ if (send_interface1(fd, iface, iface->state->reason) == -1)
+ retval = -1;
+ if (iface->ras) {
+ if (send_interface1(fd, iface, "ROUTERADVERT") == -1)
+ retval = -1;
+ }
+ return retval;
+}
+
+int
+run_script_reason(const struct interface *iface, const char *reason)
{
char *const argv[2] = { UNCONST(iface->state->options->script), NULL };
char **env = NULL, **ep;
@@ -334,11 +353,13 @@
strcmp(iface->state->options->script, "/dev/null") == 0)
return 0;
+ if (reason == NULL)
+ reason = iface->state->reason;
syslog(LOG_DEBUG, "%s: executing `%s', reason %s",
- iface->name, argv[0], iface->state->reason);
+ iface->name, argv[0], reason);
/* Make our env */
- elen = make_env(iface, &env);
+ elen = make_env(iface, reason, &env);
env = xrealloc(env, sizeof(char *) * (elen + 2));
/* Add path to it */
path = getenv("PATH");
diff -r 69dba7c00217 -r 1fc3d5c3797a external/bsd/dhcpcd/dist/configure.h
--- a/external/bsd/dhcpcd/dist/configure.h Thu Feb 02 22:49:17 2012 +0000
+++ b/external/bsd/dhcpcd/dist/configure.h Thu Feb 02 23:35:40 2012 +0000
@@ -1,6 +1,6 @@
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2009 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
@@ -31,8 +31,10 @@
#include "net.h"
int send_interface(int, const struct interface *);
-int run_script(const struct interface *);
+int run_script_reason(const struct interface *, const char *);
void build_routes(void);
int configure(struct interface *);
int route_deleted(const struct rt *);
+
+#define run_script(ifp) run_script_reason(ifp, (ifp)->state->reason);
#endif
diff -r 69dba7c00217 -r 1fc3d5c3797a external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h Thu Feb 02 22:49:17 2012 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h Thu Feb 02 23:35:40 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>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,7 +28,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "5.5.1"
+#define VERSION "5.5.2"
#ifndef CONFIG
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
diff -r 69dba7c00217 -r 1fc3d5c3797a external/bsd/dhcpcd/dist/dhcp.c
--- a/external/bsd/dhcpcd/dist/dhcp.c Thu Feb 02 22:49:17 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.c Thu Feb 02 23:35:40 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
diff -r 69dba7c00217 -r 1fc3d5c3797a external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf
--- a/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf Thu Feb 02 22:49:17 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf Thu Feb 02 23:35:40 2012 +0000
@@ -71,12 +71,12 @@
add_resolv_conf()
{
- local x= conf="$signature$NL" i=${new_ra_count:-0} ra=
+ local x= conf="$signature$NL" i=${ra_count:-0} ra=
while [ $i -ne 0 ]; do
- eval ra=\$new_ra${i}_rdnss
+ eval ra=\$ra${i}_rdnss
new_domain_name_servers="$new_domain_name_servers${new_domain_name_servers:+ }$ra"
- eval ra=\$new_ra${i}_dnssl
+ eval ra=\$ra${i}_dnssl
new_domain_search="$new_domain_search${new_domain_search:+ }$ra"
i=$(($i - 1))
done
diff -r 69dba7c00217 -r 1fc3d5c3797a external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in
--- a/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in Thu Feb 02 22:49:17 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in Thu Feb 02 23:35:40 2012 +0000
@@ -9,16 +9,8 @@
signature_end="$signature_base_end $from $interface"
state_dir=/var/run/dhcpcd
-if_up=false
-if_down=false
-case "$reason" in
-BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) if_up=true;;
-PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) if_down=true;;
-esac
-
if [ "$reason" = ROUTERADVERT ]; then
if_suffix=":ra"
- [ "$new_ra_count" != 0 ] && if_up=true
else
if_suffix=
fi
diff -r 69dba7c00217 -r 1fc3d5c3797a external/bsd/dhcpcd/dist/dhcpcd.c
--- a/external/bsd/dhcpcd/dist/dhcpcd.c Thu Feb 02 22:49:17 2012 +0000
+++ b/external/bsd/dhcpcd/dist/dhcpcd.c Thu Feb 02 23:35:40 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
@@ -25,7 +25,7 @@
* SUCH DAMAGE.
*/
-const char copyright[] = "Copyright (c) 2006-2011 Roy Marples";
+const char copyright[] = "Copyright (c) 2006-2012 Roy Marples";
#include <sys/file.h>
#include <sys/socket.h>
@@ -247,8 +247,7 @@
if (iface->ras) {
ipv6rs_free(iface);
iface->ras = NULL;
- iface->state->reason = "ROUTERADVERT";
- run_script(iface);
+ run_script_reason(iface, "ROUTERADVERT");
}
if (strcmp(iface->state->reason, "RELEASE") != 0)
drop_dhcp(iface, "STOP");
@@ -915,8 +914,7 @@
if (iface->ras) {
ipv6rs_free(iface);
iface->ras = NULL;
- iface->state->reason = "ROUTERADVERT";
- run_script(iface);
+ run_script_reason(iface, "ROUTERADVERT");
}
drop_dhcp(iface, "NOCARRIER");
}
@@ -1603,8 +1601,11 @@
} else if (strcmp(*argv, "--getinterfaces") == 0) {
len = 0;
if (argc == 1) {
- for (ifp = ifaces; ifp; ifp = ifp->next)
Home |
Main Index |
Thread Index |
Old Index