Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/dhcp adjust build to 4.2.5



details:   https://anonhg.NetBSD.org/src/rev/881491dcc417
branches:  trunk
changeset: 785691:881491dcc417
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 24 23:03:05 2013 +0000

description:
adjust build to 4.2.5

diffstat:

 external/bsd/dhcp/Makefile.inc                 |    4 +-
 external/bsd/dhcp/dist/client/dhc6.c           |   49 +-
 external/bsd/dhcp/dist/client/dhclient.c       |  169 ++-
 external/bsd/dhcp/dist/client/dhclient.conf    |   36 -
 external/bsd/dhcp/dist/common/conflex.c        |    8 +-
 external/bsd/dhcp/dist/common/dns.c            |   89 +-
 external/bsd/dhcp/dist/common/ns_name.c        |    4 +-
 external/bsd/dhcp/dist/dst/base64.c            |    4 +-
 external/bsd/dhcp/dist/dst/dst_api.c           |    4 +-
 external/bsd/dhcp/dist/includes/dhcpd.h        |   46 +-
 external/bsd/dhcp/dist/omapip/dispatch.c       |   15 +-
 external/bsd/dhcp/dist/relay/dhcrelay.c        |   23 +-
 external/bsd/dhcp/dist/server/ddns.c           |  241 ++++-
 external/bsd/dhcp/dist/server/dhcpd.conf       |  104 --
 external/bsd/dhcp/dist/server/dhcpleasequery.c |   19 +-
 external/bsd/dhcp/dist/server/dhcpv6.c         |  195 ++--
 external/bsd/dhcp/dist/server/mdb6.c           |  998 +++++++-----------------
 external/bsd/dhcp/include/config.h             |   16 +-
 18 files changed, 900 insertions(+), 1124 deletions(-)

diffs (truncated from 3412 to 300 lines):

diff -r 89d310695507 -r 881491dcc417 external/bsd/dhcp/Makefile.inc
--- a/external/bsd/dhcp/Makefile.inc    Sun Mar 24 23:00:48 2013 +0000
+++ b/external/bsd/dhcp/Makefile.inc    Sun Mar 24 23:03:05 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.2 2013/03/24 22:21:21 christos Exp $
+# $NetBSD: Makefile.inc,v 1.3 2013/03/24 23:03:05 christos Exp $
 
 WARNS?=        1       # XXX -Wshadow -Wcast-qual -Wsign-compare
 
@@ -20,7 +20,7 @@
 .if (${USE_INET6} != "no")
 CPPFLAGS+=     -DDHCPv6
 .endif
-CPPFLAGS+= -DISC_PLATFORM_USETHREADS
+CPPFLAGS+= -DISC_PLATFORM_USETHREADS -DHAVE_CONFIG_H
 CPPFLAGS+= -I${DIST} -I${DIST}/includes -I${DIST}/../include
 CPPFLAGS+= -I${BIND} -I${BIND}/includes -I${BIND}/../include
 .for dir in isc dns
diff -r 89d310695507 -r 881491dcc417 external/bsd/dhcp/dist/client/dhc6.c
--- a/external/bsd/dhcp/dist/client/dhc6.c      Sun Mar 24 23:00:48 2013 +0000
+++ b/external/bsd/dhcp/dist/client/dhc6.c      Sun Mar 24 23:03:05 2013 +0000
@@ -1,8 +1,9 @@
-/*     $NetBSD: dhc6.c,v 1.2 2013/03/24 15:53:58 christos Exp $        */
+/*     $NetBSD: dhc6.c,v 1.3 2013/03/24 23:03:05 christos Exp $        */
 
 /* dhc6.c - DHCPv6 client routines. */
 
 /*
+ * Copyright (c) 2012 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
@@ -110,6 +111,7 @@
 static void script_write_params6(struct client_state *client,
                                 const char *prefix,
                                 struct option_state *options);
+static void script_write_requested6(struct client_state *client);
 static isc_boolean_t active_prefix(struct client_state *client);
 
 static int check_timing6(struct client_state *client, u_int8_t msg_type, 
@@ -215,8 +217,10 @@
        memset(&DHCPv6DestAddr, 0, sizeof(DHCPv6DestAddr));
        DHCPv6DestAddr.sin6_family = AF_INET6;
        DHCPv6DestAddr.sin6_port = remote_port;
-       inet_pton(AF_INET6, All_DHCP_Relay_Agents_and_Servers,
-                 &DHCPv6DestAddr.sin6_addr);
+       if (inet_pton(AF_INET6, All_DHCP_Relay_Agents_and_Servers,
+                     &DHCPv6DestAddr.sin6_addr) <= 0) {
+               log_fatal("Bad address %s", All_DHCP_Relay_Agents_and_Servers);
+       }
 
        code = D6O_CLIENTID;
        if (!option_code_hash_lookup(&clientid_option,
@@ -657,7 +661,8 @@
         * not sure based on what additional keys now).
         */
        oc = lookup_option(&dhcpv6_universe, packet->options, D6O_SERVERID);
