Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/dhcp Fix conflicts in latest import.



details:   https://anonhg.NetBSD.org/src/rev/9f00d2fbce83
branches:  trunk
changeset: 494589:9f00d2fbce83
user:      mellon <mellon%NetBSD.org@localhost>
date:      Sat Jul 08 20:52:11 2000 +0000

description:
Fix conflicts in latest import.

diffstat:

 usr.sbin/dhcp/common/comapi.c     |   2 +-
 usr.sbin/dhcp/common/discover.c   |   4 +-
 usr.sbin/dhcp/common/options.c    |  10 +++++-
 usr.sbin/dhcp/includes/dhcpd.h    |  20 ++++++-----
 usr.sbin/dhcp/includes/site.h     |   6 +++
 usr.sbin/dhcp/includes/version.h  |   2 +-
 usr.sbin/dhcp/omapip/dispatch.c   |   5 ---
 usr.sbin/dhcp/server/confpars.c   |  40 ++++++++++++++++++------
 usr.sbin/dhcp/server/dhcp.c       |  63 ++++++++++++++++++--------------------
 usr.sbin/dhcp/server/dhcpd.c      |   9 +++-
 usr.sbin/dhcp/server/dhcpd.conf.5 |   2 +-
 usr.sbin/dhcp/server/omapi.c      |  19 +++++------
 12 files changed, 106 insertions(+), 76 deletions(-)

diffs (truncated from 462 to 300 lines):

