Source-Changes-HG archive

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

[src/trunk]: src/external/mpl/dhcp Merge conflicts



details:   https://anonhg.NetBSD.org/src/rev/7c02fc323c89
branches:  trunk
changeset: 936985:7c02fc323c89
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Aug 03 21:10:56 2020 +0000

description:
Merge conflicts

diffstat:

 external/mpl/dhcp/dhcp2netbsd                          |    5 +-
 external/mpl/dhcp/dist/client/clparse.c                |   32 +-
 external/mpl/dhcp/dist/client/dhc6.c                   |   23 +-
 external/mpl/dhcp/dist/client/dhclient.8               |    5 +-
 external/mpl/dhcp/dist/client/dhclient.c               |  154 ++++++-
 external/mpl/dhcp/dist/common/dhcp-options.5           |   13 +-
 external/mpl/dhcp/dist/common/discover.c               |   15 +-
 external/mpl/dhcp/dist/common/dns.c                    |   38 +-
 external/mpl/dhcp/dist/common/execute.c                |   15 +-
 external/mpl/dhcp/dist/common/ns_name.c                |   39 +-
 external/mpl/dhcp/dist/common/options.c                |  112 ++++-
 external/mpl/dhcp/dist/common/parse.c                  |  108 ++++-
 external/mpl/dhcp/dist/common/socket.c                 |   53 +-
 external/mpl/dhcp/dist/common/tables.c                 |   14 +-
 external/mpl/dhcp/dist/common/tests/domain_name_test.c |    2 +-
 external/mpl/dhcp/dist/includes/dhcpd.h                |   31 +-
 external/mpl/dhcp/dist/includes/ns_name.h              |    5 +-
 external/mpl/dhcp/dist/includes/omapip/isclib.h        |    9 +-
 external/mpl/dhcp/dist/includes/omapip/omapip_p.h      |    7 +-
 external/mpl/dhcp/dist/includes/omapip/result.h        |    2 +-
 external/mpl/dhcp/dist/includes/osdep.h                |   10 +-
 external/mpl/dhcp/dist/keama/conflex.c                 |    4 +-
 external/mpl/dhcp/dist/keama/confparse.c               |    4 +-
 external/mpl/dhcp/dist/keama/data.c                    |    4 +-
 external/mpl/dhcp/dist/keama/data.h                    |    2 +-
 external/mpl/dhcp/dist/keama/dhctoken.h                |    2 +-
 external/mpl/dhcp/dist/keama/eval.c                    |    4 +-
 external/mpl/dhcp/dist/keama/json.c                    |    4 +-
 external/mpl/dhcp/dist/keama/keama.8                   |    2 +-
 external/mpl/dhcp/dist/keama/keama.c                   |    4 +-
 external/mpl/dhcp/dist/keama/keama.h                   |    2 +-
 external/mpl/dhcp/dist/keama/options.c                 |    4 +-
 external/mpl/dhcp/dist/keama/parse.c                   |    4 +-
 external/mpl/dhcp/dist/keama/print.c                   |    4 +-
 external/mpl/dhcp/dist/keama/reduce.c                  |    4 +-
 external/mpl/dhcp/dist/omapip/errwarn.c                |   23 +-
 external/mpl/dhcp/dist/omapip/isclib.c                 |   75 ++-
 external/mpl/dhcp/dist/relay/dhcrelay.c                |   92 ++-
 external/mpl/dhcp/dist/relay/tests/relay_unittests.c   |    4 +-
 external/mpl/dhcp/dist/server/class.c                  |    7 +-
 external/mpl/dhcp/dist/server/confpars.c               |   45 +-
 external/mpl/dhcp/dist/server/ddns.c                   |    9 +-
 external/mpl/dhcp/dist/server/dhcp.c                   |  355 +++++++++++-----
 external/mpl/dhcp/dist/server/dhcpd.c                  |   10 +-
 external/mpl/dhcp/dist/server/dhcpd.conf.5             |   56 ++-
 external/mpl/dhcp/dist/server/dhcpleasequery.c         |   16 +-
 external/mpl/dhcp/dist/server/dhcpv6.c                 |   45 +-
 external/mpl/dhcp/dist/server/failover.c               |   12 +-
 external/mpl/dhcp/dist/server/ldap.c                   |   19 +-
 external/mpl/dhcp/dist/server/mdb.c                    |  120 +++--
 external/mpl/dhcp/dist/server/mdb6.c                   |    6 +-
 external/mpl/dhcp/dist/server/stables.c                |   14 +-
 external/mpl/dhcp/include/config.h                     |   18 +-
 53 files changed, 1157 insertions(+), 509 deletions(-)

