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/d02d05c7036f
branches: trunk
changeset: 336921:d02d05c7036f
user: roy <roy%NetBSD.org@localhost>
date: Fri Mar 27 11:33:46 2015 +0000
description:
Sync
diffstat:
external/bsd/dhcpcd/dist/common.c | 4 +-
external/bsd/dhcpcd/dist/crypt/hmac_md5.c | 6 ++--
external/bsd/dhcpcd/dist/defs.h | 4 +-
external/bsd/dhcpcd/dist/if-options.c | 7 +++--
external/bsd/dhcpcd/dist/ipv4.c | 39 ++++++++++++++++++++----------
external/bsd/dhcpcd/dist/ipv6.c | 29 +++++++++++++---------
6 files changed, 54 insertions(+), 35 deletions(-)
diffs (245 lines):
diff -r ce46151515b3 -r d02d05c7036f external/bsd/dhcpcd/dist/common.c
--- a/external/bsd/dhcpcd/dist/common.c Fri Mar 27 11:12:08 2015 +0000
+++ b/external/bsd/dhcpcd/dist/common.c Fri Mar 27 11:33:46 2015 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: common.c,v 1.9 2015/03/26 10:26:37 roy Exp $");
+ __RCSID("$NetBSD: common.c,v 1.10 2015/03/27 11:33:46 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -231,9 +231,9 @@
break;
}
*fp++ = '\0';
+ fmt = fmt_cpy;
}
- fmt = fmt_cpy;
#endif
if (ctx == NULL || !(ctx->options & DHCPCD_QUIET)) {
diff -r ce46151515b3 -r d02d05c7036f external/bsd/dhcpcd/dist/crypt/hmac_md5.c
--- a/external/bsd/dhcpcd/dist/crypt/hmac_md5.c Fri Mar 27 11:12:08 2015 +0000
+++ b/external/bsd/dhcpcd/dist/crypt/hmac_md5.c Fri Mar 27 11:33:46 2015 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: hmac_md5.c,v 1.6 2015/01/30 09:47:05 roy Exp $");
+ __RCSID("$NetBSD: hmac_md5.c,v 1.7 2015/03/27 11:33:47 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -60,7 +60,7 @@
/* Ensure key is no bigger than HMAC_PAD_LEN */
if (key_len > HMAC_PAD_LEN) {
MD5Init(&context);
- MD5Update(&context, key, key_len);
+ MD5Update(&context, key, (unsigned int)key_len);
MD5Final(tk, &context);
key = tk;
key_len = MD5_DIGEST_LENGTH;
@@ -81,7 +81,7 @@
/* inner MD5 */
MD5Init(&context);
MD5Update(&context, k_ipad, HMAC_PAD_LEN);
- MD5Update(&context, text, text_len);
+ MD5Update(&context, text, (unsigned int)text_len);
MD5Final(digest, &context);
/* outer MD5 */
diff -r ce46151515b3 -r d02d05c7036f external/bsd/dhcpcd/dist/defs.h
--- a/external/bsd/dhcpcd/dist/defs.h Fri Mar 27 11:12:08 2015 +0000
+++ b/external/bsd/dhcpcd/dist/defs.h Fri Mar 27 11:33:46 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.15 2015/03/26 10:26:37 roy Exp $ */
+/* $NetBSD: defs.h,v 1.16 2015/03/27 11:33:46 roy Exp $ */
/*
* dhcpcd - DHCP client daemon
@@ -30,7 +30,7 @@
#define CONFIG_H
#define PACKAGE "dhcpcd"
-#define VERSION "6.8.0"
+#define VERSION "6.8.1"
#ifndef CONFIG
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
diff -r ce46151515b3 -r d02d05c7036f external/bsd/dhcpcd/dist/if-options.c
--- a/external/bsd/dhcpcd/dist/if-options.c Fri Mar 27 11:12:08 2015 +0000
+++ b/external/bsd/dhcpcd/dist/if-options.c Fri Mar 27 11:33:46 2015 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: if-options.c,v 1.21 2015/03/26 10:26:37 roy Exp $");
+ __RCSID("$NetBSD: if-options.c,v 1.22 2015/03/27 11:33:46 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -53,6 +53,7 @@
#include "dhcp.h"
#include "dhcp6.h"
#include "dhcpcd-embedded.h"
+#include "if.h"
#include "if-options.h"
#include "ipv4.h"
@@ -1041,7 +1042,7 @@
}
TAILQ_INIT(ifo->routes);
}
- rt = malloc(sizeof(*rt));
+ rt = calloc(1, sizeof(*rt));
if (rt == NULL) {
logger(ctx, LOG_ERR, "%s: %m", __func__);
*fp = ' ';
@@ -1066,7 +1067,7 @@
}
TAILQ_INIT(ifo->routes);
}
- rt = malloc(sizeof(*rt));
+ rt = calloc(1, sizeof(*rt));
if (rt == NULL) {
logger(ctx, LOG_ERR, "%s: %m", __func__);
return -1;
diff -r ce46151515b3 -r d02d05c7036f external/bsd/dhcpcd/dist/ipv4.c
--- a/external/bsd/dhcpcd/dist/ipv4.c Fri Mar 27 11:12:08 2015 +0000
+++ b/external/bsd/dhcpcd/dist/ipv4.c Fri Mar 27 11:33:46 2015 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: ipv4.c,v 1.12 2015/03/26 10:26:37 roy Exp $");
+ __RCSID("$NetBSD: ipv4.c,v 1.13 2015/03/27 11:33:46 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -335,6 +335,12 @@
if (ctx->ipv4_kroutes == NULL)
return 0;
+ /* DHCP host routes have a gateway of the destination.
+ * We need to emulate that */
+ if (rt->gate.s_addr == INADDR_ANY &&
+ rt->net.s_addr == INADDR_BROADCAST)
+ rt->gate = rt->dest;
+
f = ipv4_findrt(ctx, rt, 1);
switch (cmd) {
case RTM_ADD:
@@ -367,9 +373,6 @@
static int
nc_route(struct rt *ort, struct rt *nrt)
{
-#ifdef HAVE_ROUTE_METRIC
- int retval;
-#endif
/* Don't set default routes if not asked to */
if (nrt->dest.s_addr == 0 &&
@@ -402,21 +405,29 @@
#ifdef HAVE_ROUTE_METRIC
/* With route metrics, we can safely add the new route before
* deleting the old route. */
- if ((retval = if_route(RTM_ADD, nrt)) == -1)
- logger(nrt->iface->ctx, LOG_ERR, "if_route (ADD): %m");
- if (ort && if_route(RTM_DELETE, ort) == -1 && errno != ESRCH)
- logger(nrt->iface->ctx, LOG_ERR, "if_route (DEL): %m");
- return retval;
-#else
+ if (if_route(RTM_ADD, nrt) == 0) {
+ if (ort && if_route(RTM_DELETE, ort) == -1 && errno != ESRCH)
+ logger(nrt->iface->ctx, LOG_ERR, "if_route (DEL): %m");
+ return 0;
+ }
+
+ /* If the kernel claims the route exists we need to rip out the
+ * old one first. */
+ if (errno != EEXIST || ort == NULL)
+ goto logerr;
+#endif
+
/* No route metrics, we need to delete the old route before
* adding the new one. */
if (ort && if_route(RTM_DELETE, ort) == -1 && errno != ESRCH)
logger(nrt->iface->ctx, LOG_ERR, "if_route (DEL): %m");
if (if_route(RTM_ADD, nrt) == 0)
return 0;
+#ifdef HAVE_ROUTE_METRIC
+logerr:
+#endif
logger(nrt->iface->ctx, LOG_ERR, "if_route (ADD): %m");
return -1;
-#endif
}
static int
@@ -701,8 +712,10 @@
free(or);
} else {
if (state->added & STATE_FAKE) {
- if (!ipv4_findrt(ctx, rt, 1))
- continue;
+ or = ipv4_findrt(ctx, rt, 1);
+ if (or == NULL ||
+ or->gate.s_addr != rt->gate.s_addr)
+ continue;
} else {
if (n_route(rt) != 0)
continue;
diff -r ce46151515b3 -r d02d05c7036f external/bsd/dhcpcd/dist/ipv6.c
--- a/external/bsd/dhcpcd/dist/ipv6.c Fri Mar 27 11:12:08 2015 +0000
+++ b/external/bsd/dhcpcd/dist/ipv6.c Fri Mar 27 11:33:46 2015 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: ipv6.c,v 1.9 2015/03/26 10:26:37 roy Exp $");
+ __RCSID("$NetBSD: ipv6.c,v 1.10 2015/03/27 11:33:46 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -1822,9 +1822,6 @@
static int
nc_route(struct rt6 *ort, struct rt6 *nrt)
{
-#ifdef HAVE_ROUTE_METRIC
- int retval;
-#endif
/* Don't set default routes if not asked to */
if (IN6_IS_ADDR_UNSPECIFIED(&nrt->dest) &&
@@ -1849,22 +1846,30 @@
#ifdef HAVE_ROUTE_METRIC
/* With route metrics, we can safely add the new route before
* deleting the old route. */
- if ((retval = if_route6(RTM_ADD, nrt)) == -1)
- logger(nrt->iface->ctx, LOG_ERR, "if_route6 (ADD): %m");
- if (ort && if_route6(RTM_DELETE, ort) == -1 &&
- errno != ESRCH)
- logger(nrt->iface->ctx, LOG_ERR, "if_route6 (DEL): %m");
- return retval;
-#else
+ if (if_route6(RTM_ADD, nrt) == 0) {
+ if (ort && if_route6(RTM_DELETE, ort) == -1 &&
+ errno != ESRCH)
+ logger(nrt->iface->ctx, LOG_ERR, "if_route6 (DEL): %m");
+ return 0;
+ }
+
+ /* If the kernel claims the route exists we need to rip out the
+ * old one first. */
+ if (errno != EEXIST || ort == NULL)
+ goto logerr;
+#endif
+
/* No route metrics, we need to delete the old route before
* adding the new one. */
if (ort && if_route6(RTM_DELETE, ort) == -1 && errno != ESRCH)
logger(nrt->iface->ctx, LOG_ERR, "if_route6: %m");
if (if_route6(RTM_ADD, nrt) == 0)
return 0;
+#ifdef HAVE_ROUTE_METRIC
+logerr:
+#endif
logger(nrt->iface->ctx, LOG_ERR, "if_route6 (ADD): %m");
return -1;
-#endif
}
static int
Home |
Main Index |
Thread Index |
Old Index