summaryrefslogtreecommitdiff
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-02-24 17:02:41 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-02-24 17:02:41 +0000
commit41e9d889d43ce3bfee1606720d5de6a405e261c9 (patch)
tree0f66310b4014ae2807b6d6f4c3b3e451cff08be6 /sbin/dhclient
parent513e7af17f8a3dc77d65f41ba136b2fc5187fa42 (diff)
zap more unused crap
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/dhcpd.h47
-rw-r--r--sbin/dhclient/hash.h55
-rw-r--r--sbin/dhclient/inet.h52
-rw-r--r--sbin/dhclient/options.c8
-rw-r--r--sbin/dhclient/tree.c119
5 files changed, 41 insertions, 240 deletions
diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h
index c5fd460241d..42f3194fd20 100644
--- a/sbin/dhclient/dhcpd.h
+++ b/sbin/dhclient/dhcpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcpd.h,v 1.16 2004/02/24 15:35:56 henning Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.17 2004/02/24 17:02:40 henning Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
@@ -74,8 +74,6 @@
#include "dhcp.h"
#include "tree.h"
-#include "hash.h"
-#include "inet.h"
#define LOCAL_PORT 68
#define REMOTE_PORT 67
@@ -90,6 +88,16 @@ struct string_list {
char *string;
};
+struct iaddr {
+ int len;
+ unsigned char iabuf[16];
+};
+
+struct iaddrlist {
+ struct iaddrlist *next;
+ struct iaddr addr;
+};
+
struct packet {
struct dhcp_packet *raw;
int packet_length;
@@ -218,6 +226,20 @@ struct protocol {
void *local;
};
+#define DEFAULT_HASH_SIZE 97
+
+struct hash_bucket {
+ struct hash_bucket *next;
+ unsigned char *name;
+ int len;
+ unsigned char *value;
+};
+
+struct hash_table {
+ int hash_count;
+ struct hash_bucket *buckets[DEFAULT_HASH_SIZE];
+};
+
/* Default path to dhcpd config file. */
#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"
#define _PATH_DHCLIENT_DB "/var/db/dhclient.leases"
@@ -229,12 +251,8 @@ struct protocol {
/* External definitions... */
/* options.c */
-void parse_options(struct packet *);
-void parse_option_buffer(struct packet *, unsigned char *, int);
int cons_options(struct packet *, struct dhcp_packet *, int,
struct tree_cache **, int, int, int, u_int8_t *, int);
-int store_options(unsigned char *, int, struct tree_cache **,
- unsigned char *, int, int, int, int);
char *pretty_print_option(unsigned int,
unsigned char *, int, int, int);
void do_packet(struct interface_info *, struct dhcp_packet *,
@@ -272,14 +290,9 @@ void convert_num(unsigned char *, char *, int, int);
time_t parse_date(FILE *);
/* tree.c */
-pair cons(caddr_t, pair);
-struct tree_cache *tree_cache(struct tree *);
-struct tree *tree_host_lookup(char *);
-struct dns_host_entry *enter_dns_host(char *);
-struct tree *tree_const(unsigned char *, int);
-struct tree *tree_concat(struct tree *, struct tree *);
-struct tree *tree_limit(struct tree *, int);
int tree_evaluate(struct tree_cache *);
+struct dns_host_entry *enter_dns_host(char *);
+pair cons(caddr_t, pair);
/* alloc.c */
void *dmalloc(int, char *);
@@ -295,12 +308,6 @@ void free_tree_cache(struct tree_cache *, char *);
void free_tree(struct tree *, char *);
void free_string_list(struct string_list *, char *);
-/* print.c */
-char *print_hw_addr(int, int, unsigned char *);
-void dump_raw(unsigned char *, int);
-void dump_packet(struct packet *);
-void hash_dump(struct hash_table *);
-
/* bpf.c */
int if_register_bpf(struct interface_info *);
void if_reinitialize_send(struct interface_info *);
diff --git a/sbin/dhclient/hash.h b/sbin/dhclient/hash.h
deleted file mode 100644
index 0f5ff56273c..00000000000
--- a/sbin/dhclient/hash.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $OpenBSD: hash.h,v 1.3 2004/02/07 13:26:35 henning Exp $ */
-
-/* Definitions for hashing... */
-
-/*
- * Copyright (c) 1995, 1996 The Internet Software Consortium.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of The Internet Software Consortium nor the names
- * of its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
- * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This software has been written for the Internet Software Consortium
- * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
- * Enterprises. To learn more about the Internet Software Consortium,
- * see ``http://www.vix.com/isc''. To learn more about Vixie
- * Enterprises, see ``http://www.vix.com''.
- */
-
-#define DEFAULT_HASH_SIZE 97
-
-struct hash_bucket {
- struct hash_bucket *next;
- unsigned char *name;
- int len;
- unsigned char *value;
-};
-
-struct hash_table {
- int hash_count;
- struct hash_bucket *buckets[DEFAULT_HASH_SIZE];
-};
diff --git a/sbin/dhclient/inet.h b/sbin/dhclient/inet.h
deleted file mode 100644
index 639d401d6fc..00000000000
--- a/sbin/dhclient/inet.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $OpenBSD: inet.h,v 1.3 2004/02/07 13:26:35 henning Exp $ */
-
-/* Portable definitions for internet addresses */
-
-/*
- * Copyright (c) 1996 The Internet Software Consortium. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of The Internet Software Consortium nor the names
- * of its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
- * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This software has been written for the Internet Software Consortium
- * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
- * Enterprises. To learn more about the Internet Software Consortium,
- * see ``http://www.vix.com/isc''. To learn more about Vixie
- * Enterprises, see ``http://www.vix.com''.
- */
-
-/* An internet address of up to 128 bits. */
-
-struct iaddr {
- int len;
- unsigned char iabuf[16];
-};
-
-struct iaddrlist {
- struct iaddrlist *next;
- struct iaddr addr;
-};
diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c
index 1d9b264f573..b1e4bb425a5 100644
--- a/sbin/dhclient/options.c
+++ b/sbin/dhclient/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.5 2004/02/07 13:59:45 henning Exp $ */
+/* $OpenBSD: options.c,v 1.6 2004/02/24 17:02:40 henning Exp $ */
/* DHCP options parsing and reassembly. */
@@ -48,6 +48,12 @@
int bad_options = 0;
int bad_options_max = 5;
+void parse_options(struct packet *);
+void parse_option_buffer(struct packet *, unsigned char *, int);
+int store_options(unsigned char *, int, struct tree_cache **,
+ unsigned char *, int, int, int, int);
+
+
/*
* Parse all available options out of the specified packet.
*/
diff --git a/sbin/dhclient/tree.c b/sbin/dhclient/tree.c
index 2589143ffa8..0a57087a0d3 100644
--- a/sbin/dhclient/tree.c
+++ b/sbin/dhclient/tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tree.c,v 1.8 2004/02/24 13:08:26 henning Exp $ */
+/* $OpenBSD: tree.c,v 1.9 2004/02/24 17:02:40 henning Exp $ */
/* Routines for manipulating parse trees... */
@@ -44,12 +44,12 @@
extern int h_errno;
-static time_t tree_evaluate_recurse(
- int *, unsigned char **, int *, struct tree *);
-static time_t do_host_lookup(
- int *, unsigned char **, int *, struct dns_host_entry *);
-static void do_data_copy(
- int *, unsigned char **, int *, unsigned char *, int);
+static time_t tree_evaluate_recurse(int *, unsigned char **, int *,
+ struct tree *);
+static time_t do_host_lookup(int *, unsigned char **, int *,
+ struct dns_host_entry *);
+static void do_data_copy(int *, unsigned char **, int *, unsigned char *,
+ int);
pair
cons(caddr_t car, pair cdr)
@@ -62,33 +62,6 @@ cons(caddr_t car, pair cdr)
return (foo);
}
-struct tree_cache *
-tree_cache(struct tree *tree)
-{
- struct tree_cache *tc;
-
- tc = new_tree_cache("tree_cache");
- if (!tc)
- return (NULL);
- tc->value = NULL;
- tc->len = tc->buf_size = 0;
- tc->timeout = 0;
- tc->tree = tree;
- return (tc);
-}
-
-struct tree *
-tree_host_lookup(char *name)
-{
- struct tree *nt;
- nt = new_tree("tree_host_lookup");
- if (!nt)
- error("No memory for host lookup tree node.");
- nt->op = TREE_HOST_LOOKUP;
- nt->data.host_lookup.host = enter_dns_host(name);
- return (nt);
-}
-
struct dns_host_entry *
enter_dns_host(char *name)
{
@@ -106,84 +79,6 @@ enter_dns_host(char *name)
return (dh);
}
-struct tree *
-tree_const(unsigned char *data, int len)
-{
- struct tree *nt;
- if (!(nt = new_tree("tree_const"))
- || !(nt->data.const_val.data = dmalloc(len, "tree_const")))
- error("No memory for constant data tree node.");
- nt->op = TREE_CONST;
- memcpy(nt->data.const_val.data, data, len);
- nt->data.const_val.len = len;
- return (nt);
-}
-
-struct tree *
-tree_concat(struct tree *left, struct tree *right)
-{
- struct tree *nt;
-
- /*
- * If we're concatenating a null tree to a non-null tree, just
- * return the non-null tree; if both trees are null, return a
- * null tree.
- */
- if (!left)
- return (right);
- if (!right)
- return (left);
-
- /* If both trees are constant, combine them. */
- if (left->op == TREE_CONST && right->op == TREE_CONST) {
- unsigned char *buf = dmalloc(left->data.const_val.len +
- right->data.const_val.len, "tree_concat");
- if (!buf)
- error("No memory to concatenate constants.");
- memcpy(buf, left->data.const_val.data,
- left->data.const_val.len);
- memcpy(buf + left->data.const_val.len,
- right->data.const_val.data,
- right->data.const_val.len);
- dfree(left->data.const_val.data, "tree_concat");
- dfree(right->data.const_val.data, "tree_concat");
- left->data.const_val.data = buf;
- left->data.const_val.len += right->data.const_val.len;
- free_tree(right, "tree_concat");
- return (left);
- }
-
- /* Otherwise, allocate a new node to concatenate the two. */
- if (!(nt = new_tree("tree_concat")))
- error("No memory for data tree concatenation node.");
- nt->op = TREE_CONCAT;
- nt->data.concat.left = left;
- nt->data.concat.right = right;
- return (nt);
-}
-
-struct tree *
-tree_limit(struct tree *tree, int limit)
-{
- struct tree *rv;
-
- /* If the tree we're limiting is constant, limit it now. */
- if (tree->op == TREE_CONST) {
- if (tree->data.const_val.len > limit)
- tree->data.const_val.len = limit;
- return (tree);
- }
-
- /* Otherwise, put in a node which enforces the limit on evaluation. */
- rv = new_tree("tree_limit");
- if (!rv)
- return (NULL);
- rv->op = TREE_LIMIT;
- rv->data.limit.tree = tree;
- rv->data.limit.limit = limit;
- return (rv);
-}
-
int
tree_evaluate(struct tree_cache *tree_cache)
{