diffs (truncated from 4372 to 300 lines):

diff -r 6b9db463382c -r 7c02fc323c89 external/mpl/dhcp/dhcp2netbsd
--- a/external/mpl/dhcp/dhcp2netbsd     Mon Aug 03 21:09:06 2020 +0000
+++ b/external/mpl/dhcp/dhcp2netbsd     Mon Aug 03 21:10:56 2020 +0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-#      $NetBSD: dhcp2netbsd,v 1.2 2018/04/07 22:34:51 christos Exp $
+#      $NetBSD: dhcp2netbsd,v 1.3 2020/08/03 21:10:56 christos Exp $
 #
 # Copyright (c) 2003, 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -67,8 +67,7 @@
 mv /tmp/dhcp1$$ $c && echo did source mods for $c
 done
 
- for f in dst/dst_api.c dst/dst_support.c dst/hmac_link.c dst/prandom.c \
-     omapip/inet_addr.c omapip/iscprint.c server/dhcpv6.c \
+for f in omapip/inet_addr.c omapip/iscprint.c server/dhcpv6.c \
      server/dhcpleasequery.c server/ldap.c server/mdb6.c; do
        c=$FILE/$f
        sed -E -e \
diff -r 6b9db463382c -r 7c02fc323c89 external/mpl/dhcp/dist/client/clparse.c
--- a/external/mpl/dhcp/dist/client/clparse.c   Mon Aug 03 21:09:06 2020 +0000
+++ b/external/mpl/dhcp/dist/client/clparse.c   Mon Aug 03 21:10:56 2020 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: clparse.c,v 1.2 2018/04/07 22:37:29 christos Exp $     */
+/*     $NetBSD: clparse.c,v 1.3 2020/08/03 21:10:56 christos Exp $     */
 
 /* clparse.c
 
    Parser for dhclient config and lease files... */
 
 /*
- * Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2019 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1996-2003 by Internet Software Consortium
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: clparse.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: clparse.c,v 1.3 2020/08/03 21:10:56 christos Exp $");
 
 #include "dhcpd.h"
 #include <errno.h>
@@ -52,6 +52,9 @@
 
 static void parse_lease_id_format (struct parse *cfile);
 
+extern void discard_duplicate (struct client_lease** lease_list,
+                               struct client_lease* lease);
+
 /* client-conf-file :== client-declarations END_OF_FILE
    client-declarations :== <nil>
                         | client-declaration
@@ -1101,7 +1104,7 @@
        struct parse *cfile;
        int is_static;
 {
-       struct client_lease *lease, *lp, *pl, *next;
+       struct client_lease *lease;
        struct interface_info *ip = (struct interface_info *)0;
        int token;
        const char *val;
@@ -1159,22 +1162,11 @@
        /* The new lease may supersede a lease that's not the
           active lease but is still on the lease list, so scan the
           lease list looking for a lease with the same address, and
-          if we find it, toss it. */
-       pl = (struct client_lease *)0;
-       for (lp = client -> leases; lp; lp = next) {
-               next = lp -> next;
-               if (lp -> address.len == lease -> address.len &&
-                   !memcmp (lp -> address.iabuf, lease -> address.iabuf,
-                            lease -> address.len)) {
-                       if (pl)
-                               pl -> next = next;
-                       else
-                               client -> leases = next;
-                       destroy_client_lease (lp);
-                       break;
-               } else
-                       pl = lp;
-       }
+          if we find it, toss it. We only allow supercession if
+          the leases originated from the same source. In other words,
+          either both are from the config file or both are from the lease
+          file.  This keeps us from discarding fallback leases */
+       discard_duplicate (&client->leases, lease);
 
        /* If this is a preloaded lease, just put it on the list of recorded
           leases - don't make it the active lease. */
