Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/dhcp/dist merge and fixup
details: https://anonhg.NetBSD.org/src/rev/ebdef31eefd0
branches: trunk
changeset: 797259:ebdef31eefd0
user: spz <spz%NetBSD.org@localhost>
date: Sat Jul 12 12:09:37 2014 +0000
description:
merge and fixup
diffstat:
external/bsd/dhcp/dist/client/dhc6.c | 72 +-
external/bsd/dhcp/dist/client/dhclient.8 | 46 +-
external/bsd/dhcp/dist/client/dhclient.c | 425 ++++++--
external/bsd/dhcp/dist/common/alloc.c | 14 +-
external/bsd/dhcp/dist/common/bpf.c | 113 +-
external/bsd/dhcp/dist/common/conflex.c | 42 +-
external/bsd/dhcp/dist/common/discover.c | 43 +-
external/bsd/dhcp/dist/common/dispatch.c | 28 +-
external/bsd/dhcp/dist/common/dns.c | 910 +++++++++++++++++++-
external/bsd/dhcp/dist/common/icmp.c | 19 +-
external/bsd/dhcp/dist/common/ns_name.c | 11 +-
external/bsd/dhcp/dist/dst/base64.c | 7 +-
external/bsd/dhcp/dist/dst/dst_api.c | 15 +-
external/bsd/dhcp/dist/includes/dhcpd.h | 222 ++--
external/bsd/dhcp/dist/omapip/dispatch.c | 71 +-
external/bsd/dhcp/dist/omapip/isclib.c | 6 +-
external/bsd/dhcp/dist/relay/dhcrelay.c | 96 +-
external/bsd/dhcp/dist/server/confpars.c | 11 +-
external/bsd/dhcp/dist/server/ddns.c | 184 ++-
external/bsd/dhcp/dist/server/dhcpd.c | 489 ++++------
external/bsd/dhcp/dist/server/dhcpleasequery.c | 32 +-
external/bsd/dhcp/dist/server/dhcpv6.c | 1055 ++++++++++++++++++-----
external/bsd/dhcp/dist/server/mdb.c | 6 +-
external/bsd/dhcp/dist/server/mdb6.c | 373 +++++++-
external/bsd/dhcp/dist/server/omapi.c | 6 +-
25 files changed, 3058 insertions(+), 1238 deletions(-)
diffs (truncated from 6967 to 300 lines):
diff -r ae522755771a -r ebdef31eefd0 external/bsd/dhcp/dist/client/dhc6.c
--- a/external/bsd/dhcp/dist/client/dhc6.c Sat Jul 12 11:57:24 2014 +0000
+++ b/external/bsd/dhcp/dist/client/dhc6.c Sat Jul 12 12:09:37 2014 +0000
@@ -1,9 +1,8 @@
-/* $NetBSD: dhc6.c,v 1.5 2013/06/20 12:24:08 christos Exp $ */
-
+/* $NetBSD: dhc6.c,v 1.6 2014/07/12 12:09:37 spz Exp $ */
/* dhc6.c - DHCPv6 client routines. */
/*
- * Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2012-2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2006-2010 by Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and distribute this software for any
@@ -26,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: dhc6.c,v 1.5 2013/06/20 12:24:08 christos Exp $");
+__RCSID("$NetBSD: dhc6.c,v 1.6 2014/07/12 12:09:37 spz Exp $");
#include "dhcpd.h"
@@ -125,69 +124,6 @@
extern int stateless;
/*
- * The "best" default DUID, since we cannot predict any information
- * about the system (such as whether or not the hardware addresses are
- * integrated into the motherboard or similar), is the "LLT", link local
- * plus time, DUID. For real stateless "LL" is better.
- *
- * Once generated, this duid is stored into the state database, and
- * retained across restarts.
- *
- * For the time being, there is probably a different state database for
- * every daemon, so this winds up being a per-interface identifier...which
- * is not how it is intended. Upcoming rearchitecting the client should
- * address this "one daemon model."
- */
-void
-form_duid(struct data_string *duid, const char *file, int line)
-{
- struct interface_info *ip;
- int len;
-
- /* For now, just use the first interface on the list. */
- ip = interfaces;
-
- if (ip == NULL)
- log_fatal("Impossible condition at %s:%d.", MDL);
-
- if ((ip->hw_address.hlen == 0) ||
- (ip->hw_address.hlen > sizeof(ip->hw_address.hbuf)))
- log_fatal("Impossible hardware address length at %s:%d.", MDL);
-
- if (duid_type == 0)
- duid_type = stateless ? DUID_LL : DUID_LLT;
-
- /*
- * 2 bytes for the 'duid type' field.
- * 2 bytes for the 'htype' field.
- * (DUID_LLT) 4 bytes for the 'current time'.
- * enough bytes for the hardware address (note that hw_address has
- * the 'htype' on byte zero).
- */
- len = 4 + (ip->hw_address.hlen - 1);
- if (duid_type == DUID_LLT)
- len += 4;
- if (!buffer_allocate(&duid->buffer, len, MDL))
- log_fatal("no memory for default DUID!");
- duid->data = duid->buffer->data;
- duid->len = len;
-
- /* Basic Link Local Address type of DUID. */
- if (duid_type == DUID_LLT) {
- putUShort(duid->buffer->data, DUID_LLT);
- putUShort(duid->buffer->data + 2, ip->hw_address.hbuf[0]);
- putULong(duid->buffer->data + 4, cur_time - DUID_TIME_EPOCH);
- memcpy(duid->buffer->data + 8, ip->hw_address.hbuf + 1,
- ip->hw_address.hlen - 1);
- } else {
- putUShort(duid->buffer->data, DUID_LL);
- putUShort(duid->buffer->data + 2, ip->hw_address.hbuf[0]);
- memcpy(duid->buffer->data + 4, ip->hw_address.hbuf + 1,
- ip->hw_address.hlen - 1);
- }
-}
-
-/*
* Assign DHCPv6 port numbers as a client.
*/
void
@@ -4952,7 +4888,7 @@
lease ? lease->options : NULL,
*op, &global_scope,
client->config->on_transmission,
- NULL);
+ NULL, NULL);
/* Rapid-commit is only for SOLICITs. */
if (message != DHCPV6_SOLICIT)
diff -r ae522755771a -r ebdef31eefd0 external/bsd/dhcp/dist/client/dhclient.8
--- a/external/bsd/dhcp/dist/client/dhclient.8 Sat Jul 12 11:57:24 2014 +0000
+++ b/external/bsd/dhcp/dist/client/dhclient.8 Sat Jul 12 12:09:37 2014 +0000
@@ -1,8 +1,8 @@
-.\" $NetBSD: dhclient.8,v 1.2 2013/06/20 12:15:38 christos Exp $
+.\" $NetBSD: dhclient.8,v 1.3 2014/07/12 12:09:37 spz Exp $
.\"
-.\" Id: dhclient.8,v 1.32.24.4 2011/04/15 22:12:50 sar Exp
+.\" Id: dhclient.8,v 1.36 2011/04/15 21:58:12 sar Exp
.\"
-.\" Copyright (c) 2004,2007-2012 by Internet Systems Consortium, Inc. ("ISC")
+.\" Copyright (c) 2004,2007-2014 by Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (c) 1996-2003 by Internet Software Consortium
.\"
.\" Permission to use, copy, modify, and distribute this software for any
@@ -58,6 +58,12 @@
]
]
[
+.B -i
+]
+[
+.B -I
+]
+[
.B -D
.I LL|LLT
]
@@ -73,10 +79,10 @@
.I VAR=value
]
[
-.B -q
+.B -m
]
[
-.B -m
+.B -q
]
[
.B -1
@@ -250,7 +256,7 @@
.TP
.BI \-nw
Become a daemon immediately (nowait) rather than waiting until an
-an IP address has been acquired.
+IP address has been acquired.
.TP
.BI \-m
Don't require that the responding ethernet address of the dhcp server
@@ -328,9 +334,20 @@
.BI \-g \ relay
.\" mockup relay
Set the giaddr field of all packets to the \fIrelay\fR IP address
-simulating a relay agent. This is for testing pruposes only and
+simulating a relay agent. This is for testing purposes only and
should not be expected to work in any consistent or useful way.
.TP
+.BI \-i
+Use a DUID with DHCPv4 clients. If no DUID is available in the
+lease file one will be constructed and saved. The DUID will be
+used to construct a RFC4361 style client id that will be included
+in the client's messages. This client id can be overridden by
+setting a client id in the configuration file. Overridding the
+client id in this fashion is discouraged.
+.TP
+.BI \-I
+Use the standard DDNS scheme from RFCs 4701 & 4702.
+.TP
.BI \--version
Print version number and exit.
.PP
@@ -360,8 +377,10 @@
(DUID-LL) if it is running in stateless mode (with \fB\-S\fR, not
requesting an address), or it creates an identifier based on the
link-layer address plus a timestamp (DUID-LLT) if it is running in
-stateful mode (without \fB\-S\fR, requesting an address). \fB\-D\fR
-overrides this default, with a value of either \fILL\fR or \fILLT\fR.
+stateful mode (without \fB\-S\fR, requesting an address). When DHCPv4
+is configured to use a DUID using \fB\-i\fR option the default is to use
+a DUID-LLT. \fB\-D\fR
+overrides these default, with a value of either \fILL\fR or \fILLT\fR.
.TP
.BI \-N
.\" TODO: is this for telling an already running dhclient?
@@ -370,7 +389,7 @@
.PP
.I Modifying default file locations:
The following options can be used to modify the locations a client uses
-for it's files. They can be particularly useful if, for example,
+for its files. They can be particularly useful if, for example,
.B DBDIR
or
.B RUNDIR
@@ -468,14 +487,9 @@
dhclient.leases(5), dhcp-eval(5).
.SH AUTHOR
.B dhclient(8)
-has been written for Internet Systems Consortium
-by Ted Lemon in cooperation with Vixie
-Enterprises. To learn more about Internet Systems Consortium,
+To learn more about Internet Systems Consortium,
see
.B https://www.isc.org
-To learn more about Vixie
-Enterprises, see
-.B http://www.vix.com.
.PP
This client was substantially modified and enhanced by Elliot Poger
for use on Linux while he was working on the MosquitoNet project at
diff -r ae522755771a -r ebdef31eefd0 external/bsd/dhcp/dist/client/dhclient.c
--- a/external/bsd/dhcp/dist/client/dhclient.c Sat Jul 12 11:57:24 2014 +0000
+++ b/external/bsd/dhcp/dist/client/dhclient.c Sat Jul 12 12:09:37 2014 +0000
@@ -1,11 +1,10 @@
-/* $NetBSD: dhclient.c,v 1.8 2014/02/04 22:34:39 christos Exp $ */
-
+/* $NetBSD: dhclient.c,v 1.9 2014/07/12 12:09:37 spz Exp $ */
/* dhclient.c
DHCP Client. */
/*
- * Copyright (c) 2004-2013 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2014 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
@@ -33,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: dhclient.c,v 1.8 2014/02/04 22:34:39 christos Exp $");
+__RCSID("$NetBSD: dhclient.c,v 1.9 2014/07/12 12:09:37 spz Exp $");
#include "dhcpd.h"
#include <syslog.h>
@@ -69,17 +68,17 @@
struct in_addr giaddr;
struct data_string default_duid;
int duid_type = 0;
+int duid_v4 = 0;
+int std_dhcid = 0;
/* ASSERT_STATE() does nothing now; it used to be
assert (state_is == state_shouldbe). */
#define ASSERT_STATE(state_is, state_shouldbe) {}
-static const char copyright[] =
-"Copyright 2004-2013 Internet Systems Consortium.";
+static const char copyright[] = "Copyright 2004-2014 Internet Systems Consortium.";
static const char arr [] = "All rights reserved.";
static const char message [] = "Internet Systems Consortium DHCP Client";
-static const char url [] =
-"For info, please visit https://www.isc.org/software/dhcp/";
+static const char url [] = "For info, please visit https://www.isc.org/software/dhcp/";
u_int16_t local_port = 0;
u_int16_t remote_port = 0;
@@ -111,16 +110,16 @@
setup(void) {
isc_result_t status;
/* Set up the isc and dns library managers */
- status = dhcp_context_create();
+ status = dhcp_context_create(DHCP_CONTEXT_PRE_DB, NULL, NULL);
if (status != ISC_R_SUCCESS)
log_fatal("Can't initialize context: %s",
- isc_result_totext(status));
+ isc_result_totext(status));
/* Set up the OMAPI. */
status = omapi_init();
if (status != ISC_R_SUCCESS)
log_fatal("Can't initialize OMAPI: %s",
- isc_result_totext(status));
+ isc_result_totext(status));
/* Set up the OMAPI wrappers for various server database internal
objects. */
@@ -138,24 +137,25 @@
isc_result_t status;
for (int i = 0; i < nifaces; i++) {
- struct interface_info *tmp = NULL;
- status = interface_allocate(&tmp, MDL);
- if (status != ISC_R_SUCCESS)
+ struct interface_info *tmp = NULL;
+ status = interface_allocate(&tmp, MDL);
+ if (status != ISC_R_SUCCESS)
log_fatal("Can't record interface %s:%s",
- ifaces[i], isc_result_totext(status));
- if (strlen(ifaces[i]) >= sizeof(tmp->name))
- log_fatal("%s: interface name too long (is %ld)",
- ifaces[i], (long)strlen(ifaces[i]));
- strcpy(tmp->name, ifaces[i]);
- if (interfaces) {
- interface_reference(&tmp->next,
- interfaces, MDL);
Home |
Main Index |
Thread Index |
Old Index