Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/dhcp merge conflicts



details:   https://anonhg.NetBSD.org/src/rev/d6d81c9097d1
branches:  trunk
changeset: 342836:d6d81c9097d1
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jan 10 20:10:44 2016 +0000

description:
merge conflicts

diffstat:

 external/bsd/dhcp/Makefile.inc                    |     7 +-
 external/bsd/dhcp/dist/client/dhc6.c              |    57 +-
 external/bsd/dhcp/dist/client/dhclient.8          |    43 +-
 external/bsd/dhcp/dist/client/dhclient.c          |   229 ++-
 external/bsd/dhcp/dist/common/alloc.c             |    68 +-
 external/bsd/dhcp/dist/common/bpf.c               |    11 +-
 external/bsd/dhcp/dist/common/conflex.c           |    37 +-
 external/bsd/dhcp/dist/common/discover.c          |    19 +-
 external/bsd/dhcp/dist/common/dns.c               |     6 +-
 external/bsd/dhcp/dist/common/ns_name.c           |   156 ++-
 external/bsd/dhcp/dist/common/packet.c            |    99 +-
 external/bsd/dhcp/dist/dst/Makefile.am            |     8 -
 external/bsd/dhcp/dist/dst/Makefile.in            |   600 ---------
 external/bsd/dhcp/dist/dst/base64.c               |   328 ----
 external/bsd/dhcp/dist/dst/dst_api.c              |  1092 ----------------
 external/bsd/dhcp/dist/dst/dst_internal.h         |   172 --
 external/bsd/dhcp/dist/dst/dst_support.c          |   474 -------
 external/bsd/dhcp/dist/dst/hmac_link.c            |   505 -------
 external/bsd/dhcp/dist/dst/md5.h                  |   124 -
 external/bsd/dhcp/dist/dst/md5_dgst.c             |   400 ------
 external/bsd/dhcp/dist/dst/md5_locl.h             |   212 ---
 external/bsd/dhcp/dist/dst/prandom.c              |   980 --------------
 external/bsd/dhcp/dist/includes/config.h.in       |    36 +
 external/bsd/dhcp/dist/includes/dhcpd.h           |   211 ++-
 external/bsd/dhcp/dist/includes/omapip/omapip_p.h |     3 +-
 external/bsd/dhcp/dist/includes/omapip/result.h   |     7 +-
 external/bsd/dhcp/dist/omapip/isclib.c            |    65 +-
 external/bsd/dhcp/dist/relay/dhcrelay.c           |    36 +-
 external/bsd/dhcp/dist/server/confpars.c          |   191 ++-
 external/bsd/dhcp/dist/server/ddns.c              |    37 +-
 external/bsd/dhcp/dist/server/dhcp.c              |    10 +-
 external/bsd/dhcp/dist/server/dhcpd.c             |   222 ++-
 external/bsd/dhcp/dist/server/dhcpv6.c            |  1398 +++++++++++++++-----
 external/bsd/dhcp/dist/server/mdb.c               |   428 ++++--
 external/bsd/dhcp/dist/server/mdb6.c              |   121 +-
 external/bsd/dhcp/dist/server/omapi.c             |    54 +-
 external/bsd/dhcp/dist/test-driver                |   127 -
 external/bsd/dhcp/include/config.h                |    52 +-
 external/bsd/dhcp/lib/Makefile                    |     4 +-
 external/bsd/dhcp/lib/dst/Makefile                |    12 -
 40 files changed, 2707 insertions(+), 5934 deletions(-)

diffs (truncated from 12143 to 300 lines):

diff -r c450e3e7db82 -r d6d81c9097d1 external/bsd/dhcp/Makefile.inc
--- a/external/bsd/dhcp/Makefile.inc    Sun Jan 10 19:44:06 2016 +0000
+++ b/external/bsd/dhcp/Makefile.inc    Sun Jan 10 20:10:44 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.15 2015/09/27 21:01:27 mlelstv Exp $
+# $NetBSD: Makefile.inc,v 1.16 2016/01/10 20:10:44 christos Exp $
 
 WARNS?=        1       # XXX -Wshadow -Wcast-qual -Wsign-compare
 