diff -r 6b9db463382c -r 7c02fc323c89 external/mpl/dhcp/dist/client/dhc6.c
--- a/external/mpl/dhcp/dist/client/dhc6.c      Mon Aug 03 21:09:06 2020 +0000
+++ b/external/mpl/dhcp/dist/client/dhc6.c      Mon Aug 03 21:10:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dhc6.c,v 1.2 2018/04/07 22:37:29 christos Exp $        */
+/*     $NetBSD: dhc6.c,v 1.3 2020/08/03 21:10:56 christos Exp $        */
 
 /* dhc6.c - DHCPv6 client routines. */
 
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: dhc6.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: dhc6.c,v 1.3 2020/08/03 21:10:56 christos Exp $");
 
 #include "dhcpd.h"
 
@@ -821,8 +821,7 @@
                } else {
                        log_error("Invalid IA_NA option cache.");
                        dfree(ia, MDL);
-                       if (ds.len != 0)
-                               data_string_forget(&ds, MDL);
+                       data_string_forget(&ds, MDL);
                        return ISC_R_UNEXPECTED;
                }
        }
@@ -924,8 +923,7 @@
                } else {
                        log_error("Invalid IA_TA option cache.");
                        dfree(ia, MDL);
-                       if (ds.len != 0)
-                               data_string_forget(&ds, MDL);
+                       data_string_forget(&ds, MDL);
                        return ISC_R_UNEXPECTED;
                }
        }
@@ -1047,8 +1045,7 @@
                } else {
                        log_error("Invalid IA_PD option cache.");
                        dfree(ia, MDL);
-                       if (ds.len != 0)
-                               data_string_forget(&ds, MDL);
+                       data_string_forget(&ds, MDL);
                        return ISC_R_UNEXPECTED;
                }
        }
@@ -1163,8 +1160,7 @@
                } else {
                        log_error("Invalid IAADDR option cache.");
                        dfree(addr, MDL);
-                       if (ds.len != 0)
-                               data_string_forget(&ds, MDL);
+                       data_string_forget(&ds, MDL);
                        return ISC_R_UNEXPECTED;
                }
        }
@@ -1288,8 +1284,7 @@
                } else {
                        log_error("Invalid IAPREFIX option cache.");
                        dfree(pfx, MDL);
-                       if (ds.len != 0)
-                               data_string_forget(&ds, MDL);
+                       data_string_forget(&ds, MDL);
                        return ISC_R_UNEXPECTED;
                }
        }
@@ -1311,9 +1306,7 @@
        }
        lease = *src;
 
-       if (lease->server_id.len != 0)
-               data_string_forget(&lease->server_id, file, line);
-
+       data_string_forget(&lease->server_id, file, line);
        for (ia = lease->bindings ; ia != NULL ; ia = nia) {
                nia = ia->next;
 
diff -r 6b9db463382c -r 7c02fc323c89 external/mpl/dhcp/dist/client/dhclient.8
--- a/external/mpl/dhcp/dist/client/dhclient.8  Mon Aug 03 21:09:06 2020 +0000
+++ b/external/mpl/dhcp/dist/client/dhclient.8  Mon Aug 03 21:10:56 2020 +0000
@@ -1,8 +1,8 @@
-.\"    $NetBSD: dhclient.8,v 1.2 2018/04/07 22:37:29 christos Exp $
+.\"    $NetBSD: dhclient.8,v 1.3 2020/08/03 21:10:56 christos Exp $
 .\"
 .\"    Id: dhclient.8,v 1.36 2011/04/15 21:58:12 sar Exp 
 .\"
-.\" Copyright (c) 2004-2018 by Internet Systems Consortium, Inc. ("ISC")
+.\" Copyright (c) 2004-2019 by Internet Systems Consortium, Inc. ("ISC")
 .\" Copyright (c) 1996-2003 by Internet Software Consortium
 .\"
 .\" This Source Code Form is subject to the terms of the Mozilla Public
@@ -57,6 +57,7 @@
 .B -P...
 ]
 ]
