Source-Changes-HG archive

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

[src/netbsd-1-5]: src/usr.sbin/dhcp Pull up revision 1.1.1.7 (requested by me...



details:   https://anonhg.NetBSD.org/src/rev/a7c3f7b4cf7f
branches:  netbsd-1-5
changeset: 491097:a7c3f7b4cf7f
user:      he <he%NetBSD.org@localhost>
date:      Wed Apr 04 20:55:51 2001 +0000

description:
Pull up revision 1.1.1.7 (requested by mellon):
  Update DHCP software to ISC version 3, Beta 2, Patchlevel 23.

diffstat:

 usr.sbin/dhcp/client/scripts/solaris |   10 +-
 usr.sbin/dhcp/common/execute.c       |  112 ++++++++++---
 usr.sbin/dhcp/omapip/alloc.c         |   76 ++++++++-
 usr.sbin/dhcp/server/failover.c      |  274 ++++++++++++++++++++++++++++++----
 usr.sbin/dhcp/server/mdb.c           |  176 ++++++++++++++++------
 5 files changed, 517 insertions(+), 131 deletions(-)

diffs (truncated from 1356 to 300 lines):

diff -r bf44cb0d5627 -r a7c3f7b4cf7f usr.sbin/dhcp/client/scripts/solaris
--- a/usr.sbin/dhcp/client/scripts/solaris      Wed Apr 04 20:55:47 2001 +0000
+++ b/usr.sbin/dhcp/client/scripts/solaris      Wed Apr 04 20:55:51 2001 +0000
@@ -52,7 +52,7 @@
 relminor=`echo $release |sed -e 's/^.*\.\([^\.]*\)$/\1/'`
 
 if [ x$reason = xMEDIUM ]; then
-  $ifconfig $interface $medium
+  eval "$ifconfig $interface $medium"
   $ifconfig $interface
   sleep 1
   exit_with_hooks 0
@@ -104,8 +104,8 @@
   fi
   if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
      [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
-    $ifconfig $interface inet $new_ip_address $new_netmask_arg \
-                                       $new_broadcast_arg $medium
+    eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
+                                       $new_broadcast_arg $medium"
     route add $new_ip_address 127.1 1 >/dev/null 2>&1
     for router in $new_routers; do
       route add default $router 1 >/dev/null 2>&1
@@ -144,8 +144,8 @@
     $ifconfig ${interface}:1 0 down > /dev/null 2>&1
     route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
   fi
-  $ifconfig $interface inet $new_ip_address $new_netmask_arg \
-                                       $new_broadcast_arg $medium
+  eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
+                                       $new_broadcast_arg $medium"
   sleep 1
   set $new_routers
   if ping -s -n -I 1 $1 64 1; then
diff -r bf44cb0d5627 -r a7c3f7b4cf7f usr.sbin/dhcp/common/execute.c
--- a/usr.sbin/dhcp/common/execute.c    Wed Apr 04 20:55:47 2001 +0000
+++ b/usr.sbin/dhcp/common/execute.c    Wed Apr 04 20:55:51 2001 +0000
@@ -43,17 +43,18 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: execute.c,v 1.1.1.2.2.2 2000/10/18 04:11:04 tv Exp $ Copyright (c) 1998-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: execute.c,v 1.1.1.2.2.3 2001/04/04 20:55:51 he Exp $ Copyright (c) 1998-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
 #include <omapip/omapip_p.h>
 
-int execute_statements (result, packet, lease, in_options, out_options, scope,
-                       statements)
+int execute_statements (result, packet, lease, client_state,
+                       in_options, out_options, scope, statements)
        struct binding_value **result;
        struct packet *packet;
        struct lease *lease;
+       struct client_state *client_state;
        struct option_state *in_options;
        struct option_state *out_options;
        struct binding_scope **scope;
@@ -84,8 +85,8 @@
                        log_debug ("exec: statements");
 #endif
                        status = execute_statements (result, packet, lease,
-                                                    in_options, out_options,
-                                                    scope,
+                                                    client_state, in_options,
+                                                    out_options, scope,
                                                     r -> data.statements);
 #if defined (DEBUG_EXPRESSIONS)
                        log_debug ("exec: statements returns %d", status);
@@ -140,7 +141,7 @@
                        log_debug ("exec: switch");
 #endif
                        status = (find_matching_case
-                                 (&e, packet, lease,
+                                 (&e, packet, lease, client_state,
                                   in_options, out_options, scope,
                                   r -> data.s_switch.expr,
                                   r -> data.s_switch.statements));
@@ -149,7 +150,7 @@
 #endif
                        if (status) {
                                if (!(execute_statements
-                                     (result, packet, lease,
+                                     (result, packet, lease, client_state,
                                       in_options, out_options, scope, e))) {
                                        executable_statement_dereference
                                                (&e, MDL);
@@ -166,7 +167,8 @@
 
                      case if_statement:
                        status = (evaluate_boolean_expression
-                                 (&rc, packet, lease, in_options,
+                                 (&rc, packet,
+                                  lease, client_state, in_options,
                                   out_options, scope, r -> data.ie.expr));
                        
 #if defined (DEBUG_EXPRESSIONS)
@@ -178,7 +180,7 @@
                        if (!status)
                                rc = 0;
                        if (!execute_statements
-                           (result, packet, lease,
+                           (result, packet, lease, client_state,
                             in_options, out_options, scope,
                             rc ? r -> data.ie.true : r -> data.ie.false))
                                return 0;
@@ -187,7 +189,7 @@
                      case eval_statement:
                        status = evaluate_expression
                                ((struct binding_value **)0,
-                                packet, lease, in_options,
+                                packet, lease, client_state, in_options,
                                 out_options, scope, r -> data.eval);
 #if defined (DEBUG_EXPRESSIONS)
                        log_debug ("exec: evaluate: %s",
@@ -197,7 +199,8 @@
 
                      case return_statement:
                        status = evaluate_expression
-                               (result, packet, lease, in_options,
+                               (result, packet,
+                                lease, client_state, in_options,
                                 out_options, scope, r -> data.retval);
 #if defined (DEBUG_EXPRESSIONS)
                        log_debug ("exec: return: %s",
@@ -221,8 +224,11 @@
                        return 1;
 
                      case supersede_option_statement:
+                     case send_option_statement:
 #if defined (DEBUG_EXPRESSIONS)
-                       log_debug ("exec: supersede option %s.%s",
+                       log_debug ("exec: %s option %s.%s",
+                             (r -> op == supersede_option_statement
+                              ? "supersede" : "send"),
                              r -> data.option -> option -> universe -> name,
                              r -> data.option -> option -> name);
                        goto option_statement;
@@ -299,9 +305,9 @@
                                if (r -> op == set_statement) {
                                        status = (evaluate_expression
                                                  (&binding -> value, packet,
-                                                  lease, in_options,
-                                                  out_options, scope,
-                                                  r -> data.set.expr));
+                                                  lease, client_state,
+                                                  in_options, out_options,
+                                                  scope, r -> data.set.expr));
                                } else {
                                    if (!(binding_value_allocate
                                          (&binding -> value, MDL))) {
@@ -330,9 +336,6 @@
                                break;
                        }
                        binding = find_binding (*scope, r -> data.unset);
-#if defined (DEBUG_EXPRESSIONS)
-                       log_debug ("exec: unset %s", r -> data.unset);
-#endif
                        if (binding) {
                                if (binding -> value)
                                        binding_value_dereference
@@ -379,6 +382,7 @@
                        if (ns && binding) {
                                status = (evaluate_expression
                                          (&binding -> value, packet, lease,
+                                          client_state,
                                           in_options, out_options,
                                           scope, e -> data.set.expr));
                                binding -> next = ns -> bindings;
@@ -400,6 +404,7 @@
                                                                 *scope, MDL);
                                execute_statements
                                      (result, packet, lease,
+                                      client_state,
                                       in_options, out_options,
                                       &ns, e -> data.let.statements);
                        }
@@ -410,7 +415,8 @@
                      case log_statement:
                        memset (&ds, 0, sizeof ds);
                        status = (evaluate_data_expression
-                                 (&ds, packet, lease, in_options,
+                                 (&ds, packet,
+                                  lease, client_state, in_options,
                                   out_options, scope, r -> data.log.expr));
                        
 #if defined (DEBUG_EXPRESSIONS)
@@ -442,7 +448,8 @@
                        break;
 
                      default:
-                       log_fatal ("bogus statement type %d", r -> op);
+                       log_error ("bogus statement type %d", r -> op);
+                       break;
                }
                executable_statement_dereference (&r, MDL);
                if (next) {
@@ -461,11 +468,13 @@
    specific scopes, so we recursively traverse the scope list, executing
    the most outer scope first. */
 
-void execute_statements_in_scope (result, packet, lease, in_options,
-                                 out_options, scope, group, limiting_group)
+void execute_statements_in_scope (result, packet,
+                                 lease, client_state, in_options, out_options,
+                                 scope, group, limiting_group)
        struct binding_value **result;
        struct packet *packet;
        struct lease *lease;
+       struct client_state *client_state;
        struct option_state *in_options;
        struct option_state *out_options;
        struct binding_scope **scope;
@@ -507,11 +516,12 @@
        }
 
        if (group -> next)
-               execute_statements_in_scope (result, packet, lease,
+               execute_statements_in_scope (result, packet,
+                                            lease, client_state,
                                             in_options, out_options, scope,
                                             group -> next, limiting_group);
-       execute_statements (result, packet, lease, in_options, out_options,
-                           scope, group -> statements);
+       execute_statements (result, packet, lease, client_state, in_options,
+                           out_options, scope, group -> statements);
 }
 
 /* Dereference or free any subexpressions of a statement being freed. */
@@ -620,6 +630,7 @@
                break;
 
              case supersede_option_statement:
+             case send_option_statement:
              case default_option_statement:
              case append_option_statement:
              case prepend_option_statement:
@@ -773,6 +784,7 @@
                        break;
 
                      case supersede_option_statement:
+                     case send_option_statement:
                        s = "supersede";
                        goto option_statement;
 
@@ -841,6 +853,40 @@
                        col = token_print_indent (file, col, indent + 6,
                                                  " ", "", ";");
                        break;
+
+                     case log_statement:
+                       indent_spaces (file, indent);
+                       fprintf (file, "log ");
+                       col = token_print_indent (file, col, indent + 4,
+                                                 "", "", "(");
+                       switch (r -> data.log.priority) {
+                       case log_priority_fatal:
+                               col = token_print_indent
+                                       (file, col, indent + 4, "",
+                                        " ", "fatal,");
+                               break;
+                       case log_priority_error:
+                               col = token_print_indent
+                                       (file, col, indent + 4, "",
+                                        " ", "error,");
+                               break;
+                       case log_priority_debug:
+                               col = token_print_indent
+                                       (file, col, indent + 4, "",
+                                        " ", "debug,");
+                               break;
+                       case log_priority_info:
+                               col = token_print_indent
+                                       (file, col, indent + 4, "",
+                                        " ", "info,");
+                               break;
+                       }
+                       col = write_expression (file, r -> data.log.expr,
+                                               indent + 4, indent + 4, 0);
+                       col = token_print_indent (file, col, indent + 4,
+                                                 "", "", ");");
+
+                       break;
                        
                      default:
                        log_fatal ("bogus statement type %d\n", r -> op);
@@ -856,6 +902,7 @@
 
 int find_matching_case (struct executable_statement **ep,
                        struct packet *packet, struct lease *lease,
+                       struct client_state *client_state,
                        struct option_state *in_options,
                        struct option_state *out_options,
                        struct binding_scope **scope,
@@ -873,14 +920,15 @@
                memset (&cd, 0, sizeof cd);
 
                status = (evaluate_data_expression (&ds, packet, lease,
-                                                   in_options, out_options,



Home | Main Index | Thread Index | Old Index