diff -r e2dbf64e39dc -r 9f00d2fbce83 usr.sbin/dhcp/common/comapi.c
--- a/usr.sbin/dhcp/common/comapi.c     Sat Jul 08 20:40:10 2000 +0000
+++ b/usr.sbin/dhcp/common/comapi.c     Sat Jul 08 20:52:11 2000 +0000
@@ -50,7 +50,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: comapi.c,v 1.1.1.2 2000/07/08 20:40:14 mellon Exp $ Copyright (c) 1999-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: comapi.c,v 1.2 2000/07/08 20:52:11 mellon Exp $ Copyright (c) 1999-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
diff -r e2dbf64e39dc -r 9f00d2fbce83 usr.sbin/dhcp/common/discover.c
--- a/usr.sbin/dhcp/common/discover.c   Sat Jul 08 20:40:10 2000 +0000
+++ b/usr.sbin/dhcp/common/discover.c   Sat Jul 08 20:52:11 2000 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: discover.c,v 1.4 2000/06/10 18:17:20 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: discover.c,v 1.5 2000/07/08 20:52:12 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -101,7 +101,7 @@
                        (&dhcp_type_interface, "interface",
                         interface_set_value, interface_get_value,
                         interface_destroy, interface_signal_handler,
-                        interface_stuff_values, 0, 0, 0, 0, 0,
+                        interface_stuff_values, 0, 0, 0, 0, 0, 0,
                         sizeof (struct interface_info));
                if (status != ISC_R_SUCCESS)
                        log_fatal ("Can't create interface object type: %s",
diff -r e2dbf64e39dc -r 9f00d2fbce83 usr.sbin/dhcp/common/options.c
--- a/usr.sbin/dhcp/common/options.c    Sat Jul 08 20:40:10 2000 +0000
+++ b/usr.sbin/dhcp/common/options.c    Sat Jul 08 20:52:11 2000 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: options.c,v 1.5 2000/06/24 06:57:05 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: options.c,v 1.6 2000/07/08 20:52:12 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #define DHCP_OPTION_DATA
@@ -672,10 +672,18 @@
                              case 't':
                                if (emit_quotes)
                                        *op++ = '"';
+<<<<<<< options.c
                                for (; dp < data + len; dp++) {
                                        if (!isascii (*dp) ||
                                            !isprint (*dp)) {
                                                sprintf (op, "\\\\%03o", *dp);
+=======
+                               for (; dp < data + len; dp++) {
+                                       if (!isascii (*dp) ||
+                                           !isprint (*dp)) {
+                                               sprintf (op, "\\%03o",
+                                                        *dp);
+>>>>>>> 1.1.1.13
                                                op += 4;
                                        } else if (*dp == '"' ||
                                                   *dp == '\'' ||
diff -r e2dbf64e39dc -r 9f00d2fbce83 usr.sbin/dhcp/includes/dhcpd.h
--- a/usr.sbin/dhcp/includes/dhcpd.h    Sat Jul 08 20:40:10 2000 +0000
+++ b/usr.sbin/dhcp/includes/dhcpd.h    Sat Jul 08 20:52:11 2000 +0000
@@ -1660,6 +1660,8 @@
 #endif
 int db_printable PROTO ((const char *));
 int db_printable_len PROTO ((const unsigned char *, unsigned));
+void write_named_billing_class (const char *, unsigned, struct class *);
+void write_billing_classes (void);
 int write_billing_class PROTO ((struct class *));
 int commit_leases PROTO ((void));
 void db_startup PROTO ((int));
@@ -1786,8 +1788,9 @@
 isc_result_t tsig_key_lookup (struct tsig_key **, const char *);
 int dns_zone_dereference PROTO ((struct dns_zone **, const char *, int));
 #if defined (NSUPDATE)
-int find_cached_zone (const char *, ns_class, char *,
-                     size_t, struct in_addr *, int, struct dns_zone **);
+ns_rcode find_cached_zone (const char *, ns_class, char *,
+                          size_t, struct in_addr *, int, int *,
+                          struct dns_zone **);
 void forget_zone (struct dns_zone **);
 void repudiate_zone (struct dns_zone **);
 #endif /* NSUPDATE */
@@ -1840,13 +1843,11 @@
 int executable_statement_dereference PROTO ((struct executable_statement **,
                                             const char *, int));
 void write_statements (FILE *, struct executable_statement *, int);
-struct executable_statement *find_matching_case PROTO ((struct packet *,
-                                                       struct lease *,
-                                                       struct option_state *,
-                                                       struct option_state *,
-                                                       struct binding_scope *,
-                                                       struct expression *,
-                                             struct executable_statement *));
+int find_matching_case (struct executable_statement **,
+                       struct packet *, struct lease *,
+                       struct option_state *, struct option_state *,
+                       struct binding_scope *,
+                       struct expression *, struct executable_statement *);
 
 /* auth.c */
 void enter_auth_key PROTO ((struct data_string *, struct auth_key *));
@@ -2122,6 +2123,7 @@
 void new_address_range PROTO ((struct iaddr, struct iaddr,
                               struct subnet *, struct pool *));
 isc_result_t dhcp_lease_free (omapi_object_t *, const char *, int);
+isc_result_t dhcp_lease_get (omapi_object_t **, const char *, int);
 int find_grouped_subnet PROTO ((struct subnet **, struct shared_network *,
                                struct iaddr, const char *, int));
 int find_subnet (struct subnet **, struct iaddr, const char *, int);
diff -r e2dbf64e39dc -r 9f00d2fbce83 usr.sbin/dhcp/includes/site.h
--- a/usr.sbin/dhcp/includes/site.h     Sat Jul 08 20:40:10 2000 +0000
+++ b/usr.sbin/dhcp/includes/site.h     Sat Jul 08 20:52:11 2000 +0000
@@ -157,3 +157,9 @@
 /* Define this to change the logging facility used by dhcpd. */
 
 /* #define DHCPD_LOG_FACILITY LOG_DAEMON */
+
+/* Define this if you aren't debugging and you want to save memory
+   (potentially a _lot_ of memory) by allocating leases in chunks rather
+   than one at a time. */
+
+#define COMPACT_LEASES
diff -r e2dbf64e39dc -r 9f00d2fbce83 usr.sbin/dhcp/includes/version.h
--- a/usr.sbin/dhcp/includes/version.h  Sat Jul 08 20:40:10 2000 +0000
+++ b/usr.sbin/dhcp/includes/version.h  Sat Jul 08 20:52:11 2000 +0000
@@ -1,3 +1,3 @@
 /* Current version of ISC DHCP Distribution. */
 
-#define DHCP_VERSION   "V3.0b2pl0-20000810"
+#define DHCP_VERSION   "V3.0b2pl0-20000708"
diff -r e2dbf64e39dc -r 9f00d2fbce83 usr.sbin/dhcp/omapip/dispatch.c
--- a/usr.sbin/dhcp/omapip/dispatch.c   Sat Jul 08 20:40:10 2000 +0000
+++ b/usr.sbin/dhcp/omapip/dispatch.c   Sat Jul 08 20:52:11 2000 +0000
@@ -303,8 +303,6 @@
                        if (io -> readfd && io -> inner &&
                            (desc = (*(io -> readfd)) (io -> inner)) >= 0) {
                            FD_SET (desc, &r);
-                           log_error ("read check: %d %x %x",
-                                      max, r.fds_bits [0], w.fds_bits [0]);
                            count = select (desc + 1, &r, &w, &x, &t0);
                           bogon:
                            if (count < 0) {
@@ -330,9 +328,6 @@
                        if (io -> writefd && io -> inner &&
                            (desc = (*(io -> writefd)) (io -> inner)) >= 0) {
                                FD_SET (desc, &w);
-                               log_error ("write check: %d %x %x",
-                                          max,
-                                          r.fds_bits [0], w.fds_bits [0]);
                                count = select (desc + 1, &r, &w, &x, &t0);
                                if (count < 0)
                                        goto bogon;
diff -r e2dbf64e39dc -r 9f00d2fbce83 usr.sbin/dhcp/server/confpars.c
--- a/usr.sbin/dhcp/server/confpars.c   Sat Jul 08 20:40:10 2000 +0000
+++ b/usr.sbin/dhcp/server/confpars.c   Sat Jul 08 20:52:11 2000 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: confpars.c,v 1.4 2000/06/24 06:57:05 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: confpars.c,v 1.5 2000/07/08 20:52:19 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -137,15 +137,6 @@
                        struct lease *lease = (struct lease *)0;
                        if (parse_lease_declaration (&lease, cfile)) {
                                enter_lease (lease);
-                               if (lease -> on_expiry)
-                                       executable_statement_dereference
-                                               (&lease -> on_expiry, MDL);
-                               if (lease -> on_commit)
-                                       executable_statement_dereference
-                                               (&lease -> on_commit, MDL);
-                               if (lease -> on_release)
-                                       executable_statement_dereference
-                                               (&lease -> on_release, MDL);
                                lease_dereference (&lease, MDL);
                        } else
                                parse_warn (cfile,
@@ -2388,6 +2379,12 @@
                      case TOKEN_NEXT:
                        seenbit = 128;
                        statep = &lease -> next_binding_state;
+                       token = next_token (&val, cfile);
+                       if (token != BINDING) {
+                               parse_warn (cfile, "expecting 'binding'");
+                               skip_to_semi (cfile);
+                               break;
+                       }
                        goto do_binding_state;
 
                      case BINDING:
@@ -2693,6 +2690,29 @@
                        seenmask |= seenbit;
 
        } while (1);
+
+       /* If no binding state is specified, make one up. */
+       if (!(seenmask & 256)) {
+               if (lease -> ends > cur_time ||
+                   lease -> on_expiry || lease -> on_release)
+                       lease -> binding_state = FTS_ACTIVE;
+#if defined (FAILOVER_PROTOCOL)
+               else if (lease -> pool && lease -> pool -> failover_peer)
+                       lease -> binding_state = FTS_EXPIRED;
+#endif
+               else
+                       lease -> binding_state = FTS_FREE;
+               if (lease -> binding_state == FTS_ACTIVE) {
+#if defined (FAILOVER_PROTOCOL)
+                       if (lease -> pool && lease -> pool -> failover_peer)
+                               lease -> next_binding_state = FTS_EXPIRED;
+                       else
+#endif
+                               lease -> next_binding_state = FTS_FREE;
+               } else
+                       lease -> next_binding_state = lease -> binding_state;
+       }
+
        lease_reference (lp, lease, MDL);
        lease_dereference (&lease, MDL);
        return 1;
diff -r e2dbf64e39dc -r 9f00d2fbce83 usr.sbin/dhcp/server/dhcp.c
--- a/usr.sbin/dhcp/server/dhcp.c       Sat Jul 08 20:40:10 2000 +0000
+++ b/usr.sbin/dhcp/server/dhcp.c       Sat Jul 08 20:52:11 2000 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dhcp.c,v 1.14 2000/06/24 06:50:03 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhcp.c,v 1.15 2000/07/08 20:52:19 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -1202,37 +1202,6 @@
                           packet -> options, DHO_DHCP_SERVER_IDENTIFIER))
                state -> got_server_identifier = 1;
 
-       /* Replace the old lease hostname with the new one, if it's changed. */
-       oc = lookup_option (&dhcp_universe, packet -> options, DHO_HOST_NAME);
-       memset (&d1, 0, sizeof d1);
-       if (oc)
-               s1 = evaluate_option_cache (&d1, packet, (struct lease *)0,
-                                           packet -> options,
-                                           (struct option_state *)0,
-                                           &global_scope, oc, MDL);
-       if (oc && s1 &&
-           lease -> client_hostname &&
-           strlen (lease -> client_hostname) == d1.len &&
-           !memcmp (lease -> client_hostname, d1.data, d1.len)) {
-               /* Hasn't changed. */
-               data_string_forget (&d1, MDL);
-       } else if (oc && s1) {
-               if (lease -> client_hostname)
-                       dfree (lease -> client_hostname, MDL);
-               lease -> client_hostname =
-                       dmalloc (d1.len + 1, MDL);
-               if (!lease -> client_hostname)
-                       log_error ("no memory for client hostname.");
-               else {
-                       memcpy (lease -> client_hostname, d1.data, d1.len);
-                       lease -> client_hostname [d1.len] = 0;
-               }
-               data_string_forget (&d1, MDL);
-       } else if (lease -> client_hostname) {
-               dfree (lease -> client_hostname, MDL);
-               lease -> client_hostname = 0;
-       }
-
        /* Steal the agent options from the packet. */
        if (packet -> options -> universes [agent_universe.index]) {
                state -> options -> universes [agent_universe.index] =
@@ -1371,6 +1340,7 @@
 
        /* Make sure this packet satisfies the configured minimum
           number of seconds. */
+       memset (&d1, 0, sizeof d1);
        if (offer == DHCPOFFER &&
            (oc = lookup_option (&server_universe, state -> options,
                                 SV_MIN_SECS))) {
@@ -1778,6 +1748,32 @@
        lt -> scope.bindings = lease -> scope.bindings;
        lease -> scope.bindings = (struct binding *)0;
 
+       /* Replace the old lease hostname with the new one, if it's changed. */
+       oc = lookup_option (&dhcp_universe, packet -> options, DHO_HOST_NAME);
+       if (oc)
+               s1 = evaluate_option_cache (&d1, packet, (struct lease *)0,
+                                           packet -> options,
+                                           (struct option_state *)0,
+                                           &global_scope, oc, MDL);
+       if (oc && s1 &&
+           lease -> client_hostname &&



Home | Main Index | Thread Index | Old Index