+[
 .B -R
 ]
 [
diff -r 6b9db463382c -r 7c02fc323c89 external/mpl/dhcp/dist/client/dhclient.c
--- a/external/mpl/dhcp/dist/client/dhclient.c  Mon Aug 03 21:09:06 2020 +0000
+++ b/external/mpl/dhcp/dist/client/dhclient.c  Mon Aug 03 21:10:56 2020 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: dhclient.c,v 1.2 2018/04/07 22:37:29 christos Exp $    */
+/*     $NetBSD: dhclient.c,v 1.3 2020/08/03 21:10:56 christos Exp $    */
 
 /* dhclient.c
 
    DHCP Client. */
 
 /*
- * Copyright (c) 2004-2018 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2020 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1995-2003 by Internet Software Consortium
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: dhclient.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: dhclient.c,v 1.3 2020/08/03 21:10:56 christos Exp $");
 
 #include "dhcpd.h"
 #include <isc/util.h>
@@ -56,6 +56,8 @@
 char *path_dhclient_script = path_dhclient_script_array;
 const char *path_dhclient_duid = NULL;
 
+static void add_to_tail(struct client_lease** lease_list, struct client_lease* lease);
+
 /* 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;
@@ -82,7 +84,7 @@
 #define ASSERT_STATE(state_is, state_shouldbe) {}
 
 #ifndef UNIT_TEST
-static const char copyright[] = "Copyright 2004-2018 Internet Systems Consortium.";
+static const char copyright[] = "Copyright 2004-2020 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/";;
@@ -142,8 +144,11 @@
 static int check_option_values(struct universe *universe, unsigned int opt,
                               const char *ptr, size_t len);
 
+#if defined(NSUPDATE)
 static void dhclient_ddns_cb_free(dhcp_ddns_cb_t *ddns_cb,
                                    char* file, int line);
+#endif /* defined NSUPDATE */
+
 static void
 setup(void) {
        isc_result_t status;
@@ -236,7 +241,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: dhclient.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: dhclient.c,v 1.3 2020/08/03 21:10:56 christos Exp $");
 
 #if defined(DHCPv6) && defined(DHCP4o6)
 static void dhcp4o6_poll(void *dummy);
@@ -1225,7 +1230,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: dhclient.c,v 1.2 2018/04/07 22:37:29 christos Exp $");
+__RCSID("$NetBSD: dhclient.c,v 1.3 2020/08/03 21:10:56 christos Exp $");
 
 void state_reboot (cpp)
        void *cpp;
@@ -1630,8 +1635,16 @@
                write_client_lease(client, client->new, 0, 1);
 
        /* Replace the old active lease with the new one. */
-       if (client->active)
-               destroy_client_lease(client->active);
+       if (client->active) {
+               if (client->active->is_static) {
+                       // We need to preserve the fallback lease in case
+                       // we lose DHCP service again.
+                       add_to_tail(&client->leases, client->active);
+               } else {
+                       destroy_client_lease(client->active);
+               }
+       }
+
        client->active = client->new;
        client->new = NULL;
 
@@ -1650,7 +1663,8 @@
 #if defined (NSUPDATE)
        if (client->config->do_forward_update)
                dhclient_schedule_updates(client, &client->active->address, 1);
-#endif
+#endif /* defined NSUPDATE */
+
 }
 
 /* state_bound is called when we've successfully bound to a particular
@@ -2515,6 +2529,101 @@
        add_timeout(&tv, send_discover, client, 0, 0);



Home | Main Index | Thread Index | Old Index