Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/mpl/dhcp/dist sync our changes.
details: https://anonhg.NetBSD.org/src/rev/23d56db4aa4f
branches: trunk
changeset: 321852:23d56db4aa4f
user: christos <christos%NetBSD.org@localhost>
date: Sat Apr 07 22:37:29 2018 +0000
description:
sync our changes.
diffstat:
external/mpl/dhcp/dist/client/client_tables.c | 7 +-
external/mpl/dhcp/dist/client/clparse.c | 4 +-
external/mpl/dhcp/dist/client/dhc6.c | 6 +-
external/mpl/dhcp/dist/client/dhclient-script.8 | 2 +-
external/mpl/dhcp/dist/client/dhclient.8 | 9 +-
external/mpl/dhcp/dist/client/dhclient.c | 257 ++++++----
external/mpl/dhcp/dist/client/dhclient.conf.5 | 2 +-
external/mpl/dhcp/dist/client/dhclient.leases.5 | 2 +-
external/mpl/dhcp/dist/client/tests/duid_unittest.c | 4 +-
external/mpl/dhcp/dist/common/alloc.c | 6 +-
external/mpl/dhcp/dist/common/bpf.c | 51 +-
external/mpl/dhcp/dist/common/comapi.c | 7 +-
external/mpl/dhcp/dist/common/conflex.c | 6 +-
external/mpl/dhcp/dist/common/ctrace.c | 4 +-
external/mpl/dhcp/dist/common/dhcp-eval.5 | 2 +-
external/mpl/dhcp/dist/common/dhcp-options.5 | 2 +-
external/mpl/dhcp/dist/common/dhcp4o6.c | 4 +-
external/mpl/dhcp/dist/common/discover.c | 22 +-
external/mpl/dhcp/dist/common/dispatch.c | 19 +-
external/mpl/dhcp/dist/common/dlpi.c | 6 +-
external/mpl/dhcp/dist/common/dns.c | 30 +-
external/mpl/dhcp/dist/common/ethernet.c | 4 +-
external/mpl/dhcp/dist/common/execute.c | 6 +-
external/mpl/dhcp/dist/common/fddi.c | 4 +-
external/mpl/dhcp/dist/common/icmp.c | 6 +-
external/mpl/dhcp/dist/common/inet.c | 4 +-
external/mpl/dhcp/dist/common/lpf.c | 6 +-
external/mpl/dhcp/dist/common/memory.c | 4 +-
external/mpl/dhcp/dist/common/nit.c | 6 +-
external/mpl/dhcp/dist/common/ns_name.c | 15 +-
external/mpl/dhcp/dist/common/options.c | 10 +-
external/mpl/dhcp/dist/common/packet.c | 6 +-
external/mpl/dhcp/dist/common/parse.c | 8 +-
external/mpl/dhcp/dist/common/print.c | 4 +-
external/mpl/dhcp/dist/common/raw.c | 4 +-
external/mpl/dhcp/dist/common/resolv.c | 4 +-
external/mpl/dhcp/dist/common/socket.c | 4 +-
external/mpl/dhcp/dist/common/tables.c | 4 +-
external/mpl/dhcp/dist/common/tests/dns_unittest.c | 2 +-
external/mpl/dhcp/dist/common/tests/misc_unittest.c | 2 +-
external/mpl/dhcp/dist/common/tests/ns_name_test.c | 2 +-
external/mpl/dhcp/dist/common/tests/option_unittest.c | 2 +-
external/mpl/dhcp/dist/common/tests/test_alloc.c | 2 +-
external/mpl/dhcp/dist/common/tr.c | 6 +-
external/mpl/dhcp/dist/common/tree.c | 8 +-
external/mpl/dhcp/dist/common/upf.c | 6 +-
external/mpl/dhcp/dist/config.guess | 354 +++++---------
external/mpl/dhcp/dist/config.sub | 104 +++-
external/mpl/dhcp/dist/dhcpctl/callback.c | 4 +-
external/mpl/dhcp/dist/dhcpctl/cltest.c | 23 +-
external/mpl/dhcp/dist/dhcpctl/dhcpctl.3 | 2 +-
external/mpl/dhcp/dist/dhcpctl/dhcpctl.c | 4 +-
external/mpl/dhcp/dist/dhcpctl/dhcpctl.h | 2 +-
external/mpl/dhcp/dist/dhcpctl/omshell.1 | 2 +-
external/mpl/dhcp/dist/dhcpctl/omshell.c | 23 +-
external/mpl/dhcp/dist/dhcpctl/remote.c | 4 +-
external/mpl/dhcp/dist/doc/ja_JP.eucJP/dhclient-script.8 | 2 +-
external/mpl/dhcp/dist/doc/ja_JP.eucJP/dhclient.8 | 2 +-
external/mpl/dhcp/dist/doc/ja_JP.eucJP/dhclient.conf.5 | 2 +-
external/mpl/dhcp/dist/doc/ja_JP.eucJP/dhclient.leases.5 | 2 +-
external/mpl/dhcp/dist/doc/ja_JP.eucJP/dhcp-eval.5 | 2 +-
external/mpl/dhcp/dist/doc/ja_JP.eucJP/dhcp-options.5 | 2 +-
external/mpl/dhcp/dist/includes/arpa/nameser.h | 2 +-
external/mpl/dhcp/dist/includes/arpa/nameser_compat.h | 2 +-
external/mpl/dhcp/dist/includes/cdefs.h | 2 +-
external/mpl/dhcp/dist/includes/ctrace.h | 2 +-
external/mpl/dhcp/dist/includes/dhcp.h | 2 +-
external/mpl/dhcp/dist/includes/dhcp6.h | 2 +-
external/mpl/dhcp/dist/includes/dhcpd.h | 31 +-
external/mpl/dhcp/dist/includes/dhctoken.h | 2 +-
external/mpl/dhcp/dist/includes/failover.h | 2 +-
external/mpl/dhcp/dist/includes/heap.h | 2 +-
external/mpl/dhcp/dist/includes/inet.h | 2 +-
external/mpl/dhcp/dist/includes/ldap_casa.h | 2 +-
external/mpl/dhcp/dist/includes/ldap_krb_helper.h | 2 +-
external/mpl/dhcp/dist/includes/netinet/if_ether.h | 2 +-
external/mpl/dhcp/dist/includes/netinet/ip.h | 2 +-
external/mpl/dhcp/dist/includes/netinet/ip_icmp.h | 2 +-
external/mpl/dhcp/dist/includes/netinet/udp.h | 2 +-
external/mpl/dhcp/dist/includes/ns_name.h | 2 +-
external/mpl/dhcp/dist/includes/omapip/alloc.h | 2 +-
external/mpl/dhcp/dist/includes/omapip/buffer.h | 2 +-
external/mpl/dhcp/dist/includes/omapip/convert.h | 2 +-
external/mpl/dhcp/dist/includes/omapip/hash.h | 2 +-
external/mpl/dhcp/dist/includes/omapip/isclib.h | 4 +-
external/mpl/dhcp/dist/includes/omapip/omapip.h | 2 +-
external/mpl/dhcp/dist/includes/omapip/omapip_p.h | 14 +-
external/mpl/dhcp/dist/includes/omapip/result.h | 2 +-
external/mpl/dhcp/dist/includes/omapip/trace.h | 2 +-
external/mpl/dhcp/dist/includes/osdep.h | 2 +-
external/mpl/dhcp/dist/includes/site.h | 2 +-
external/mpl/dhcp/dist/includes/statement.h | 2 +-
external/mpl/dhcp/dist/includes/t_api.h | 2 +-
external/mpl/dhcp/dist/includes/tree.h | 2 +-
external/mpl/dhcp/dist/omapip/alloc.c | 4 +-
external/mpl/dhcp/dist/omapip/array.c | 4 +-
external/mpl/dhcp/dist/omapip/auth.c | 4 +-
external/mpl/dhcp/dist/omapip/buffer.c | 4 +-
external/mpl/dhcp/dist/omapip/connection.c | 4 +-
external/mpl/dhcp/dist/omapip/convert.c | 4 +-
external/mpl/dhcp/dist/omapip/dispatch.c | 6 +-
external/mpl/dhcp/dist/omapip/errwarn.c | 4 +-
external/mpl/dhcp/dist/omapip/generic.c | 4 +-
external/mpl/dhcp/dist/omapip/handle.c | 4 +-
external/mpl/dhcp/dist/omapip/hash.c | 4 +-
external/mpl/dhcp/dist/omapip/inet_addr.c | 4 +-
external/mpl/dhcp/dist/omapip/isclib.c | 6 +-
external/mpl/dhcp/dist/omapip/iscprint.c | 4 +-
external/mpl/dhcp/dist/omapip/listener.c | 4 +-
external/mpl/dhcp/dist/omapip/message.c | 4 +-
external/mpl/dhcp/dist/omapip/omapi.3 | 2 +-
external/mpl/dhcp/dist/omapip/protocol.c | 4 +-
external/mpl/dhcp/dist/omapip/result.c | 4 +-
external/mpl/dhcp/dist/omapip/support.c | 4 +-
external/mpl/dhcp/dist/omapip/test.c | 4 +-
external/mpl/dhcp/dist/omapip/toisc.c | 4 +-
external/mpl/dhcp/dist/omapip/trace.c | 4 +-
external/mpl/dhcp/dist/relay/dhcrelay.8 | 2 +-
external/mpl/dhcp/dist/relay/dhcrelay.c | 54 +-
external/mpl/dhcp/dist/server/bootp.c | 4 +-
external/mpl/dhcp/dist/server/class.c | 4 +-
external/mpl/dhcp/dist/server/confpars.c | 11 +-
external/mpl/dhcp/dist/server/db.c | 4 +-
external/mpl/dhcp/dist/server/ddns.c | 29 +-
external/mpl/dhcp/dist/server/dhcp.c | 10 +-
external/mpl/dhcp/dist/server/dhcpd.8 | 2 +-
external/mpl/dhcp/dist/server/dhcpd.c | 48 +-
external/mpl/dhcp/dist/server/dhcpd.conf.5 | 2 +-
external/mpl/dhcp/dist/server/dhcpd.leases.5 | 2 +-
external/mpl/dhcp/dist/server/dhcpleasequery.c | 6 +-
external/mpl/dhcp/dist/server/dhcpv6.c | 30 +-
external/mpl/dhcp/dist/server/failover.c | 6 +-
external/mpl/dhcp/dist/server/ldap.c | 4 +-
external/mpl/dhcp/dist/server/ldap_casa.c | 4 +-
external/mpl/dhcp/dist/server/ldap_krb_helper.c | 2 +-
external/mpl/dhcp/dist/server/leasechain.c | 4 +-
external/mpl/dhcp/dist/server/mdb.c | 6 +-
external/mpl/dhcp/dist/server/mdb6.c | 16 +-
external/mpl/dhcp/dist/server/omapi.c | 6 +-
external/mpl/dhcp/dist/server/salloc.c | 4 +-
external/mpl/dhcp/dist/server/stables.c | 4 +-
external/mpl/dhcp/dist/server/tests/hash_unittest.c | 4 +-
external/mpl/dhcp/dist/server/tests/leaseq_unittest.c | 2 +-
external/mpl/dhcp/dist/server/tests/load_bal_unittest.c | 2 +-
external/mpl/dhcp/dist/server/tests/mdb6_unittest.c | 2 +-
external/mpl/dhcp/dist/server/tests/simple_unittest.c | 2 +-
external/mpl/dhcp/dist/tests/t_api.c | 23 +-
external/mpl/dhcp/dist/tests/t_api_dhcp.c | 2 +-
external/mpl/dhcp/dist/tests/unit_test_sample.c | 2 +-
149 files changed, 915 insertions(+), 704 deletions(-)
diffs (truncated from 4704 to 300 lines):
diff -r e48645ebedaa -r 23d56db4aa4f external/mpl/dhcp/dist/client/client_tables.c
--- a/external/mpl/dhcp/dist/client/client_tables.c Sat Apr 07 22:34:51 2018 +0000
+++ b/external/mpl/dhcp/dist/client/client_tables.c Sat Apr 07 22:37:29 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: client_tables.c,v 1.1.1.1 2018/04/07 22:34:25 christos Exp $ */
+/* $NetBSD: client_tables.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */
/* client_tables.c
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: client_tables.c,v 1.1.1.1 2018/04/07 22:34:25 christos Exp $");
+__RCSID("$NetBSD: client_tables.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
#include "dhcpd.h"
@@ -41,7 +41,8 @@
#define CLIENT_HASH_SIZE (2*(sizeof(client_options) / sizeof(struct option)))
-void initialize_client_option_spaces()
+void initialize_client_option_spaces(void);
+void initialize_client_option_spaces(void)
{
int i;
diff -r e48645ebedaa -r 23d56db4aa4f external/mpl/dhcp/dist/client/clparse.c
--- a/external/mpl/dhcp/dist/client/clparse.c Sat Apr 07 22:34:51 2018 +0000
+++ b/external/mpl/dhcp/dist/client/clparse.c Sat Apr 07 22:37:29 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clparse.c,v 1.1.1.1 2018/04/07 22:34:25 christos Exp $ */
+/* $NetBSD: clparse.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */
/* clparse.c
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: clparse.c,v 1.1.1.1 2018/04/07 22:34:25 christos Exp $");
+__RCSID("$NetBSD: clparse.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
#include "dhcpd.h"
#include <errno.h>
diff -r e48645ebedaa -r 23d56db4aa4f external/mpl/dhcp/dist/client/dhc6.c
--- a/external/mpl/dhcp/dist/client/dhc6.c Sat Apr 07 22:34:51 2018 +0000
+++ b/external/mpl/dhcp/dist/client/dhc6.c Sat Apr 07 22:37:29 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dhc6.c,v 1.1.1.1 2018/04/07 22:34:25 christos Exp $ */
+/* $NetBSD: dhc6.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */
/* dhc6.c - DHCPv6 client routines. */
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: dhc6.c,v 1.1.1.1 2018/04/07 22:34:25 christos Exp $");
+__RCSID("$NetBSD: dhc6.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
#include "dhcpd.h"
@@ -5582,7 +5582,7 @@
}
}
-void
+static void
refresh_info_request6(void *input)
{
struct client_state *client;
diff -r e48645ebedaa -r 23d56db4aa4f external/mpl/dhcp/dist/client/dhclient-script.8
--- a/external/mpl/dhcp/dist/client/dhclient-script.8 Sat Apr 07 22:34:51 2018 +0000
+++ b/external/mpl/dhcp/dist/client/dhclient-script.8 Sat Apr 07 22:37:29 2018 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: dhclient-script.8,v 1.1.1.1 2018/04/07 22:34:25 christos Exp $
+.\" $NetBSD: dhclient-script.8,v 1.2 2018/04/07 22:37:29 christos Exp $
.\"
.\" dhclient-script.8
.\"
diff -r e48645ebedaa -r 23d56db4aa4f external/mpl/dhcp/dist/client/dhclient.8
--- a/external/mpl/dhcp/dist/client/dhclient.8 Sat Apr 07 22:34:51 2018 +0000
+++ b/external/mpl/dhcp/dist/client/dhclient.8 Sat Apr 07 22:37:29 2018 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: dhclient.8,v 1.1.1.1 2018/04/07 22:34:25 christos Exp $
+.\" $NetBSD: dhclient.8,v 1.2 2018/04/07 22:37:29 christos Exp $
.\"
.\" Id: dhclient.8,v 1.36 2011/04/15 21:58:12 sar Exp
.\"
@@ -89,6 +89,9 @@
.I VAR=value
]
[
+.B -m
+]
+[
.B -q
]
[
@@ -285,6 +288,10 @@
Become a daemon immediately (nowait) rather than waiting until an
IP address has been acquired.
.TP
+.BI \-m
+Don't require that the responding ethernet address of the dhcp server
+matches the one we expect.
+.TP
.BI \-q
Be quiet at startup, this is the default.
.TP
diff -r e48645ebedaa -r 23d56db4aa4f external/mpl/dhcp/dist/client/dhclient.c
--- a/external/mpl/dhcp/dist/client/dhclient.c Sat Apr 07 22:34:51 2018 +0000
+++ b/external/mpl/dhcp/dist/client/dhclient.c Sat Apr 07 22:37:29 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dhclient.c,v 1.1.1.1 2018/04/07 22:34:25 christos Exp $ */
+/* $NetBSD: dhclient.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */
/* dhclient.c
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: dhclient.c,v 1.1.1.1 2018/04/07 22:34:25 christos Exp $");
+__RCSID("$NetBSD: dhclient.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
#include "dhcpd.h"
#include <isc/util.h>
@@ -58,10 +58,12 @@
/* False (default) => we write and use a pid file */
isc_boolean_t no_pid_file = ISC_FALSE;
+isc_boolean_t hw_mismatch_drop = ISC_TRUE;
int dhcp_max_agent_option_packet_length = 0;
int interfaces_requested = 0;
+int interfaces_left = 0;
struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } };
struct iaddr iaddr_any = { 4, { 0, 0, 0, 0 } };
@@ -113,6 +115,21 @@
int address_prefix_len = DHCLIENT_DEFAULT_PREFIX_LEN;
char *mockup_relay = NULL;
+libdhcp_callbacks_t dhclient_callbacks = {
+ &local_port,
+ &remote_port,
+ classify,
+ check_collection,
+ dhcp,
+#ifdef DHCPv6
+ dhcpv6,
+#endif /* DHCPv6 */
+ bootp,
+ find_class,
+ parse_allow_deny,
+ dhcp_set_control_state,
+};
+
char *progname = NULL;
void run_stateless(int exit_mode, u_int16_t port);
@@ -127,6 +144,80 @@
static void dhclient_ddns_cb_free(dhcp_ddns_cb_t *ddns_cb,
char* file, int line);
+static void
+setup(void) {
+ isc_result_t status;
+ /* Set up the isc and dns library managers */
+ 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));
+
+ /* Set up the OMAPI. */
+ status = omapi_init();
+ if (status != ISC_R_SUCCESS)
+ log_fatal("Can't initialize OMAPI: %s",
+ isc_result_totext(status));
+
+ /* Set up the OMAPI wrappers for various server database internal
+ objects. */
+ dhcp_common_objects_setup();
+
+ dhcp_interface_discovery_hook = dhclient_interface_discovery_hook;
+ dhcp_interface_shutdown_hook = dhclient_interface_shutdown_hook;
+ dhcp_interface_startup_hook = dhclient_interface_startup_hook;
+}
+
+static void
+go_daemon(void)
+{
+ int pid;
+
+ if (pipe(dfd) == -1)
+ log_fatal("Can't get pipe: %m");
+ if ((pid = fork ()) < 0)
+ log_fatal("Can't fork daemon: %m");
+ if (pid != 0) {
+ /* Parent: wait for the child to start */
+ int n;
+
+ (void) close(dfd[1]);
+ do {
+ char buf;
+
+ n = read(dfd[0], &buf, 1);
+ if (n == 1)
+ _exit((int)buf);
+ } while (n == -1 && errno == EINTR);
+ _exit(1);
+ }
+ /* Child */
+ (void) close(dfd[0]);
+}
+
+static void
+add_interfaces(char **ifaces, int nifaces)
+{
+ 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)
+ 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);
+ interface_dereference(&interfaces, MDL);
+ }
+ interface_reference(&interfaces, tmp, MDL);
+ tmp->flags = INTERFACE_REQUESTED;
+ }
+}
/*!
*
@@ -145,7 +236,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: dhclient.c,v 1.1.1.1 2018/04/07 22:34:25 christos Exp $");
+__RCSID("$NetBSD: dhclient.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
#if defined(DHCPv6) && defined(DHCP4o6)
static void dhcp4o6_poll(void *dummy);
@@ -217,7 +308,7 @@
DHCLIENT_USAGEH);
}
-extern void initialize_client_option_spaces();
+extern void initialize_client_option_spaces(void);
int
main(int argc, char **argv) {
@@ -227,7 +318,6 @@
struct client_state *client;
unsigned seed;
char *server = NULL;
- isc_result_t status;
int exit_mode = 0;
int release_mode = 0;
struct timeval tv;
@@ -245,6 +335,9 @@
#endif /* DHCP4o6 */
#endif /* DHCPv6 */
char *s;
+ char **ifaces;
+
+ libdhcp_callbacks_register(&dhclient_callbacks);
#ifdef OLD_LOG_NAME
progname = "dhclient";
@@ -273,6 +366,11 @@
setlogmask(LOG_UPTO(LOG_INFO));
#endif
+ if ((ifaces = malloc(sizeof(*ifaces) * argc)) == NULL) {
+ log_fatal("Can't allocate memory");
+ return 1;
+ }
+
/* Parse arguments changing no_daemon */
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-r")) {
@@ -312,50 +410,10 @@
}
/* When not forbidden prepare to become a daemon */
if (!no_daemon) {
- int pid;
-
Home |
Main Index |
Thread Index |
Old Index