#include "dhcpd.h"
#include <isc/util.h>
#include <isc/file.h>
#include <dns/result.h>
#include <syslog.h>
#include <signal.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <limits.h>
Go to the source code of this file.
Macros | |
#define | ASSERT_STATE(state_is, state_shouldbe) |
#define | DHCLIENT_USAGE0 |
#define | DHCLIENT_USAGEC |
#define | DHCLIENT_USAGEH "{--version|--help|-h}" |
Functions | |
int | asprintf (char **strp, const char *fmt,...) |
void | run_stateless (int exit_mode, u_int16_t port) |
void | initialize_client_option_spaces () |
int | main (int argc, char **argv) |
isc_result_t | find_class (struct class **c, const char *s, const char *file, int line) |
int | check_collection (struct packet *packet, struct lease *lease, struct collection *collection) |
void | classify (struct packet *packet, struct class *class) |
void | unbill_class (struct lease *lease) |
int | find_subnet (struct subnet **sp, struct iaddr addr, const char *file, int line) |
void | state_reboot (void *cpp) |
void | state_init (void *cpp) |
uint32_t | check_v6only (struct packet *packet, struct client_state *client) |
void | finish_v6only (void *cpp) |
void | start_v6only (struct client_state *client, uint32_t v6only_wait) |
void | state_selecting (void *cpp) |
void | dhcpack (struct packet *packet) |
void | bind_lease (struct client_state *client) |
void | state_bound (void *cpp) |
void | state_stop (void *cpp) |
int | commit_leases () |
int | write_lease (struct lease *lease) |
int | write_host (struct host_decl *host) |
void | db_startup (int testp) |
void | bootp (struct packet *packet) |
void | dhcp (struct packet *packet) |
void | dhcpoffer (struct packet *packet) |
struct client_lease * | packet_to_lease (struct packet *packet, struct client_state *client) |
void | dhcpnak (struct packet *packet) |
void | send_discover (void *cpp) |
void | discard_duplicate (struct client_lease **lease_list, struct client_lease *lease) |
void | state_panic (void *cpp) |
void | send_request (void *cpp) |
void | send_decline (void *cpp) |
void | send_release (void *cpp) |
void | make_client_options (struct client_state *client, struct client_lease *lease, u_int8_t *type, struct option_cache *sid, struct iaddr *rip, struct option **prl, struct option_state **op) |
void | make_discover (struct client_state *client, struct client_lease *lease) |
void | make_request (struct client_state *client, struct client_lease *lease) |
void | make_decline (struct client_state *client, struct client_lease *lease) |
void | make_release (struct client_state *client, struct client_lease *lease) |
void | destroy_client_lease (struct client_lease *lease) |
void | rewrite_client_leases () |
void | write_lease_option (struct option_cache *oc, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *u, void *stuff) |
int | unhexchar (char c) |
isc_result_t | read_uuid (u_int8_t *uuid) |
isc_result_t | form_duid (struct data_string *duid, const char *file, int line) |
isc_result_t | write_client6_lease (struct client_state *client, struct dhc6_lease *lease, int rewrite, int sync) |
int | write_client_lease (struct client_state *client, struct client_lease *lease, int rewrite, int makesure) |
void | script_init (struct client_state *client, const char *reason, struct string_list *medium) |
Initializes basic variables for a script. | |
void | client_option_envadd (struct option_cache *oc, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *u, void *stuff) |
void | script_write_params (struct client_state *client, const char *prefix, struct client_lease *lease) |
Adds parameters to environment variables for a script. | |
void | script_write_requested (struct client_state *client) |
Write out the environent variable the client requested. Write out the environment variables for the objects that the client requested. If the object was requested the variable will be: requested_<option_name>=1 If it wasn't requested there won't be a variable. | |
int | script_go (struct client_state *client) |
Calls external script. | |
void | client_envadd (struct client_state *client, const char *prefix, const char *name, const char *fmt,...) |
int | dhcp_option_ev_name (char *buf, size_t buflen, struct option *option) |
void | finish (char ret) |
void | detach () |
void | write_client_pid_file () |
void | client_location_changed () |
void | do_release (struct client_state *client) |
int | dhclient_interface_shutdown_hook (struct interface_info *interface) |
int | dhclient_interface_discovery_hook (struct interface_info *tmp) |
isc_result_t | dhclient_interface_startup_hook (struct interface_info *interface) |
int | parse_agent_information_option (struct packet *packet, int len, u_int8_t *data) |
unsigned | cons_agent_information_options (struct option_state *cfg_options, struct dhcp_packet *outpacket, unsigned agentix, unsigned length) |
isc_result_t | dhcp_set_control_state (control_object_state_t oldstate, control_object_state_t newstate) |
void | dhcpv4_client_assignments (void) |
#define ASSERT_STATE | ( | state_is, | |
state_shouldbe ) |
Definition at line 87 of file dhclient.c.
#define DHCLIENT_USAGE0 |
Definition at line 197 of file dhclient.c.
#define DHCLIENT_USAGEC |
Definition at line 202 of file dhclient.c.
#define DHCLIENT_USAGEH "{--version|--help|-h}" |
Definition at line 212 of file dhclient.c.
|
extern |
void bind_lease | ( | struct client_state * | client | ) |
Definition at line 2071 of file dhclient.c.
void bootp | ( | struct packet * | packet | ) |
Definition at line 2256 of file dhclient.c.
int check_collection | ( | struct packet * | packet, |
struct lease * | lease, | ||
struct collection * | collection ) |
Definition at line 1548 of file dhclient.c.
uint32_t check_v6only | ( | struct packet * | packet, |
struct client_state * | client ) |
Definition at line 1703 of file dhclient.c.
Definition at line 1556 of file dhclient.c.
void client_envadd | ( | struct client_state * | client, |
const char * | prefix, | ||
const char * | name, | ||
const char * | fmt, | ||
... ) |
Definition at line 5144 of file dhclient.c.
void client_location_changed | ( | void | ) |
Definition at line 5302 of file dhclient.c.
void client_option_envadd | ( | struct option_cache * | oc, |
struct packet * | packet, | ||
struct lease * | lease, | ||
struct client_state * | client_state, | ||
struct option_state * | in_options, | ||
struct option_state * | cfg_options, | ||
struct binding_scope ** | scope, | ||
struct universe * | u, | ||
void * | stuff ) |
Definition at line 4844 of file dhclient.c.
int commit_leases | ( | void | ) |
Definition at line 2234 of file dhclient.c.
unsigned cons_agent_information_options | ( | struct option_state * | cfg_options, |
struct dhcp_packet * | outpacket, | ||
unsigned | agentix, | ||
unsigned | length ) |
Definition at line 5528 of file dhclient.c.
void db_startup | ( | int | testp | ) |
Definition at line 2251 of file dhclient.c.
void destroy_client_lease | ( | struct client_lease * | lease | ) |
Definition at line 4181 of file dhclient.c.
void detach | ( | void | ) |
Definition at line 5233 of file dhclient.c.
int dhclient_interface_discovery_hook | ( | struct interface_info * | tmp | ) |
Definition at line 5423 of file dhclient.c.
int dhclient_interface_shutdown_hook | ( | struct interface_info * | interface | ) |
Definition at line 5416 of file dhclient.c.
isc_result_t dhclient_interface_startup_hook | ( | struct interface_info * | interface | ) |
Definition at line 5466 of file dhclient.c.
void dhcp | ( | struct packet * | packet | ) |
Definition at line 2289 of file dhclient.c.
Definition at line 5182 of file dhclient.c.
isc_result_t dhcp_set_control_state | ( | control_object_state_t | oldstate, |
control_object_state_t | newstate ) |
Definition at line 5616 of file dhclient.c.
void dhcpack | ( | struct packet * | packet | ) |
Definition at line 1888 of file dhclient.c.
void dhcpnak | ( | struct packet * | packet | ) |
Definition at line 2848 of file dhclient.c.
void dhcpoffer | ( | struct packet * | packet | ) |
Definition at line 2576 of file dhclient.c.
void dhcpv4_client_assignments | ( | void | ) |
Definition at line 6012 of file dhclient.c.
void discard_duplicate | ( | struct client_lease ** | lease_list, |
struct client_lease * | lease ) |
Definition at line 3065 of file dhclient.c.
void do_release | ( | struct client_state * | client | ) |
Definition at line 5337 of file dhclient.c.
Definition at line 1542 of file dhclient.c.
Definition at line 1567 of file dhclient.c.
void finish | ( | char | ret | ) |
Definition at line 5222 of file dhclient.c.
void finish_v6only | ( | void * | cpp | ) |
Definition at line 1755 of file dhclient.c.
isc_result_t form_duid | ( | struct data_string * | duid, |
const char * | file, | ||
int | line ) |
Definition at line 4381 of file dhclient.c.
|
extern |
Definition at line 39 of file client_tables.c.
Definition at line 241 of file dhclient.c.
void make_client_options | ( | struct client_state * | client, |
struct client_lease * | lease, | ||
u_int8_t * | type, | ||
struct option_cache * | sid, | ||
struct iaddr * | rip, | ||
struct option ** | prl, | ||
struct option_state ** | op ) |
Definition at line 3759 of file dhclient.c.
void make_decline | ( | struct client_state * | client, |
struct client_lease * | lease ) |
Definition at line 4064 of file dhclient.c.
void make_discover | ( | struct client_state * | client, |
struct client_lease * | lease ) |
Definition at line 3909 of file dhclient.c.
void make_release | ( | struct client_state * | client, |
struct client_lease * | lease ) |
Definition at line 4124 of file dhclient.c.
void make_request | ( | struct client_state * | client, |
struct client_lease * | lease ) |
Definition at line 3974 of file dhclient.c.
struct client_lease * packet_to_lease | ( | struct packet * | packet, |
struct client_state * | client ) |
Definition at line 2725 of file dhclient.c.
Definition at line 5518 of file dhclient.c.
isc_result_t read_uuid | ( | u_int8_t * | uuid | ) |
Definition at line 4328 of file dhclient.c.
void rewrite_client_leases | ( | void | ) |
Definition at line 4195 of file dhclient.c.
void run_stateless | ( | int | exit_mode, |
u_int16_t | port ) |
Definition at line 1425 of file dhclient.c.
int script_go | ( | struct client_state * | client | ) |
Calls external script.
External script is specified either using -sf command line or script parameter in the configuration file.
client | specifies client information (environment variables, and other parameters will be extracted and passed to the script. |
Definition at line 5058 of file dhclient.c.
void script_init | ( | struct client_state * | client, |
const char * | reason, | ||
struct string_list * | medium ) |
Initializes basic variables for a script.
This function is called as an initial preparation for calling a script. It sets up a number of common env. variables that will be passed to the script. For actual script calling, see script_go .
client | variables will be stored here (if null, the whole function is no-op) |
reason | specified the reason for calling a script (must be non-null) |
medium | if specified, defines medium type (may be null) |
Definition at line 4811 of file dhclient.c.
void script_write_params | ( | struct client_state * | client, |
const char * | prefix, | ||
struct client_lease * | lease ) |
Adds parameters to environment variables for a script.
This function add details of specified lease to a list of env. variables to be passed to a script. The lease details will be prepended with specified prefix (e.g. "old_") and added to the list stored in client. Following variables may be set:
client | env. variables will be stored here |
prefix | textual prefix to be added to each variable (e.g. "old_") |
lease | lease details will be extracted from here |
Definition at line 4905 of file dhclient.c.
void script_write_requested | ( | struct client_state * | client | ) |
Write out the environent variable the client requested. Write out the environment variables for the objects that the client requested. If the object was requested the variable will be: requested_<option_name>=1 If it wasn't requested there won't be a variable.
client | client structure |
Definition at line 5028 of file dhclient.c.
void send_decline | ( | void * | cpp | ) |
Definition at line 3477 of file dhclient.c.
void send_discover | ( | void * | cpp | ) |
Definition at line 2927 of file dhclient.c.
void send_release | ( | void * | cpp | ) |
Definition at line 3519 of file dhclient.c.
void send_request | ( | void * | cpp | ) |
Definition at line 3265 of file dhclient.c.
void start_v6only | ( | struct client_state * | client, |
uint32_t | v6only_wait ) |
Definition at line 1769 of file dhclient.c.
void state_bound | ( | void * | cpp | ) |
Definition at line 2167 of file dhclient.c.
void state_init | ( | void * | cpp | ) |
Definition at line 1678 of file dhclient.c.
void state_panic | ( | void * | cpp | ) |
Definition at line 3150 of file dhclient.c.
void state_reboot | ( | void * | cpp | ) |
Definition at line 1625 of file dhclient.c.
void state_selecting | ( | void * | cpp | ) |
Definition at line 1803 of file dhclient.c.
void state_stop | ( | void * | cpp | ) |
Definition at line 2209 of file dhclient.c.
void unbill_class | ( | struct lease * | lease | ) |
Definition at line 1562 of file dhclient.c.
int unhexchar | ( | char | c | ) |
Definition at line 4313 of file dhclient.c.
isc_result_t write_client6_lease | ( | struct client_state * | client, |
struct dhc6_lease * | lease, | ||
int | rewrite, | ||
int | sync ) |
Definition at line 4501 of file dhclient.c.
int write_client_lease | ( | struct client_state * | client, |
struct client_lease * | lease, | ||
int | rewrite, | ||
int | makesure ) |
Definition at line 4655 of file dhclient.c.
void write_client_pid_file | ( | void | ) |
Definition at line 5275 of file dhclient.c.
Definition at line 2245 of file dhclient.c.
Definition at line 2239 of file dhclient.c.
void write_lease_option | ( | struct option_cache * | oc, |
struct packet * | packet, | ||
struct lease * | lease, | ||
struct client_state * | client_state, | ||
struct option_state * | in_options, | ||
struct option_state * | cfg_options, | ||
struct binding_scope ** | scope, | ||
struct universe * | u, | ||
void * | stuff ) |
Definition at line 4257 of file dhclient.c.
int address_prefix_len = DHCLIENT_DEFAULT_PREFIX_LEN |
Definition at line 121 of file dhclient.c.
int bootp_broadcast_always = 0 |
Definition at line 126 of file dhclient.c.
struct string_list* client_env = NULL |
Definition at line 104 of file dhclient.c.
int client_env_count = 0 |
Definition at line 105 of file dhclient.c.
int decline_wait_time = 10 |
Definition at line 83 of file dhclient.c.
struct data_string default_duid |
Definition at line 78 of file dhclient.c.
TIME default_lease_time = 43200 |
Definition at line 54 of file dhclient.c.
int dfd[2] = { -1, -1 } |
Definition at line 103 of file dhclient.c.
int dhcp_max_agent_option_packet_length = 0 |
Definition at line 69 of file dhclient.c.
int duid_type = 0 |
Definition at line 79 of file dhclient.c.
int duid_v4 = 0 |
Definition at line 80 of file dhclient.c.
struct in_addr giaddr |
Definition at line 77 of file dhclient.c.
struct iaddr iaddr_any = { 4, { 0, 0, 0, 0 } } |
Definition at line 74 of file dhclient.c.
struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } } |
Definition at line 73 of file dhclient.c.
struct in_addr inaddr_any |
Definition at line 75 of file dhclient.c.
int interfaces_requested = 0 |
Definition at line 71 of file dhclient.c.
FILE* leaseFile = NULL |
Definition at line 4192 of file dhclient.c.
int leases_written = 0 |
Definition at line 4193 of file dhclient.c.
|
extern |
Definition at line 48 of file discover.c.
TIME max_lease_time = 86400 |
Definition at line 55 of file dhclient.c.
char* mockup_relay = NULL |
Definition at line 122 of file dhclient.c.
int no_daemon = 0 |
Definition at line 102 of file dhclient.c.
isc_boolean_t no_pid_file = ISC_FALSE |
Definition at line 67 of file dhclient.c.
int nowait = 0 |
Definition at line 108 of file dhclient.c.
int onetry = 0 |
Definition at line 106 of file dhclient.c.
const char* path_dhclient_conf = _PATH_DHCLIENT_CONF |
Definition at line 57 of file dhclient.c.
const char* path_dhclient_db = NULL |
Definition at line 58 of file dhclient.c.
const char* path_dhclient_duid = NULL |
Definition at line 62 of file dhclient.c.
const char* path_dhclient_pid = NULL |
Definition at line 59 of file dhclient.c.
char* path_dhclient_script = path_dhclient_script_array |
Definition at line 61 of file dhclient.c.
char* progname = NULL |
Definition at line 124 of file dhclient.c.
int quiet = 1 |
Definition at line 107 of file dhclient.c.
|
extern |
Definition at line 49 of file discover.c.
int require_all_ias = 0 |
Definition at line 113 of file dhclient.c.
FILE* scriptFile |
Definition at line 4797 of file dhclient.c.
char scriptName[256] |
Definition at line 4796 of file dhclient.c.
struct sockaddr_in sockaddr_broadcast |
Definition at line 76 of file dhclient.c.
int stateless = 0 |
Definition at line 109 of file dhclient.c.
int std_dhcid = 0 |
Definition at line 81 of file dhclient.c.
int wanted_ia_na = -1 |
Definition at line 110 of file dhclient.c.
int wanted_ia_pd = 0 |
Definition at line 112 of file dhclient.c.
int wanted_ia_ta = 0 |
Definition at line 111 of file dhclient.c.