@@ -15,7 +15,6 @@
 
 COBJDIR!=cd ${.PARSEDIR}/lib/common && ${PRINTOBJDIR}
 OMOBJDIR!=cd ${.PARSEDIR}/lib/omapip && ${PRINTOBJDIR}
-DSTOBJDIR!=cd ${.PARSEDIR}/lib/dst && ${PRINTOBJDIR}
 
 .if (${USE_INET6} != "no")
 CPPFLAGS+=     -DDHCPv6
@@ -30,7 +29,7 @@
 .endfor
 CPPFLAGS+= -DLOCALSTATEDIR='"/var"'
 LDADD+= ${COBJDIR}/libdhcp.a
-LDADD+= ${OMOBJDIR}/libomapi.a ${DSTOBJDIR}/libdst.a
+LDADD+= ${OMOBJDIR}/libomapi.a
 .if defined(PROG) && ${PROG} == "dhclient"
 LDADD+=-Wl,-Bstatic
 .endif
@@ -53,6 +52,6 @@
 LDADD+=-Wl,-Bdynamic
 .endif
 DPADD+= ${COBJDIR}/libdhcp.a
-DPADD+= ${OMOBJDIR}/libomapi.a ${DSTOBJDIR}/libdst.a
+DPADD+= ${OMOBJDIR}/libomapi.a
 DPADD+=        ${LIBDNS} ${LIBISC}
 DPADD+= ${LIBPTHREAD}
diff -r c450e3e7db82 -r d6d81c9097d1 external/bsd/dhcp/dist/client/dhc6.c
--- a/external/bsd/dhcp/dist/client/dhc6.c      Sun Jan 10 19:44:06 2016 +0000
+++ b/external/bsd/dhcp/dist/client/dhc6.c      Sun Jan 10 20:10:44 2016 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: dhc6.c,v 1.6 2014/07/12 12:09:37 spz Exp $     */
+/*     $NetBSD: dhc6.c,v 1.7 2016/01/10 20:10:44 christos Exp $        */
 /* dhc6.c - DHCPv6 client routines. */
 
 /*
- * Copyright (c) 2012-2013 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2012-2015 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
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: dhc6.c,v 1.6 2014/07/12 12:09:37 spz Exp $");
+__RCSID("$NetBSD: dhc6.c,v 1.7 2016/01/10 20:10:44 christos Exp $");
 
 #include "dhcpd.h"
 
@@ -304,7 +304,7 @@
 static void
 dhc6_retrans_advance(struct client_state *client)
 {
-       struct timeval elapsed;
+       struct timeval elapsed, elapsed_plus_rt;
 
        /* elapsed = cur - start */
        elapsed.tv_sec = cur_tv.tv_sec - client->start_time.tv_sec;
@@ -321,6 +321,12 @@
                elapsed.tv_sec += 1;
                elapsed.tv_usec -= 1000000;
        }
+       /*
+        * Save what the time will be after the current RT to determine
+        * what the delta to MRD will be.
+        */
+       elapsed_plus_rt.tv_sec = elapsed.tv_sec;
+       elapsed_plus_rt.tv_usec = elapsed.tv_usec;
 
        /*
         * RT for each subsequent message transmission is based on the previous
@@ -359,12 +365,16 @@
        }
        if (elapsed.tv_sec >= client->MRD) {
                /*
-                * wake at RT + cur = start + MRD
+                * The desired RT is the time that will be remaining in MRD
+                * when the current timeout finishes.  We then have 
+                * desired RT = MRD - (elapsed time + previous RT); or
+                * desired RT = MRD - elapsed_plut_rt;
                 */
-               client->RT = client->MRD +
-                       (client->start_time.tv_sec - cur_tv.tv_sec);
-               client->RT = client->RT * 100 +
-                       (client->start_time.tv_usec - cur_tv.tv_usec) / 10000;
+               client->RT = client->MRD - elapsed_plus_rt.tv_sec;
+               client->RT = (client->RT * 100) -
+                       (elapsed_plus_rt.tv_usec / 10000);
+               if (client->RT < 0)
+                       client->RT = 0;
        }
        client->txcount++;
 }