-       if (!evaluate_option_cache(&lease->server_id, packet, NULL, NULL,
+       if ((oc == NULL) ||
+           !evaluate_option_cache(&lease->server_id, packet, NULL, NULL,
                                   lease->options, NULL, &global_scope,
                                   oc, MDL) ||
            lease->server_id.len == 0) {
@@ -4025,7 +4030,7 @@
                                /* Set rebind to 3/4 expiration interval. */
                                tmp = ia->starts;
                                tmp += use_expire + (use_expire / 2);
-                       } else if (ia->renew == 0xffffffff)
+                       } else if (ia->rebind == 0xffffffff)
                                tmp = MAX_TIME;
                        else
                                tmp = ia->starts + ia->rebind;
@@ -4337,6 +4342,7 @@
                                dhc6_marshall_values("old_", client, old,
                                                     oldia, oldaddr);
                        dhc6_marshall_values("new_", client, lease, ia, addr);
+                       script_write_requested6(client);
 
                        script_go(client);
                }
@@ -4353,6 +4359,7 @@
 
                        dhc6_marshall_values("new_", client, lease, ia,
                                             NULL);
+                       script_write_requested6(client);
 
                        script_go(client);
                }
@@ -4369,6 +4376,7 @@
                                                old->bindings->addrs : NULL);
 
                dhc6_marshall_values("new_", client, lease, NULL, NULL);
+               script_write_requested6(client);
 
                script_go(client);
        }
@@ -4647,6 +4655,7 @@
                                script_init(client, "DEPREF6", NULL);
                                dhc6_marshall_values("cur_", client, lease,
                                                     ia, addr);
+                               script_write_requested6(client);
                                script_go(client);
 
                                addr->flags |= DHC6_ADDR_DEPREFFED;
@@ -4700,6 +4709,7 @@
                                script_init(client, "EXPIRE6", NULL);
                                dhc6_marshall_values("old_", client, lease,
                                                     ia, addr);
+                               script_write_requested6(client);
                                script_go(client);
 
                                addr->flags |= DHC6_ADDR_EXPIRED;
@@ -4764,6 +4774,7 @@
                if (client->active_lease != NULL)
                        script_write_params6(client, "old_",
                                             client->active_lease->options);
+               script_write_requested6(client);
                script_go(client);
                return;
        }
@@ -4779,6 +4790,7 @@
                        script_init(client, reason, NULL);
                        dhc6_marshall_values("old_", client,
                                             client->active_lease, ia, addr);
+                       script_write_requested6(client);
                        script_go(client);
 
 #if defined (NSUPDATE)
@@ -4872,6 +4884,7 @@
                script_write_params6(client, "old_",
                                     client->old_lease->options);
        script_write_params6(client, "new_", client->active_lease->options);
+       script_write_requested6(client);
        script_go(client);
 
        go_daemon();
@@ -5099,6 +5112,32 @@
 }
 
 /*
+ * A clone of the DHCPv4 routine.
+ * Write out the environment variables for the objects that the
+ * client requested.  If the object was requested the variable will be:
+ * requested_<option_name>=1
+ * If it wasn't requested there won't be a variable.
+ */
+static void script_write_requested6(client)
+       struct client_state *client;
+{
+       int i;
+       struct option **req;
+       char name[256];
+       req = client->config->requested_options;
+
+       if (req == NULL)
+               return;
+
+       for (i = 0 ; req[i] != NULL ; i++) {
+               if ((req[i]->universe == &dhcpv6_universe) &&
+                   dhcp_option_ev_name (name, sizeof(name), req[i])) {
+                       client_envadd(client, "requested_", name, "%d", 1);
+               }
+       }
+}
+
+/*
  * Check if there is something not fully defined in the active lease.
  */
 static isc_boolean_t
