ISC DHCP  4.3.3
A reference DHCPv4 and DHCPv6 implementation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
dhclient.c File Reference
#include "dhcpd.h"
#include <syslog.h>
#include <signal.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <limits.h>
#include <dns/result.h>

Go to the source code of this file.

Macros

#define ASSERT_STATE(state_is, state_shouldbe)   {}
 

Functions

int asprintf (char **strp, const char *fmt,...)
 
void run_stateless (int exit_mode)
 
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)
 
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_leasepacket_to_lease (struct packet *packet, struct client_state *client)
 
void dhcpnak (struct packet *packet)
 
void send_discover (void *cpp)
 
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)
 
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)
 
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)
 
void script_write_requested (struct client_state *client)
 
int script_go (struct client_state *client)
 
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 go_daemon ()
 
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)
 

Variables

TIME default_lease_time = 43200
 
TIME max_lease_time = 86400
 
const char * path_dhclient_conf = _PATH_DHCLIENT_CONF
 
const char * path_dhclient_db = NULL
 
const char * path_dhclient_pid = NULL
 
char * path_dhclient_script = path_dhclient_script_array
 
const char * path_dhclient_duid = NULL
 
isc_boolean_t no_pid_file = ISC_FALSE
 
int dhcp_max_agent_option_packet_length = 0
 
int interfaces_requested = 0
 
struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }
 
struct iaddr iaddr_any = { 4, { 0, 0, 0, 0 } }
 
struct in_addr inaddr_any
 
struct sockaddr_in sockaddr_broadcast
 
struct in_addr giaddr
 
struct data_string default_duid
 
int duid_type = 0
 
int duid_v4 = 1
 
int std_dhcid = 0
 
u_int16_t local_port = 0
 
u_int16_t remote_port = 0
 
int no_daemon = 0
 
struct string_listclient_env = NULL
 
int client_env_count = 0
 
int onetry = 0
 
int quiet = 1
 
int nowait = 0
 
int stateless = 0
 
int wanted_ia_na = -1
 
int wanted_ia_ta = 0
 
int wanted_ia_pd = 0
 
char * mockup_relay = NULL
 
int bootp_broadcast_always = 0
 
struct optiondefault_requested_options []
 
FILE * leaseFile = NULL
 
int leases_written = 0
 
char scriptName [256]
 
FILE * scriptFile
 

Macro Definition Documentation

#define ASSERT_STATE (   state_is,
  state_shouldbe 
)    {}

Definition at line 81 of file dhclient.c.

Function Documentation

int asprintf ( char **  strp,
const char *  fmt,
  ... 
)
void bind_lease ( struct client_state client)

Definition at line 1672 of file dhclient.c.

void bootp ( struct packet packet)

Definition at line 1833 of file dhclient.c.

int check_collection ( struct packet packet,
struct lease lease,
struct collection collection 
)

Definition at line 1262 of file dhclient.c.

void classify ( struct packet packet,
struct class class 
)

Definition at line 1270 of file dhclient.c.

void client_envadd ( struct client_state client,
const char *  prefix,
const char *  name,
const char *  fmt,
  ... 
)

Definition at line 4049 of file dhclient.c.

void client_location_changed ( void  )

Definition at line 4191 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 3788 of file dhclient.c.

int commit_leases ( void  )

Definition at line 1811 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 4401 of file dhclient.c.

void db_startup ( int  testp)

Definition at line 1828 of file dhclient.c.

void destroy_client_lease ( struct client_lease lease)

Definition at line 3231 of file dhclient.c.

int dhclient_interface_discovery_hook ( struct interface_info tmp)

Definition at line 4296 of file dhclient.c.

int dhclient_interface_shutdown_hook ( struct interface_info interface)

Definition at line 4289 of file dhclient.c.

isc_result_t dhclient_interface_startup_hook ( struct interface_info interface)

Definition at line 4339 of file dhclient.c.

void dhcp ( struct packet packet)

Definition at line 1866 of file dhclient.c.

int dhcp_option_ev_name ( char *  buf,
size_t  buflen,
struct option option 
)

Definition at line 4082 of file dhclient.c.

isc_result_t dhcp_set_control_state ( control_object_state_t  oldstate,
control_object_state_t  newstate 
)

Definition at line 4488 of file dhclient.c.

void dhcpack ( struct packet packet)

Definition at line 1503 of file dhclient.c.

void dhcpnak ( struct packet packet)

Definition at line 2230 of file dhclient.c.

void dhcpoffer ( struct packet packet)

Definition at line 1972 of file dhclient.c.

void dhcpv4_client_assignments ( void  )

Definition at line 4877 of file dhclient.c.

void do_release ( struct client_state client)

Definition at line 4225 of file dhclient.c.

isc_result_t find_class ( struct class **  c,
const char *  s,
const char *  file,
int  line 
)

Definition at line 1256 of file dhclient.c.

int find_subnet ( struct subnet **  sp,
struct iaddr  addr,
const char *  file,
int  line 
)

Definition at line 1281 of file dhclient.c.

isc_result_t form_duid ( struct data_string duid,
const char *  file,
int  line 
)

Definition at line 3378 of file dhclient.c.

void go_daemon ( void  )

Definition at line 4122 of file dhclient.c.

int main ( int  argc,
char **  argv 
)

Definition at line 124 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 2813 of file dhclient.c.

void make_decline ( struct client_state client,
struct client_lease lease 
)

Definition at line 3116 of file dhclient.c.

void make_discover ( struct client_state client,
struct client_lease lease 
)

Definition at line 2963 of file dhclient.c.

