summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcp/includes
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2001-06-24 06:05:12 +0000
committerBob Beck <beck@cvs.openbsd.org>2001-06-24 06:05:12 +0000
commitb05a03077c919111a1996bc750b5680d14414c50 (patch)
tree0e7ff68ba57f076be7c2acba2b531b69f097a762 /usr.sbin/dhcp/includes
parent31a8df16f90ba9044505180bdd3f03fb36c1ca39 (diff)
dhcp 2.0pl5 merge/cleanup/deadcode slashing. still needs more eyes on this
but appears to work better than what's been in-tree before for dealing with stupid dhcp servers.
Diffstat (limited to 'usr.sbin/dhcp/includes')
-rw-r--r--usr.sbin/dhcp/includes/cf/alphaosf.h22
-rw-r--r--usr.sbin/dhcp/includes/cf/freebsd.h8
-rw-r--r--usr.sbin/dhcp/includes/cf/hpux.h12
-rw-r--r--usr.sbin/dhcp/includes/cf/linux.h48
-rw-r--r--usr.sbin/dhcp/includes/cf/nextstep.h16
-rw-r--r--usr.sbin/dhcp/includes/cf/openbsd.h2
-rw-r--r--usr.sbin/dhcp/includes/cf/qnx.h8
-rw-r--r--usr.sbin/dhcp/includes/cf/sample.h4
-rw-r--r--usr.sbin/dhcp/includes/cf/sunos5-5.h9
-rw-r--r--usr.sbin/dhcp/includes/cf/ultrix.h5
-rw-r--r--usr.sbin/dhcp/includes/dhcp.h1
-rw-r--r--usr.sbin/dhcp/includes/dhcpd.h188
-rw-r--r--usr.sbin/dhcp/includes/dhctoken.h9
-rw-r--r--usr.sbin/dhcp/includes/hash.h5
-rw-r--r--usr.sbin/dhcp/includes/netinet/if_ether.h74
-rw-r--r--usr.sbin/dhcp/includes/netinet/ip.h171
-rw-r--r--usr.sbin/dhcp/includes/netinet/ip_icmp.h182
-rw-r--r--usr.sbin/dhcp/includes/netinet/udp.h47
-rw-r--r--usr.sbin/dhcp/includes/osdep.h109
-rw-r--r--usr.sbin/dhcp/includes/site.h2
-rw-r--r--usr.sbin/dhcp/includes/version.h3
21 files changed, 362 insertions, 563 deletions
diff --git a/usr.sbin/dhcp/includes/cf/alphaosf.h b/usr.sbin/dhcp/includes/cf/alphaosf.h
index e8298ba3d14..91171404409 100644
--- a/usr.sbin/dhcp/includes/cf/alphaosf.h
+++ b/usr.sbin/dhcp/includes/cf/alphaosf.h
@@ -35,16 +35,6 @@
* under a contract with Vixie Laboratories.
*/
-/* Define the basic integer types... */
-typedef char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-
-typedef unsigned char u_int8_t;
-typedef unsigned short u_int16_t;
-typedef unsigned int u_int32_t;
-typedef unsigned long u_int64_t;
-
#include <syslog.h>
#include <sys/types.h>
#include <string.h>
@@ -63,6 +53,18 @@ extern int h_errno;
#include <net/if.h>
#include <net/if_dl.h>
+/* Define the basic integer types... */
+#if !defined (__BIT_TYPES_DEFINED__)
+typedef char int8_t;
+typedef short int16_t;
+typedef int int32_t;
+
+typedef unsigned char u_int8_t;
+typedef unsigned short u_int16_t;
+typedef unsigned int u_int32_t;
+typedef unsigned long u_int64_t;
+#endif
+
/* Varargs stuff... */
#include <varargs.h>
#define VA_DOTDOTDOT va_alist
diff --git a/usr.sbin/dhcp/includes/cf/freebsd.h b/usr.sbin/dhcp/includes/cf/freebsd.h
index 965d33236f2..032d52c2b00 100644
--- a/usr.sbin/dhcp/includes/cf/freebsd.h
+++ b/usr.sbin/dhcp/includes/cf/freebsd.h
@@ -3,7 +3,8 @@
System dependencies for FreeBSD... */
/*
- * Copyright (c) 1996 The Internet Software Consortium. All rights reserved.
+ * Copyright (c) 1996, 1998 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
@@ -53,7 +54,10 @@ extern int h_errno;
#include <net/if.h>
#include <net/if_dl.h>
-#define INADDR_LOOPBACK ((u_int32_t)0x7f000001)
+#include <net/if_arp.h>
+#if !defined (INADDR_LOOPBACK)
+# define INADDR_LOOPBACK ((u_int32_t)0x7f000001)
+#endif
/* Varargs stuff... */
#include <stdarg.h>
diff --git a/usr.sbin/dhcp/includes/cf/hpux.h b/usr.sbin/dhcp/includes/cf/hpux.h
index 7271931fa6d..191839401f4 100644
--- a/usr.sbin/dhcp/includes/cf/hpux.h
+++ b/usr.sbin/dhcp/includes/cf/hpux.h
@@ -65,9 +65,17 @@ extern int h_errno;
#define _PATH_DHCRELAY_PID "/etc/dhcrelay.pid"
#endif
+#if !defined (__ANSI__)
+/* Varargs stuff: use stdarg.h instead ... */
+#include <stdarg.h>
+#define VA_DOTDOTDOT ...
+#define VA_start(list, last) va_start (list, last)
+#define va_dcl
+#else
#include <varargs.h>
#define VA_DOTDOTDOT va_alist
#define VA_start(list, last) va_start (list)
+#endif
#define vsnprintf(buf, size, fmt, list) vsprintf (buf, fmt, list)
#define NO_SNPRINTF
@@ -82,3 +90,7 @@ extern int h_errno;
#define GET_TIME(x) time ((x))
#define random rand
+
+#define BIG_ENDIAN 1
+#define LITTLE_ENDIEN 2
+#define BYTE_ORDER BIG_ENDIAN
diff --git a/usr.sbin/dhcp/includes/cf/linux.h b/usr.sbin/dhcp/includes/cf/linux.h
index 4386a7e2ff8..cb7e23c57fe 100644
--- a/usr.sbin/dhcp/includes/cf/linux.h
+++ b/usr.sbin/dhcp/includes/cf/linux.h
@@ -5,7 +5,7 @@
Based on a configuration originally supplied by Jonathan Stone. */
/*
- * Copyright (c) 1996, 1998 The Internet Software Consortium.
+ * Copyright (c) 1996, 1998, 1999 The Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,6 +48,10 @@ typedef unsigned short u_int16_t;
typedef unsigned long u_int32_t;
#endif /* __BIT_TYPES_DEFINED__ */
+typedef u_int8_t u8;
+typedef u_int16_t u16;
+typedef u_int32_t u32;
+
#include <syslog.h>
#include <sys/types.h>
#include <string.h>
@@ -63,7 +67,7 @@ extern int h_errno;
#include <net/if.h>
#include <net/route.h>
-#if defined (LINUX_1_X)
+#if LINUX_MAJOR == 1
# include <linux/if_arp.h>
# include <linux/time.h> /* also necessary */
#else
@@ -72,14 +76,19 @@ extern int h_errno;
#include <sys/time.h> /* gettimeofday()*/
-#ifndef _PATH_DHCPD_PID
-#define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
-#endif
-#ifndef _PATH_DHCLIENT_PID
-#define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
+/* Databases go in /var/state/dhcp. It would also be valid to put them
+ in /var/state/misc - indeed, given that there's only one lease file, it
+ would probably be better. However, I have some ideas for optimizing
+ the lease database that may result in a _lot_ of smaller files being
+ created, so in that context it makes more sense to have a seperate
+ directory. */
+
+#ifndef _PATH_DHCPD_DB
+#define _PATH_DHCPD_DB "/var/state/dhcp/dhcpd.leases"
#endif
+
#ifndef _PATH_DHCLIENT_DB
-#define _PATH_DHCLIENT_DB "/var/db/dhclient.leases"
+#define _PATH_DHCLIENT_DB "/var/state/dhcp/dhclient.leases"
#endif
/* Varargs stuff... */
@@ -102,9 +111,28 @@ extern int h_errno;
#define TIME time_t
#define GET_TIME(x) time ((x))
-#if defined (USE_DEFAULT_NETWORK)
+#if (LINUX_MAJOR >= 2)
+# if (LINUX_MINOR >= 1)
+# if defined (USE_DEFAULT_NETWORK)
+# define USE_LPF
+# endif
+# define LINUX_SLASHPROC_DISCOVERY
+# define PROCDEV_DEVICE "/proc/net/dev"
+# define HAVE_ARPHRD_TUNNEL
+# define HAVE_TR_SUPPORT
+# endif
+# define HAVE_ARPHRD_METRICOM
+# define HAVE_ARPHRD_IEEE802
+# define HAVE_ARPHRD_LOOPBACK
+# define HAVE_SO_BINDTODEVICE
+# define HAVE_SIOCGIFHWADDR
+#endif
+
+#if !defined (USE_LPF)
+# if defined (USE_DEFAULT_NETWORK)
# define USE_SOCKETS
-# define IGNORE_HOSTUNREACH
+# endif
+# define IGNORE_HOSTUNREACH
#endif
#define ALIAS_NAMES_PERMUTED
diff --git a/usr.sbin/dhcp/includes/cf/nextstep.h b/usr.sbin/dhcp/includes/cf/nextstep.h
index c1e88e1d205..38b4d479d1d 100644
--- a/usr.sbin/dhcp/includes/cf/nextstep.h
+++ b/usr.sbin/dhcp/includes/cf/nextstep.h
@@ -68,9 +68,19 @@ extern int h_errno;
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
#endif
-#define _PATH_DHCPD_PID "/etc/dhcpd.pid"
-#define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
-#define _PATH_DHCLIENT_PID "/etc/dhcrelay.pid"
+
+#if !defined (_PATH_DHCPD_PID)
+# define _PATH_DHCPD_PID "/etc/dhcpd.pid"
+#endif
+
+#if !defined (_PATH_DHCLIENT_PID)
+# define _PATH_DHCLIENT_PID "/etc/dhclient.pid"
+#endif
+
+#if !defined (_PATH_DHCRELAY_PID)
+# define _PATH_DHCRELAY_PID "/etc/dhcrelay.pid"
+#endif
+
/* Stdarg definitions for ANSI-compliant C compilers. */
#import <stdarg.h>
#define VA_DOTDOTDOT ...
diff --git a/usr.sbin/dhcp/includes/cf/openbsd.h b/usr.sbin/dhcp/includes/cf/openbsd.h
index a70d4b6f063..1c9b3690a3b 100644
--- a/usr.sbin/dhcp/includes/cf/openbsd.h
+++ b/usr.sbin/dhcp/includes/cf/openbsd.h
@@ -1,4 +1,4 @@
-/* OpenBSD.h
+/* netbsd.h
System dependencies for OpenBSD... */
diff --git a/usr.sbin/dhcp/includes/cf/qnx.h b/usr.sbin/dhcp/includes/cf/qnx.h
index 0e78582dc44..1f5b7f8de0e 100644
--- a/usr.sbin/dhcp/includes/cf/qnx.h
+++ b/usr.sbin/dhcp/includes/cf/qnx.h
@@ -86,6 +86,7 @@ extern int h_errno;
typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned long u_int32_t;
+typedef signed char int8_t;
typedef signed short int16_t;
typedef signed long int32_t;
@@ -100,6 +101,13 @@ typedef signed long int32_t;
#define NO_SNPRINTF
#undef AF_LINK
+#ifndef LITTLE_ENDIAN
+#define LITTLE_ENDIAN 1234
+#endif
+#ifndef BYTE_ORDER
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+
/*
NOTE: to get the routing of the 255.255.255.255 broadcasts to work
under QNX, you need to issue the following command before starting
diff --git a/usr.sbin/dhcp/includes/cf/sample.h b/usr.sbin/dhcp/includes/cf/sample.h
index e50d8b17b0e..892303b977e 100644
--- a/usr.sbin/dhcp/includes/cf/sample.h
+++ b/usr.sbin/dhcp/includes/cf/sample.h
@@ -255,13 +255,13 @@ char *strerror PROTO ((int));
/* #define HAVE_SA_LEN */
-/* Every operating system has its own way of separating lines in a
+/* Every operating system has its own way of seperating lines in a
sequential text file. Most modern systems use a single character,
either an ASCII Newline (10) or an ASCII Carriage Return (13).
The most notable exception is MS-DOS (and consequently, Windows),
which uses an ASCII Carriage Return followed by a Newline to
- separate each line. Fortunately, MS-DOS C compiler libraries
+ seperate each line. Fortunately, MS-DOS C compiler libraries
typically hide this from the programmer, returning just a Newline.
Define EOL to be whatever getc() returns for a newline. */
diff --git a/usr.sbin/dhcp/includes/cf/sunos5-5.h b/usr.sbin/dhcp/includes/cf/sunos5-5.h
index f88084f6d9e..07343b2d5ef 100644
--- a/usr.sbin/dhcp/includes/cf/sunos5-5.h
+++ b/usr.sbin/dhcp/includes/cf/sunos5-5.h
@@ -3,7 +3,8 @@
System dependencies for Solaris 2.x (tested on 2.5 with gcc)... */
/*
- * Copyright (c) 1996 The Internet Software Consortium. All rights reserved.
+ * Copyright (c) 1996, 1998 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
@@ -116,11 +117,9 @@ extern int h_errno;
#define NEED_INET_ATON
-/* By default, use BSD Socket API for receiving and sending packets.
- This actually works pretty well on Solaris, which doesn't censor
- the all-ones broadcast address. */
#if defined (USE_DEFAULT_NETWORK)
-# define USE_SOCKETS
+# define USE_DLPI
+# define USE_DLPI_PFMOD
#endif
#define USE_POLL
diff --git a/usr.sbin/dhcp/includes/cf/ultrix.h b/usr.sbin/dhcp/includes/cf/ultrix.h
index da7c35c6c1a..c6a2fe80182 100644
--- a/usr.sbin/dhcp/includes/cf/ultrix.h
+++ b/usr.sbin/dhcp/includes/cf/ultrix.h
@@ -3,7 +3,8 @@
System dependencies for Ultrix 4.2 (tested on 4.2a+multicast)... */
/*
- * Copyright (c) 1996 The Internet Software Consortium. All rights reserved.
+ * Copyright (c) 1996, 1999
+ * 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
@@ -70,6 +71,8 @@ extern int h_errno;
#define u_int16_t unsigned short
#define u_int32_t unsigned long
+#define ssize_t size_t
+
/* The jmp_buf type is an array on ultrix, so we can't dereference it
and must declare it differently. */
#define jbp_decl(x) jmp_buf x
diff --git a/usr.sbin/dhcp/includes/dhcp.h b/usr.sbin/dhcp/includes/dhcp.h
index 18127757952..b96ec3d096d 100644
--- a/usr.sbin/dhcp/includes/dhcp.h
+++ b/usr.sbin/dhcp/includes/dhcp.h
@@ -84,6 +84,7 @@ struct dhcp_packet {
/* Possible values for hardware type (htype) field... */
#define HTYPE_ETHER 1 /* Ethernet 10Mbps */
#define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */
+#define HTYPE_FDDI 8 /* FDDI... */
/* Magic cookie validating dhcp options field (and bootp vendor
extensions field). */
diff --git a/usr.sbin/dhcp/includes/dhcpd.h b/usr.sbin/dhcp/includes/dhcpd.h
index 404624d34d2..25396eb29c9 100644
--- a/usr.sbin/dhcp/includes/dhcpd.h
+++ b/usr.sbin/dhcp/includes/dhcpd.h
@@ -3,8 +3,8 @@
Definitions for dhcpd... */
/*
- * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium.
- * All rights reserved.
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999
+ * 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
@@ -75,7 +75,7 @@ struct option_data {
struct string_list {
struct string_list *next;
- char string [1];
+ char *string;
};
/* A name server, from /etc/resolv.conf. */
@@ -106,6 +106,8 @@ struct packet {
of local sender (maybe gateway). */
struct shared_network *shared_network;
struct option_data options [256];
+ int got_requested_address; /* True if client sent the
+ dhcp-requested-address option. */
};
struct hardware {
@@ -144,7 +146,7 @@ struct lease {
# define ABANDONED_LEASE 16
struct lease_state *state;
- u_int8_t releasing;
+ u_int8_t releasing;
};
struct lease_state {
@@ -156,7 +158,20 @@ struct lease_state {
struct tree_cache *options [256];
u_int32_t expiry, renewal, rebind;
- char *filename, *server_name;
+ char filename [DHCP_FILE_LEN];
+ char *server_name;
+
+ struct iaddr from;
+
+ int max_message_size;
+ u_int8_t *prl;
+ int prl_len;
+ int got_requested_address; /* True if client sent the
+ dhcp-requested-address option. */
+ int got_server_identifier; /* True if client sent the
+ dhcp-server-identifier option. */
+ struct shared_network *shared_network; /* Shared network of interface
+ on which request arrived. */
u_int32_t xid;
u_int16_t secs;
@@ -205,6 +220,9 @@ struct group {
int one_lease_per_client;
int get_lease_hostnames;
int use_host_decl_names;
+ int use_lease_addr_for_default_route;
+ int authoritative;
+ int always_reply_rfc1048;
struct tree_cache *options [256];
};
@@ -328,6 +346,7 @@ struct client_state {
enum dhcp_state state; /* Current state for this interface. */
struct iaddr destination; /* Where to send packet. */
u_int32_t xid; /* Transaction ID. */
+ u_int16_t secs; /* secs value from DHCPDISCOVER. */
TIME first_sending; /* When was first copy sent? */
TIME interval; /* What's the current resend interval? */
struct string_list *medium; /* Last media type tried. */
@@ -338,6 +357,12 @@ struct client_state {
struct iaddr requested_address; /* Address we would like to get. */
struct client_config *config; /* Information from config file. */
+
+ char **scriptEnv; /* Client script env */
+ int scriptEnvsize; /* size of the env table */
+
+ struct string_list *env; /* Client script environment. */
+ int envc; /* Number of entries in environment. */
};
/* Information about each network interface. */
@@ -364,9 +389,9 @@ struct interface_info {
/* Only used by DHCP client code. */
struct client_state *client;
- int noifmedia;
- int errors;
- int dead;
+ int noifmedia;
+ int errors;
+ int dead;
};
struct hardware_link {
@@ -456,15 +481,16 @@ typedef unsigned char option_mask [16];
void parse_options PROTO ((struct packet *));
void parse_option_buffer PROTO ((struct packet *, unsigned char *, int));
-int cons_options PROTO ((struct packet *, struct dhcp_packet *,
- struct tree_cache **, int, int, int));
+int cons_options PROTO ((struct packet *, struct dhcp_packet *, int,
+ struct tree_cache **, int, int, int,
+ u_int8_t *, int));
int store_options PROTO ((unsigned char *, int, struct tree_cache **,
unsigned char *, int, int, int, int));
char *pretty_print_option PROTO ((unsigned int,
unsigned char *, int, int, int));
void do_packet PROTO ((struct interface_info *,
- unsigned char *, int,
- unsigned short, struct iaddr, struct hardware *));
+ struct dhcp_packet *, int,
+ unsigned int, struct iaddr, struct hardware *));
/* errwarn.c */
extern int warnings_occurred;
@@ -473,7 +499,6 @@ int warn PROTO ((char *, ...));
int note PROTO ((char *, ...));
int debug PROTO ((char *, ...));
int parse_warn PROTO ((char *, ...));
-void write_pidfile PROTO((char *, pid_t));
/* dhcpd.c */
extern TIME cur_time;
@@ -484,10 +509,6 @@ extern u_int16_t remote_port;
extern int log_priority;
extern int log_perror;
-#ifdef USE_FALLBACK
-extern struct interface_info fallback_interface;
-#endif
-
extern char *path_dhcpd_conf;
extern char *path_dhcpd_db;
extern char *path_dhcpd_pid;
@@ -558,7 +579,7 @@ void dhcprelease PROTO ((struct packet *));
void dhcpdecline PROTO ((struct packet *));
void dhcpinform PROTO ((struct packet *));
void nak_lease PROTO ((struct packet *, struct iaddr *cip));
-void ack_lease PROTO ((struct packet *, struct lease *, unsigned char, TIME));
+void ack_lease PROTO ((struct packet *, struct lease *, unsigned int, TIME));
void dhcp_reply PROTO ((struct lease *));
struct lease *find_lease PROTO ((struct packet *,
struct shared_network *, int *));
@@ -582,6 +603,7 @@ extern struct subnet *find_grouped_subnet PROTO ((struct shared_network *,
struct iaddr));
extern struct subnet *find_subnet PROTO ((struct iaddr));
void enter_shared_network PROTO ((struct shared_network *));
+int subnet_inner_than PROTO ((struct subnet *, struct subnet *, int));
void enter_subnet PROTO ((struct subnet *));
void enter_lease PROTO ((struct lease *));
int supersede_lease PROTO ((struct lease *, struct lease *, int));
@@ -595,7 +617,7 @@ void uid_hash_delete PROTO ((struct lease *));
void hw_hash_add PROTO ((struct lease *));
void hw_hash_delete PROTO ((struct lease *));
struct class *add_class PROTO ((int, char *));
-struct class *find_class PROTO ((int, char *, int));
+struct class *find_class PROTO ((int, unsigned char *, int));
struct group *clone_group PROTO ((struct group *, char *));
void write_leases PROTO ((void));
void dump_subnets PROTO ((void));
@@ -619,6 +641,7 @@ struct protocol *new_protocol PROTO ((char *));
struct lease_state *new_lease_state PROTO ((char *));
struct domain_search_list *new_domain_search_list PROTO ((char *));
struct name_server *new_name_server PROTO ((char *));
+struct string_list *new_string_list PROTO ((size_t size, char * name));
void free_name_server PROTO ((struct name_server *, char *));
void free_domain_search_list PROTO ((struct domain_search_list *, char *));
void free_lease_state PROTO ((struct lease_state *, char *));
@@ -634,6 +657,7 @@ void free_tree_cache PROTO ((struct tree_cache *, char *));
void free_packet PROTO ((struct packet *, char *));
void free_dhcp_packet PROTO ((struct dhcp_packet *, char *));
void free_tree PROTO ((struct tree *, char *));
+void free_string_list PROTO ((struct string_list *, char *));
/* print.c */
char *print_hw_addr PROTO ((int, int, unsigned char *));
@@ -648,14 +672,13 @@ void hash_dump PROTO ((struct hash_table *));
int if_register_socket PROTO ((struct interface_info *));
#endif
-#ifdef USE_SOCKET_FALLBACK
+#if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND)
void if_reinitialize_fallback PROTO ((struct interface_info *));
void if_register_fallback PROTO ((struct interface_info *));
ssize_t send_fallback PROTO ((struct interface_info *,
struct packet *, struct dhcp_packet *, size_t,
struct in_addr,
struct sockaddr_in *, struct hardware *));
-void fallback_discard PROTO ((struct protocol *));
#endif
#ifdef USE_SOCKET_SEND
@@ -666,6 +689,9 @@ ssize_t send_packet PROTO ((struct interface_info *,
struct in_addr,
struct sockaddr_in *, struct hardware *));
#endif
+#if defined (USE_SOCKET_FALLBACK)
+void fallback_discard PROTO ((struct protocol *));
+#endif
#ifdef USE_SOCKET_RECEIVE
void if_reinitialize_receive PROTO ((struct interface_info *));
void if_register_receive PROTO ((struct interface_info *));
@@ -673,8 +699,10 @@ ssize_t receive_packet PROTO ((struct interface_info *,
unsigned char *, size_t,
struct sockaddr_in *, struct hardware *));
#endif
-#if defined (USE_SOCKET_SEND) && !defined (USE_SOCKET_FALLBACK)
-void if_enable PROTO ((struct interface_info *));
+#if defined (USE_SOCKET_SEND)
+int can_unicast_without_arp PROTO ((void));
+int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
+void maybe_setup_fallback PROTO ((void));
#endif
/* bpf.c */
@@ -697,7 +725,34 @@ ssize_t receive_packet PROTO ((struct interface_info *,
struct sockaddr_in *, struct hardware *));
#endif
#if defined (USE_BPF_SEND)
-void if_enable PROTO ((struct interface_info *));
+int can_unicast_without_arp PROTO ((void));
+int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
+void maybe_setup_fallback PROTO ((void));
+#endif
+
+/* lpf.c */
+#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
+int if_register_lpf PROTO ( (struct interface_info *));
+#endif
+#ifdef USE_LPF_SEND
+void if_reinitialize_send PROTO ((struct interface_info *));
+void if_register_send PROTO ((struct interface_info *));
+ssize_t send_packet PROTO ((struct interface_info *,
+ struct packet *, struct dhcp_packet *, size_t,
+ struct in_addr,
+ struct sockaddr_in *, struct hardware *));
+#endif
+#ifdef USE_LPF_RECEIVE
+void if_reinitialize_receive PROTO ((struct interface_info *));
+void if_register_receive PROTO ((struct interface_info *));
+ssize_t receive_packet PROTO ((struct interface_info *,
+ unsigned char *, size_t,
+ struct sockaddr_in *, struct hardware *));
+#endif
+#if defined (USE_LPF_SEND)
+int can_unicast_without_arp PROTO ((void));
+int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
+void maybe_setup_fallback PROTO ((void));
#endif
/* nit.c */
@@ -720,8 +775,31 @@ ssize_t receive_packet PROTO ((struct interface_info *,
unsigned char *, size_t,
struct sockaddr_in *, struct hardware *));
#endif
-#if defined (USE_BPF_SEND)
-void if_enable PROTO ((struct interface_info *));
+#if defined (USE_NIT_SEND)
+int can_unicast_without_arp PROTO ((void));
+int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
+void maybe_setup_fallback PROTO ((void));
+#endif
+
+#ifdef USE_DLPI_SEND
+void if_reinitialize_send PROTO ((struct interface_info *));
+void if_register_send PROTO ((struct interface_info *));
+ssize_t send_packet PROTO ((struct interface_info *,
+ struct packet *, struct dhcp_packet *, size_t,
+ struct in_addr,
+ struct sockaddr_in *, struct hardware *));
+#endif
+#ifdef USE_DLPI_RECEIVE
+void if_reinitialize_receive PROTO ((struct interface_info *));
+void if_register_receive PROTO ((struct interface_info *));
+ssize_t receive_packet PROTO ((struct interface_info *,
+ unsigned char *, size_t,
+ struct sockaddr_in *, struct hardware *));
+#endif
+#if defined (USE_DLPI_SEND)
+int can_unicast_without_arp PROTO ((void));
+int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
+void maybe_setup_fallback PROTO ((void));
#endif
/* raw.c */
@@ -732,24 +810,28 @@ ssize_t send_packet PROTO ((struct interface_info *,
struct packet *, struct dhcp_packet *, size_t,
struct in_addr,
struct sockaddr_in *, struct hardware *));
+int can_unicast_without_arp PROTO ((void));
+int can_receive_unicast_unconfigured PROTO ((struct interface_info *));
+void maybe_setup_fallback PROTO ((void));
#endif
/* dispatch.c */
-extern struct interface_info *interfaces, *dummy_interfaces;
+extern struct interface_info *interfaces,
+ *dummy_interfaces, *fallback_interface;
extern struct protocol *protocols;
extern int quiet_interface_discovery;
extern void (*bootp_packet_handler) PROTO ((struct interface_info *,
- unsigned char *, int, unsigned short,
- struct iaddr, struct hardware *));
+ struct dhcp_packet *, int,
+ unsigned int,
+ struct iaddr, struct hardware *));
extern struct timeout *timeouts;
void discover_interfaces PROTO ((int));
+struct interface_info *setup_fallback PROTO ((void));
void reinitialize_interfaces PROTO ((void));
void dispatch PROTO ((void));
int locate_network PROTO ((struct packet *));
+void got_one PROTO ((struct protocol *));
void add_timeout PROTO ((TIME, void (*) PROTO ((void *)), void *));
-#if 0
-void add_fast_timeout PROTO ((UTIME, void (*) PROTO ((void *)), void *));
-#endif
void cancel_timeout PROTO ((void (*) PROTO ((void *)), void *));
void add_protocol PROTO ((char *, int,
void (*) PROTO ((struct protocol *)), void *));
@@ -758,9 +840,10 @@ void remove_protocol PROTO ((struct protocol *));
/* hash.c */
struct hash_table *new_hash PROTO ((void));
-void add_hash PROTO ((struct hash_table *, char *, int, unsigned char *));
-void delete_hash_entry PROTO ((struct hash_table *, char *, int));
-unsigned char *hash_lookup PROTO ((struct hash_table *, char *, int));
+void add_hash PROTO ((struct hash_table *, unsigned char *,
+ int, unsigned char *));
+void delete_hash_entry PROTO ((struct hash_table *, unsigned char *, int));
+unsigned char *hash_lookup PROTO ((struct hash_table *, unsigned char *, int));
/* tables.c */
extern struct option dhcp_options [256];
@@ -778,8 +861,8 @@ u_int16_t getUShort PROTO ((unsigned char *));
int16_t getShort PROTO ((unsigned char *));
void putULong PROTO ((unsigned char *, u_int32_t));
void putLong PROTO ((unsigned char *, int32_t));
-void putUShort PROTO ((unsigned char *, u_int16_t));
-void putShort PROTO ((unsigned char *, int16_t));
+void putUShort PROTO ((unsigned char *, unsigned int));
+void putShort PROTO ((unsigned char *, int));
/* inet.c */
struct iaddr subnet_number PROTO ((struct iaddr, struct iaddr));
@@ -823,14 +906,19 @@ void make_release PROTO ((struct interface_info *, struct client_lease *));
void free_client_lease PROTO ((struct client_lease *));
void rewrite_client_leases PROTO ((void));
void write_client_lease PROTO ((struct interface_info *,
- struct client_lease *));
-char *dhcp_option_ev_name PROTO ((struct option *));
+ struct client_lease *, int));
void script_init PROTO ((struct interface_info *, char *,
struct string_list *));
void script_write_params PROTO ((struct interface_info *,
char *, struct client_lease *));
int script_go PROTO ((struct interface_info *));
+void client_envadd PROTO ((struct client_state *,
+ const char *, const char *, const char *, ...));
+void script_set_env (struct client_state *, const char *, const char *,
+ const char *);
+void script_flush_env(struct client_state *);
+int dhcp_option_ev_name (char *, size_t, struct option *);
struct client_lease *packet_to_lease PROTO ((struct packet *));
void go_daemon PROTO ((void));
@@ -850,7 +938,7 @@ u_int32_t wrapsum PROTO ((u_int32_t));
void assemble_hw_header PROTO ((struct interface_info *, unsigned char *,
int *, struct hardware *));
void assemble_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
- int *, u_int32_t, u_int32_t, u_int16_t,
+ int *, u_int32_t, u_int32_t, unsigned int,
unsigned char *, int));
ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *,
int, struct hardware *));
@@ -858,6 +946,20 @@ ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
int, struct sockaddr_in *,
unsigned char *, int));
+/* ethernet.c */
+void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,
+ int *, struct hardware *));
+ssize_t decode_ethernet_header PROTO ((struct interface_info *,
+ unsigned char *,
+ int, struct hardware *));
+
+/* tr.c */
+void assemble_tr_header PROTO ((struct interface_info *, unsigned char *,
+ int *, struct hardware *));
+ssize_t decode_tr_header PROTO ((struct interface_info *,
+ unsigned char *,
+ int, struct hardware *));
+
/* dhxpxlt.c */
void convert_statement PROTO ((FILE *));
void convert_host_statement PROTO ((FILE *, jrefproto));
@@ -917,8 +1019,8 @@ int parse_ip_addr PROTO ((FILE *, struct iaddr *));
void parse_reject_statement PROTO ((FILE *, struct client_config *));
/* dhcrelay.c */
-void relay PROTO ((struct interface_info *, u_int8_t *, int,
- unsigned short, struct iaddr, struct hardware *));
+void relay PROTO ((struct interface_info *, struct dhcp_packet *, int,
+ unsigned int, struct iaddr, struct hardware *));
/* icmp.c */
void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr,
@@ -941,7 +1043,7 @@ struct sockaddr_in *pick_name_server PROTO ((void));
/* inet_addr.c */
#ifdef NEED_INET_ATON
-int inet_aton PROTO ((char *, struct in_addr *));
+int inet_aton PROTO ((const char *, struct in_addr *));
#endif
/* sysconf.c */
diff --git a/usr.sbin/dhcp/includes/dhctoken.h b/usr.sbin/dhcp/includes/dhctoken.h
index 88acd162298..2aeb5303af1 100644
--- a/usr.sbin/dhcp/includes/dhctoken.h
+++ b/usr.sbin/dhcp/includes/dhctoken.h
@@ -3,8 +3,8 @@
Tokens for config file lexer and parser. */
/*
- * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium.
- * All rights reserved.
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999
+ * 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
@@ -124,6 +124,11 @@
#define HOSTNAME 328
#define CLIENT_HOSTNAME 329
#define REJECT 330
+#define FDDI 331
+#define USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 332
+#define AUTHORITATIVE 333
+#define TOKEN_NOT 334
+#define ALWAYS_REPLY_RFC1048 335
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
(x) != STRING && \
diff --git a/usr.sbin/dhcp/includes/hash.h b/usr.sbin/dhcp/includes/hash.h
index d30072b3c12..1bebb3140f8 100644
--- a/usr.sbin/dhcp/includes/hash.h
+++ b/usr.sbin/dhcp/includes/hash.h
@@ -3,7 +3,8 @@
Definitions for hashing... */
/*
- * Copyright (c) 1995 The Internet Software Consortium. All rights reserved.
+ * 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
@@ -43,7 +44,7 @@
struct hash_bucket {
struct hash_bucket *next;
- char *name;
+ unsigned char *name;
int len;
unsigned char *value;
};
diff --git a/usr.sbin/dhcp/includes/netinet/if_ether.h b/usr.sbin/dhcp/includes/netinet/if_ether.h
deleted file mode 100644
index 2af9198e542..00000000000
--- a/usr.sbin/dhcp/includes/netinet/if_ether.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $NetBSD: if_ether.h,v 1.1.1.1 1997/03/29 21:52:18 mellon Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
- *
- * @(#)if_ether.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Ethernet address - 6 octets
- * this is only used by the ethers(3) functions.
- */
-struct ether_addr {
- u_int8_t ether_addr_octet[6];
-};
-
-/*
- * Structure of a 10Mb/s Ethernet header.
- */
-#define ETHER_ADDR_LEN 6
-
-struct ether_header {
- u_int8_t ether_dhost[ETHER_ADDR_LEN];
- u_int8_t ether_shost[ETHER_ADDR_LEN];
- u_int16_t ether_type;
-};
-
-#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
-#define ETHERTYPE_IP 0x0800 /* IP protocol */
-#define ETHERTYPE_ARP 0x0806 /* address resolution protocol */
-#define ETHERTYPE_REVARP 0x8035 /* reverse addr resolution protocol */
-
-/*
- * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
- * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
- * by an ETHER type (as given above) and then the (variable-length) header.
- */
-#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
-#define ETHERTYPE_NTRAILER 16
-
-#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
-
-#define ETHERMTU 1500
-#define ETHERMIN (60-14)
-
diff --git a/usr.sbin/dhcp/includes/netinet/ip.h b/usr.sbin/dhcp/includes/netinet/ip.h
deleted file mode 100644
index bb02d2eaf0a..00000000000
--- a/usr.sbin/dhcp/includes/netinet/ip.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* $NetBSD: ip.h,v 1.1.1.1 1997/03/29 21:52:18 mellon Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
- *
- * @(#)ip.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Definitions for internet protocol version 4.
- * Per RFC 791, September 1981.
- */
-#define IPVERSION 4
-
-/*
- * Structure of an internet header, naked of options.
- *
- * We declare ip_len and ip_off to be short, rather than u_short
- * pragmatically since otherwise unsigned comparisons can result
- * against negative integers quite easily, and fail in subtle ways.
- */
-struct ip {
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_int8_t ip_hl:4, /* header length */
- ip_v:4; /* version */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t ip_v:4, /* version */
- ip_hl:4; /* header length */
-#endif
- u_int8_t ip_tos; /* type of service */
- int16_t ip_len; /* total length */
- u_int16_t ip_id; /* identification */
- int16_t ip_off; /* fragment offset field */
-#define IP_DF 0x4000 /* dont fragment flag */
-#define IP_MF 0x2000 /* more fragments flag */
-#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
- u_int8_t ip_ttl; /* time to live */
- u_int8_t ip_p; /* protocol */
- u_int16_t ip_sum; /* checksum */
- struct in_addr ip_src, ip_dst; /* source and dest address */
-};
-
-#define IP_MAXPACKET 65535 /* maximum packet size */
-
-/*
- * Definitions for IP type of service (ip_tos)
- */
-#define IPTOS_LOWDELAY 0x10
-#define IPTOS_THROUGHPUT 0x08
-#define IPTOS_RELIABILITY 0x04
-/* IPTOS_LOWCOST 0x02 XXX */
-
-/*
- * Definitions for IP precedence (also in ip_tos) (hopefully unused)
- */
-#define IPTOS_PREC_NETCONTROL 0xe0
-#define IPTOS_PREC_INTERNETCONTROL 0xc0
-#define IPTOS_PREC_CRITIC_ECP 0xa0
-#define IPTOS_PREC_FLASHOVERRIDE 0x80
-#define IPTOS_PREC_FLASH 0x60
-#define IPTOS_PREC_IMMEDIATE 0x40
-#define IPTOS_PREC_PRIORITY 0x20
-#define IPTOS_PREC_ROUTINE 0x00
-
-/*
- * Definitions for options.
- */
-#define IPOPT_COPIED(o) ((o)&0x80)
-#define IPOPT_CLASS(o) ((o)&0x60)
-#define IPOPT_NUMBER(o) ((o)&0x1f)
-
-#define IPOPT_CONTROL 0x00
-#define IPOPT_RESERVED1 0x20
-#define IPOPT_DEBMEAS 0x40
-#define IPOPT_RESERVED2 0x60
-
-#define IPOPT_EOL 0 /* end of option list */
-#define IPOPT_NOP 1 /* no operation */
-
-#define IPOPT_RR 7 /* record packet route */
-#define IPOPT_TS 68 /* timestamp */
-#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
-#define IPOPT_LSRR 131 /* loose source route */
-#define IPOPT_SATID 136 /* satnet id */
-#define IPOPT_SSRR 137 /* strict source route */
-
-/*
- * Offsets to fields in options other than EOL and NOP.
- */
-#define IPOPT_OPTVAL 0 /* option ID */
-#define IPOPT_OLEN 1 /* option length */
-#define IPOPT_OFFSET 2 /* offset within option */
-#define IPOPT_MINOFF 4 /* min value of above */
-
-/*
- * Time stamp option structure.
- */
-struct ip_timestamp {
- u_int8_t ipt_code; /* IPOPT_TS */
- u_int8_t ipt_len; /* size of structure (variable) */
- u_int8_t ipt_ptr; /* index of current entry */
-#if BYTE_ORDER == LITTLE_ENDIAN
- u_int8_t ipt_flg:4, /* flags, see below */
- ipt_oflw:4; /* overflow counter */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
- u_int8_t ipt_oflw:4, /* overflow counter */
- ipt_flg:4; /* flags, see below */
-#endif
- union ipt_timestamp {
- u_int32_t ipt_time[1];
- struct ipt_ta {
- struct in_addr ipt_addr;
- u_int32_t ipt_time;
- } ipt_ta[1];
- } ipt_timestamp;
-};
-
-/* flag bits for ipt_flg */
-#define IPOPT_TS_TSONLY 0 /* timestamps only */
-#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
-#define IPOPT_TS_PRESPEC 3 /* specified modules only */
-
-/* bits for security (not byte swapped) */
-#define IPOPT_SECUR_UNCLASS 0x0000
-#define IPOPT_SECUR_CONFID 0xf135
-#define IPOPT_SECUR_EFTO 0x789a
-#define IPOPT_SECUR_MMMM 0xbc4d
-#define IPOPT_SECUR_RESTR 0xaf13
-#define IPOPT_SECUR_SECRET 0xd788
-#define IPOPT_SECUR_TOPSECRET 0x6bc5
-
-/*
- * Internet implementation parameters.
- */
-#define MAXTTL 255 /* maximum time to live (seconds) */
-#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
-#define IPFRAGTTL 60 /* time to live for frags, slowhz */
-#define IPTTLDEC 1 /* subtracted when forwarding */
-
-#define IP_MSS 576 /* default maximum segment size */
diff --git a/usr.sbin/dhcp/includes/netinet/ip_icmp.h b/usr.sbin/dhcp/includes/netinet/ip_icmp.h
deleted file mode 100644
index e8cd0eda204..00000000000
--- a/usr.sbin/dhcp/includes/netinet/ip_icmp.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/* $NetBSD: ip_icmp.h,v 1.1.1.1 1997/03/29 21:52:18 mellon Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
- *
- * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
- */
-
-
-/*
- * Interface Control Message Protocol Definitions.
- * Per RFC 792, September 1981.
- */
-
-/*
- * Internal of an ICMP Router Advertisement
- */
-struct icmp_ra_addr {
- u_int32_t ira_addr;
- u_int32_t ira_preference;
-};
-
-/*
- * Structure of an icmp header.
- */
-struct icmp {
- u_int8_t icmp_type; /* type of message, see below */
- u_int8_t icmp_code; /* type sub code */
- u_int16_t icmp_cksum; /* ones complement cksum of struct */
- union {
- u_int8_t ih_pptr; /* ICMP_PARAMPROB */
- struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
- struct ih_idseq {
- int16_t icd_id;
- int16_t icd_seq;
- } ih_idseq;
- int32_t ih_void;
-
- /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
- struct ih_pmtu {
- int16_t ipm_void;
- int16_t ipm_nextmtu;
- } ih_pmtu;
- struct ih_rtradv {
- u_int8_t irt_num_addrs;
- u_int8_t irt_wpa;
- u_int16_t irt_lifetime;
- } ih_rtradv;
- } icmp_hun;
-#define icmp_pptr icmp_hun.ih_pptr
-#define icmp_gwaddr icmp_hun.ih_gwaddr
-#define icmp_id icmp_hun.ih_idseq.icd_id
-#define icmp_seq icmp_hun.ih_idseq.icd_seq
-#define icmp_void icmp_hun.ih_void
-#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
-#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
-#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
-#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
-#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
- union {
- struct id_ts {
- u_int32_t its_otime;
- u_int32_t its_rtime;
- u_int32_t its_ttime;
- } id_ts;
- struct id_ip {
- struct ip idi_ip;
- /* options and then 64 bits of data */
- } id_ip;
- struct icmp_ra_addr id_radv;
- u_int32_t id_mask;
- int8_t id_data[1];
- } icmp_dun;
-#define icmp_otime icmp_dun.id_ts.its_otime
-#define icmp_rtime icmp_dun.id_ts.its_rtime
-#define icmp_ttime icmp_dun.id_ts.its_ttime
-#define icmp_ip icmp_dun.id_ip.idi_ip
-#define icmp_radv icmp_dun.id_mask
-#define icmp_mask icmp_dun.id_mask
-#define icmp_data icmp_dun.id_data
-};
-
-/*
- * Lower bounds on packet lengths for various types.
- * For the error advice packets must first insure that the
- * packet is large enought to contain the returned ip header.
- * Only then can we do the check to see if 64 bits of packet
- * data have been returned, since we need to check the returned
- * ip header length.
- */
-#define ICMP_MINLEN 8 /* abs minimum */
-#define ICMP_TSLEN (8 + 3 * sizeof (u_int32_t)) /* timestamp */
-#define ICMP_MASKLEN 12 /* address mask */
-#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
-#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
- /* N.B.: must separately check that ip_hl >= 5 */
-
-/*
- * Definition of type and code field values.
- */
-#define ICMP_ECHOREPLY 0 /* echo reply */
-#define ICMP_UNREACH 3 /* dest unreachable, codes: */
-#define ICMP_UNREACH_NET 0 /* bad net */
-#define ICMP_UNREACH_HOST 1 /* bad host */
-#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
-#define ICMP_UNREACH_PORT 3 /* bad port */
-#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
-#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
-#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */
-#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */
-#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */
-#define ICMP_UNREACH_NET_PROHIB 9 /* prohibited access */
-#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */
-#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */
-#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */
-#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
-#define ICMP_REDIRECT 5 /* shorter route, codes: */
-#define ICMP_REDIRECT_NET 0 /* for network */
-#define ICMP_REDIRECT_HOST 1 /* for host */
-#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
-#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
-#define ICMP_ECHO 8 /* echo service */
-#define ICMP_ROUTERADVERT 9 /* router advertisement */
-#define ICMP_ROUTERSOLICIT 10 /* router solicitation */
-#define ICMP_TIMXCEED 11 /* time exceeded, code: */
-#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
-#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
-#define ICMP_PARAMPROB 12 /* ip header bad */
-#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */
-#define ICMP_TSTAMP 13 /* timestamp request */
-#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
-#define ICMP_IREQ 15 /* information request */
-#define ICMP_IREQREPLY 16 /* information reply */
-#define ICMP_MASKREQ 17 /* address mask request */
-#define ICMP_MASKREPLY 18 /* address mask reply */
-
-#define ICMP_MAXTYPE 18
-
-#define ICMP_INFOTYPE(type) \
- ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
- (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
- (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
- (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
- (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
-
-#ifdef _KERNEL
-void icmp_error __P((struct mbuf *, int, int, n_long, struct ifnet *));
-void icmp_input __P((struct mbuf *, ...));
-void icmp_reflect __P((struct mbuf *));
-void icmp_send __P((struct mbuf *, struct mbuf *));
-int icmp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
-#endif
-
diff --git a/usr.sbin/dhcp/includes/netinet/udp.h b/usr.sbin/dhcp/includes/netinet/udp.h
deleted file mode 100644
index 8ad181b390f..00000000000
--- a/usr.sbin/dhcp/includes/netinet/udp.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $NetBSD: udp.h,v 1.1.1.1 1997/03/29 21:52:18 mellon Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
- *
- * @(#)udp.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Udp protocol header.
- * Per RFC 768, September, 1981.
- */
-struct udphdr {
- u_int16_t uh_sport; /* source port */
- u_int16_t uh_dport; /* destination port */
- int16_t uh_ulen; /* udp length */
- u_int16_t uh_sum; /* udp checksum */
-};
diff --git a/usr.sbin/dhcp/includes/osdep.h b/usr.sbin/dhcp/includes/osdep.h
index 801eba5223a..ff5fc74ac4c 100644
--- a/usr.sbin/dhcp/includes/osdep.h
+++ b/usr.sbin/dhcp/includes/osdep.h
@@ -3,7 +3,8 @@
Operating system dependencies... */
/*
- * Copyright (c) 1996 The Internet Software Consortium. All rights reserved.
+ * Copyright (c) 1996, 1997, 1998, 1999 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
@@ -50,9 +51,14 @@
!defined (USE_BPF) && \
!defined (USE_BPF_SEND) && \
!defined (USE_BPF_RECEIVE) && \
+ !defined (USE_LPF) && \
+ !defined (USE_LPF_SEND) && \
+ !defined (USE_LPF_RECEIVE) && \
!defined (USE_NIT) && \
!defined (USE_NIT_SEND) && \
- !defined (USE_NIT_RECEIVE)
+ !defined (USE_NIT_RECEIVE) && \
+ !defined (USR_DLPI_SEND) && \
+ !defined (USE_DLPI_RECEIVE)
# define USE_DEFAULT_NETWORK
#endif
@@ -69,6 +75,10 @@
# endif
#endif
+#ifdef aix
+# include "cf/aix.h"
+#endif
+
#ifdef bsdi
# include "cf/bsdos.h"
#endif
@@ -101,7 +111,7 @@
# include "cf/sco.h"
#endif
-#ifdef hpux
+#if defined (hpux) || defined (__hpux)
# include "cf/hpux.h"
#endif
@@ -113,8 +123,20 @@
# include "cf/cygwin32.h"
#endif
-#ifdef NeXT
+#ifdef __APPLE__
+# include "cf/rhapsody.h"
+#else
+# if defined (NeXT)
# include "cf/nextstep.h"
+# endif
+#endif
+
+#if defined(IRIX) || defined(__sgi)
+# include "cf/irix.h"
+#endif
+
+#if !defined (TIME_MAX)
+# define TIME_MAX 2147483647
#endif
/* Porting::
@@ -138,11 +160,21 @@
# define USE_BPF_RECEIVE
#endif
+#ifdef USE_LPF
+# define USE_LPF_SEND
+# define USE_LPF_RECEIVE
+#endif
+
#ifdef USE_NIT
# define USE_NIT_SEND
# define USE_NIT_RECEIVE
#endif
+#ifdef USE_DLPI
+# define USE_DLPI_SEND
+# define USE_DLPI_RECEIVE
+#endif
+
#ifdef USE_UPF
# define USE_UPF_SEND
# define USE_UPF_RECEIVE
@@ -156,7 +188,8 @@
Currently, all low-level packet interfaces use BSD sockets as a
fallback. */
-#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || defined (USE_UPF_SEND)
+#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \
+ defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || defined (USE_LPF_SEND)
# define USE_SOCKET_FALLBACK
# define USE_FALLBACK
#endif
@@ -168,7 +201,8 @@
definition for your interface to the list tested below. */
#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \
- defined (USE_NIT_SEND) || defined (USE_UPF_SEND)
+ defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \
+ defined (USE_DLPI_SEND) || defined (USE_LPF_SEND)
# define PACKET_ASSEMBLY
#endif
@@ -179,10 +213,19 @@
definition for your interface to the list tested below. */
#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \
- defined (USE_NIT_RECEIVE) || defined (USE_UPF_SEND)
+ defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \
+ defined (USE_DLPI_RECEIVE) || \
+ defined (USE_LPF_SEND) || \
+ (defined (USE_SOCKET_SEND) && defined (SO_BINDTODEVICE))
# define PACKET_DECODING
#endif
+/* If we don't have a DLPI packet filter, we have to filter in userland.
+ Probably not worth doing, actually. */
+#if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD)
+# define USERLAND_FILTER
+#endif
+
/* jmp_buf is assumed to be a struct unless otherwise defined in the
system header. */
#ifndef jbp_decl
@@ -201,3 +244,55 @@
#ifndef BPF_FORMAT
# define BPF_FORMAT "/dev/bpf%d"
#endif
+
+#if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT)
+# define HAVE_IFF_POINTOPOINT
+#endif
+
+#if defined (AF_LINK) && !defined (HAVE_AF_LINK)
+# define HAVE_AF_LINK
+#endif
+
+#if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL)
+# define HAVE_ARPHRD_TUNNEL
+#endif
+
+#if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK)
+# define HAVE_ARPHRD_LOOPBACK
+#endif
+
+#if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE)
+# define HAVE_ARPHRD_ROSE
+#endif
+
+#if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802)
+# define HAVE_ARPHRD_IEEE802
+#endif
+
+#if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI)
+# define HAVE_ARPHRD_FDDI
+#endif
+
+#if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25)
+# define HAVE_ARPHRD_AX25
+#endif
+
+#if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM)
+# define HAVE_ARPHRD_NETROM
+#endif
+
+#if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM)
+# define HAVE_ARPHRD_METRICOM
+#endif
+
+#if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE)
+# define HAVE_SO_BINDTODEVICE
+#endif
+
+#if defined (SIOCGIFHWADDR) && !defined (HAVE_SIOCGIFHWADDR)
+# define HAVE_SIOCGIFHWADDR
+#endif
+
+#if defined (AF_LINK) && !defined (HAVE_AF_LINK)
+# define HAVE_AF_LINK
+#endif
diff --git a/usr.sbin/dhcp/includes/site.h b/usr.sbin/dhcp/includes/site.h
index e420661061c..30fdb703005 100644
--- a/usr.sbin/dhcp/includes/site.h
+++ b/usr.sbin/dhcp/includes/site.h
@@ -78,7 +78,7 @@
/* Define this to use the Berkeley Packet Filter API.
The BPF API is available on all 4.4-BSD derivatives, including
- OpenBSD, NetBSD, FreeBSD and BSDI's BSD/OS. It's also available on
+ NetBSD, FreeBSD and BSDI's BSD/OS. It's also available on
DEC Alpha OSF/1 in a compatibility mode supported by the Alpha OSF/1
packetfilter interface. */
diff --git a/usr.sbin/dhcp/includes/version.h b/usr.sbin/dhcp/includes/version.h
new file mode 100644
index 00000000000..2897e2e2a72
--- /dev/null
+++ b/usr.sbin/dhcp/includes/version.h
@@ -0,0 +1,3 @@
+/* Current version of ISC DHCP Distribution. */
+
+#define DHCP_VERSION "2.0pl5-OpenBSD"