diff -r 89d310695507 -r 881491dcc417 external/bsd/dhcp/dist/client/dhclient.c
--- a/external/bsd/dhcp/dist/client/dhclient.c  Sun Mar 24 23:00:48 2013 +0000
+++ b/external/bsd/dhcp/dist/client/dhclient.c  Sun Mar 24 23:03:05 2013 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: dhclient.c,v 1.2 2013/03/24 15:53:58 christos Exp $    */
+/*     $NetBSD: dhclient.c,v 1.3 2013/03/24 23:03:05 christos Exp $    */
 
 /* dhclient.c
 
    DHCP Client. */
 
 /*
- * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2013 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
@@ -70,7 +70,7 @@
 #define ASSERT_STATE(state_is, state_shouldbe) {}
 
 static const char copyright[] =
-"Copyright 2004-2011 Internet Systems Consortium.";
+"Copyright 2004-2013 Internet Systems Consortium.";
 static const char arr [] = "All rights reserved.";
 static const char message [] = "Internet Systems Consortium DHCP Client";
 static const char url [] = 
@@ -1207,6 +1207,7 @@
        if (client -> active && client -> state != S_REBOOTING)
                script_write_params (client, "old_", client -> active);
        script_write_params (client, "new_", client -> new);
+       script_write_requested(client);
        if (client -> alias)
                script_write_params (client, "alias_", client -> alias);
 
@@ -1313,6 +1314,7 @@
        if (client->active) {
                script_init(client, "STOP", client->active->medium);
                script_write_params(client, "old_", client->active);
+               script_write_requested(client);
                if (client->alias)
                        script_write_params(client, "alias_", client->alias);
                script_go(client);
@@ -1787,6 +1789,7 @@
         */
        script_init(client, "EXPIRE", NULL);
        script_write_params(client, "old_", client->active);
+       script_write_requested(client);
        if (client->alias)
                script_write_params(client, "alias_", client->alias);
        script_go(client);
@@ -1903,11 +1906,14 @@
              ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval));
 
        /* Send out a packet. */
-       result = send_packet (client -> interface, (struct packet *)0,
-                             &client -> packet,
-                             client -> packet_length,
-                             inaddr_any, &sockaddr_broadcast,
-                             (struct hardware *)0);
+       result = send_packet(client->interface, NULL, &client->packet,
+                            client->packet_length, inaddr_any,
+                             &sockaddr_broadcast, NULL);
+        if (result < 0) {
+               log_error("%s:%d: Failed to send %d byte long packet over %s "
+                         "interface.", MDL, client->packet_length,
+                         client->interface->name);
+       }
 
        /*
         * If we used 0 microseconds here, and there were other clients on the
@@ -1952,6 +1958,7 @@
                        script_init (client, "TIMEOUT",
                                     client -> active -> medium);
                        script_write_params (client, "new_", client -> active);
+                       script_write_requested(client);
                        if (client -> alias)
                                script_write_params (client, "alias_",
                                                     client -> alias);
@@ -2090,6 +2097,7 @@
                /* Run the client script with the new parameters. */
                script_init (client, "EXPIRE", (struct string_list *)0);
                script_write_params (client, "old_", client -> active);
+               script_write_requested(client);
                if (client -> alias)
                        script_write_params (client, "alias_",
                                             client -> alias);
@@ -2170,20 +2178,29 @@
              ntohs (destination.sin_port));
 
        if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
-           fallback_interface)
-               result = send_packet (fallback_interface,
-                                     (struct packet *)0,
-                                     &client -> packet,
-                                     client -> packet_length,
-                                     from, &destination,
-                                     (struct hardware *)0);
-       else
+           fallback_interface) {
+               result = send_packet(fallback_interface, NULL, &client->packet,
+                                    client->packet_length, from, &destination,
+                                    NULL);
+               if (result < 0) {
+                       log_error("%s:%d: Failed to send %d byte long packet "
+                                 "over %s interface.", MDL,
+                                 client->packet_length,
+                                 fallback_interface->name);
+               }
+        }
+       else {
                /* Send out a packet. */
-               result = send_packet (client -> interface, (struct packet *)0,
-                                     &client -> packet,
-                                     client -> packet_length,
-                                     from, &destination,
-                                     (struct hardware *)0);
+               result = send_packet(client->interface, NULL, &client->packet,
+                                    client->packet_length, from, &destination,
+                                    NULL);
+               if (result < 0) {
+                       log_error("%s:%d: Failed to send %d byte long packet"
+                                 " over %s interface.", MDL,
+                                 client->packet_length,
+                                 client->interface->name);
+               }
+        }
 
        tv.tv_sec = cur_tv.tv_sec + client->interval;
        tv.tv_usec = ((tv.tv_sec - cur_tv.tv_sec) > 1) ?
@@ -2199,16 +2216,19 @@
        int result;



Home | Main Index | Thread Index | Old Index