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/9a577fc34d6a
branches: trunk
changeset: 338274:9a577fc34d6a
user: roy <roy%NetBSD.org@localhost>
date: Sat May 16 23:31:32 2015 +0000
description:
Sync
diffstat:
external/bsd/dhcpcd/dist/arp.c | 10 +-
external/bsd/dhcpcd/dist/arp.h | 3 +-
external/bsd/dhcpcd/dist/auth.h | 6 +-
external/bsd/dhcpcd/dist/common.c | 103 +--
external/bsd/dhcpcd/dist/common.h | 18 +-
external/bsd/dhcpcd/dist/config.h | 4 +-
external/bsd/dhcpcd/dist/control.c | 12 +-
external/bsd/dhcpcd/dist/defs.h | 4 +-
external/bsd/dhcpcd/dist/dhcp-common.c | 112 ++-
external/bsd/dhcpcd/dist/dhcp-common.h | 7 +-
external/bsd/dhcpcd/dist/dhcp.c | 254 ++++----
external/bsd/dhcpcd/dist/dhcp6.c | 37 +-
external/bsd/dhcpcd/dist/dhcpcd-definitions.conf | 36 +-
external/bsd/dhcpcd/dist/dhcpcd-embedded.c | 26 +-
external/bsd/dhcpcd/dist/dhcpcd-embedded.h | 3 +-
external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf | 53 +-
external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in | 9 +-
external/bsd/dhcpcd/dist/dhcpcd.8.in | 11 +-
external/bsd/dhcpcd/dist/dhcpcd.c | 173 ++---
external/bsd/dhcpcd/dist/dhcpcd.conf.5.in | 114 ++-
external/bsd/dhcpcd/dist/dhcpcd.h | 19 +-
external/bsd/dhcpcd/dist/eloop.c | 492 ++++++++++-----
external/bsd/dhcpcd/dist/eloop.h | 139 +++-
external/bsd/dhcpcd/dist/if-bsd.c | 4 +-
external/bsd/dhcpcd/dist/if-options.c | 97 ++-
external/bsd/dhcpcd/dist/if-options.h | 12 +-
external/bsd/dhcpcd/dist/ipv4.c | 134 ++-
external/bsd/dhcpcd/dist/ipv4.h | 7 +-
external/bsd/dhcpcd/dist/ipv6.c | 49 +-
external/bsd/dhcpcd/dist/ipv6.h | 16 +-
external/bsd/dhcpcd/dist/ipv6nd.c | 566 ++++++++----------
external/bsd/dhcpcd/dist/ipv6nd.h | 27 +-
external/bsd/dhcpcd/dist/script.c | 23 +-
33 files changed, 1494 insertions(+), 1086 deletions(-)
diffs (truncated from 4771 to 300 lines):
diff -r b9bab1931112 -r 9a577fc34d6a external/bsd/dhcpcd/dist/arp.c
--- a/external/bsd/dhcpcd/dist/arp.c Sat May 16 23:25:41 2015 +0000
+++ b/external/bsd/dhcpcd/dist/arp.c Sat May 16 23:31:32 2015 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: arp.c,v 1.12 2015/05/02 15:18:36 roy Exp $");
+ __RCSID("$NetBSD: arp.c,v 1.13 2015/05/16 23:31:32 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -297,17 +297,19 @@
arp_probe1(astate);
}
-static struct arp_state *
+struct arp_state *
arp_find(struct interface *ifp, const struct in_addr *addr)
{
struct arp_state *astate;
struct dhcp_state *state;
- state = D_STATE(ifp);
+ if ((state = D_STATE(ifp)) == NULL)
+ goto out;
TAILQ_FOREACH(astate, &state->arp_states, next) {
if (astate->addr.s_addr == addr->s_addr && astate->iface == ifp)
return astate;
}
+out:
errno = ESRCH;
return NULL;
}
@@ -380,7 +382,7 @@
return;
if (state->arp_fd != -1) {
- eloop_event_delete(ifp->ctx->eloop, state->arp_fd, 0);
+ eloop_event_delete(ifp->ctx->eloop, state->arp_fd);
close(state->arp_fd);
state->arp_fd = -1;
}
diff -r b9bab1931112 -r 9a577fc34d6a external/bsd/dhcpcd/dist/arp.h
--- a/external/bsd/dhcpcd/dist/arp.h Sat May 16 23:25:41 2015 +0000
+++ b/external/bsd/dhcpcd/dist/arp.h Sat May 16 23:31:32 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arp.h,v 1.9 2015/05/02 15:18:36 roy Exp $ */
+/* $NetBSD: arp.h,v 1.10 2015/05/16 23:31:32 roy Exp $ */
/*
* dhcpcd - DHCP client daemon
@@ -75,6 +75,7 @@
void arp_cancel(struct arp_state *);
void arp_free(struct arp_state *);
void arp_free_but(struct arp_state *);
+struct arp_state *arp_find(struct interface *, const struct in_addr *);
void arp_close(struct interface *);
void arp_handleifa(int, struct interface *, const struct in_addr *, int);
diff -r b9bab1931112 -r 9a577fc34d6a external/bsd/dhcpcd/dist/auth.h
--- a/external/bsd/dhcpcd/dist/auth.h Sat May 16 23:25:41 2015 +0000
+++ b/external/bsd/dhcpcd/dist/auth.h Sat May 16 23:31:32 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auth.h,v 1.8 2015/01/30 09:47:05 roy Exp $ */
+/* $NetBSD: auth.h,v 1.9 2015/05/16 23:31:32 roy Exp $ */
/*
* dhcpcd - DHCP client daemon
@@ -32,6 +32,10 @@
#include "config.h"
+#ifdef HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+
#define DHCPCD_AUTH_SEND (1 << 0)
#define DHCPCD_AUTH_REQUIRE (1 << 1)
#define DHCPCD_AUTH_RDM_COUNTER (1 << 2)
diff -r b9bab1931112 -r 9a577fc34d6a external/bsd/dhcpcd/dist/common.c
--- a/external/bsd/dhcpcd/dist/common.c Sat May 16 23:25:41 2015 +0000
+++ b/external/bsd/dhcpcd/dist/common.c Sat May 16 23:31:32 2015 +0000
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
- __RCSID("$NetBSD: common.c,v 1.12 2015/05/02 15:18:36 roy Exp $");
+ __RCSID("$NetBSD: common.c,v 1.13 2015/05/16 23:31:32 roy Exp $");
/*
* dhcpcd - DHCP client daemon
@@ -28,11 +28,6 @@
* SUCH DAMAGE.
*/
-#ifdef __APPLE__
-# include <mach/mach_time.h>
-# include <mach/kern_return.h>
-#endif
-
#include <sys/param.h>
#include <sys/time.h>
@@ -84,64 +79,6 @@
return buf;
}
-/* Handy function to get the time.
- * We only care about time advancements, not the actual time itself
- * Which is why we use CLOCK_MONOTONIC, but it is not available on all
- * platforms.
- */
-#define NO_MONOTONIC "host does not support a monotonic clock - timing can skew"
-int
-get_monotonic(struct timespec *ts)
-{
-
-#if defined(_POSIX_MONOTONIC_CLOCK) && defined(CLOCK_MONOTONIC)
- return clock_gettime(CLOCK_MONOTONIC, ts);
-#elif defined(__APPLE__)
- /* We can use mach kernel functions here.
- * This is crap though - why can't they implement clock_gettime?*/
- static struct mach_timebase_info info = { 0, 0 };
- static double factor = 0.0;
- uint64_t nano;
- long rem;
-
- if (!posix_clock_set) {
- if (mach_timebase_info(&info) == KERN_SUCCESS) {
- factor = (double)info.numer / (double)info.denom;
- clock_monotonic = posix_clock_set = 1;
- }
- }
- if (clock_monotonic) {
- nano = mach_absolute_time();
- if ((info.denom != 1 || info.numer != 1) && factor != 0.0)
- nano *= factor;
- ts->tv_sec = nano / NSEC_PER_SEC;
- ts->tv_nsec = nano % NSEC_PER_SEC;
- if (ts->tv_nsec < 0) {
- ts->tv_sec--;
- ts->tv_nsec += NSEC_PER_SEC;
- }
- return 0;
- }
-#endif
-
-#if 0
- /* Something above failed, so fall back to gettimeofday */
- if (!posix_clock_set) {
- logger(NULL, LOG_WARNING, NO_MONOTONIC);
- posix_clock_set = 1;
- }
-#endif
- {
- struct timeval tv;
- if (gettimeofday(&tv, NULL) == 0) {
- TIMEVAL_TO_TIMESPEC(&tv, ts);
- return 0;
- }
- }
-
- return -1;
-}
-
#if USE_LOGFILE
void
logger_open(struct dhcpcd_ctx *ctx)
@@ -269,33 +206,55 @@
ssize_t
setvar(struct dhcpcd_ctx *ctx,
- char ***e, const char *prefix, const char *var, const char *value)
+ char **e, const char *prefix, const char *var, const char *value)
{
size_t len = strlen(var) + strlen(value) + 3;
if (prefix)
len += strlen(prefix) + 1;
- **e = malloc(len);
- if (**e == NULL) {
+ *e = malloc(len);
+ if (*e == NULL) {
logger(ctx, LOG_ERR, "%s: %m", __func__);
return -1;
}
if (prefix)
- snprintf(**e, len, "%s_%s=%s", prefix, var, value);
+ snprintf(*e, len, "%s_%s=%s", prefix, var, value);
else
- snprintf(**e, len, "%s=%s", var, value);
- (*e)++;
+ snprintf(*e, len, "%s=%s", var, value);
return (ssize_t)len;
}
ssize_t
setvard(struct dhcpcd_ctx *ctx,
+ char **e, const char *prefix, const char *var, size_t value)
+{
+
+ char buffer[32];
+
+ snprintf(buffer, sizeof(buffer), "%zu", value);
+ return setvar(ctx, e, prefix, var, buffer);
+}
+
+ssize_t
+addvar(struct dhcpcd_ctx *ctx,
+ char ***e, const char *prefix, const char *var, const char *value)
+{
+ ssize_t len;
+
+ len = setvar(ctx, *e, prefix, var, value);
+ if (len != -1)
+ (*e)++;
+ return (ssize_t)len;
+}
+
+ssize_t
+addvard(struct dhcpcd_ctx *ctx,
char ***e, const char *prefix, const char *var, size_t value)
{
char buffer[32];
snprintf(buffer, sizeof(buffer), "%zu", value);
- return setvar(ctx, e, prefix, var, buffer);
+ return addvar(ctx, e, prefix, var, buffer);
}
@@ -304,7 +263,7 @@
{
struct timespec tv;
- if (get_monotonic(&tv) == -1)
+ if (clock_gettime(CLOCK_MONOTONIC, &tv) == -1)
return -1;
return tv.tv_sec;
}
diff -r b9bab1931112 -r 9a577fc34d6a external/bsd/dhcpcd/dist/common.h
--- a/external/bsd/dhcpcd/dist/common.h Sat May 16 23:25:41 2015 +0000
+++ b/external/bsd/dhcpcd/dist/common.h Sat May 16 23:31:32 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: common.h,v 1.8 2015/03/26 10:26:37 roy Exp $ */
+/* $NetBSD: common.h,v 1.9 2015/05/16 23:31:32 roy Exp $ */
/*
* dhcpcd - DHCP client daemon
@@ -56,8 +56,8 @@
#define USEC_PER_SEC 1000000L
#define USEC_PER_NSEC 1000L
#define NSEC_PER_SEC 1000000000L
+#define NSEC_PER_MSEC 1000000L
#define MSEC_PER_SEC 1000L
-#define MSEC_PER_NSEC 1000000L
/* Some systems don't define timespec macros */
#ifndef timespecclear
@@ -97,12 +97,12 @@
} while (0 /* CONSTCOND */);
#define ts_to_ms(ms, tv) do { \
ms = (tv)->tv_sec * MSEC_PER_SEC; \
- ms += (tv)->tv_nsec / MSEC_PER_NSEC; \
+ ms += (tv)->tv_nsec / NSEC_PER_MSEC; \
} while (0 /* CONSTCOND */);
#define ms_to_ts(tv, ms) do { \
(tv)->tv_sec = ms / MSEC_PER_SEC; \
(tv)->tv_nsec = (suseconds_t)(ms - ((tv)->tv_sec * MSEC_PER_SEC)) \
- * MSEC_PER_NSEC; \
+ * NSEC_PER_MSEC; \
} while (0 /* CONSTCOND */);
#ifndef TIMEVAL_TO_TIMESPEC
@@ -140,6 +140,10 @@
# endif
#endif
+#ifndef __arraycount
+#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
+#endif
+
/* We don't really need this as our supported systems define __restrict
* automatically for us, but it is here for completeness. */
#ifndef __restrict
@@ -182,8 +186,12 @@
#endif
ssize_t setvar(struct dhcpcd_ctx *,
+ char **, const char *, const char *, const char *);
+ssize_t setvard(struct dhcpcd_ctx *,
+ char **, const char *, const char *, size_t);
+ssize_t addvar(struct dhcpcd_ctx *,
char ***, const char *, const char *, const char *);
-ssize_t setvard(struct dhcpcd_ctx *,
+ssize_t addvard(struct dhcpcd_ctx *,
char ***, const char *, const char *, size_t);
time_t uptime(void);
diff -r b9bab1931112 -r 9a577fc34d6a external/bsd/dhcpcd/dist/config.h
--- a/external/bsd/dhcpcd/dist/config.h Sat May 16 23:25:41 2015 +0000
+++ b/external/bsd/dhcpcd/dist/config.h Sat May 16 23:31:32 2015 +0000
@@ -1,4 +1,4 @@
Home |
Main Index |
Thread Index |
Old Index