@@ -1441,7 +1451,7 @@
        }
 
        /* Check if finished (-1 argument). */
-       if ((client->MRD != 0) && (elapsed.tv_sec > client->MRD)) {
+       if ((client->MRD != 0) && (elapsed.tv_sec >= client->MRD)) {
                log_info("Max retransmission duration exceeded.");
                return(CHK_TIM_MRD_EXCEEDED);
        }
@@ -2792,6 +2802,12 @@
 
        lease = dhc6_leaseify(packet);
 
+       /* Out of memory or corrupt packet condition...hopefully a temporary
+        * problem.  Returning now makes us try to retransmit later.
+        */
+       if (lease == NULL)
+               return;
+
        if (dhc6_check_advertise(lease) != ISC_R_SUCCESS) {
                log_debug("PRC: Lease failed to satisfy.");
                dhc6_lease_destroy(&lease, MDL);
@@ -2909,7 +2925,7 @@
 
        lease = dhc6_leaseify(packet);
 
-       /* This is an out of memory condition...hopefully a temporary
+       /* Out of memory or corrupt packet condition...hopefully a temporary
         * problem.  Returning now makes us try to retransmit later.
         */
        if (lease == NULL)
@@ -3723,7 +3739,7 @@
 
        lease = dhc6_leaseify(packet);
 
-       /* This is an out of memory condition...hopefully a temporary
+       /* Out of memory or corrupt packet condition...hopefully a temporary
         * problem.  Returning now makes us try to retransmit later.
         */
        if (lease == NULL)
@@ -3845,11 +3861,8 @@
                                      piaddr(addr->address),
                                      (unsigned) addr->plen);
                } else {
-                       /* Current practice is that all subnets are /64's, but
-                        * some suspect this may not be permanent.
-                        */
                        client_envadd(client, prefix, "ip6_prefixlen",
-                                     "%d", 64);
+                                     "%d", DHCLIENT_DEFAULT_PREFIX_LEN);
                        client_envadd(client, prefix, "ip6_address",
                                      "%s", piaddr(addr->address));
                }
@@ -3859,10 +3872,10 @@
                }
                client_envadd(client, prefix, "life_starts", "%d",
                              (int)(addr->starts));
-               client_envadd(client, prefix, "preferred_life", "%d",
-                             (int)(addr->preferred_life));
-               client_envadd(client, prefix, "max_life", "%d",
-                             (int)(addr->max_life));
+               client_envadd(client, prefix, "preferred_life", "%u",
+                             addr->preferred_life);
+               client_envadd(client, prefix, "max_life", "%u",
+                             addr->max_life);
        }
 
        /* ia fields. */