void make_release ( struct client_state client,
struct client_lease lease 
)

Definition at line 3175 of file dhclient.c.

void make_request ( struct client_state client,
struct client_lease lease 
)

Definition at line 3027 of file dhclient.c.

struct client_lease* packet_to_lease ( struct packet packet,
struct client_state client 
)

Definition at line 2107 of file dhclient.c.

int parse_agent_information_option ( struct packet packet,
int  len,
u_int8_t *  data 
)

Definition at line 4391 of file dhclient.c.

void rewrite_client_leases ( void  )

Definition at line 3245 of file dhclient.c.

void run_stateless ( int  exit_mode)

Definition at line 1166 of file dhclient.c.

int script_go ( struct client_state client)

Definition at line 3968 of file dhclient.c.

void script_init ( struct client_state client,
const char *  reason,
struct string_list medium 
)

Definition at line 3757 of file dhclient.c.

void script_write_params ( struct client_state client,
const char *  prefix,
struct client_lease lease 
)

Definition at line 3829 of file dhclient.c.

void script_write_requested ( struct client_state client)

Definition at line 3949 of file dhclient.c.

void send_decline ( void *  cpp)

Definition at line 2714 of file dhclient.c.

void send_discover ( void *  cpp)

Definition at line 2309 of file dhclient.c.

void send_release ( void *  cpp)

Definition at line 2737 of file dhclient.c.

void send_request ( void *  cpp)

Definition at line 2532 of file dhclient.c.

void state_bound ( void *  cpp)

Definition at line 1747 of file dhclient.c.

void state_init ( void *  cpp)

Definition at line 1381 of file dhclient.c.

void state_panic ( void *  cpp)

Definition at line 2422 of file dhclient.c.

void state_reboot ( void *  cpp)

Definition at line 1339 of file dhclient.c.

void state_selecting ( void *  cpp)

Definition at line 1418 of file dhclient.c.

void state_stop ( void *  cpp)

Definition at line 1789 of file dhclient.c.

void unbill_class ( struct lease lease)

Definition at line 1276 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 3486 of file dhclient.c.

int write_client_lease ( struct client_state client,
struct client_lease lease,
int  rewrite,
int  makesure 
)

Definition at line 3613 of file dhclient.c.

void write_client_pid_file ( void  )

Definition at line 4164 of file dhclient.c.

int write_host ( struct host_decl host)

Definition at line 1822 of file dhclient.c.

int write_lease ( struct lease lease)

Definition at line 1816 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 3307 of file dhclient.c.

Variable Documentation

int bootp_broadcast_always = 0

Definition at line 101 of file dhclient.c.

struct string_list* client_env = NULL

Definition at line 91 of file dhclient.c.

int client_env_count = 0

Definition at line 92 of file dhclient.c.

struct data_string default_duid

Definition at line 74 of file dhclient.c.

TIME default_lease_time = 43200

Definition at line 52 of file dhclient.c.

struct option* default_requested_options[]

Definition at line 35 of file clparse.c.

int dhcp_max_agent_option_packet_length = 0

Definition at line 65 of file dhclient.c.

int duid_type = 0

Definition at line 75 of file dhclient.c.

int duid_v4 = 1

Definition at line 76 of file dhclient.c.

struct in_addr giaddr

Definition at line 73 of file dhclient.c.

struct iaddr iaddr_any = { 4, { 0, 0, 0, 0 } }

Definition at line 70 of file dhclient.c.

struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }

Definition at line 69 of file dhclient.c.

struct in_addr inaddr_any

Definition at line 71 of file dhclient.c.

int interfaces_requested = 0

Definition at line 67 of file dhclient.c.

FILE* leaseFile = NULL

Definition at line 3242 of file dhclient.c.

int leases_written = 0

Definition at line 3243 of file dhclient.c.

u_int16_t local_port = 0

Definition at line 88 of file dhclient.c.

TIME max_lease_time = 86400

Definition at line 53 of file dhclient.c.

char* mockup_relay = NULL

Definition at line 100 of file dhclient.c.

int no_daemon = 0

Definition at line 90 of file dhclient.c.

isc_boolean_t no_pid_file = ISC_FALSE

Definition at line 63 of file dhclient.c.

int nowait = 0

Definition at line 95 of file dhclient.c.

int onetry = 0

Definition at line 93 of file dhclient.c.

const char* path_dhclient_conf = _PATH_DHCLIENT_CONF

Definition at line 55 of file dhclient.c.

const char* path_dhclient_db = NULL

Definition at line 56 of file dhclient.c.

const char* path_dhclient_duid = NULL

Definition at line 60 of file dhclient.c.

const char* path_dhclient_pid = NULL

Definition at line 57 of file dhclient.c.

char* path_dhclient_script = path_dhclient_script_array

Definition at line 59 of file dhclient.c.

int quiet = 1

Definition at line 94 of file dhclient.c.

u_int16_t remote_port = 0

Definition at line 89 of file dhclient.c.

FILE* scriptFile

Definition at line 3755 of file dhclient.c.

char scriptName[256]

Definition at line 3754 of file dhclient.c.

struct sockaddr_in sockaddr_broadcast

Definition at line 72 of file dhclient.c.

int stateless = 0

Definition at line 96 of file dhclient.c.

int std_dhcid = 0

Definition at line 77 of file dhclient.c.

int wanted_ia_na = -1

Definition at line 97 of file dhclient.c.

int wanted_ia_pd = 0

Definition at line 99 of file dhclient.c.

int wanted_ia_ta = 0

Definition at line 98 of file dhclient.c.