1995-11-29 07:40:04 +00:00
|
|
|
/* dhcpd.h
|
|
|
|
|
|
|
|
Definitions for dhcpd... */
|
|
|
|
|
|
|
|
/*
|
1998-03-16 06:19:46 +00:00
|
|
|
* Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.
|
1996-05-12 23:59:45 +00:00
|
|
|
* All rights reserved.
|
1995-11-29 07:40:04 +00:00
|
|
|
*
|
|
|
|
* 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''.
|
|
|
|
*/
|
|
|
|
|
1997-06-02 23:23:05 +00:00
|
|
|
#ifndef __CYGWIN32__
|
1995-11-29 07:40:04 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <sys/socket.h>
|
1997-09-16 18:16:55 +00:00
|
|
|
#include <sys/un.h>
|
1995-11-29 07:40:04 +00:00
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <netdb.h>
|
1997-06-02 23:23:05 +00:00
|
|
|
#else
|
|
|
|
#define fd_set cygwin_fd_set
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
1995-11-29 07:40:04 +00:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stdio.h>
|
1996-02-06 20:25:56 +00:00
|
|
|
#include <unistd.h>
|
1996-05-17 23:29:07 +00:00
|
|
|
#include <string.h>
|
1996-02-06 20:25:56 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <ctype.h>
|
1996-02-21 12:11:09 +00:00
|
|
|
#include <time.h>
|
1996-02-06 20:25:56 +00:00
|
|
|
|
1996-05-16 07:18:45 +00:00
|
|
|
#include "cdefs.h"
|
1996-03-16 17:50:30 +00:00
|
|
|
#include "osdep.h"
|
1995-11-29 07:40:04 +00:00
|
|
|
#include "dhcp.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "hash.h"
|
1996-02-06 20:25:56 +00:00
|
|
|
#include "inet.h"
|
1997-10-20 22:11:44 +00:00
|
|
|
#include "sysconf.h"
|
1995-11-29 07:40:04 +00:00
|
|
|
|
1997-02-22 08:50:59 +00:00
|
|
|
struct string_list {
|
|
|
|
struct string_list *next;
|
|
|
|
char string [1];
|
|
|
|
};
|
|
|
|
|
1998-04-19 23:21:54 +00:00
|
|
|
/* A string of data bytes, possibly accompanied by a larger buffer. */
|
|
|
|
struct data_string {
|
|
|
|
unsigned char *data, *buffer;
|
|
|
|
int len;
|
|
|
|
int terminated;
|
|
|
|
};
|
|
|
|
|
1997-06-02 23:23:05 +00:00
|
|
|
/* A name server, from /etc/resolv.conf. */
|
|
|
|
struct name_server {
|
|
|
|
struct name_server *next;
|
|
|
|
struct sockaddr_in addr;
|
|
|
|
TIME rcdate;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* A domain search list element. */
|
|
|
|
struct domain_search_list {
|
|
|
|
struct domain_search_list *next;
|
|
|
|
char *domain;
|
|
|
|
TIME rcdate;
|
|
|
|
};
|
|
|
|
|
1998-03-15 20:57:28 +00:00
|
|
|
/* Option tag structures are used to build chains of option tags, for
|
|
|
|
when we're sure we're not going to have enough of them to justify
|
|
|
|
maintaining an array. */
|
|
|
|
|
|
|
|
struct option_tag {
|
|
|
|
struct option_tag *next;
|
|
|
|
u_int8_t data [1];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* An agent option structure. We need a special structure for the
|
|
|
|
Relay Agent Information option because if more than one appears in
|
|
|
|
a message, we have to keep them seperate. */
|
|
|
|
|
|
|
|
struct agent_options {
|
|
|
|
struct agent_options *next;
|
|
|
|
int length;
|
|
|
|
struct option_tag *first;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The data associated with a given option in an array of options. */
|
|
|
|
|
|
|
|
struct option_data {
|
|
|
|
int len;
|
|
|
|
u_int8_t *data;
|
|
|
|
};
|
|
|
|
|
1995-11-29 07:40:04 +00:00
|
|
|
/* A dhcp packet and the pointers to its option values. */
|
|
|
|
struct packet {
|
|
|
|
struct dhcp_packet *raw;
|
|
|
|
int packet_length;
|
|
|
|
int packet_type;
|
|
|
|
int options_valid;
|
1996-02-06 20:25:56 +00:00
|
|
|
int client_port;
|
|
|
|
struct iaddr client_addr;
|
1996-05-12 23:59:45 +00:00
|
|
|
struct interface_info *interface; /* Interface on which packet
|
|
|
|
was received. */
|
|
|
|
struct hardware *haddr; /* Physical link address
|
|
|
|
of local sender (maybe gateway). */
|
1996-05-22 07:23:16 +00:00
|
|
|
struct shared_network *shared_network;
|
1997-02-18 14:26:11 +00:00
|
|
|
struct option_data options [256];
|
1998-03-15 20:57:28 +00:00
|
|
|
struct agent_options *agent_options; /* Received agent options. */
|
1998-04-19 23:21:54 +00:00
|
|
|
|
|
|
|
#if !defined (PACKET_MAX_CLASSES)
|
|
|
|
# define PACKET_MAX_CLASSES 5
|
|
|
|
#endif
|
|
|
|
int class_count;
|
|
|
|
struct class *classes [PACKET_MAX_CLASSES];
|
1995-11-29 07:40:04 +00:00
|
|
|
};
|
|
|
|
|
1998-03-15 20:57:28 +00:00
|
|
|
/* A network interface's MAC address. */
|
|
|
|
|
1995-11-29 07:40:04 +00:00
|
|
|
struct hardware {
|
|
|
|
u_int8_t htype;
|
|
|
|
u_int8_t hlen;
|
|
|
|
u_int8_t haddr [16];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* A dhcp lease declaration structure. */
|
|
|
|
struct lease {
|
|
|
|
struct lease *next;
|
|
|
|
struct lease *prev;
|
1996-08-27 09:46:28 +00:00
|
|
|
struct lease *n_uid, *n_hw;
|
1997-03-05 06:38:27 +00:00
|
|
|
struct lease *waitq_next;
|
|
|
|
|
1996-02-06 20:25:56 +00:00
|
|
|
struct iaddr ip_addr;
|
1995-11-29 07:40:04 +00:00
|
|
|
TIME starts, ends, timestamp;
|
|
|
|
unsigned char *uid;
|
|
|
|
int uid_len;
|
1997-03-05 06:38:27 +00:00
|
|
|
int uid_max;
|
|
|
|
unsigned char uid_buf [32];
|
1996-08-28 01:32:38 +00:00
|
|
|
char *hostname;
|
1997-06-02 23:23:05 +00:00
|
|
|
char *client_hostname;
|
1995-11-29 07:40:04 +00:00
|
|
|
struct host_decl *host;
|
1996-05-22 07:23:16 +00:00
|
|
|
struct subnet *subnet;
|
|
|
|
struct shared_network *shared_network;
|
1995-11-29 07:40:04 +00:00
|
|
|
struct hardware hardware_addr;
|
1997-03-05 06:38:27 +00:00
|
|
|
|
1996-05-22 07:23:16 +00:00
|
|
|
int flags;
|
|
|
|
# define STATIC_LEASE 1
|
|
|
|
# define BOOTP_LEASE 2
|
|
|
|
# define DYNAMIC_BOOTP_OK 4
|
|
|
|
# define PERSISTENT_FLAGS (DYNAMIC_BOOTP_OK)
|
|
|
|
# define EPHEMERAL_FLAGS (BOOTP_LEASE)
|
1997-03-05 06:38:27 +00:00
|
|
|
# define MS_NULL_TERMINATION 8
|
1997-03-06 19:28:35 +00:00
|
|
|
# define ABANDONED_LEASE 16
|
1997-03-05 06:38:27 +00:00
|
|
|
|
1997-03-06 06:57:19 +00:00
|
|
|
struct lease_state *state;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lease_state {
|
|
|
|
struct lease_state *next;
|
|
|
|
|
|
|
|
struct interface_info *ip;
|
|
|
|
|
|
|
|
TIME offered_expiry;
|
|
|
|
|
1997-03-05 06:38:27 +00:00
|
|
|
struct tree_cache *options [256];
|
1998-03-15 20:57:28 +00:00
|
|
|
struct agent_options *agent_options;
|
|
|
|
int max_message_size;
|
1997-03-05 06:38:27 +00:00
|
|
|
u_int32_t expiry, renewal, rebind;
|
|
|
|
char *filename, *server_name;
|
|
|
|
|
|
|
|
u_int32_t xid;
|
|
|
|
u_int16_t secs;
|
|
|
|
u_int16_t bootp_flags;
|
|
|
|
struct in_addr ciaddr;
|
|
|
|
struct in_addr giaddr;
|
|
|
|
u_int8_t hops;
|
|
|
|
u_int8_t offer;
|
1996-05-22 07:23:16 +00:00
|
|
|
};
|
|
|
|
|
1996-08-27 09:46:28 +00:00
|
|
|
#define ROOT_GROUP 0
|
1996-08-29 09:16:49 +00:00
|
|
|
#define HOST_DECL 1
|
|
|
|
#define SHARED_NET_DECL 2
|
|
|
|
#define SUBNET_DECL 3
|
|
|
|
#define CLASS_DECL 4
|
|
|
|
#define GROUP_DECL 5
|
1996-08-27 09:46:28 +00:00
|
|
|
|
1997-02-18 14:26:11 +00:00
|
|
|
/* Possible modes in which discover_interfaces can run. */
|
|
|
|
|
|
|
|
#define DISCOVER_RUNNING 0
|
|
|
|
#define DISCOVER_SERVER 1
|
|
|
|
#define DISCOVER_UNCONFIGURED 2
|
1997-02-22 12:25:32 +00:00
|
|
|
#define DISCOVER_RELAY 3
|
1997-09-16 18:16:55 +00:00
|
|
|
#define DISCOVER_REQUESTED 4
|
1997-02-18 14:26:11 +00:00
|
|
|
|
1996-08-29 09:16:49 +00:00
|
|
|
/* Group of declarations that share common parameters. */
|
1996-08-27 09:46:28 +00:00
|
|
|
struct group {
|
|
|
|
struct group *next;
|
|
|
|
|
|
|
|
struct subnet *subnet;
|
|
|
|
struct shared_network *shared_network;
|
|
|
|
|
|
|
|
TIME default_lease_time;
|
|
|
|
TIME max_lease_time;
|
1998-04-09 04:35:50 +00:00
|
|
|
TIME min_lease_time;
|
1996-08-27 09:46:28 +00:00
|
|
|
TIME bootp_lease_cutoff;
|
|
|
|
TIME bootp_lease_length;
|
|
|
|
|
|
|
|
char *filename;
|
|
|
|
char *server_name;
|
|
|
|
struct iaddr next_server;
|
|
|
|
|
|
|
|
int boot_unknown_clients;
|
|
|
|
int dynamic_bootp;
|
1997-02-22 08:50:59 +00:00
|
|
|
int allow_bootp;
|
|
|
|
int allow_booting;
|
1996-08-28 01:32:38 +00:00
|
|
|
int one_lease_per_client;
|
1996-08-29 23:02:40 +00:00
|
|
|
int get_lease_hostnames;
|
1996-09-09 07:04:29 +00:00
|
|
|
int use_host_decl_names;
|
1998-04-09 04:35:50 +00:00
|
|
|
int use_lease_addr_for_default_route;
|
|
|
|
int min_secs;
|
1996-08-27 09:46:28 +00:00
|
|
|
|
|
|
|
struct tree_cache *options [256];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* A dhcp host declaration structure. */
|
|
|
|
struct host_decl {
|
|
|
|
struct host_decl *n_ipaddr;
|
|
|
|
char *name;
|
|
|
|
struct hardware interface;
|
|
|
|
struct tree_cache *fixed_addr;
|
|
|
|
struct group *group;
|
|
|
|
};
|
|
|
|
|
1996-05-22 07:23:16 +00:00
|
|
|
struct shared_network {
|
|
|
|
struct shared_network *next;
|
1996-08-27 09:46:28 +00:00
|
|
|
char *name;
|
1996-05-22 07:23:16 +00:00
|
|
|
struct subnet *subnets;
|
|
|
|
struct interface_info *interface;
|
|
|
|
struct lease *leases;
|
|
|
|
struct lease *insertion_point;
|
|
|
|
struct lease *last_lease;
|
1996-08-27 09:46:28 +00:00
|
|
|
|
|
|
|
struct group *group;
|
1995-11-29 07:40:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct subnet {
|
1996-05-22 07:23:16 +00:00
|
|
|
struct subnet *next_subnet;
|
|
|
|
struct subnet *next_sibling;
|
|
|
|
struct shared_network *shared_network;
|
|
|
|
struct interface_info *interface;
|
|
|
|
struct iaddr interface_address;
|
1996-02-06 20:25:56 +00:00
|
|
|
struct iaddr net;
|
|
|
|
struct iaddr netmask;
|
1996-08-27 09:46:28 +00:00
|
|
|
|
|
|
|
struct group *group;
|
1995-11-29 07:40:04 +00:00
|
|
|
};
|
|
|
|
|
1998-04-19 23:21:54 +00:00
|
|
|
struct match_expr {
|
|
|
|
enum {
|
|
|
|
match_check,
|
|
|
|
match_equal,
|
|
|
|
match_substring,
|
|
|
|
match_suffix,
|
|
|
|
match_and,
|
|
|
|
match_or,
|
|
|
|
match_not,
|
|
|
|
match_option,
|
|
|
|
match_hardware,
|
|
|
|
match_packet,
|
|
|
|
match_const_data,
|
|
|
|
match_extract_int8,
|
|
|
|
match_extract_int16,
|
|
|
|
match_extract_int32,
|
|
|
|
match_const_int,
|
|
|
|
} op;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
struct match_expr *expr;
|
|
|
|
struct match_expr *offset;
|
|
|
|
struct match_expr *len;
|
|
|
|
} substring;
|
1998-04-20 18:02:29 +00:00
|
|
|
struct match_expr *equal [2];
|
1998-04-19 23:21:54 +00:00
|
|
|
struct match_expr *and [2];
|
|
|
|
struct match_expr *or [2];
|
|
|
|
struct match_expr *not;
|
|
|
|
struct collection *check;
|
|
|
|
struct {
|
1998-04-20 18:02:29 +00:00
|
|
|
struct match_expr *expr;
|
|
|
|
struct match_expr *len;
|
|
|
|
} suffix;
|
|
|
|
struct option *option;
|
1998-04-19 23:21:54 +00:00
|
|
|
struct {
|
|
|
|
struct match_expr *offset;
|
|
|
|
struct match_expr *len;
|
|
|
|
} packet;
|
|
|
|
struct data_string const_data;
|
1998-04-20 18:02:29 +00:00
|
|
|
struct {
|
|
|
|
struct match_expr *expr;
|
|
|
|
struct match_expr *width;
|
|
|
|
} extract_int;
|
1998-04-19 23:21:54 +00:00
|
|
|
unsigned long const_int;
|
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct classification_rule {
|
|
|
|
struct classification_rule *next;
|
|
|
|
enum classification_op {
|
|
|
|
classify_if,
|
|
|
|
classify_eval,
|
|
|
|
classify_add,
|
|
|
|
classify_break,
|
|
|
|
} op;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
struct classification_rule *true, *false;
|
|
|
|
struct match_expr *expr;
|
|
|
|
} ie;
|
|
|
|
struct match_expr *eval;
|
|
|
|
struct class *add;
|
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct collection {
|
|
|
|
struct collection *next;
|
|
|
|
|
1996-02-29 18:25:51 +00:00
|
|
|
char *name;
|
1998-04-19 23:21:54 +00:00
|
|
|
struct class *classes;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct class {
|
|
|
|
struct class *nic; /* Next in collection. */
|
|
|
|
char *name; /* Optional... */
|
1996-08-27 09:46:28 +00:00
|
|
|
|
1998-04-19 23:21:54 +00:00
|
|
|
struct hash_table *hash;
|
|
|
|
struct match_expr *expr;
|
|
|
|
struct match_expr *spawn;
|
|
|
|
|
1996-08-27 09:46:28 +00:00
|
|
|
struct group *group;
|
1996-02-29 18:25:51 +00:00
|
|
|
};
|
|
|
|
|
1997-02-18 14:26:11 +00:00
|
|
|
/* DHCP client lease structure... */
|
|
|
|
struct client_lease {
|
1997-02-19 10:52:37 +00:00
|
|
|
struct client_lease *next; /* Next lease in list. */
|
|
|
|
TIME expiry, renewal, rebind; /* Lease timeouts. */
|
|
|
|
struct iaddr address; /* Address being leased. */
|
|
|
|
char *server_name; /* Name of boot server. */
|
|
|
|
char *filename; /* Name of file we're supposed to boot. */
|
1997-02-22 08:50:59 +00:00
|
|
|
struct string_list *medium; /* Network medium. */
|
1997-02-18 14:26:11 +00:00
|
|
|
|
1997-06-02 23:23:05 +00:00
|
|
|
unsigned int is_static : 1; /* If set, lease is from config file. */
|
|
|
|
unsigned int is_bootp: 1; /* If set, lease was aquired with BOOTP. */
|
1997-02-19 10:52:37 +00:00
|
|
|
|
|
|
|
struct option_data options [256]; /* Options supplied with lease. */
|
1997-02-18 14:26:11 +00:00
|
|
|
};
|
|
|
|
|
1997-02-19 10:52:37 +00:00
|
|
|
/* Possible states in which the client can be. */
|
1997-02-18 14:26:11 +00:00
|
|
|
enum dhcp_state {
|
1997-03-05 06:38:27 +00:00
|
|
|
S_REBOOTING,
|
1997-02-18 14:26:11 +00:00
|
|
|
S_INIT,
|
|
|
|
S_SELECTING,
|
|
|
|
S_REQUESTING,
|
|
|
|
S_BOUND,
|
|
|
|
S_RENEWING,
|
|
|
|
S_REBINDING
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Configuration information from the config file... */
|
|
|
|
struct client_config {
|
1997-02-22 08:50:59 +00:00
|
|
|
struct option_data defaults [256]; /* Default values for options. */
|
1997-06-02 23:23:05 +00:00
|
|
|
enum {
|
|
|
|
ACTION_DEFAULT, /* Use server value if present,
|
|
|
|
otherwise default. */
|
|
|
|
ACTION_SUPERSEDE, /* Always use default. */
|
|
|
|
ACTION_PREPEND, /* Prepend default to server. */
|
|
|
|
ACTION_APPEND, /* Append default to server. */
|
|
|
|
} default_actions [256];
|
|
|
|
|
1997-02-22 08:50:59 +00:00
|
|
|
struct option_data send_options [256]; /* Send these to server. */
|
1997-02-18 14:26:11 +00:00
|
|
|
u_int8_t required_options [256]; /* Options server must supply. */
|
|
|
|
u_int8_t requested_options [256]; /* Options to request from server. */
|
|
|
|
int requested_option_count; /* Number of requested options. */
|
|
|
|
TIME timeout; /* Start to panic if we don't get a
|
|
|
|
lease in this time period when
|
|
|
|
SELECTING. */
|
1997-03-29 01:26:56 +00:00
|
|
|
TIME initial_interval; /* All exponential backoff intervals
|
|
|
|
start here. */
|
1997-02-18 14:26:11 +00:00
|
|
|
TIME retry_interval; /* If the protocol failed to produce
|
|
|
|
an address before the timeout,
|
|
|
|
try the protocol again after this
|
|
|
|
many seconds. */
|
|
|
|
TIME select_interval; /* Wait this many seconds from the
|
|
|
|
first DHCPDISCOVER before
|
|
|
|
picking an offered lease. */
|
1997-03-05 06:38:27 +00:00
|
|
|
TIME reboot_timeout; /* When in INIT-REBOOT, wait this
|
|
|
|
long before giving up and going
|
|
|
|
to INIT. */
|
1997-03-29 01:26:56 +00:00
|
|
|
TIME backoff_cutoff; /* When doing exponential backoff,
|
|
|
|
never back off to an interval
|
|
|
|
longer than this amount. */
|
1997-02-22 08:50:59 +00:00
|
|
|
struct string_list *media; /* Possible network media values. */
|
1997-02-18 14:26:11 +00:00
|
|
|
char *script_name; /* Name of config script. */
|
|
|
|
enum { IGNORE, ACCEPT, PREFER } bootp_policy;
|
|
|
|
/* Ignore, accept or prefer BOOTP
|
|
|
|
responses. */
|
1997-02-22 08:50:59 +00:00
|
|
|
struct string_list *medium; /* Current network medium. */
|
1997-06-02 23:23:05 +00:00
|
|
|
|
|
|
|
struct iaddrlist *reject_list; /* Servers to reject. */
|
1997-02-18 14:26:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Per-interface state used in the dhcp client... */
|
|
|
|
struct client_state {
|
|
|
|
struct client_lease *active; /* Currently active lease. */
|
|
|
|
struct client_lease *new; /* New lease. */
|
|
|
|
struct client_lease *offered_leases; /* Leases offered to us. */
|
|
|
|
struct client_lease *leases; /* Leases we currently hold. */
|
1997-02-22 12:25:32 +00:00
|
|
|
struct client_lease *alias; /* Alias lease. */
|
1997-02-18 14:26:11 +00:00
|
|
|
|
|
|
|
enum dhcp_state state; /* Current state for this interface. */
|
|
|
|
struct iaddr destination; /* Where to send packet. */
|
|
|
|
u_int32_t xid; /* Transaction ID. */
|
|
|
|
TIME first_sending; /* When was first copy sent? */
|
1997-02-22 08:50:59 +00:00
|
|
|
TIME interval; /* What's the current resend interval? */
|
|
|
|
struct string_list *medium; /* Last media type tried. */
|
1997-02-18 14:26:11 +00:00
|
|
|
|
|
|
|
struct dhcp_packet packet; /* Outgoing DHCP packet. */
|
|
|
|
int packet_length; /* Actual length of generated packet. */
|
|
|
|
|
1997-02-19 10:52:37 +00:00
|
|
|
struct iaddr requested_address; /* Address we would like to get. */
|
|
|
|
|
1997-02-18 14:26:11 +00:00
|
|
|
struct client_config *config; /* Information from config file. */
|
|
|
|
};
|
|
|
|
|
1996-05-12 23:59:45 +00:00
|
|
|
/* Information about each network interface. */
|
|
|
|
|
|
|
|
struct interface_info {
|
|
|
|
struct interface_info *next; /* Next interface in list... */
|
1996-05-22 07:23:16 +00:00
|
|
|
struct shared_network *shared_network;
|
|
|
|
/* Networks connected to this interface. */
|
1996-05-12 23:59:45 +00:00
|
|
|
struct hardware hw_address; /* Its physical address. */
|
1997-02-22 08:50:59 +00:00
|
|
|
struct in_addr primary_address; /* Primary interface address. */
|
1996-05-12 23:59:45 +00:00
|
|
|
char name [IFNAMSIZ]; /* Its name... */
|
|
|
|
int rfdesc; /* Its read file descriptor. */
|
|
|
|
int wfdesc; /* Its write file descriptor, if
|
|
|
|
different. */
|
|
|
|
unsigned char *rbuf; /* Read buffer, if required. */
|
|
|
|
size_t rbuf_max; /* Size of read buffer. */
|
|
|
|
size_t rbuf_offset; /* Current offset into buffer. */
|
|
|
|
size_t rbuf_len; /* Length of data in buffer. */
|
1996-05-22 07:23:16 +00:00
|
|
|
|
1997-02-19 10:52:37 +00:00
|
|
|
struct ifreq *ifp; /* Pointer to ifreq struct. */
|
1996-06-27 19:06:04 +00:00
|
|
|
u_int32_t flags; /* Control flags... */
|
|
|
|
#define INTERFACE_REQUESTED 1
|
1997-09-16 18:16:55 +00:00
|
|
|
#define INTERFACE_AUTOMATIC 2
|
1997-02-18 14:26:11 +00:00
|
|
|
|
|
|
|
/* Only used by DHCP client code. */
|
|
|
|
struct client_state *client;
|
1996-05-12 23:59:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct hardware_link {
|
|
|
|
struct hardware_link *next;
|
|
|
|
char name [IFNAMSIZ];
|
|
|
|
struct hardware address;
|
|
|
|
};
|
|
|
|
|
1997-02-18 14:26:11 +00:00
|
|
|
struct timeout {
|
|
|
|
struct timeout *next;
|
|
|
|
TIME when;
|
1997-03-06 06:57:19 +00:00
|
|
|
void (*func) PROTO ((void *));
|
|
|
|
void *what;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct protocol {
|
|
|
|
struct protocol *next;
|
|
|
|
int fd;
|
|
|
|
void (*handler) PROTO ((struct protocol *));
|
|
|
|
void *local;
|
1997-02-18 14:26:11 +00:00
|
|
|
};
|
|
|
|
|
1998-01-12 01:06:16 +00:00
|
|
|
struct dns_query; /* forward */
|
|
|
|
|
|
|
|
struct dns_wakeup {
|
|
|
|
struct dns_wakeup *next; /* Next wakeup in chain. */
|
|
|
|
void (*func) PROTO ((struct dns_query *));
|
|
|
|
};
|
|
|
|
|
1998-03-15 20:57:28 +00:00
|
|
|
struct dns_question {
|
|
|
|
u_int16_t type; /* Type of query. */
|
|
|
|
u_int16_t class; /* Class of query. */
|
|
|
|
unsigned char data [1]; /* Query data. */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dns_answer {
|
|
|
|
u_int16_t type; /* Type of answer. */
|
|
|
|
u_int16_t class; /* Class of answer. */
|
|
|
|
int count; /* Number of answers. */
|
|
|
|
unsigned char *answers[1]; /* Pointers to answers. */
|
|
|
|
};
|
|
|
|
|
1998-01-12 01:06:16 +00:00
|
|
|
struct dns_query {
|
|
|
|
struct dns_query *next; /* Next query in hash bucket. */
|
1998-03-15 20:57:28 +00:00
|
|
|
u_int32_t hash; /* Hash bucket index. */
|
1998-01-12 01:06:16 +00:00
|
|
|
TIME expiry; /* Query expiry time (zero if not yet
|
|
|
|
answered. */
|
|
|
|
u_int16_t id; /* Query ID (also hash table index) */
|
|
|
|
caddr_t waiters; /* Pointer to list of things waiting
|
|
|
|
on this query. */
|
1998-03-15 20:57:28 +00:00
|
|
|
|
|
|
|
struct dns_question *question; /* Question, internal format. */
|
|
|
|
struct dns_answer *answer; /* Answer, internal format. */
|
|
|
|
|
|
|
|
unsigned char *query; /* Query formatted for DNS server. */
|
1998-01-12 01:06:16 +00:00
|
|
|
int len; /* Length of entire query. */
|
|
|
|
int sent; /* The query has been sent. */
|
|
|
|
struct dns_wakeup *wakeups; /* Wakeups to call if this query is
|
|
|
|
answered. */
|
|
|
|
struct name_server *next_server; /* Next server to try. */
|
|
|
|
int backoff; /* Current backoff, in seconds. */
|
|
|
|
};
|
|
|
|
|
1998-04-09 04:35:50 +00:00
|
|
|
struct interact_client; /* forward */
|
|
|
|
|
|
|
|
/* Actions that can be taken by an interactive connection to the dhcp server
|
|
|
|
or client. */
|
|
|
|
|
|
|
|
struct interact_actions {
|
|
|
|
void (*ls) PROTO ((struct interact_client *));
|
|
|
|
void (*print) PROTO ((struct interact_client *, char *));
|
|
|
|
void (*set) PROTO ((struct interact_client *, char *));
|
|
|
|
void (*rm) PROTO ((struct interact_client *, char *));
|
|
|
|
void (*cd) PROTO ((struct interact_client *, char *));
|
|
|
|
void (*cdup) PROTO ((struct interact_client *));
|
|
|
|
void * (*next) PROTO ((struct interact_client *, void *));
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Interactive connection state. */
|
|
|
|
|
|
|
|
struct interact_client {
|
|
|
|
struct interact_client *next;
|
|
|
|
int fd;
|
|
|
|
struct interact_actions cur_node_actions;
|
|
|
|
void *cur_node;
|
|
|
|
int cur_node_classp;
|
|
|
|
int last_input;
|
|
|
|
struct protocol *proto;
|
|
|
|
|
|
|
|
char ibuf [1024];
|
|
|
|
int ibuflen;
|
|
|
|
};
|
|
|
|
|
1995-11-29 07:40:04 +00:00
|
|
|
/* Bitmask of dhcp option codes. */
|
|
|
|
typedef unsigned char option_mask [16];
|
|
|
|
|
|
|
|
/* DHCP Option mask manipulation macros... */
|
|
|
|
#define OPTION_ZERO(mask) (memset (mask, 0, 16))
|
|
|
|
#define OPTION_SET(mask, bit) (mask [bit >> 8] |= (1 << (bit & 7)))
|
|
|
|
#define OPTION_CLR(mask, bit) (mask [bit >> 8] &= ~(1 << (bit & 7)))
|
|
|
|
#define OPTION_ISSET(mask, bit) (mask [bit >> 8] & (1 << (bit & 7)))
|
|
|
|
#define OPTION_ISCLR(mask, bit) (!OPTION_ISSET (mask, bit))
|
|
|
|
|
|
|
|
/* An option occupies its length plus two header bytes (code and
|
|
|
|
length) for every 255 bytes that must be stored. */
|
|
|
|
#define OPTION_SPACE(x) ((x) + 2 * ((x) / 255 + 1))
|
|
|
|
|
|
|
|
/* Default path to dhcpd config file. */
|
|
|
|
#ifdef DEBUG
|
1996-06-01 00:29:14 +00:00
|
|
|
#undef _PATH_DHCPD_CONF
|
1995-11-29 07:40:04 +00:00
|
|
|
#define _PATH_DHCPD_CONF "dhcpd.conf"
|
1996-06-01 00:29:14 +00:00
|
|
|
#undef _PATH_DHCPD_DB
|
1996-03-02 05:13:36 +00:00
|
|
|
#define _PATH_DHCPD_DB "dhcpd.leases"
|
1995-11-29 07:40:04 +00:00
|
|
|
#else
|
1996-03-16 17:50:30 +00:00
|
|
|
#ifndef _PATH_DHCPD_CONF
|
1995-11-29 07:40:04 +00:00
|
|
|
#define _PATH_DHCPD_CONF "/etc/dhcpd.conf"
|
1996-03-16 17:50:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _PATH_DHCPD_DB
|
1996-03-06 10:40:57 +00:00
|
|
|
#define _PATH_DHCPD_DB "/etc/dhcpd.leases"
|
1995-11-29 07:40:04 +00:00
|
|
|
#endif
|
1996-03-16 17:50:30 +00:00
|
|
|
|
|
|
|
#ifndef _PATH_DHCPD_PID
|
|
|
|
#define _PATH_DHCPD_PID "/var/run/dhcpd.pid"
|
|
|
|
#endif
|
1995-11-29 07:40:04 +00:00
|
|
|
#endif
|
|
|
|
|
1997-02-18 14:26:11 +00:00
|
|
|
#ifndef _PATH_DHCLIENT_CONF
|
|
|
|
#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _PATH_DHCLIENT_PID
|
|
|
|
#define _PATH_DHCLIENT_PID "/var/run/dhclient.pid"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _PATH_DHCLIENT_DB
|
|
|
|
#define _PATH_DHCLIENT_DB "/etc/dhclient.leases"
|
|
|
|
#endif
|
|
|
|
|
1997-06-02 23:23:05 +00:00
|
|
|
#ifndef _PATH_RESOLV_CONF
|
|
|
|
#define _PATH_RESOLV_CONF "/etc/resolv.conf"
|
|
|
|
#endif
|
1997-02-18 14:26:11 +00:00
|
|
|
|
1997-11-22 07:52:16 +00:00
|
|
|
#ifndef _PATH_DHCRELAY_PID
|
|
|
|
#define _PATH_DHCRELAY_PID "/var/run/dhcrelay.pid"
|
|
|
|
#endif
|
|
|
|
|
1996-08-27 09:46:28 +00:00
|
|
|
#ifndef DHCPD_LOG_FACILITY
|
|
|
|
#define DHCPD_LOG_FACILITY LOG_DAEMON
|
|
|
|
#endif
|
|
|
|
|
1995-11-29 07:40:04 +00:00
|
|
|
#define MAX_TIME 0x7fffffff
|
|
|
|
#define MIN_TIME 0
|
|
|
|
|
|
|
|
/* External definitions... */
|
|
|
|
|
|
|
|
/* options.c */
|
|
|
|
|
|
|
|
void parse_options PROTO ((struct packet *));
|
|
|
|
void parse_option_buffer PROTO ((struct packet *, unsigned char *, int));
|
1998-03-15 20:57:28 +00:00
|
|
|
int parse_agent_information_option PROTO ((struct packet *, int, u_int8_t *));
|
|
|
|
int cons_options PROTO ((struct packet *, struct dhcp_packet *, int,
|
|
|
|
struct tree_cache **, struct agent_options *,
|
|
|
|
int, int, int));
|
1996-02-29 18:25:51 +00:00
|
|
|
int store_options PROTO ((unsigned char *, int, struct tree_cache **,
|
1996-09-11 05:53:06 +00:00
|
|
|
unsigned char *, int, int, int, int));
|
1997-06-02 23:23:05 +00:00
|
|
|
char *pretty_print_option PROTO ((unsigned int,
|
|
|
|
unsigned char *, int, int, int));
|
1997-03-06 06:57:19 +00:00
|
|
|
void do_packet PROTO ((struct interface_info *,
|
|
|
|
unsigned char *, int,
|
1998-03-16 06:19:46 +00:00
|
|
|
unsigned int, struct iaddr, struct hardware *));
|
1998-04-19 23:21:54 +00:00
|
|
|
struct data_string dhcp_option_lookup PROTO ((struct packet *, int));
|
|
|
|
struct data_string agent_suboption_lookup PROTO ((struct packet *, int));
|
1995-11-29 07:40:04 +00:00
|
|
|
|
|
|
|
/* errwarn.c */
|
1996-08-29 09:49:53 +00:00
|
|
|
extern int warnings_occurred;
|
1996-05-17 23:29:07 +00:00
|
|
|
void error PROTO ((char *, ...));
|
1995-11-29 07:40:04 +00:00
|
|
|
int warn PROTO ((char *, ...));
|
|
|
|
int note PROTO ((char *, ...));
|
|
|
|
int debug PROTO ((char *, ...));
|
|
|
|
int parse_warn PROTO ((char *, ...));
|
|
|
|
|
|
|
|
/* dhcpd.c */
|
1996-05-17 23:29:07 +00:00
|
|
|
extern TIME cur_time;
|
1996-08-29 23:22:06 +00:00
|
|
|
extern struct group root_group;
|
1996-05-22 07:23:16 +00:00
|
|
|
|
1997-02-18 14:26:11 +00:00
|
|
|
extern u_int16_t local_port;
|
|
|
|
extern u_int16_t remote_port;
|
1996-05-17 00:28:58 +00:00
|
|
|
extern int log_priority;
|
1996-08-28 01:32:38 +00:00
|
|
|
extern int log_perror;
|
1996-02-21 15:16:18 +00:00
|
|
|
|
1996-05-22 07:23:16 +00:00
|
|
|
#ifdef USE_FALLBACK
|
|
|
|
extern struct interface_info fallback_interface;
|
|
|
|
#endif
|
|
|
|
|
1996-09-02 21:16:25 +00:00
|
|
|
extern char *path_dhcpd_conf;
|
|
|
|
extern char *path_dhcpd_db;
|
|
|
|
extern char *path_dhcpd_pid;
|
|
|
|
|
1998-03-15 20:57:28 +00:00
|
|
|
extern int dhcp_max_agent_option_packet_length;
|
|
|
|
|
1995-11-29 07:40:04 +00:00
|
|
|
int main PROTO ((int, char **, char **));
|
|
|
|
void cleanup PROTO ((void));
|
1997-03-06 18:38:59 +00:00
|
|
|
void lease_pinged PROTO ((struct iaddr, u_int8_t *, int));
|
|
|
|
void lease_ping_timeout PROTO ((void *));
|
1995-11-29 07:40:04 +00:00
|
|
|
|
|
|
|
/* conflex.c */
|
1996-08-27 09:46:28 +00:00
|
|
|
extern int lexline, lexchar;
|
1996-08-28 01:32:38 +00:00
|
|
|
extern char *token_line, *tlname;
|
|
|
|
extern char comments [4096];
|
|
|
|
extern int comment_index;
|
1997-06-02 23:23:05 +00:00
|
|
|
extern int eol_token;
|
1996-08-27 09:46:28 +00:00
|
|
|
void new_parse PROTO ((char *));
|
1995-11-29 07:40:04 +00:00
|
|
|
int next_token PROTO ((char **, FILE *));
|
|
|
|
int peek_token PROTO ((char **, FILE *));
|
|
|
|
|
|
|
|
/* confpars.c */
|
1996-08-29 09:49:53 +00:00
|
|
|
int readconf PROTO ((void));
|
1996-03-02 05:13:36 +00:00
|
|
|
void read_leases PROTO ((void));
|
1996-08-27 09:46:28 +00:00
|
|
|
int parse_statement PROTO ((FILE *,
|
1996-08-29 09:16:49 +00:00
|
|
|
struct group *, int, struct host_decl *, int));
|
1997-02-22 08:50:59 +00:00
|
|
|
void parse_allow_deny PROTO ((FILE *, struct group *, int));
|
1996-08-28 01:32:38 +00:00
|
|
|
int parse_boolean PROTO ((FILE *));
|
1996-08-27 09:46:28 +00:00
|
|
|
int parse_lbrace PROTO ((FILE *));
|
1996-08-29 09:16:49 +00:00
|
|
|
void parse_host_declaration PROTO ((FILE *, struct group *));
|
|
|
|
void parse_class_declaration PROTO ((FILE *, struct group *, int));
|
|
|
|
void parse_shared_net_declaration PROTO ((FILE *, struct group *));
|
|
|
|
void parse_subnet_declaration PROTO ((FILE *, struct shared_network *));
|
|
|
|
void parse_group_declaration PROTO ((FILE *, struct group *));
|
|
|
|
struct tree_cache *parse_fixed_addr_param PROTO ((FILE *));
|
|
|
|
void parse_option_param PROTO ((FILE *, struct group *));
|
1996-08-27 09:46:28 +00:00
|
|
|
TIME parse_timestamp PROTO ((FILE *));
|
1996-08-29 09:16:49 +00:00
|
|
|
struct lease *parse_lease_declaration PROTO ((FILE *));
|
1996-08-27 09:46:28 +00:00
|
|
|
void parse_address_range PROTO ((FILE *, struct subnet *));
|
1998-04-20 18:02:29 +00:00
|
|
|
struct match_expr *parse_boolean_expression PROTO ((FILE *, int *));
|
|
|
|
struct match_expr *parse_data_expression PROTO ((FILE *, int *));
|
|
|
|
struct match_expr *parse_numeric_expression PROTO ((FILE *, int *));
|
|
|
|
|
|
|
|
/* parse.c */
|
|
|
|
void skip_to_semi PROTO ((FILE *));
|
|
|
|
int parse_semi PROTO ((FILE *));
|
|
|
|
char *parse_string PROTO ((FILE *));
|
|
|
|
char *parse_host_name PROTO ((FILE *));
|
|
|
|
struct tree *parse_ip_addr_or_hostname PROTO ((FILE *, int));
|
|
|
|
void parse_hardware_param PROTO ((FILE *, struct hardware *));
|
|
|
|
void parse_lease_time PROTO ((FILE *, TIME *));
|
1996-08-27 09:46:28 +00:00
|
|
|
unsigned char *parse_numeric_aggregate PROTO ((FILE *,
|
1995-11-29 07:40:04 +00:00
|
|
|
unsigned char *, int *,
|
|
|
|
int, int, int));
|
|
|
|
void convert_num PROTO ((unsigned char *, char *, int, int));
|
1998-04-20 18:02:29 +00:00
|
|
|
TIME parse_date PROTO ((FILE *));
|
|
|
|
struct option *parse_option_name PROTO ((FILE *));
|
|
|
|
unsigned char *parse_cshl PROTO ((FILE *, int *));
|
1995-11-29 07:40:04 +00:00
|
|
|
|
|
|
|
/* tree.c */
|
|
|
|
pair cons PROTO ((caddr_t, pair));
|
|
|
|
struct tree_cache *tree_cache PROTO ((struct tree *));
|
|
|
|
struct tree *tree_host_lookup PROTO ((char *));
|
|
|
|
struct dns_host_entry *enter_dns_host PROTO ((char *));
|
|
|
|
struct tree *tree_const PROTO ((unsigned char *, int));
|
|
|
|
struct tree *tree_concat PROTO ((struct tree *, struct tree *));
|
|
|
|
struct tree *tree_limit PROTO ((struct tree *, int));
|
|
|
|
int tree_evaluate PROTO ((struct tree_cache *));
|
|
|
|
|
|
|
|
/* dhcp.c */
|
1997-03-06 18:38:59 +00:00
|
|
|
extern int outstanding_pings;
|
|
|
|
|
1995-11-29 07:40:04 +00:00
|
|
|
void dhcp PROTO ((struct packet *));
|
1996-02-26 01:57:06 +00:00
|
|
|
void dhcpdiscover PROTO ((struct packet *));
|
|
|
|
void dhcprequest PROTO ((struct packet *));
|
|
|
|
void dhcprelease PROTO ((struct packet *));
|
1996-02-29 18:25:51 +00:00
|
|
|
void dhcpdecline PROTO ((struct packet *));
|
|
|
|
void dhcpinform PROTO ((struct packet *));
|
1996-03-16 17:50:30 +00:00
|
|
|
void nak_lease PROTO ((struct packet *, struct iaddr *cip));
|
1998-03-16 06:19:46 +00:00
|
|
|
void ack_lease PROTO ((struct packet *, struct lease *, unsigned int, TIME));
|
1997-03-05 06:38:27 +00:00
|
|
|
void dhcp_reply PROTO ((struct lease *));
|
1997-06-08 03:55:58 +00:00
|
|
|
struct lease *find_lease PROTO ((struct packet *,
|
|
|
|
struct shared_network *, int *));
|
1996-05-23 02:31:07 +00:00
|
|
|
struct lease *mockup_lease PROTO ((struct packet *,
|
|
|
|
struct shared_network *,
|
|
|
|
struct host_decl *));
|
1995-11-29 07:40:04 +00:00
|
|
|
|
|
|
|
/* bootp.c */
|
|
|
|
void bootp PROTO ((struct packet *));
|
|
|
|
|
|
|
|
/* memory.c */
|
|
|
|
void enter_host PROTO ((struct host_decl *));
|
1996-05-22 07:23:16 +00:00
|
|
|
struct host_decl *find_hosts_by_haddr PROTO ((int, unsigned char *, int));
|
|
|
|
struct host_decl *find_hosts_by_uid PROTO ((unsigned char *, int));
|
|
|
|
struct subnet *find_host_for_network PROTO ((struct host_decl **,
|
|
|
|
struct iaddr *,
|
|
|
|
struct shared_network *));
|
1996-02-06 20:25:56 +00:00
|
|
|
void new_address_range PROTO ((struct iaddr, struct iaddr,
|
1996-05-22 07:23:16 +00:00
|
|
|
struct subnet *, int));
|
|
|
|
extern struct subnet *find_grouped_subnet PROTO ((struct shared_network *,
|
|
|
|
struct iaddr));
|
1996-05-16 07:18:45 +00:00
|
|
|
extern struct subnet *find_subnet PROTO ((struct iaddr));
|
1996-05-22 07:23:16 +00:00
|
|
|
void enter_shared_network PROTO ((struct shared_network *));
|
1996-05-16 07:18:45 +00:00
|
|
|
void enter_subnet PROTO ((struct subnet *));
|
1995-11-29 07:40:04 +00:00
|
|
|
void enter_lease PROTO ((struct lease *));
|
1996-03-02 05:13:36 +00:00
|
|
|
int supersede_lease PROTO ((struct lease *, struct lease *, int));
|
1996-02-21 12:11:09 +00:00
|
|
|
void release_lease PROTO ((struct lease *));
|
1997-03-06 18:38:59 +00:00
|
|
|
void abandon_lease PROTO ((struct lease *, char *));
|
1998-04-09 04:35:50 +00:00
|
|
|
void dissociate_lease PROTO ((struct lease *));
|
1995-11-29 07:40:04 +00:00
|
|
|
struct lease *find_lease_by_uid PROTO ((unsigned char *, int));
|
1996-02-21 12:11:09 +00:00
|
|
|
struct lease *find_lease_by_hw_addr PROTO ((unsigned char *, int));
|
1996-02-06 20:25:56 +00:00
|
|
|
struct lease *find_lease_by_ip_addr PROTO ((struct iaddr));
|
1996-08-27 09:46:28 +00:00
|
|
|
void uid_hash_add PROTO ((struct lease *));
|
|
|
|
void uid_hash_delete PROTO ((struct lease *));
|
|
|
|
void hw_hash_add PROTO ((struct lease *));
|
|
|
|
void hw_hash_delete PROTO ((struct lease *));
|
1996-02-29 18:25:51 +00:00
|
|
|
struct class *add_class PROTO ((int, char *));
|
|
|
|
struct class *find_class PROTO ((int, char *, int));
|
1996-08-27 09:46:28 +00:00
|
|
|
struct group *clone_group PROTO ((struct group *, char *));
|
1996-03-02 05:13:36 +00:00
|
|
|
void write_leases PROTO ((void));
|
1996-02-21 12:11:09 +00:00
|
|
|
void dump_subnets PROTO ((void));
|
1995-11-29 07:40:04 +00:00
|
|
|
|
|
|
|
/* alloc.c */
|
|
|
|
VOIDPTR dmalloc PROTO ((int, char *));
|
|
|
|
void dfree PROTO ((VOIDPTR, char *));
|
|
|
|
struct packet *new_packet PROTO ((char *));
|
|
|
|
struct dhcp_packet *new_dhcp_packet PROTO ((char *));
|
|
|
|
struct tree *new_tree PROTO ((char *));
|
|
|
|
struct tree_cache *new_tree_cache PROTO ((char *));
|
|
|
|
struct hash_table *new_hash_table PROTO ((int, char *));
|
|
|
|
struct hash_bucket *new_hash_bucket PROTO ((char *));
|
|
|
|
struct lease *new_lease PROTO ((char *));
|
1996-05-16 07:18:45 +00:00
|
|
|
struct lease *new_leases PROTO ((int, char *));
|
1995-11-29 07:40:04 +00:00
|
|
|
struct subnet *new_subnet PROTO ((char *));
|
1996-02-29 18:25:51 +00:00
|
|
|
struct class *new_class PROTO ((char *));
|
1996-05-22 07:23:16 +00:00
|
|
|
struct shared_network *new_shared_network PROTO ((char *));
|
1996-08-27 09:46:28 +00:00
|
|
|
struct group *new_group PROTO ((char *));
|
1997-03-06 06:57:19 +00:00
|
|
|
struct protocol *new_protocol PROTO ((char *));
|
|
|
|
struct lease_state *new_lease_state PROTO ((char *));
|
1997-06-02 23:23:05 +00:00
|
|
|
struct domain_search_list *new_domain_search_list PROTO ((char *));
|
|
|
|
struct name_server *new_name_server PROTO ((char *));
|
|
|
|
void free_name_server PROTO ((struct name_server *, char *));
|
|
|
|
void free_domain_search_list PROTO ((struct domain_search_list *, char *));
|
1997-03-06 06:57:19 +00:00
|
|
|
void free_lease_state PROTO ((struct lease_state *, char *));
|
|
|
|
void free_protocol PROTO ((struct protocol *, char *));
|
1996-08-27 09:46:28 +00:00
|
|
|
void free_group PROTO ((struct group *, char *));
|
1996-05-22 07:23:16 +00:00
|
|
|
void free_shared_network PROTO ((struct shared_network *, char *));
|
1996-02-29 18:25:51 +00:00
|
|
|
void free_class PROTO ((struct class *, char *));
|
1995-11-29 07:40:04 +00:00
|
|
|
void free_subnet PROTO ((struct subnet *, char *));
|
|
|
|
void free_lease PROTO ((struct lease *, char *));
|
|
|
|
void free_hash_bucket PROTO ((struct hash_bucket *, char *));
|
|
|
|
void free_hash_table PROTO ((struct hash_table *, char *));
|
|
|
|
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 *));
|
|
|
|
|
|
|
|
/* print.c */
|
|
|
|
char *print_hw_addr PROTO ((int, int, unsigned char *));
|
1996-02-21 12:11:09 +00:00
|
|
|
void print_lease PROTO ((struct lease *));
|
1996-02-29 18:25:51 +00:00
|
|
|
void dump_raw PROTO ((unsigned char *, int));
|
1996-05-12 23:59:45 +00:00
|
|
|
void dump_packet PROTO ((struct packet *));
|
1996-05-22 07:23:16 +00:00
|
|
|
void hash_dump PROTO ((struct hash_table *));
|
1995-11-29 07:40:04 +00:00
|
|
|
|
|
|
|
/* socket.c */
|
1996-05-22 07:23:16 +00:00
|
|
|
#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
|
|
|
|
|| defined (USE_SOCKET_FALLBACK)
|
1997-02-19 10:52:37 +00:00
|
|
|
int if_register_socket PROTO ((struct interface_info *));
|
1996-05-12 23:59:45 +00:00
|
|
|
#endif
|
|
|
|
|
1996-05-22 07:23:16 +00:00
|
|
|
#ifdef USE_SOCKET_FALLBACK
|
1997-02-19 10:52:37 +00:00
|
|
|
void if_reinitialize_fallback PROTO ((struct interface_info *));
|
|
|
|
void if_register_fallback PROTO ((struct interface_info *));
|
1997-06-08 03:18:09 +00:00
|
|
|
ssize_t send_fallback PROTO ((struct interface_info *,
|
|
|
|
struct packet *, struct dhcp_packet *, size_t,
|
|
|
|
struct in_addr,
|
|
|
|
struct sockaddr_in *, struct hardware *));
|
1997-03-06 06:57:19 +00:00
|
|
|
void fallback_discard PROTO ((struct protocol *));
|
1996-05-22 07:23:16 +00:00
|
|
|
#endif
|
|
|
|
|
1996-04-11 06:47:03 +00:00
|
|
|
#ifdef USE_SOCKET_SEND
|
1997-02-19 10:52:37 +00:00
|
|
|
void if_reinitialize_send PROTO ((struct interface_info *));
|
|
|
|
void if_register_send PROTO ((struct interface_info *));
|
1997-06-08 03:18:09 +00:00
|
|
|
ssize_t send_packet PROTO ((struct interface_info *,
|
|
|
|
struct packet *, struct dhcp_packet *, size_t,
|
|
|
|
struct in_addr,
|
|
|
|
struct sockaddr_in *, struct hardware *));
|
1996-04-11 06:47:03 +00:00
|
|
|
#endif
|
|
|
|
#ifdef USE_SOCKET_RECEIVE
|
1997-02-19 10:52:37 +00:00
|
|
|
void if_reinitialize_receive PROTO ((struct interface_info *));
|
|
|
|
void if_register_receive PROTO ((struct interface_info *));
|
1997-06-08 03:18:09 +00:00
|
|
|
ssize_t receive_packet PROTO ((struct interface_info *,
|
|
|
|
unsigned char *, size_t,
|
|
|
|
struct sockaddr_in *, struct hardware *));
|
1996-04-11 06:47:03 +00:00
|
|
|
#endif
|
1997-01-02 12:00:19 +00:00
|
|
|
#if defined (USE_SOCKET_SEND) && !defined (USE_SOCKET_FALLBACK)
|
|
|
|
void if_enable PROTO ((struct interface_info *));
|
|
|
|
#endif
|
1996-04-11 06:47:03 +00:00
|
|
|
|
|
|
|
/* bpf.c */
|
1996-05-12 23:59:45 +00:00
|
|
|
#if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE)
|
1997-02-19 10:52:37 +00:00
|
|
|
int if_register_bpf PROTO ( (struct interface_info *));
|
1996-05-12 23:59:45 +00:00
|
|
|
#endif
|
1996-04-11 06:47:03 +00:00
|
|
|
#ifdef USE_BPF_SEND
|
1997-02-19 10:52:37 +00:00
|
|
|
void if_reinitialize_send PROTO ((struct interface_info *));
|
|
|
|
void if_register_send PROTO ((struct interface_info *));
|
1997-06-08 03:18:09 +00:00
|
|
|
ssize_t send_packet PROTO ((struct interface_info *,
|
|
|
|
struct packet *, struct dhcp_packet *, size_t,
|
|
|
|
struct in_addr,
|
|
|
|
struct sockaddr_in *, struct hardware *));
|
1996-04-11 06:47:03 +00:00
|
|
|
#endif
|
|
|
|
#ifdef USE_BPF_RECEIVE
|
1997-02-19 10:52:37 +00:00
|
|
|
void if_reinitialize_receive PROTO ((struct interface_info *));
|
|
|
|
void if_register_receive PROTO ((struct interface_info *));
|
1997-06-08 03:18:09 +00:00
|
|
|
ssize_t receive_packet PROTO ((struct interface_info *,
|
|
|
|
unsigned char *, size_t,
|
|
|
|
struct sockaddr_in *, struct hardware *));
|
1996-04-11 06:47:03 +00:00
|
|
|
#endif
|
1997-01-02 12:00:19 +00:00
|
|
|
#if defined (USE_BPF_SEND)
|
|
|
|
void if_enable PROTO ((struct interface_info *));
|
|
|
|
#endif
|
1996-04-11 06:47:03 +00:00
|
|
|
|
|
|
|
/* nit.c */
|
1997-02-19 10:52:37 +00:00
|
|
|
#if defined (USE_NIT_SEND) || defined (USE_NIT_RECEIVE)
|
|
|
|
int if_register_nit PROTO ( (struct interface_info *));
|
|
|
|
#endif
|
|
|
|
|
1996-04-11 06:47:03 +00:00
|
|
|
#ifdef USE_NIT_SEND
|
1997-02-19 10:52:37 +00:00
|
|
|
void if_reinitialize_send PROTO ((struct interface_info *));
|
|
|
|
void if_register_send PROTO ((struct interface_info *));
|
1997-06-08 03:18:09 +00:00
|
|
|
ssize_t send_packet PROTO ((struct interface_info *,
|
|
|
|
struct packet *, struct dhcp_packet *, size_t,
|
|
|
|
struct in_addr,
|
|
|
|
struct sockaddr_in *, struct hardware *));
|
1996-04-11 06:47:03 +00:00
|
|
|
#endif
|
|
|
|
#ifdef USE_NIT_RECEIVE
|
1997-02-19 10:52:37 +00:00
|
|
|
void if_reinitialize_receive PROTO ((struct interface_info *));
|
|
|
|
void if_register_receive PROTO ((struct interface_info *));
|
1997-06-08 03:18:09 +00:00
|
|
|
ssize_t receive_packet PROTO ((struct interface_info *,
|
|
|
|
unsigned char *, size_t,
|
|
|
|
struct sockaddr_in *, struct hardware *));
|
1996-04-11 06:47:03 +00:00
|
|
|
#endif
|
1998-01-12 01:06:16 +00:00
|
|
|
#if defined (USE_NIT_SEND)
|
1997-01-02 12:00:19 +00:00
|
|
|
void if_enable PROTO ((struct interface_info *));
|
|
|
|
#endif
|
1996-04-11 06:47:03 +00:00
|
|
|
|
1998-01-12 01:06:16 +00:00
|
|
|
/* dlpi.c */
|
1998-03-15 20:57:28 +00:00
|
|
|
#if defined (USE_DLPI_SEND) || defined (USE_DLPI_RECEIVE)
|
|
|
|
int if_register_dlpi PROTO ( (struct interface_info *));
|
|
|
|
#endif
|
|
|
|
|
1998-01-12 01:06:16 +00:00
|
|
|
#ifdef USE_DLPI_SEND
|
1998-03-15 20:57:28 +00:00
|
|
|
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 *));
|
1998-01-12 01:06:16 +00:00
|
|
|
#endif
|
|
|
|
#ifdef USE_DLPI_RECEIVE
|
1998-03-15 20:57:28 +00:00
|
|
|
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 *));
|
1998-01-12 01:06:16 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1996-04-11 06:47:03 +00:00
|
|
|
/* raw.c */
|
|
|
|
#ifdef USE_RAW_SEND
|
1997-02-19 10:52:37 +00:00
|
|
|
void if_reinitialize_send PROTO ((struct interface_info *));
|
|
|
|
void if_register_send PROTO ((struct interface_info *));
|
1997-06-08 03:18:09 +00:00
|
|
|
ssize_t send_packet PROTO ((struct interface_info *,
|
|
|
|
struct packet *, struct dhcp_packet *, size_t,
|
|
|
|
struct in_addr,
|
|
|
|
struct sockaddr_in *, struct hardware *));
|
1996-04-11 06:47:03 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* dispatch.c */
|
1997-02-19 10:52:37 +00:00
|
|
|
extern struct interface_info *interfaces, *dummy_interfaces;
|
1997-03-06 06:57:19 +00:00
|
|
|
extern struct protocol *protocols;
|
1997-10-20 21:49:23 +00:00
|
|
|
extern int quiet_interface_discovery;
|
1997-03-06 06:57:19 +00:00
|
|
|
extern void (*bootp_packet_handler) PROTO ((struct interface_info *,
|
1998-03-16 06:19:46 +00:00
|
|
|
unsigned char *, int, unsigned int,
|
1997-03-06 06:57:19 +00:00
|
|
|
struct iaddr, struct hardware *));
|
1997-02-18 14:26:11 +00:00
|
|
|
extern struct timeout *timeouts;
|
1996-09-11 20:27:07 +00:00
|
|
|
void discover_interfaces PROTO ((int));
|
1997-02-19 10:52:37 +00:00
|
|
|
void reinitialize_interfaces PROTO ((void));
|
1997-03-06 06:57:19 +00:00
|
|
|
void dispatch PROTO ((void));
|
1996-05-22 09:30:47 +00:00
|
|
|
int locate_network PROTO ((struct packet *));
|
1997-03-06 06:57:19 +00:00
|
|
|
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 *));
|
1998-04-09 04:35:50 +00:00
|
|
|
struct protocol *add_protocol PROTO ((char *, int,
|
|
|
|
void (*) PROTO ((struct protocol *)),
|
|
|
|
void *));
|
1995-11-29 07:40:04 +00:00
|
|
|
|
1997-09-16 18:16:55 +00:00
|
|
|
void remove_protocol PROTO ((struct protocol *));
|
|
|
|
|
1995-11-29 07:40:04 +00:00
|
|
|
/* hash.c */
|
|
|
|
struct hash_table *new_hash PROTO ((void));
|
1998-03-16 06:19:46 +00:00
|
|
|
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));
|
1995-11-29 07:40:04 +00:00
|
|
|
|
|
|
|
/* tables.c */
|
1998-04-19 23:21:54 +00:00
|
|
|
extern struct universe dhcp_universe;
|
1995-11-29 07:40:04 +00:00
|
|
|
extern struct option dhcp_options [256];
|
1998-04-19 23:21:54 +00:00
|
|
|
extern struct universe agent_universe;
|
|
|
|
extern struct option agent_options [256];
|
1995-11-29 07:40:04 +00:00
|
|
|
extern unsigned char dhcp_option_default_priority_list [];
|
|
|
|
extern int sizeof_dhcp_option_default_priority_list;
|
1996-03-02 05:13:36 +00:00
|
|
|
extern char *hardware_types [256];
|
1995-11-29 07:40:04 +00:00
|
|
|
extern struct hash_table universe_hash;
|
|
|
|
void initialize_universes PROTO ((void));
|
|
|
|
|
1996-02-06 20:25:56 +00:00
|
|
|
/* convert.c */
|
1996-05-20 00:08:47 +00:00
|
|
|
u_int32_t getULong PROTO ((unsigned char *));
|
|
|
|
int32_t getLong PROTO ((unsigned char *));
|
|
|
|
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));
|
1998-03-16 06:19:46 +00:00
|
|
|
void putUShort PROTO ((unsigned char *, u_int32_t));
|
|
|
|
void putShort PROTO ((unsigned char *, int32_t));
|
1996-02-06 20:25:56 +00:00
|
|
|
|
|
|
|
/* inet.c */
|
1996-03-02 05:13:36 +00:00
|
|
|
struct iaddr subnet_number PROTO ((struct iaddr, struct iaddr));
|
1996-05-17 01:08:52 +00:00
|
|
|
struct iaddr ip_addr PROTO ((struct iaddr, struct iaddr, u_int32_t));
|
1997-11-22 00:46:40 +00:00
|
|
|
struct iaddr broadcast_addr PROTO ((struct iaddr, struct iaddr));
|
1996-05-17 01:08:52 +00:00
|
|
|
u_int32_t host_addr PROTO ((struct iaddr, struct iaddr));
|
1996-03-02 05:13:36 +00:00
|
|
|
int addr_eq PROTO ((struct iaddr, struct iaddr));
|
|
|
|
char *piaddr PROTO ((struct iaddr));
|
1996-02-07 22:43:54 +00:00
|
|
|
|
|
|
|
/* dhclient.c */
|
1997-02-18 14:26:11 +00:00
|
|
|
extern char *path_dhclient_conf;
|
|
|
|
extern char *path_dhclient_db;
|
|
|
|
extern char *path_dhclient_pid;
|
1997-09-16 18:16:55 +00:00
|
|
|
extern int interfaces_requested;
|
1997-02-18 14:26:11 +00:00
|
|
|
|
|
|
|
extern struct client_config top_level_config;
|
|
|
|
|
1996-05-22 09:30:47 +00:00
|
|
|
void dhcpoffer PROTO ((struct packet *));
|
|
|
|
void dhcpack PROTO ((struct packet *));
|
|
|
|
void dhcpnak PROTO ((struct packet *));
|
1997-02-18 14:26:11 +00:00
|
|
|
|
1997-03-06 06:57:19 +00:00
|
|
|
void send_discover PROTO ((void *));
|
|
|
|
void send_request PROTO ((void *));
|
|
|
|
void send_release PROTO ((void *));
|
|
|
|
void send_decline PROTO ((void *));
|
1997-02-18 14:26:11 +00:00
|
|
|
|
1997-03-06 06:57:19 +00:00
|
|
|
void state_reboot PROTO ((void *));
|
|
|
|
void state_init PROTO ((void *));
|
|
|
|
void state_selecting PROTO ((void *));
|
|
|
|
void state_requesting PROTO ((void *));
|
|
|
|
void state_bound PROTO ((void *));
|
|
|
|
void state_panic PROTO ((void *));
|
1997-02-18 14:26:11 +00:00
|
|
|
|
1997-06-02 23:23:05 +00:00
|
|
|
void bind_lease PROTO ((struct interface_info *));
|
|
|
|
|
1997-02-18 14:26:11 +00:00
|
|
|
void make_discover PROTO ((struct interface_info *, struct client_lease *));
|
|
|
|
void make_request PROTO ((struct interface_info *, struct client_lease *));
|
|
|
|
void make_decline PROTO ((struct interface_info *, struct client_lease *));
|
|
|
|
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 *,
|
1998-03-15 20:57:28 +00:00
|
|
|
struct client_lease *, int));
|
1997-02-18 14:26:11 +00:00
|
|
|
char *dhcp_option_ev_name PROTO ((struct option *));
|
|
|
|
|
1997-02-22 08:50:59 +00:00
|
|
|
void script_init PROTO ((struct interface_info *, char *,
|
|
|
|
struct string_list *));
|
1997-02-18 14:26:11 +00:00
|
|
|
void script_write_params PROTO ((struct interface_info *,
|
|
|
|
char *, struct client_lease *));
|
|
|
|
int script_go PROTO ((struct interface_info *));
|
|
|
|
|
|
|
|
struct client_lease *packet_to_lease PROTO ((struct packet *));
|
1997-02-19 10:52:37 +00:00
|
|
|
void go_daemon PROTO ((void));
|
1997-09-16 18:16:55 +00:00
|
|
|
void write_client_pid_file PROTO ((void));
|
1997-10-20 22:11:44 +00:00
|
|
|
void status_message PROTO ((struct sysconf_header *, void *));
|
1997-09-16 18:16:55 +00:00
|
|
|
void client_location_changed PROTO ((void));
|
1996-02-07 22:43:54 +00:00
|
|
|
|
1996-03-02 05:13:36 +00:00
|
|
|
/* db.c */
|
|
|
|
int write_lease PROTO ((struct lease *));
|
|
|
|
int commit_leases PROTO ((void));
|
|
|
|
void db_startup PROTO ((void));
|
|
|
|
void new_lease_file PROTO ((void));
|
1996-05-12 23:59:45 +00:00
|
|
|
|
|
|
|
/* packet.c */
|
1997-03-06 18:38:59 +00:00
|
|
|
u_int32_t checksum PROTO ((unsigned char *, int, u_int32_t));
|
|
|
|
u_int32_t wrapsum PROTO ((u_int32_t));
|
1996-05-12 23:59:45 +00:00
|
|
|
void assemble_hw_header PROTO ((struct interface_info *, unsigned char *,
|
|
|
|
int *, struct hardware *));
|
|
|
|
void assemble_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
|
1998-03-16 06:19:46 +00:00
|
|
|
int *, u_int32_t, u_int32_t, u_int32_t,
|
1996-05-12 23:59:45 +00:00
|
|
|
unsigned char *, int));
|
1997-06-08 03:18:09 +00:00
|
|
|
ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *,
|
|
|
|
int, struct hardware *));
|
|
|
|
ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
|
|
|
|
int, struct sockaddr_in *,
|
|
|
|
unsigned char *, int));
|
1996-08-27 09:46:28 +00:00
|
|
|
|
|
|
|
/* dhxpxlt.c */
|
|
|
|
void convert_statement PROTO ((FILE *));
|
|
|
|
void convert_host_statement PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_host_name PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_class_statement PROTO ((FILE *, jrefproto, int));
|
|
|
|
void convert_class_decl PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_lease_time PROTO ((FILE *, jrefproto, char *));
|
|
|
|
void convert_shared_net_statement PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_subnet_statement PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_subnet_decl PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_host_decl PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_hardware_decl PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_hardware_addr PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_filename_decl PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_servername_decl PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_ip_addr_or_hostname PROTO ((FILE *, jrefproto, int));
|
|
|
|
void convert_fixed_addr_decl PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_option_decl PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_timestamp PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_lease_statement PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_address_range PROTO ((FILE *, jrefproto));
|
|
|
|
void convert_date PROTO ((FILE *, jrefproto, char *));
|
|
|
|
void convert_numeric_aggregate PROTO ((FILE *, jrefproto, int, int, int, int));
|
|
|
|
void indent PROTO ((int));
|
1997-01-02 12:00:19 +00:00
|
|
|
|
|
|
|
/* route.c */
|
|
|
|
void add_route_direct PROTO ((struct interface_info *, struct in_addr));
|
|
|
|
void add_route_net PROTO ((struct interface_info *, struct in_addr,
|
|
|
|
struct in_addr));
|
|
|
|
void add_route_default_gateway PROTO ((struct interface_info *,
|
|
|
|
struct in_addr));
|
|
|
|
void remove_routes PROTO ((struct in_addr));
|
|
|
|
void remove_if_route PROTO ((struct interface_info *, struct in_addr));
|
|
|
|
void remove_all_if_routes PROTO ((struct interface_info *));
|
|
|
|
void set_netmask PROTO ((struct interface_info *, struct in_addr));
|
|
|
|
void set_broadcast_addr PROTO ((struct interface_info *, struct in_addr));
|
|
|
|
void set_ip_address PROTO ((struct interface_info *, struct in_addr));
|
1997-02-18 14:26:11 +00:00
|
|
|
|
|
|
|
/* clparse.c */
|
|
|
|
int read_client_conf PROTO ((void));
|
|
|
|
void read_client_leases PROTO ((void));
|
|
|
|
void parse_client_statement PROTO ((FILE *, struct interface_info *,
|
|
|
|
struct client_config *));
|
1997-02-19 10:52:37 +00:00
|
|
|
int parse_X PROTO ((FILE *, u_int8_t *, int));
|
1997-02-18 14:26:11 +00:00
|
|
|
int parse_option_list PROTO ((FILE *, u_int8_t *));
|
|
|
|
void parse_interface_declaration PROTO ((FILE *, struct client_config *));
|
1997-02-19 10:52:37 +00:00
|
|
|
struct interface_info *interface_or_dummy PROTO ((char *));
|
|
|
|
void make_client_state PROTO ((struct interface_info *));
|
|
|
|
void make_client_config PROTO ((struct interface_info *,
|
|
|
|
struct client_config *));
|
|
|
|
void parse_client_lease_statement PROTO ((FILE *, int));
|
1997-02-18 14:26:11 +00:00
|
|
|
void parse_client_lease_declaration PROTO ((FILE *, struct client_lease *,
|
|
|
|
struct interface_info **));
|
1997-06-02 23:23:05 +00:00
|
|
|
struct option *parse_option_decl PROTO ((FILE *, struct option_data *));
|
1997-02-22 08:50:59 +00:00
|
|
|
void parse_string_list PROTO ((FILE *, struct string_list **, int));
|
1997-06-02 23:23:05 +00:00
|
|
|
int parse_ip_addr PROTO ((FILE *, struct iaddr *));
|
|
|
|
void parse_reject_statement PROTO ((FILE *, struct client_config *));
|
1997-02-22 08:50:59 +00:00
|
|
|
|
|
|
|
/* dhcrelay.c */
|
1997-03-06 06:57:19 +00:00
|
|
|
void relay PROTO ((struct interface_info *, u_int8_t *, int,
|
1998-03-16 06:19:46 +00:00
|
|
|
unsigned int, struct iaddr, struct hardware *));
|
1997-03-06 06:57:19 +00:00
|
|
|
|
|
|
|
/* icmp.c */
|
|
|
|
void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr,
|
1997-03-06 07:28:54 +00:00
|
|
|
u_int8_t *, int))));
|
1997-03-06 06:57:19 +00:00
|
|
|
int icmp_echorequest PROTO ((struct iaddr *));
|
|
|
|
void icmp_echoreply PROTO ((struct protocol *));
|
1997-03-29 01:26:56 +00:00
|
|
|
|
|
|
|
/* dns.c */
|
|
|
|
void dns_startup PROTO ((void));
|
1998-03-15 20:57:28 +00:00
|
|
|
struct dns_query *find_dns_query PROTO ((struct dns_question *, int));
|
|
|
|
void destroy_dns_query PROTO ((struct dns_query *));
|
1998-01-12 01:06:16 +00:00
|
|
|
struct dns_query *ns_inaddr_lookup PROTO ((struct iaddr, struct dns_wakeup *));
|
1998-03-15 20:57:28 +00:00
|
|
|
struct dns_query *ns_query PROTO ((struct dns_question *,
|
|
|
|
unsigned char *, int, struct dns_wakeup *));
|
1998-01-12 01:06:16 +00:00
|
|
|
void dns_timeout PROTO ((void *));
|
1997-06-02 23:23:05 +00:00
|
|
|
void dns_packet PROTO ((struct protocol *));
|
|
|
|
|
|
|
|
/* resolv.c */
|
|
|
|
extern char path_resolv_conf [];
|
|
|
|
struct name_server *name_servers;
|
|
|
|
struct domain_search_list *domains;
|
|
|
|
|
|
|
|
void read_resolv_conf PROTO ((TIME));
|
1998-01-12 01:06:16 +00:00
|
|
|
struct name_server *first_name_server PROTO ((void));
|
1997-03-29 10:38:08 +00:00
|
|
|
|
|
|
|
/* inet_addr.c */
|
|
|
|
#ifdef NEED_INET_ATON
|
|
|
|
int inet_aton PROTO ((char *, struct in_addr *));
|
|
|
|
#endif
|
1997-09-16 18:16:55 +00:00
|
|
|
|
1997-10-20 22:11:44 +00:00
|
|
|
/* sysconf.c */
|
|
|
|
void sysconf_startup PROTO ((void (*) (struct sysconf_header *, void *)));
|
|
|
|
void sysconf_restart PROTO ((void *));
|
|
|
|
void sysconf_message PROTO ((struct protocol *proto));
|
1998-04-09 04:35:50 +00:00
|
|
|
|
|
|
|
/* interact.c */
|
|
|
|
void interact_startup PROTO ((void));
|
|
|
|
void new_interact_connection PROTO ((struct protocol *));
|
|
|
|
void interact_client_input PROTO ((struct protocol *));
|
|
|
|
int interact_client_write PROTO ((struct interact_client *, char *, int));
|
|
|
|
|
|
|
|
/* dhcpdi.c */
|
|
|
|
extern struct interact_actions top_level_actions;
|
1998-04-19 23:21:54 +00:00
|
|
|
|
|
|
|
/* class.c */
|
|
|
|
struct class unknown_class;
|
|
|
|
struct class known_class;
|
|
|
|
struct collection default_collection;
|
1998-04-20 18:02:29 +00:00
|
|
|
struct collection *collections;
|
1998-04-19 23:21:54 +00:00
|
|
|
struct classification_rule *default_classification_rules;
|
|
|
|
struct named_hash *named_hashes;
|
|
|
|
struct named_hash *known_hardware_hash;
|
|
|
|
|
|
|
|
void classification_setup PROTO ((void));
|
|
|
|
void classify_client PROTO ((struct packet *));
|
|
|
|
int run_classification_ruleset PROTO ((struct packet *,
|
|
|
|
struct classification_rule *));
|
|
|
|
int evaluate_match_expression PROTO ((struct packet *, struct match_expr *));
|
|
|
|
struct data_string evaluate_data_expression PROTO ((struct packet *,
|
|
|
|
struct match_expr *));
|
|
|
|
unsigned long evaluate_numeric_expression PROTO ((struct packet *,
|
|
|
|
struct match_expr *));
|
|
|
|
int check_collection PROTO ((struct packet *, struct collection *));
|
|
|
|
void classify PROTO ((struct packet *, struct class *));
|