@@ -4256,6 +4269,10 @@
                        oldia = NULL;
 
                for (addr = ia->addrs ; addr != NULL ; addr = addr->next) {
+                       /* Don't try to use the address if it's already expired */
+                       if (addr->flags & DHC6_ADDR_EXPIRED)
+                               continue;
+
                        if (oldia != NULL) {
                                if (ia->ia_type != D6O_IA_PD)
                                        oldaddr = find_addr(oldia->addrs,
diff -r c450e3e7db82 -r d6d81c9097d1 external/bsd/dhcp/dist/client/dhclient.8
--- a/external/bsd/dhcp/dist/client/dhclient.8  Sun Jan 10 19:44:06 2016 +0000
+++ b/external/bsd/dhcp/dist/client/dhclient.8  Sun Jan 10 20:10:44 2016 +0000
@@ -1,8 +1,8 @@
-.\"    $NetBSD: dhclient.8,v 1.3 2014/07/12 12:09:37 spz Exp $
+.\"    $NetBSD: dhclient.8,v 1.4 2016/01/10 20:10:44 christos Exp $
 .\"
 .\"    Id: dhclient.8,v 1.36 2011/04/15 21:58:12 sar Exp 
 .\"
-.\" Copyright (c) 2004,2007-2014 by Internet Systems Consortium, Inc. ("ISC")
+.\" Copyright (c) 2004,2007-2015 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
@@ -75,6 +75,10 @@
 .B -d
 ]
 [
+.B -df
+.I duid-lease-file
+]
+[
 .B -e
 .I VAR=value
 ]
@@ -400,6 +404,16 @@
 .B ETCDIR/dhclient.conf
 is used.  See \fBdhclient.conf(5)\fR for a description of this file.
 .TP
+.BI \-df \ duid-lease-file
+Path to a secondary lease file.  If the primary lease file doesn't contain
+a DUID this file will be searched.  The DUID read from the secondary will
+be written to the primary.  This option can be used to allow an IPv4 instance
+of the client to share a DUID with an IPv6 instance.  After starting one of
+the instances the second can be started with this option pointing to the
+lease file of the first instance.  There is no default.  If no file is
+specified no search is made for a DUID should one not be found in the main
+lease file.
+.TP
 .BI \-lf \ lease-file
 Path to the lease database file.  If unspecified, the default
 .B DBDIR/dhclient.leases
@@ -422,8 +436,33 @@
 when it gets a lease.  If unspecified, the default
 .B CLIENTBINDIR/dhclient-script
 is used.  See \fBdhclient-script(8)\fR for a description of this file.
+.PP
+.SH PORTS
+During operations the client may use multiple UDP ports
+to provide different functions.  Which ports are opened depends
+on both the way you compiled your code and the configuration you
+supply.  The following should provide you an idea of what
+ports may be in use.
 
+Normally a DHCPv4 client will open a raw UDP socket to receive
+and send most DHCPv4 packets.  It also opens a fallback UDP socket
+for use in sending unicast packets.  Normally these will both
+use the well known port number for BOOTPC.
 
+For DHCPv6 the client opens a UDP socket on the well known
+client port and a fallback UDP socket on a random port for
+use in sending unicast messages.  Unlike DHCPv4 the well
+known socket doesn't need to be opened in raw mode.
+
+If you have included an omapi port statement in your configuration
+file then the client will open a TCP socket on that port to
+listen for OMPAI connections.  When something connects another
+port will be used for the established connection.
+
+When DDNS is enabled at compile time (see includes/site.h)
+the client will open both a v4 and a v6 UDP socket on
+random ports.  These ports are opened even if DDNS is disabled
+in the configuration file.
 .PP
 .SH CONFIGURATION
 The syntax of the \fBdhclient.conf(5)\fR file is discussed separately.
diff -r c450e3e7db82 -r d6d81c9097d1 external/bsd/dhcp/dist/client/dhclient.c
--- a/external/bsd/dhcp/dist/client/dhclient.c  Sun Jan 10 19:44:06 2016 +0000
+++ b/external/bsd/dhcp/dist/client/dhclient.c  Sun Jan 10 20:10:44 2016 +0000
@@ -1,10 +1,10 @@
-/*     $NetBSD: dhclient.c,v 1.9 2014/07/12 12:09:37 spz Exp $ */
+/*     $NetBSD: dhclient.c,v 1.10 2016/01/10 20:10:44 christos Exp $   */
 /* dhclient.c
 
    DHCP Client. */
 
 /*
- * Copyright (c) 2004-2014 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2015 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
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: dhclient.c,v 1.9 2014/07/12 12:09:37 spz Exp $");
+__RCSID("$NetBSD: dhclient.c,v 1.10 2016/01/10 20:10:44 christos Exp $");
 
 #include "dhcpd.h"
 #include <syslog.h>
@@ -51,6 +51,7 @@
 const char *path_dhclient_pid = NULL;
 static char path_dhclient_script_array[] = _PATH_DHCLIENT_SCRIPT;
 char *path_dhclient_script = path_dhclient_script_array;
+const char *path_dhclient_duid = NULL;
 
 /* False (default) => we write and use a pid file */
 isc_boolean_t no_pid_file = ISC_FALSE;
@@ -75,7 +76,7 @@
    assert (state_is == state_shouldbe). */
 #define ASSERT_STATE(state_is, state_shouldbe) {}
 
-static const char copyright[] = "Copyright 2004-2014 Internet Systems Consortium.";
+static const char copyright[] = "Copyright 2004-2015 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/";;
@@ -106,6 +107,8 @@
 static int check_option_values(struct universe *universe, unsigned int opt,



Home | Main Index | Thread Index | Old Index