ReactOS 0.4.16-dev-2617-g01a0906
dhcpd.h File Reference
#include <winsock2.h>
#include <iphlpapi.h>
#include "stdint.h"
#include <pshpack1.h>
#include <poppack.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "dhcp.h"
#include "tree.h"
Include dependency graph for dhcpd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ether_header
 
struct  ip
 
struct  udphdr
 
struct  option_data
 
struct  string_list
 
struct  iaddr
 
struct  iaddrlist
 
struct  packet
 
struct  hardware
 
struct  client_lease
 
struct  client_config
 
struct  client_state
 
struct  interface_info
 
struct  timeout
 
struct  protocol
 
struct  hash_bucket
 
struct  hash_table
 

Macros

#define IFNAMSIZ   MAX_INTERFACE_NAME_LEN
 
#define ETH_ALEN   6
 
#define ETHER_ADDR_LEN   ETH_ALEN
 
#define IP_RF   0x8000 /* reserved fragment flag */
 
#define IP_DF   0x4000 /* dont fragment flag */
 
#define IP_MF   0x2000 /* more fragments flag */
 
#define IP_OFFMASK   0x1fff /* mask for fragmenting bits */
 
#define ETHERTYPE_IP   0x0800
 
#define IPTOS_LOWDELAY   0x10
 
#define ARPHRD_ETHER   1
 
#define SIZE_T_MAX   1600
 
#define USE_SOCKET_RECEIVE
 
#define USE_SOCKET_SEND
 
#define LOCAL_PORT   68
 
#define REMOTE_PORT   67
 
#define DEFAULT_HASH_SIZE   97
 
#define _PATH_DHCLIENT_CONF   "/etc/dhclient.conf"
 
#define _PATH_DHCLIENT_DB   "/var/db/dhclient.leases"
 
#define DHCPD_LOG_FACILITY   LOG_DAEMON
 
#define MAX_TIME   0x7fffffff
 
#define MIN_TIME   0
 

Enumerations

enum  dhcp_state {
  S_REBOOTING , S_INIT , S_SELECTING , S_REQUESTING ,
  S_BOUND , S_RENEWING , S_REBINDING , S_STATIC ,
  S_RELEASED
}
 

Functions

int cons_options (struct packet *, struct dhcp_packet *, int, struct tree_cache **)
 
charpretty_print_option (unsigned int, unsigned char *, int, int, int)
 
void do_packet (struct interface_info *, struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *)
 
void error (char *,...) __attribute__((__format__(__printf__
 
void int warning (char *,...) __attribute__((__format__(__printf__
 
void int int note (char *,...) __attribute__((__format__(__printf__
 
void int int int debug (char *,...) __attribute__((__format__(__printf__
 
void int int int int parse_warn (char *,...) __attribute__((__format__(__printf__
 
void new_parse (char *)
 
int next_token (char **, FILE *)
 
int peek_token (char **, FILE *)
 
void skip_to_semi (FILE *)
 
int parse_semi (FILE *)
 
charparse_string (FILE *)
 
int parse_ip_addr (FILE *, struct iaddr *)
 
void parse_hardware_param (FILE *, struct hardware *)
 
void parse_lease_time (FILE *, time_t *)
 
unsigned charparse_numeric_aggregate (FILE *, unsigned char *, int *, int, int, int)
 
void convert_num (unsigned char *, char *, int, int)
 
time_t parse_date (FILE *)
 
pair cons (caddr_t, pair)
 
struct string_listnew_string_list (size_t size)
 
struct hash_tablenew_hash_table (int)
 
struct hash_bucketnew_hash_bucket (void)
 
void dfree (void *, char *)
 
void free_hash_bucket (struct hash_bucket *, char *)
 
int if_register_bpf (struct interface_info *)
 
void if_register_send (struct interface_info *)
 
void if_register_receive (struct interface_info *)
 
ssize_t send_packet (struct interface_info *, struct dhcp_packet *, size_t, struct in_addr, struct sockaddr_in *, struct hardware *)
 
ssize_t receive_packet (struct interface_info *, unsigned char *, size_t, struct sockaddr_in *, struct hardware *)
 
void discover_interfaces (struct interface_info *)
 
void reinitialize_interfaces (void)
 
void dispatch (HANDLE hStopEvent)
 
void got_one (struct protocol *)
 
void add_timeout (time_t, void(*)(void *), void *)
 
void cancel_timeout (void(*)(void *), void *)
 
void add_protocol (char *, int, void(*)(struct protocol *), void *)
 
void remove_protocol (struct protocol *)
 
struct protocolfind_protocol_by_adapter (struct interface_info *)
 
int interface_link_status (char *)
 
struct hash_tablenew_hash (void)
 
void add_hash (struct hash_table *, unsigned char *, int, unsigned char *)
 
unsigned charhash_lookup (struct hash_table *, unsigned char *, int)
 
void initialize_universes (void)
 
u_int32_t getULong (unsigned char *)
 
int32_t getLong (unsigned char *)
 
u_int16_t getUShort (unsigned char *)
 
int16_t getShort (unsigned char *)
 
void putULong (unsigned char *, u_int32_t)
 
void putLong (unsigned char *, int32_t)
 
void putUShort (unsigned char *, unsigned int)
 
void putShort (unsigned char *, int)
 
struct iaddr subnet_number (struct iaddr, struct iaddr)
 
struct iaddr broadcast_addr (struct iaddr, struct iaddr)
 
int addr_eq (struct iaddr, struct iaddr)
 
charpiaddr (struct iaddr)
 
void dhcpoffer (struct packet *)
 
void dhcpack (struct packet *)
 
void dhcpnak (struct packet *)
 
void send_discover (void *)
 
void send_request (void *)
 
void send_decline (void *)
 
void send_release (void *)
 
void state_reboot (void *)
 
void state_init (void *)
 
void state_release (void *)
 
void state_selecting (void *)
 
void state_requesting (void *)
 
void state_bound (void *)
 
void state_panic (void *)
 
void bind_lease (struct interface_info *)
 
void unbind_lease (struct interface_info *)
 
void make_discover (struct interface_info *, struct client_lease *)
 
void make_request (struct interface_info *, struct client_lease *)
 
void make_decline (struct interface_info *, struct client_lease *)
 
void make_release (struct interface_info *, struct client_lease *)
 
void free_client_lease (struct client_lease *)
 
void rewrite_client_leases (struct interface_info *)
 
void write_client_lease (struct interface_info *, struct client_lease *, int)
 
void priv_script_init (struct interface_info *, char *, char *)
 
void priv_script_write_params (struct interface_info *, char *, struct client_lease *)
 
int priv_script_go (void)
 
void script_init (char *, struct string_list *)
 
void script_write_params (char *, struct client_lease *)
 
int script_go (void)
 
void client_envadd (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 dhcp_option *)
 
struct client_leasepacket_to_lease (struct packet *)
 
void go_daemon (void)
 
void client_location_changed (void)
 
void bootp (struct packet *)
 
void dhcp (struct packet *)
 
void assemble_hw_header (struct interface_info *, unsigned char *, int *, struct hardware *)
 
void assemble_udp_ip_header (unsigned char *, int *, u_int32_t, u_int32_t, unsigned int, unsigned char *, int)
 
ssize_t decode_hw_header (unsigned char *, int, struct hardware *)
 
ssize_t decode_udp_ip_header (unsigned char *, int, struct sockaddr_in *, unsigned char *, int)
 
void assemble_ethernet_header (struct interface_info *, unsigned char *, int *, struct hardware *)
 
ssize_t decode_ethernet_header (struct interface_info *, unsigned char *, int, struct hardware *)
 
int read_client_conf (struct interface_info *)
 
void read_client_leases (void)
 
void parse_client_statement (FILE *, struct interface_info *, struct client_config *)
 
int parse_X (FILE *, u_int8_t *, int)
 
int parse_option_list (FILE *, u_int8_t *)
 
void parse_interface_declaration (FILE *, struct client_config *)
 
struct interface_infointerface_or_dummy (char *)
 
void make_client_state (struct interface_info *)
 
void make_client_config (struct interface_info *, struct client_config *)
 
void parse_client_lease_statement (FILE *, int)
 
void parse_client_lease_declaration (FILE *, struct client_lease *, struct interface_info **)
 
struct dhcp_optionparse_option_decl (FILE *, struct option_data *)
 
void parse_string_list (FILE *, struct string_list **, int)
 
void parse_reject_statement (FILE *, struct client_config *)
 
struct bufbuf_open (size_t)
 
int buf_add (struct buf *, void *, size_t)
 
int buf_close (int, struct buf *)
 
ssize_t buf_read (int, void *, size_t)
 
void dispatch_imsg (int)
 

Variables

int warnings_occurred
 
void int int int int int lexline
 
void int int int int int lexchar
 
chartoken_line
 
chartlname
 
char comments [4096]
 
int comment_index
 
int eol_token
 
void(* bootp_packet_handler )(struct interface_info *, struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *)
 
struct dhcp_option dhcp_options [256]
 
unsigned char dhcp_option_default_priority_list []
 
int sizeof_dhcp_option_default_priority_list
 
struct hash_table universe_hash
 
struct universe dhcp_universe
 
charpath_dhclient_conf
 
charpath_dhclient_db
 
time_t cur_time
 
int log_priority
 
int log_perror
 
struct client_config top_level_config
 

Macro Definition Documentation

◆ _PATH_DHCLIENT_CONF

#define _PATH_DHCLIENT_CONF   "/etc/dhclient.conf"

Definition at line 277 of file dhcpd.h.

◆ _PATH_DHCLIENT_DB

#define _PATH_DHCLIENT_DB   "/var/db/dhclient.leases"

Definition at line 278 of file dhcpd.h.

◆ ARPHRD_ETHER

#define ARPHRD_ETHER   1

Definition at line 88 of file dhcpd.h.

◆ DEFAULT_HASH_SIZE

#define DEFAULT_HASH_SIZE   97

Definition at line 262 of file dhcpd.h.

◆ DHCPD_LOG_FACILITY

#define DHCPD_LOG_FACILITY   LOG_DAEMON

Definition at line 279 of file dhcpd.h.

◆ ETH_ALEN

#define ETH_ALEN   6

Definition at line 50 of file dhcpd.h.

◆ ETHER_ADDR_LEN

#define ETHER_ADDR_LEN   ETH_ALEN

Definition at line 51 of file dhcpd.h.

◆ ETHERTYPE_IP

#define ETHERTYPE_IP   0x0800

Definition at line 86 of file dhcpd.h.

◆ IFNAMSIZ

Definition at line 48 of file dhcpd.h.

◆ IP_DF

#define IP_DF   0x4000 /* dont fragment flag */

Definition at line 70 of file dhcpd.h.

◆ IP_MF

#define IP_MF   0x2000 /* more fragments flag */

Definition at line 71 of file dhcpd.h.

◆ IP_OFFMASK

#define IP_OFFMASK   0x1fff /* mask for fragmenting bits */

Definition at line 72 of file dhcpd.h.

◆ IP_RF

#define IP_RF   0x8000 /* reserved fragment flag */

Definition at line 69 of file dhcpd.h.

◆ IPTOS_LOWDELAY

#define IPTOS_LOWDELAY   0x10

Definition at line 87 of file dhcpd.h.

◆ LOCAL_PORT

#define LOCAL_PORT   68

Definition at line 112 of file dhcpd.h.

◆ MAX_TIME

#define MAX_TIME   0x7fffffff

Definition at line 281 of file dhcpd.h.

◆ MIN_TIME

#define MIN_TIME   0

Definition at line 282 of file dhcpd.h.

◆ REMOTE_PORT

#define REMOTE_PORT   67

Definition at line 113 of file dhcpd.h.

◆ SIZE_T_MAX

#define SIZE_T_MAX   1600

Definition at line 91 of file dhcpd.h.

◆ USE_SOCKET_RECEIVE

#define USE_SOCKET_RECEIVE

Definition at line 93 of file dhcpd.h.

◆ USE_SOCKET_SEND

#define USE_SOCKET_SEND

Definition at line 94 of file dhcpd.h.

Enumeration Type Documentation

◆ dhcp_state

Enumerator
S_REBOOTING 
S_INIT 
S_SELECTING 
S_REQUESTING 
S_BOUND 
S_RENEWING 
S_REBINDING 
S_STATIC 
S_RELEASED 

Definition at line 171 of file dhcpd.h.

171 {
173 S_INIT,
176 S_BOUND,
179 S_STATIC,
181};
@ S_RELEASED
Definition: dhcpd.h:180
@ S_REBOOTING
Definition: dhcpd.h:172
@ S_BOUND
Definition: dhcpd.h:176
@ S_RENEWING
Definition: dhcpd.h:177
@ S_REBINDING
Definition: dhcpd.h:178
@ S_SELECTING
Definition: dhcpd.h:174
@ S_REQUESTING
Definition: dhcpd.h:175
@ S_INIT
Definition: dhcpd.h:173
@ S_STATIC
Definition: dhcpd.h:179

Function Documentation

◆ add_hash()

void add_hash ( struct hash_table table,
unsigned char name,
int  len,
unsigned char pointer 
)

Definition at line 82 of file hash.c.

87{
88 int hashno;
89 struct hash_bucket *bp;
90
91 if (!table)
92 return;
93 if (!len)
94 len = strlen ((char *)name);
95
96 hashno = do_hash (name, len, table -> hash_count);
97 bp = new_hash_bucket ();
98
99 if (!bp) {
100 warn ("Can't add %s to hash table.", name);
101 return;
102 }
103 bp -> name = name;
104 bp -> value = pointer;
105 bp -> next = table -> buckets [hashno];
106 bp -> len = len;
107 table -> buckets [hashno] = bp;
108}
struct hash_bucket * new_hash_bucket(void)
Definition: alloc.c:71
static __inline int do_hash(unsigned char *name, int len, int size)
Definition: hash.c:63
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
GLsizei const GLvoid * pointer
Definition: glext.h:5848
GLenum GLsizei len
Definition: glext.h:6722
static unsigned __int64 next
Definition: rand_nt.c:6
#define warn(...)
struct list buckets
Definition: threadpool.c:324
unsigned char * name
Definition: dhcpd.h:266
Definition: name.c:39
Definition: pdh_main.c:96

Referenced by assign_file_addresses(), assign_inodes(), compute_linkcount(), and initialize_universes().

◆ add_protocol()

void add_protocol ( char name,
int  fd,
void(*)(struct protocol *)  handler,
void local 
)

Definition at line 342 of file dispatch.c.

344{
345 struct protocol *p;
346
347 p = malloc(sizeof(*p));
348 if (!p)
349 error("can't allocate protocol struct for %s", name);
350
351 p->fd = fd;
352 p->handler = handler;
353 p->local = local;
354 p->next = protocols;
355 protocols = p;
356}
struct protocol * protocols
Definition: dispatch.c:56
#define malloc
Definition: debug_ros.c:4
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7512
#define local
Definition: zutil.h:30
GLfloat GLfloat p
Definition: glext.h:8902
#define error(str)
Definition: mkdosfs.c:1605
static int fd
Definition: io.c:51
struct define * next
Definition: compiler.c:65

Referenced by AdapterDiscoveryThread(), Server_AcquireParameters(), and Server_EnableDhcp().

◆ add_timeout()

void add_timeout ( time_t  when,
void(*)(void *)  where,
void what 
)

Definition at line 253 of file dispatch.c.

254{
255 struct timeout *t, *q;
256
257 DH_DbgPrint(MID_TRACE,("Adding timeout %x %p %x\n", when, where, what));
258 /* See if this timeout supersedes an existing timeout. */
259 t = NULL;
260 for (q = timeouts; q; q = q->next) {
261 if (q->func == where && q->what == what) {
262 if (t)
263 t->next = q->next;
264 else
265 timeouts = q->next;
266 break;
267 }
268 t = q;
269 }
270
271 /* If we didn't supersede a timeout, allocate a timeout
272 structure now. */
273 if (!q) {
274 if (free_timeouts) {
276 free_timeouts = q->next;
277 q->func = where;
278 q->what = what;
279 } else {
280 q = malloc(sizeof(struct timeout));
281 if (!q) {
282 error("Can't allocate timeout structure!");
283 return;
284 }
285 q->func = where;
286 q->what = what;
287 }
288 }
289
290 q->when = when;
291
292 /* Now sort this timeout into the timeout list. */
293
294 /* Beginning of list? */
295 if (!timeouts || timeouts->when > q->when) {
296 q->next = timeouts;
297 timeouts = q;
298 return;
299 }
300
301 /* Middle of list? */
302 for (t = timeouts; t->next; t = t->next) {
303 if (t->next->when > q->when) {
304 q->next = t->next;
305 t->next = q;
306 return;
307 }
308 }
309
310 /* End of list. */
311 t->next = q;
312 q->next = NULL;
313}
static struct timeout * free_timeouts
Definition: dispatch.c:58
struct timeout * timeouts
Definition: dispatch.c:57
#define MID_TRACE
Definition: debug.h:15
#define DH_DbgPrint(_t_, _x_)
Definition: debug.h:49
#define NULL
Definition: types.h:112
GLdouble GLdouble t
Definition: gl.h:2047
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
Definition: dhcpd.h:248
void * what
Definition: dhcpd.h:252
time_t when
Definition: dhcpd.h:250

Referenced by bind_lease(), dhcpoffer(), send_discover(), and send_request().

◆ addr_eq()

int addr_eq ( struct iaddr  a,
struct iaddr  b 
)

Definition at line 100 of file util.c.

100 {
101 return a.len == b.len && !memcmp( a.iabuf, b.iabuf, a.len );
102}
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by bootp(), and dhcp().

◆ assemble_ethernet_header()

void assemble_ethernet_header ( struct interface_info ,
unsigned char ,
int ,
struct hardware  
)

◆ assemble_hw_header()

void assemble_hw_header ( struct interface_info ,
unsigned char ,
int ,
struct hardware  
)

◆ assemble_udp_ip_header()

void assemble_udp_ip_header ( unsigned char ,
int ,
u_int32_t  ,
u_int32_t  ,
unsigned int  ,
unsigned char ,
int   
)

◆ bind_lease()

void bind_lease ( struct interface_info ip)

Definition at line 707 of file dhclient.c.

708{
709 PDHCP_ADAPTER Adapter;
710 struct client_lease *new_lease = ip->client->new;
712
713 time(&cur_time);
714
715 /* Remember the medium. */
716 ip->client->new->medium = ip->client->medium;
717
718 /* Replace the old active lease with the new one. */
719 if (ip->client->active)
720 free_client_lease(ip->client->active);
721 ip->client->active = ip->client->new;
722 ip->client->new = NULL;
723
724 /* Set up a timeout to start the renewal process. */
725 /* Timeout of zero means no timeout (some implementations seem to use
726 * one day).
727 */
728 if( ip->client->active->renewal - cur_time )
729 add_timeout(ip->client->active->renewal, state_bound, ip);
730
731 note("bound to %s -- renewal in %ld seconds.",
732 piaddr(ip->client->active->address),
733 (long int)(ip->client->active->renewal - cur_time));
734
735 ip->client->state = S_BOUND;
736
737 Adapter = AdapterFindInfo( ip );
738
739 if( Adapter ) setup_adapter( Adapter, new_lease );
740 else {
741 warning("Could not find adapter for info %p\n", ip);
742 return;
743 }
744 set_name_servers( Adapter, new_lease );
745 set_domain( Adapter, new_lease );
746}
PDHCP_ADAPTER AdapterFindInfo(struct interface_info *ip)
Definition: adapter.c:638
void add_timeout(time_t when, void(*where)(void *), void *what)
Definition: dispatch.c:253
int note(char *format,...)
Definition: util.c:12
char * piaddr(struct iaddr addr)
Definition: util.c:6
void free_client_lease(struct client_lease *lease)
Definition: dhclient.c:1899
void state_bound(void *ipp)
Definition: dhclient.c:777
void setup_adapter(PDHCP_ADAPTER Adapter, struct client_lease *new_lease)
Definition: dhclient.c:561
void set_domain(PDHCP_ADAPTER Adapter, struct client_lease *new_lease)
Definition: dhclient.c:483
void set_name_servers(PDHCP_ADAPTER Adapter, struct client_lease *new_lease)
Definition: dhclient.c:421
time_t cur_time
__time32_t time_t
Definition: corecrt.h:228
__u16 time
Definition: mkdosfs.c:8
#define warning(s)
Definition: debug.h:83
Definition: dhcpd.h:62

Referenced by dhcpack(), and state_selecting().

◆ bootp()

void bootp ( struct packet packet)

Definition at line 803 of file dhclient.c.

804{
805 struct iaddrlist *ap;
806
807 if (packet->raw->op != BOOTREPLY)
808 return;
809
810 /* If there's a reject list, make sure this packet's sender isn't
811 on it. */
812 for (ap = packet->interface->client->config->reject_list;
813 ap; ap = ap->next) {
814 if (addr_eq(packet->client_addr, ap->addr)) {
815 note("BOOTREPLY from %s rejected.", piaddr(ap->addr));
816 return;
817 }
818 }
820}
int addr_eq(struct iaddr a, struct iaddr b)
Definition: util.c:100
#define BOOTREPLY
Definition: dhcp.h:79
void dhcpoffer(struct packet *packet)
Definition: dhclient.c:859
Definition: dhcpd.h:135
struct dhcp_packet * raw
Definition: dhcpd.h:136
struct interface_info * interface
Definition: dhcpd.h:142
struct iaddr client_addr
Definition: dhcpd.h:141
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

Referenced by do_packet().

◆ broadcast_addr()

struct iaddr broadcast_addr ( struct iaddr  addr,
struct iaddr  mask 
)

Definition at line 178 of file util.c.

178 {
179 struct iaddr bcast = { 0 };
180 return bcast;
181}
Definition: dhcpd.h:125

Referenced by priv_script_write_params().

◆ buf_add()

int buf_add ( struct buf ,
void ,
size_t   
)

◆ buf_close()

int buf_close ( int  ,
struct buf  
)

◆ buf_open()

struct buf * buf_open ( size_t  )

◆ buf_read()

ssize_t buf_read ( int  ,
void ,
size_t   
)

◆ cancel_timeout()

void cancel_timeout ( void(*)(void *)  where,
void what 
)

Definition at line 316 of file dispatch.c.

317{
318 struct timeout *t, *q;
319
320 /* Look for this timeout on the list, and unlink it if we find it. */
321 t = NULL;
322 for (q = timeouts; q; q = q->next) {
323 if (q->func == where && q->what == what) {
324 if (t)
325 t->next = q->next;
326 else
327 timeouts = q->next;
328 break;
329 }
330 t = q;
331 }
332
333 /* If we found the timeout, put it on the free list. */
334 if (q) {
335 q->next = free_timeouts;
337 }
338}

Referenced by dhcpack(), dhcpnak(), dhcpoffer(), send_request(), and state_selecting().

◆ client_envadd()

void client_envadd ( struct client_state ,
const char ,
const char ,
const char ,
  ... 
)

◆ client_location_changed()

void client_location_changed ( void  )

◆ cons()

pair cons ( caddr_t  car,
pair  cdr 
)

Definition at line 57 of file tree.c.

60{
61 pair foo = (pair)dmalloc (sizeof *foo, "cons");
62 if (!foo)
63 error ("no memory for cons.");
64 foo -> car = car;
65 foo -> cdr = cdr;
66 return foo;
67}
void * dmalloc(int size, char *name)
Definition: util.c:104
Definition: _pair.h:47

◆ cons_options()

int cons_options ( struct packet inpacket,
struct dhcp_packet outpacket,
int  mms,
struct tree_cache **  options 
)

Definition at line 199 of file options.c.

201{
202 unsigned char priority_list[300], buffer[4096];
203 int priority_len, main_buffer_size, mainbufix;
204 int option_size, length;
205
206 /*
207 * If the client has provided a maximum DHCP message size, use
208 * that; otherwise, if it's BOOTP, only 64 bytes; otherwise use
209 * up to the minimum IP MTU size (576 bytes).
210 *
211 * XXX if a BOOTP client specifies a max message size, we will
212 * honor it.
213 */
214 if (!mms &&
215 inpacket &&
216 inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data &&
217 (inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >=
218 sizeof(u_int16_t)))
219 mms = getUShort(
220 inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data);
221
222 if (mms)
223 main_buffer_size = mms - DHCP_FIXED_LEN;
224 else
225 main_buffer_size = 576 - DHCP_FIXED_LEN;
226
227 if (main_buffer_size > sizeof(buffer))
228 main_buffer_size = sizeof(buffer);
229
230 /* Preload the option priority list with mandatory options. */
231 priority_len = 0;
232 priority_list[priority_len++] = DHO_DHCP_MESSAGE_TYPE;
233 priority_list[priority_len++] = DHO_DHCP_SERVER_IDENTIFIER;
234 priority_list[priority_len++] = DHO_DHCP_LEASE_TIME;
235 priority_list[priority_len++] = DHO_DHCP_MESSAGE;
236
237 /*
238 * If the client has provided a list of options that it wishes
239 * returned, use it to prioritize. Otherwise, prioritize based
240 * on the default priority list.
241 */
242 if (inpacket &&
244 int prlen =
246 if (prlen + priority_len > sizeof(priority_list))
247 prlen = sizeof(priority_list) - priority_len;
248
249 memcpy(&priority_list[priority_len],
251 prlen);
252 priority_len += prlen;
253 } else {
254 memcpy(&priority_list[priority_len],
258 }
259
260 /* Copy the options into the big buffer... */
261 option_size = store_options(
262 buffer,
263 main_buffer_size - 7,
264 options, priority_list, priority_len, main_buffer_size,
265 main_buffer_size);
266
267 /* Put the cookie up front... */
268 memcpy(outpacket->options, DHCP_OPTIONS_COOKIE, 4);
269 mainbufix = 4;
270
271 /*
272 * If we're going to have to overload, store the overload option
273 * at the beginning. If we can, though, just store the whole
274 * thing in the packet's option buffer and leave it at that.
275 */
276 if (option_size <= main_buffer_size - mainbufix) {
277 memcpy(&outpacket->options[mainbufix],
278 buffer, option_size);
279 mainbufix += option_size;
280 if (mainbufix < main_buffer_size)
281 outpacket->options[mainbufix++] = DHO_END;
282 length = DHCP_FIXED_NON_UDP + mainbufix;
283 } else {
284 outpacket->options[mainbufix++] = DHO_DHCP_OPTION_OVERLOAD;
285 outpacket->options[mainbufix++] = 1;
286 if (option_size >
287 main_buffer_size - mainbufix + DHCP_FILE_LEN)
288 outpacket->options[mainbufix++] = 3;
289 else
290 outpacket->options[mainbufix++] = 1;
291
292 memcpy(&outpacket->options[mainbufix],
293 buffer, main_buffer_size - mainbufix);
294 length = DHCP_FIXED_NON_UDP + mainbufix;
295 }
296 return (length);
297}
int store_options(unsigned char *, int, struct tree_cache **, unsigned char *, int, int, int)
Definition: options.c:303
int sizeof_dhcp_option_default_priority_list
Definition: tables.c:408
unsigned char dhcp_option_default_priority_list[]
Definition: tables.c:329
u_int16_t getUShort(unsigned char *data)
Definition: util.c:88
#define DHO_DHCP_MESSAGE
Definition: dhcp.h:152
#define DHO_DHCP_MAX_MESSAGE_SIZE
Definition: dhcp.h:153
#define DHO_DHCP_PARAMETER_REQUEST_LIST
Definition: dhcp.h:151
#define DHCP_FILE_LEN
Definition: dhcp.h:47
#define DHCP_FIXED_NON_UDP
Definition: dhcp.h:48
#define DHO_DHCP_MESSAGE_TYPE
Definition: dhcp.h:149
#define DHCP_OPTIONS_COOKIE
Definition: dhcp.h:91
#define DHO_END
Definition: dhcp.h:159
#define DHO_DHCP_OPTION_OVERLOAD
Definition: dhcp.h:148
#define DHO_DHCP_SERVER_IDENTIFIER
Definition: dhcp.h:150
#define DHO_DHCP_LEASE_TIME
Definition: dhcp.h:147
#define DHCP_FIXED_LEN
Definition: dhcp.h:49
GLuint buffer
Definition: glext.h:5915
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned short u_int16_t
Definition: rosdhcp.h:38
unsigned char options[DHCP_OPTION_LEN]
Definition: dhcp.h:72
struct option_data options[256]
Definition: dhcpd.h:144

Referenced by make_decline(), make_discover(), make_release(), and make_request().

◆ convert_num()

void convert_num ( unsigned char ,
char ,
int  ,
int   
)

◆ debug()

void int int int debug ( char ,
  ... 
)

◆ decode_ethernet_header()

ssize_t decode_ethernet_header ( struct interface_info ,
unsigned char ,
int  ,
struct hardware  
)

◆ decode_hw_header()

ssize_t decode_hw_header ( unsigned char ,
int  ,
struct hardware  
)

◆ decode_udp_ip_header()

ssize_t decode_udp_ip_header ( unsigned char ,
int  ,
struct sockaddr_in ,
unsigned char ,
int   
)

◆ dfree()

void dfree ( void ptr,
char name 
)

Definition at line 79 of file alloc.c.

80{
81 if (!ptr) {
82 warning("dfree %s: free on null pointer.", name);
83 return;
84 }
85 free(ptr);
86}
#define free
Definition: debug_ros.c:5
static PVOID ptr
Definition: dispmode.c:27

Referenced by do_host_lookup(), free_hash_bucket(), tree_concat(), and tree_evaluate().

◆ dhcp()

void dhcp ( struct packet packet)

Definition at line 823 of file dhclient.c.

824{
825 struct iaddrlist *ap;
826 void (*handler)(struct packet *);
827 char *type;
828
829 switch (packet->packet_type) {
830 case DHCPOFFER:
832 type = "DHCPOFFER";
833 break;
834 case DHCPNAK:
836 type = "DHCPNACK";
837 break;
838 case DHCPACK:
840 type = "DHCPACK";
841 break;
842 default:
843 return;
844 }
845
846 /* If there's a reject list, make sure this packet's sender isn't
847 on it. */
848 for (ap = packet->interface->client->config->reject_list;
849 ap; ap = ap->next) {
850 if (addr_eq(packet->client_addr, ap->addr)) {
851 note("%s from %s rejected.", type, piaddr(ap->addr));
852 return;
853 }
854 }
855 (*handler)(packet);
856}
#define DHCPNAK
Definition: dhcp.h:167
#define DHCPACK
Definition: dhcp.h:166
#define DHCPOFFER
Definition: dhcp.h:163
void dhcpnak(struct packet *packet)
Definition: dhclient.c:1072
void dhcpack(struct packet *packet)
Definition: dhclient.c:338
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int packet_type
Definition: dhcpd.h:138

Referenced by do_packet(), and START_TEST().

◆ dhcp_option_ev_name()

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

Definition at line 2151 of file dhclient.c.

2152{
2153 int i;
2154
2155 for (i = 0; option->name[i]; i++) {
2156 if (i + 1 == buflen)
2157 return 0;
2158 if (option->name[i] == '-')
2159 buf[i] = '_';
2160 else
2161 buf[i] = option->name[i];
2162 }
2163
2164 buf[i] = 0;
2165 return 1;
2166}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
Definition: getopt.h:109
WCHAR * name
Definition: getopt.h:110

Referenced by priv_script_write_params().

◆ dhcpack()

void dhcpack ( struct packet packet)

Definition at line 338 of file dhclient.c.

339{
341 struct client_lease *lease;
343
344 time(&cur_time);
345
346 /* If we're not receptive to an offer right now, or if the offer
347 has an unrecognizable transaction id, then just drop it. */
348 if (packet->interface->client->xid != packet->raw->xid ||
349 (packet->interface->hw_address.hlen != packet->raw->hlen) ||
350 (memcmp(packet->interface->hw_address.haddr,
351 packet->raw->chaddr, packet->raw->hlen)))
352 return;
353
354 if (ip->client->state != S_REBOOTING &&
355 ip->client->state != S_REQUESTING &&
356 ip->client->state != S_RENEWING &&
357 ip->client->state != S_REBINDING)
358 return;
359
360 note("DHCPACK from %s", piaddr(packet->client_addr));
361
362 lease = packet_to_lease(packet);
363 if (!lease) {
364 note("packet_to_lease failed.");
365 return;
366 }
367
368 ip->client->new = lease;
369
370 /* Stop resending DHCPREQUEST. */
372
373 /* Figure out the lease time. */
374 if (ip->client->new->options[DHO_DHCP_LEASE_TIME].data)
375 ip->client->new->expiry = getULong(
376 ip->client->new->options[DHO_DHCP_LEASE_TIME].data);
377 else
378 ip->client->new->expiry = DHCP_DEFAULT_LEASE_TIME;
379 /* A number that looks negative here is really just very large,
380 because the lease expiry offset is unsigned. */
381 if (ip->client->new->expiry < 0)
382 ip->client->new->expiry = TIME_MAX;
383 /* XXX should be fixed by resetting the client state */
384 if (ip->client->new->expiry < 60)
385 ip->client->new->expiry = 60;
386
387 /* Take the server-provided renewal time if there is one;
388 otherwise figure it out according to the spec. */
389 if (ip->client->new->options[DHO_DHCP_RENEWAL_TIME].len)
390 ip->client->new->renewal = getULong(
391 ip->client->new->options[DHO_DHCP_RENEWAL_TIME].data);
392 else
393 ip->client->new->renewal = ip->client->new->expiry / 2;
394
395 /* Same deal with the rebind time. */
396 if (ip->client->new->options[DHO_DHCP_REBINDING_TIME].len)
397 ip->client->new->rebind = getULong(
398 ip->client->new->options[DHO_DHCP_REBINDING_TIME].data);
399 else
400 ip->client->new->rebind = ip->client->new->renewal +
401 ip->client->new->renewal / 2 + ip->client->new->renewal / 4;
402
403#ifdef __REACTOS__
404 ip->client->new->lease = ip->client->new->expiry;
405 ip->client->new->obtained = cur_time;
406#endif
407 ip->client->new->expiry += cur_time;
408 /* Lease lengths can never be negative. */
409 if (ip->client->new->expiry < cur_time)
410 ip->client->new->expiry = TIME_MAX;
411 ip->client->new->renewal += cur_time;
412 if (ip->client->new->renewal < cur_time)
413 ip->client->new->renewal = TIME_MAX;
414 ip->client->new->rebind += cur_time;
415 if (ip->client->new->rebind < cur_time)
416 ip->client->new->rebind = TIME_MAX;
417
418 bind_lease(ip);
419}
void cancel_timeout(void(*where)(void *), void *what)
Definition: dispatch.c:316
u_int32_t getULong(unsigned char *data)
Definition: util.c:96
#define DHO_DHCP_RENEWAL_TIME
Definition: dhcp.h:154
#define DHO_DHCP_REBINDING_TIME
Definition: dhcp.h:155
#define TIME_MAX
Definition: dhclient.c:90
struct client_lease * packet_to_lease(struct packet *packet)
Definition: dhclient.c:978
void bind_lease(struct interface_info *ip)
Definition: dhclient.c:707
#define DHCP_DEFAULT_LEASE_TIME
Definition: rosdhcp.h:34

Referenced by dhcp().

◆ dhcpnak()

void dhcpnak ( struct packet packet)

Definition at line 1072 of file dhclient.c.

1073{
1074 struct interface_info *ip = packet->interface;
1075
1076 /* If we're not receptive to an offer right now, or if the offer
1077 has an unrecognizable transaction id, then just drop it. */
1078 if (packet->interface->client->xid != packet->raw->xid ||
1079 (packet->interface->hw_address.hlen != packet->raw->hlen) ||
1080 (memcmp(packet->interface->hw_address.haddr,
1081 packet->raw->chaddr, packet->raw->hlen)))
1082 return;
1083
1084 if (ip->client->state != S_REBOOTING &&
1085 ip->client->state != S_REQUESTING &&
1086 ip->client->state != S_RENEWING &&
1087 ip->client->state != S_REBINDING)
1088 return;
1089
1090 note("DHCPNAK from %s", piaddr(packet->client_addr));
1091
1092 if (!ip->client->active) {
1093 note("DHCPNAK with no active lease.\n");
1094 return;
1095 }
1096
1097 free_client_lease(ip->client->active);
1098 ip->client->active = NULL;
1099
1100 /* Stop sending DHCPREQUEST packets... */
1102
1103 ip->client->state = S_INIT;
1104 state_init(ip);
1105}
void state_init(void *ipp)
Definition: dhclient.c:210

Referenced by dhcp().

◆ dhcpoffer()

void dhcpoffer ( struct packet packet)

Definition at line 859 of file dhclient.c.

860{
862 struct client_lease *lease, *lp;
863 int i;
864 int arp_timeout_needed = 0, stop_selecting;
866 "DHCPOFFER" : "BOOTREPLY";
868
869 time(&cur_time);
870
871 /* If we're not receptive to an offer right now, or if the offer
872 has an unrecognizable transaction id, then just drop it. */
873 if (ip->client->state != S_SELECTING ||
874 packet->interface->client->xid != packet->raw->xid ||
875 (packet->interface->hw_address.hlen != packet->raw->hlen) ||
876 (memcmp(packet->interface->hw_address.haddr,
877 packet->raw->chaddr, packet->raw->hlen)))
878 return;
879
880 note("%s from %s", name, piaddr(packet->client_addr));
881
882
883 /* If this lease doesn't supply the minimum required parameters,
884 blow it off. */
885 for (i = 0; ip->client->config->required_options[i]; i++) {
886 if (!packet->options[ip->client->config->
887 required_options[i]].len) {
888 note("%s isn't satisfactory.", name);
889 return;
890 }
891 }
892
893 /* If we've already seen this lease, don't record it again. */
894 for (lease = ip->client->offered_leases;
895 lease; lease = lease->next) {
896 if (lease->address.len == sizeof(packet->raw->yiaddr) &&
897 !memcmp(lease->address.iabuf,
898 &packet->raw->yiaddr, lease->address.len)) {
899 debug("%s already seen.", name);
900 return;
901 }
902 }
903
904 lease = packet_to_lease(packet);
905 if (!lease) {
906 note("packet_to_lease failed.");
907 return;
908 }
909
910 /* If this lease was acquired through a BOOTREPLY, record that
911 fact. */
913 lease->is_bootp = 1;
914
915 /* Record the medium under which this lease was offered. */
916 lease->medium = ip->client->medium;
917
918 /* Send out an ARP Request for the offered IP address. */
919 if( !check_arp( ip, lease ) ) {
920 note("Arp check failed\n");
921 return;
922 }
923
924 /* Figure out when we're supposed to stop selecting. */
925 stop_selecting =
926 ip->client->first_sending + ip->client->config->select_interval;
927
928 /* If this is the lease we asked for, put it at the head of the
929 list, and don't mess with the arp request timeout. */
930 if (lease->address.len == ip->client->requested_address.len &&
931 !memcmp(lease->address.iabuf,
932 ip->client->requested_address.iabuf,
933 ip->client->requested_address.len)) {
934 lease->next = ip->client->offered_leases;
935 ip->client->offered_leases = lease;
936 } else {
937 /* If we already have an offer, and arping for this
938 offer would take us past the selection timeout,
939 then don't extend the timeout - just hope for the
940 best. */
941 if (ip->client->offered_leases &&
942 (cur_time + arp_timeout_needed) > stop_selecting)
943 arp_timeout_needed = 0;
944
945 /* Put the lease at the end of the list. */
946 lease->next = NULL;
947 if (!ip->client->offered_leases)
948 ip->client->offered_leases = lease;
949 else {
950 for (lp = ip->client->offered_leases; lp->next;
951 lp = lp->next)
952 ; /* nothing */
953 lp->next = lease;
954 }
955 }
956
957 /* If we're supposed to stop selecting before we've had time
958 to wait for the ARPREPLY, add some delay to wait for
959 the ARPREPLY. */
960 if (stop_selecting - cur_time < arp_timeout_needed)
961 stop_selecting = cur_time + arp_timeout_needed;
962
963 /* If the selecting interval has expired, go immediately to
964 state_selecting(). Otherwise, time out into
965 state_selecting at the select interval. */
966 if (stop_selecting <= 0)
968 else {
969 add_timeout(stop_selecting, state_selecting, ip);
971 }
972}
void send_discover(void *ipp)
Definition: dhclient.c:1112
void state_selecting(void *ipp)
Definition: dhclient.c:257
int check_arp(struct interface_info *ip, struct client_lease *lp)
Definition: dhclient.c:137
#define debug(msg)
Definition: key_call.c:71
struct string_list * medium
Definition: dhcpd.h:164
struct iaddr address
Definition: dhcpd.h:156
unsigned int is_bootp
Definition: dhcpd.h:166
struct client_lease * next
Definition: dhcpd.h:154

Referenced by bootp(), and dhcp().

◆ discover_interfaces()

void discover_interfaces ( struct interface_info )

◆ dispatch()

void dispatch ( HANDLE  hStopEvent)

Definition at line 70 of file dispatch.c.

71{
72 int count, to_msec;
73 struct protocol *l;
74 time_t howlong, cur_time;
75 HANDLE Events[3];
76 int EventCount = 2;
77
79 Events[1] = hStopEvent;
81
82 ApiLock();
83
84 do {
85 /*
86 * Call any expired timeouts, and then if there's still
87 * a timeout registered, time out the select call then.
88 */
89 time(&cur_time);
90
91 if (timeouts)
92 {
93 struct timeout *t;
94
95 if (timeouts->when <= cur_time) {
96 t = timeouts;
97 timeouts = timeouts->next;
98 (*(t->func))(t->what);
99 t->next = free_timeouts;
101 continue;
102 }
103
104 /*
105 * Figure timeout in milliseconds, and check for
106 * potential overflow, so we can cram into an
107 * int for poll, while not polling with a
108 * negative timeout and blocking indefinitely.
109 */
110 howlong = timeouts->when - cur_time;
111 if (howlong > INT_MAX / 1000)
112 howlong = INT_MAX / 1000;
113 to_msec = howlong * 1000;
114 }
115 else
116 {
117 to_msec = INFINITE;
118 }
119
121 {
122 Events[2] = WSACreateEvent();
123 if (Events[2] != WSA_INVALID_EVENT)
124 {
126 if (count != NO_ERROR)
127 {
130 }
131 else
132 {
133 EventCount = 3;
134 }
135 }
136 }
138 {
141
142 EventCount = 2;
143 }
144
145 ApiUnlock();
146 count = WaitForMultipleObjects(EventCount,
147 Events,
148 FALSE,
149 to_msec);
150 ApiLock();
151 if (count == WAIT_OBJECT_0)
152 {
153 /* Adapter state change */
154 continue;
155 }
156 else if (count == WAIT_OBJECT_0 + 1)
157 {
158 /* Stop event signalled */
159 DPRINT("Dispatch thread stop event!\n");
160 break;
161 }
162 else if (count == WAIT_OBJECT_0 + 2)
163 {
164 /* Packet received */
165
166 /* WSA events are manual reset events */
168 }
169 else
170 {
171 /* Timeout */
172 continue;
173 }
174
175 for (l = protocols; l; l = l->next) {
176 struct interface_info *ip;
177 ip = l->local;
178 if (ip && (l->handler != got_one ||
179 !ip->dead)) {
180 DH_DbgPrint(MID_TRACE,("Handling %x\n", l));
181 (*(l->handler))(l);
182 }
183 }
184 } while (1);
185
187
188 ApiUnlock();
189
190 DPRINT("Dispatch thread stopped!\n");
191}
VOID ApiLock()
Definition: api.c:22
VOID ApiUnlock()
Definition: api.c:26
HANDLE hAdapterStateChangedEvent
Definition: dhcpcsvc.c:21
SOCKET DhcpSocket
Definition: adapter.c:8
void got_one(struct protocol *l)
Definition: dispatch.c:194
HANDLE Events[3]
Definition: schedsvc.c:40
r l[0]
Definition: byte_order.h:168
#define NO_ERROR
Definition: dderror.h:5
HANDLE hStopEvent
Definition: dhcpcsvc.c:20
#define FALSE
Definition: types.h:117
#define INT_MAX
Definition: limits.h:26
BOOL WSAAPI WSAResetEvent(IN WSAEVENT hEvent)
Definition: event.c:53
BOOL WSAAPI WSACloseEvent(IN WSAEVENT hEvent)
Definition: event.c:23
INT WSAAPI WSAEventSelect(IN SOCKET s, IN WSAEVENT hEventObject, IN LONG lNetworkEvents)
Definition: select.c:182
#define INFINITE
Definition: serial.h:102
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define DPRINT
Definition: sndvol32.h:73
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
Definition: synch.c:151
#define WAIT_OBJECT_0
Definition: winbase.h:383
WINSOCK_API_LINKAGE WSAEVENT WSAAPI WSACreateEvent(void)
Definition: event.c:42
#define WSA_INVALID_EVENT
Definition: winsock2.h:617
#define FD_READ
Definition: winsock.h:399
#define INVALID_SOCKET
Definition: winsock.h:326
#define FD_CLOSE
Definition: winsock.h:404

Referenced by __CxxFrameHandler(), create_database(), create_list(), create_view(), cxx_frame_handler(), cxx_local_unwind(), CxxHandleV8Frame(), database_invoke(), find_catch_block(), ICreateTypeInfo2_fnSetTypeFlags(), init_test_dispatch(), InstallerImpl_OpenDatabase(), InstallerImpl_OpenPackage(), InstallerImpl_Products(), InstallerImpl_RelatedProducts(), InstallerImpl_SummaryInformation(), main(), run_script(), ServiceMain(), session_invoke(), svc_create(), svc_reg(), svc_tp_create(), test_CreateTypeLib(), test_IConnectionPoint(), test_IWinHttpRequest_Invoke(), test_ParseDisplayName(), test_recinfo(), test_VarCat(), and test_VarUI1FromDisp().

◆ dispatch_imsg()

void dispatch_imsg ( int  )

◆ do_packet()

void do_packet ( struct interface_info interface,
struct dhcp_packet packet,
int  len,
unsigned int  from_port,
struct iaddr  from,
struct hardware hfrom 
)

Definition at line 635 of file options.c.

637{
638 struct packet tp;
639 int i;
640
641 if (packet->hlen > sizeof(packet->chaddr)) {
642 note("Discarding packet with invalid hlen.");
643 return;
644 }
645
646 memset(&tp, 0, sizeof(tp));
647 tp.raw = packet;
648 tp.packet_length = len;
649 tp.client_port = from_port;
650 tp.client_addr = from;
651 tp.interface = interface;
652 tp.haddr = hfrom;
653
655 if (tp.options_valid &&
656 tp.options[DHO_DHCP_MESSAGE_TYPE].data)
657 tp.packet_type = tp.options[DHO_DHCP_MESSAGE_TYPE].data[0];
658 if (tp.packet_type)
659 dhcp(&tp);
660 else
661 bootp(&tp);
662
663 /* Free the data associated with the options. */
664 for (i = 0; i < 256; i++)
665 if (tp.options[i].len && tp.options[i].data)
666 free(tp.options[i].data);
667}
void parse_options(struct packet *)
Definition: options.c:59
#define interface
Definition: basetyps.h:61
void bootp(struct packet *packet)
Definition: dhclient.c:803
void dhcp(struct packet *packet)
Definition: dhclient.c:823
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
#define memset(x, y, z)
Definition: compat.h:39
CardRegion * from
Definition: spigame.cpp:19

Referenced by init_client().

◆ error()

void error ( char format,
  ... 
)

Definition at line 128 of file uimain.c.

818{
819 va_list ap;
820 char text[512];
821 char text1[512];
822
823 sprintf(text1, "ERROR: ");
826 va_end(ap);
827 strcat(text1, text);
828 mi_error(text1);
829}
const WCHAR * text
Definition: package.c:1794
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl vsprintf(char *, const char *, va_list) __WINE_CRT_PRINTF_ATTR(2
char * va_list
Definition: vadefs.h:50
#define sprintf
Definition: sprintf.c:45
strcat
Definition: string.h:92
Definition: format.c:58
void mi_error(char *msg)
Definition: win32.c:131

◆ find_protocol_by_adapter()

struct protocol * find_protocol_by_adapter ( struct interface_info info)

Definition at line 412 of file dispatch.c.

413{
414 struct protocol *p;
415
416 for( p = protocols; p; p = p->next ) {
417 if( p->local == (void *)info ) return p;
418 }
419
420 return NULL;
421}

Referenced by AdapterDiscoveryThread(), IsReconnectHackNeeded(), Server_AcquireParameters(), Server_EnableDhcp(), Server_ReleaseParameters(), and Server_StaticRefreshParams().

◆ free_client_lease()

void free_client_lease ( struct client_lease lease)

Definition at line 1899 of file dhclient.c.

1900{
1901 int i;
1902
1903 if (lease->server_name)
1904 free(lease->server_name);
1905 if (lease->filename)
1906 free(lease->filename);
1907 for (i = 0; i < 256; i++) {
1908 if (lease->options[i].len)
1909 free(lease->options[i].data);
1910 }
1911 free(lease);
1912}
struct option_data options[256]
Definition: dhcpd.h:167
char * filename
Definition: dhcpd.h:163
char * server_name
Definition: dhcpd.h:157

Referenced by bind_lease(), dhcpnak(), packet_to_lease(), state_selecting(), and unbind_lease().

◆ free_hash_bucket()

void free_hash_bucket ( struct hash_bucket ptr,
char name 
)

Definition at line 89 of file alloc.c.

90{
91 dfree(ptr, name);
92}
void dfree(void *ptr, char *name)
Definition: alloc.c:79

Referenced by delete_hash_entry().

◆ getLong()

int32_t getLong ( unsigned char data)

Definition at line 92 of file util.c.

92 {
93 return (int32_t) ntohl(*(u_int32_t*) data);
94}
INT32 int32_t
Definition: types.h:71
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define ntohl(x)
Definition: module.h:205
unsigned int u_int32_t
Definition: rosdhcp.h:39

Referenced by pretty_print_option().

◆ getShort()

int16_t getShort ( unsigned char data)

Definition at line 84 of file util.c.

84 {
85 return (int16_t) ntohs(*(int16_t*) data);
86}
INT16 int16_t
Definition: types.h:70
#define ntohs(x)
Definition: module.h:210

Referenced by pretty_print_option().

◆ getULong()

u_int32_t getULong ( unsigned char data)

Definition at line 96 of file util.c.

96 {
97 return ntohl(*(u_int32_t*)data);
98}

Referenced by dhcpack(), and pretty_print_option().

◆ getUShort()

u_int16_t getUShort ( unsigned char data)

Definition at line 88 of file util.c.

88 {
89 return (u_int16_t) ntohs(*(u_int16_t*) data);
90}

Referenced by cons_options(), and pretty_print_option().

◆ go_daemon()

void go_daemon ( void  )

◆ got_one()

void got_one ( struct protocol l)

Definition at line 194 of file dispatch.c.

195{
196 struct sockaddr_in from;
197 struct hardware hfrom;
198 struct iaddr ifrom;
200 union {
201 /*
202 * Packet input buffer. Must be as large as largest
203 * possible MTU.
204 */
205 unsigned char packbuf[4095];
206 struct dhcp_packet packet;
207 } u;
208 struct interface_info *ip = l->local;
210
211 if ((result = receive_packet(ip, u.packbuf, sizeof(u), &from,
212 &hfrom)) == -1) {
213 warning("receive_packet failed on %s: %d", ip->name,
215 ip->errors++;
216 if (ip->errors > 20) {
217 /* our interface has gone away. */
218 warning("Interface %s no longer appears valid.",
219 ip->name);
220 ip->dead = 1;
221 closesocket(l->fd);
224 if (adapter) {
225 RemoveEntryList(&adapter->ListEntry);
226 free(adapter);
227 }
228 }
229 return;
230 }
231 if (result == 0)
232 return;
233
235 ifrom.len = 4;
236 memcpy(ifrom.iabuf, &from.sin_addr, ifrom.len);
237
238
239 adapter = AdapterFindByHardwareAddress(u.packet.chaddr,
240 u.packet.hlen);
241
242 if (!adapter) {
243 warning("Discarding packet with a non-matching target physical address\n");
244 return;
245 }
246
247 (*bootp_packet_handler)(&adapter->DhclientInfo, &u.packet, result,
248 from.sin_port, ifrom, &hfrom);
249 }
250}
PDHCP_ADAPTER AdapterFindByHardwareAddress(u_int8_t *haddr, u_int8_t hlen)
Definition: adapter.c:652
void remove_protocol(struct protocol *proto)
Definition: dispatch.c:359
void(* bootp_packet_handler)(struct interface_info *, struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *)
Definition: dispatch.c:59
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
return adapter
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define closesocket
Definition: ncftp.h:477
int ssize_t
Definition: rosdhcp.h:52
ssize_t receive_packet(struct interface_info *ip, unsigned char *packet_data, size_t packet_len, struct sockaddr_in *dest, struct hardware *hardware)
Definition: socket.c:34
int PASCAL FAR WSAGetLastError(void)
Definition: dllmain.c:131

Referenced by AdapterDiscoveryThread(), dispatch(), Server_AcquireParameters(), Server_EnableDhcp(), and slurpstring().

◆ hash_lookup()

unsigned char * hash_lookup ( struct hash_table table,
unsigned char name,
int  len 
)

Definition at line 144 of file hash.c.

148{
149 int hashno;
150 struct hash_bucket *bp;
151
152 if (!table)
153 return (unsigned char *)0;
154
155 if (!len)
156 len = strlen ((char *)name);
157
158 hashno = do_hash (name, len, table -> hash_count);
159
160 for (bp = table -> buckets [hashno]; bp; bp = bp -> next) {
161 if (len == bp -> len && !memcmp (bp -> name, name, len))
162 return bp -> value;
163 }
164 return (unsigned char *)0;
165}
unsigned char * value
Definition: dhcpd.h:268

◆ if_register_bpf()

int if_register_bpf ( struct interface_info )

◆ if_register_receive()

void if_register_receive ( struct interface_info ip)

Definition at line 687 of file adapter.c.

687 {
688}

◆ if_register_send()

void if_register_send ( struct interface_info ip)

Definition at line 683 of file adapter.c.

683 {
684
685}

◆ initialize_universes()

void initialize_universes ( void  )

Definition at line 674 of file tables.c.

675{
676 int i;
677
678 dhcp_universe.name = "dhcp";
679 dhcp_universe.hash = new_hash ();
680 if (!dhcp_universe.hash)
681 error ("Can't allocate dhcp option hash table.");
682 for (i = 0; i < 256; i++) {
683 dhcp_universe.options [i] = &dhcp_options [i];
685 (unsigned char *)dhcp_options [i].name, 0,
686 (unsigned char *)&dhcp_options [i]);
687 }
688 universe_hash.hash_count = DEFAULT_HASH_SIZE;
690 (unsigned char *)dhcp_universe.name, 0,
691 (unsigned char *)&dhcp_universe);
692}
void add_hash(struct hash_table *table, unsigned char *name, int len, unsigned char *pointer)
Definition: hash.c:82
struct hash_table * new_hash()
Definition: hash.c:53
struct hash_table universe_hash
Definition: tables.c:672
struct universe dhcp_universe
Definition: tables.c:67
struct dhcp_option dhcp_options[256]
Definition: tables.c:68
#define DEFAULT_HASH_SIZE
Definition: dhcpd.h:262

◆ interface_link_status()

int interface_link_status ( char ifname)

Definition at line 424 of file dispatch.c.

425{
426 return (1);
427}

◆ interface_or_dummy()

struct interface_info * interface_or_dummy ( char )

◆ make_client_config()

void make_client_config ( struct interface_info ,
struct client_config  
)

◆ make_client_state()

void make_client_state ( struct interface_info )

◆ make_decline()

void make_decline ( struct interface_info ip,
struct client_lease lease 
)

Definition at line 1761 of file dhclient.c.

1762{
1763 struct tree_cache *options[256], message_type_tree;
1764 struct tree_cache requested_address_tree;
1765 struct tree_cache server_id_tree, client_id_tree;
1766 unsigned char decline = DHCPDECLINE;
1767 int i;
1768
1769 memset(options, 0, sizeof(options));
1770 memset(&ip->client->packet, 0, sizeof(ip->client->packet));
1771
1772 /* Set DHCP_MESSAGE_TYPE to DHCPDECLINE */
1774 options[i] = &message_type_tree;
1775 options[i]->value = &decline;
1776 options[i]->len = sizeof(decline);
1777 options[i]->buf_size = sizeof(decline);
1778 options[i]->timeout = 0xFFFFFFFF;
1779
1780 /* Send back the server identifier... */
1782 options[i] = &server_id_tree;
1783 options[i]->value = lease->options[i].data;
1784 options[i]->len = lease->options[i].len;
1785 options[i]->buf_size = lease->options[i].len;
1786 options[i]->timeout = 0xFFFFFFFF;
1787
1788 /* Send back the address we're declining. */
1790 options[i] = &requested_address_tree;
1791 options[i]->value = lease->address.iabuf;
1792 options[i]->len = lease->address.len;
1793 options[i]->buf_size = lease->address.len;
1794 options[i]->timeout = 0xFFFFFFFF;
1795
1796 /* Send the uid if the user supplied one. */
1798 if (ip->client->config->send_options[i].len) {
1799 options[i] = &client_id_tree;
1800 options[i]->value = ip->client->config->send_options[i].data;
1801 options[i]->len = ip->client->config->send_options[i].len;
1802 options[i]->buf_size = ip->client->config->send_options[i].len;
1803 options[i]->timeout = 0xFFFFFFFF;
1804 }
1805
1806
1807 /* Set up the option buffer... */
1808 ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0,
1809 options);
1810 if (ip->client->packet_length < BOOTP_MIN_LEN)
1811 ip->client->packet_length = BOOTP_MIN_LEN;
1812
1813 ip->client->packet.op = BOOTREQUEST;
1814 ip->client->packet.htype = ip->hw_address.htype;
1815 ip->client->packet.hlen = ip->hw_address.hlen;
1816 ip->client->packet.hops = 0;
1817 ip->client->packet.xid = ip->client->xid;
1818 ip->client->packet.secs = 0; /* Filled in by send_request. */
1819 ip->client->packet.flags = 0;
1820
1821 /* ciaddr must always be zero. */
1822 memset(&ip->client->packet.ciaddr, 0,
1823 sizeof(ip->client->packet.ciaddr));
1824 memset(&ip->client->packet.yiaddr, 0,
1825 sizeof(ip->client->packet.yiaddr));
1826 memset(&ip->client->packet.siaddr, 0,
1827 sizeof(ip->client->packet.siaddr));
1828 memset(&ip->client->packet.giaddr, 0,
1829 sizeof(ip->client->packet.giaddr));
1830 memcpy(ip->client->packet.chaddr,
1831 ip->hw_address.haddr, ip->hw_address.hlen);
1832}
int cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, int mms, struct tree_cache **options)
Definition: options.c:199
#define BOOTP_MIN_LEN
Definition: dhcp.h:54
#define DHO_DHCP_CLIENT_IDENTIFIER
Definition: dhcp.h:157
#define BOOTREQUEST
Definition: dhcp.h:78
#define DHO_DHCP_REQUESTED_ADDRESS
Definition: dhcp.h:146
#define DHCPDECLINE
Definition: dhcp.h:165

◆ make_discover()

void make_discover ( struct interface_info ip,
struct client_lease lease 
)

Definition at line 1576 of file dhclient.c.

1577{
1578 unsigned char discover = DHCPDISCOVER;
1579 struct tree_cache *options[256];
1580 struct tree_cache option_elements[256];
1581 int i;
1583
1584 memset(option_elements, 0, sizeof(option_elements));
1585 memset(options, 0, sizeof(options));
1586 memset(&ip->client->packet, 0, sizeof(ip->client->packet));
1587
1588 /* Set DHCP_MESSAGE_TYPE to DHCPDISCOVER */
1590 options[i] = &option_elements[i];
1591 options[i]->value = &discover;
1592 options[i]->len = sizeof(discover);
1593 options[i]->buf_size = sizeof(discover);
1594 options[i]->timeout = 0xFFFFFFFF;
1595
1596 /* Request the options we want */
1598 options[i] = &option_elements[i];
1599 options[i]->value = ip->client->config->requested_options;
1600 options[i]->len = ip->client->config->requested_option_count;
1601 options[i]->buf_size =
1602 ip->client->config->requested_option_count;
1603 options[i]->timeout = 0xFFFFFFFF;
1604
1605 /* If we had an address, try to get it again. */
1606 if (lease) {
1607 ip->client->requested_address = lease->address;
1609 options[i] = &option_elements[i];
1610 options[i]->value = lease->address.iabuf;
1611 options[i]->len = lease->address.len;
1612 options[i]->buf_size = lease->address.len;
1613 options[i]->timeout = 0xFFFFFFFF;
1614 } else
1615 ip->client->requested_address.len = 0;
1616
1617 /* Send any options requested in the config file. */
1618 for (i = 0; i < 256; i++)
1619 if (!options[i] &&
1620 ip->client->config->send_options[i].data) {
1621 options[i] = &option_elements[i];
1622 options[i]->value =
1623 ip->client->config->send_options[i].data;
1624 options[i]->len =
1625 ip->client->config->send_options[i].len;
1626 options[i]->buf_size =
1627 ip->client->config->send_options[i].len;
1628 options[i]->timeout = 0xFFFFFFFF;
1629 }
1630
1631 /* Set up the option buffer... */
1632 ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0,
1633 options);
1634 if (ip->client->packet_length < BOOTP_MIN_LEN)
1635 ip->client->packet_length = BOOTP_MIN_LEN;
1636
1637 ip->client->packet.op = BOOTREQUEST;
1638 ip->client->packet.htype = ip->hw_address.htype;
1639 ip->client->packet.hlen = ip->hw_address.hlen;
1640 ip->client->packet.hops = 0;
1641 ip->client->packet.xid = RtlRandom(&foo);
1642 ip->client->packet.secs = 0; /* filled in by send_discover. */
1643 ip->client->packet.flags = 0;
1644
1645 memset(&(ip->client->packet.ciaddr),
1646 0, sizeof(ip->client->packet.ciaddr));
1647 memset(&(ip->client->packet.yiaddr),
1648 0, sizeof(ip->client->packet.yiaddr));
1649 memset(&(ip->client->packet.siaddr),
1650 0, sizeof(ip->client->packet.siaddr));
1651 memset(&(ip->client->packet.giaddr),
1652 0, sizeof(ip->client->packet.giaddr));
1653 memcpy(ip->client->packet.chaddr,
1654 ip->hw_address.haddr, ip->hw_address.hlen);
1655}
#define DHCPDISCOVER
Definition: dhcp.h:162
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
NTSYSAPI ULONG NTAPI RtlRandom(_Inout_ PULONG Seed)
uint32_t ULONG
Definition: typedefs.h:59

Referenced by state_init().

◆ make_release()

void make_release ( struct interface_info ip,
struct client_lease lease 
)

Definition at line 1835 of file dhclient.c.

1836{
1837 struct tree_cache *options[256], message_type_tree;
1838 struct tree_cache server_id_tree, client_id_tree;
1839 unsigned char release = DHCPRELEASE;
1840 int i;
1841
1842 memset(options, 0, sizeof(options));
1843 memset(&ip->client->packet, 0, sizeof(ip->client->packet));
1844
1845 /* Set DHCP_MESSAGE_TYPE to DHCPRELEASE */
1847 options[i] = &message_type_tree;
1848 options[i]->value = &release;
1849 options[i]->len = sizeof(release);
1850 options[i]->buf_size = sizeof(release);
1851 options[i]->timeout = 0xFFFFFFFF;
1852
1853 /* Send back the server identifier... */
1855 options[i] = &server_id_tree;
1856 options[i]->value = lease->options[i].data;
1857 options[i]->len = lease->options[i].len;
1858 options[i]->buf_size = lease->options[i].len;
1859 options[i]->timeout = 0xFFFFFFFF;
1860
1861 /* Send the uid if the user supplied one. */
1863 if (ip->client->config->send_options[i].len)
1864 {
1865 options[i] = &client_id_tree;
1866 options[i]->value = ip->client->config->send_options[i].data;
1867 options[i]->len = ip->client->config->send_options[i].len;
1868 options[i]->buf_size = ip->client->config->send_options[i].len;
1869 options[i]->timeout = 0xFFFFFFFF;
1870 }
1871
1872 /* Set up the option buffer... */
1873 ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, options);
1874 if (ip->client->packet_length < BOOTP_MIN_LEN)
1875 ip->client->packet_length = BOOTP_MIN_LEN;
1876
1877 ip->client->packet.op = BOOTREQUEST;
1878 ip->client->packet.htype = ip->hw_address.htype;
1879 ip->client->packet.hlen = ip->hw_address.hlen;
1880 ip->client->packet.hops = 0;
1881 ip->client->packet.xid = 0;
1882 ip->client->packet.secs = 0;
1883 ip->client->packet.flags = 0;
1884
1885 /* ciaddr is the address to be released */
1886 memcpy(&ip->client->packet.ciaddr,
1887 lease->address.iabuf, lease->address.len);
1888 memset(&ip->client->packet.yiaddr, 0,
1889 sizeof(ip->client->packet.yiaddr));
1890 memset(&ip->client->packet.siaddr, 0,
1891 sizeof(ip->client->packet.siaddr));
1892 memset(&ip->client->packet.giaddr, 0,
1893 sizeof(ip->client->packet.giaddr));
1894 memcpy(ip->client->packet.chaddr,
1895 ip->hw_address.haddr, ip->hw_address.hlen);
1896}
#define DHCPRELEASE
Definition: dhcp.h:168

Referenced by state_release().

◆ make_request()

void make_request ( struct interface_info ip,
struct client_lease lease 
)

Definition at line 1659 of file dhclient.c.

1660{
1661 unsigned char request = DHCPREQUEST;
1662 struct tree_cache *options[256];
1663 struct tree_cache option_elements[256];
1664 int i;
1665
1666 memset(options, 0, sizeof(options));
1667 memset(&ip->client->packet, 0, sizeof(ip->client->packet));
1668
1669 /* Set DHCP_MESSAGE_TYPE to DHCPREQUEST */
1671 options[i] = &option_elements[i];
1672 options[i]->value = &request;
1673 options[i]->len = sizeof(request);
1674 options[i]->buf_size = sizeof(request);
1675 options[i]->timeout = 0xFFFFFFFF;
1676
1677 /* Request the options we want */
1679 options[i] = &option_elements[i];
1680 options[i]->value = ip->client->config->requested_options;
1681 options[i]->len = ip->client->config->requested_option_count;
1682 options[i]->buf_size =
1683 ip->client->config->requested_option_count;
1684 options[i]->timeout = 0xFFFFFFFF;
1685
1686 /* If we are requesting an address that hasn't yet been assigned
1687 to us, use the DHCP Requested Address option. */
1688 if (ip->client->state == S_REQUESTING) {
1689 /* Send back the server identifier... */
1691 options[i] = &option_elements[i];
1692 options[i]->value = lease->options[i].data;
1693 options[i]->len = lease->options[i].len;
1694 options[i]->buf_size = lease->options[i].len;
1695 options[i]->timeout = 0xFFFFFFFF;
1696 }
1697 if (ip->client->state == S_REQUESTING ||
1698 ip->client->state == S_REBOOTING) {
1699 ip->client->requested_address = lease->address;
1701 options[i] = &option_elements[i];
1702 options[i]->value = lease->address.iabuf;
1703 options[i]->len = lease->address.len;
1704 options[i]->buf_size = lease->address.len;
1705 options[i]->timeout = 0xFFFFFFFF;
1706 } else
1707 ip->client->requested_address.len = 0;
1708
1709 /* Send any options requested in the config file. */
1710 for (i = 0; i < 256; i++)
1711 if (!options[i] &&
1712 ip->client->config->send_options[i].data) {
1713 options[i] = &option_elements[i];
1714 options[i]->value =
1715 ip->client->config->send_options[i].data;
1716 options[i]->len =
1717 ip->client->config->send_options[i].len;
1718 options[i]->buf_size =
1719 ip->client->config->send_options[i].len;
1720 options[i]->timeout = 0xFFFFFFFF;
1721 }
1722
1723 /* Set up the option buffer... */
1724 ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0,
1725 options);
1726 if (ip->client->packet_length < BOOTP_MIN_LEN)
1727 ip->client->packet_length = BOOTP_MIN_LEN;
1728
1729 ip->client->packet.op = BOOTREQUEST;
1730 ip->client->packet.htype = ip->hw_address.htype;
1731 ip->client->packet.hlen = ip->hw_address.hlen;
1732 ip->client->packet.hops = 0;
1733 ip->client->packet.xid = ip->client->xid;
1734 ip->client->packet.secs = 0; /* Filled in by send_request. */
1735
1736 /* If we own the address we're requesting, put it in ciaddr;
1737 otherwise set ciaddr to zero. */
1738 if (ip->client->state == S_BOUND ||
1739 ip->client->state == S_RENEWING ||
1740 ip->client->state == S_REBINDING) {
1741 memcpy(&ip->client->packet.ciaddr,
1742 lease->address.iabuf, lease->address.len);
1743 ip->client->packet.flags = 0;
1744 } else {
1745 memset(&ip->client->packet.ciaddr, 0,
1746 sizeof(ip->client->packet.ciaddr));
1747 ip->client->packet.flags = 0;
1748 }
1749
1750 memset(&ip->client->packet.yiaddr, 0,
1751 sizeof(ip->client->packet.yiaddr));
1752 memset(&ip->client->packet.siaddr, 0,
1753 sizeof(ip->client->packet.siaddr));
1754 memset(&ip->client->packet.giaddr, 0,
1755 sizeof(ip->client->packet.giaddr));
1756 memcpy(ip->client->packet.chaddr,
1757 ip->hw_address.haddr, ip->hw_address.hlen);
1758}
#define DHCPREQUEST
Definition: dhcp.h:164
Definition: tftpd.h:86

Referenced by state_bound(), state_reboot(), and state_selecting().

◆ new_hash()

struct hash_table * new_hash ( void  )

Definition at line 53 of file hash.c.

54{
56 if (!rv)
57 return rv;
58 memset (&rv -> buckets [0], 0,
59 DEFAULT_HASH_SIZE * sizeof (struct hash_bucket *));
60 return rv;
61}
struct hash_table * new_hash_table(int count)
Definition: alloc.c:57

Referenced by initialize_universes(), and test_put_hash().

◆ new_hash_bucket()

struct hash_bucket * new_hash_bucket ( void  )

Definition at line 71 of file alloc.c.

72{
73 struct hash_bucket *rval = calloc(1, sizeof(struct hash_bucket));
74
75 return (rval);
76}
float rval
Definition: cylfrac.c:48
#define calloc
Definition: rosglue.h:14

Referenced by add_hash().

◆ new_hash_table()

struct hash_table * new_hash_table ( int  count)

Definition at line 57 of file alloc.c.

58{
59 struct hash_table *rval;
60
61 rval = calloc(1, sizeof(struct hash_table) -
62 (DEFAULT_HASH_SIZE * sizeof(struct hash_bucket *)) +
63 (count * sizeof(struct hash_bucket *)));
64 if (rval == NULL)
65 return (NULL);
66 rval->hash_count = count;
67 return (rval);
68}

Referenced by new_hash().

◆ new_parse()

void new_parse ( char )

◆ new_string_list()

struct string_list * new_string_list ( size_t  size)

Definition at line 46 of file alloc.c.

47{
48 struct string_list *rval;
49
50 rval = calloc(1, sizeof(struct string_list) + size);
51 if (rval != NULL)
52 rval->string = ((char *)rval) + sizeof(struct string_list);
53 return (rval);
54}
GLsizeiptr size
Definition: glext.h:5919

◆ next_token()

int next_token ( char **  ,
FILE  
)

Referenced by get_token(), and wcstok_s().

◆ note()

void int int note ( char ,
  ... 
)

◆ packet_to_lease()

struct client_lease * packet_to_lease ( struct packet packet)

Definition at line 978 of file dhclient.c.

979{
980 struct client_lease *lease;
981 int i;
982
983 lease = malloc(sizeof(struct client_lease));
984
985 if (!lease) {
986 warning("dhcpoffer: no memory to record lease.");
987 return (NULL);
988 }
989
990 memset(lease, 0, sizeof(*lease));
991
992 /* Copy the lease options. */
993 for (i = 0; i < 256; i++) {
994 if (packet->options[i].len) {
995 lease->options[i].data =
996 malloc(packet->options[i].len + 1);
997 if (!lease->options[i].data) {
998 warning("dhcpoffer: no memory for option %d", i);
999 free_client_lease(lease);
1000 return (NULL);
1001 } else {
1002 memcpy(lease->options[i].data,
1003 packet->options[i].data,
1004 packet->options[i].len);
1005 lease->options[i].len =
1006 packet->options[i].len;
1007 lease->options[i].data[lease->options[i].len] =
1008 0;
1009 }
1010 if (!check_option(lease,i)) {
1011 /* ignore a bogus lease offer */
1012 warning("Invalid lease option - ignoring offer");
1013 free_client_lease(lease);
1014 return (NULL);
1015 }
1016 }
1017 }
1018
1019 lease->address.len = sizeof(packet->raw->yiaddr);
1020 memcpy(lease->address.iabuf, &packet->raw->yiaddr, lease->address.len);
1021#ifdef __REACTOS__
1022 if (packet->raw->siaddr.S_un.S_addr == 0)
1023 {
1024 lease->serveraddress.len = packet->client_addr.len;
1025 memcpy(lease->serveraddress.iabuf, &packet->client_addr.iabuf, packet->client_addr.len);
1026 }
1027 else
1028 {
1029 lease->serveraddress.len = sizeof(packet->raw->siaddr);
1030 memcpy(lease->serveraddress.iabuf, &packet->raw->siaddr, lease->serveraddress.len);
1031 }
1032#endif
1033
1034 /* If the server name was filled out, copy it. */
1036 !(packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2)) &&
1037 packet->raw->sname[0]) {
1038 lease->server_name = malloc(DHCP_SNAME_LEN + 1);
1039 if (!lease->server_name) {
1040 warning("dhcpoffer: no memory for server name.");
1041 free_client_lease(lease);
1042 return (NULL);
1043 }
1044 memcpy(lease->server_name, packet->raw->sname, DHCP_SNAME_LEN);
1045 lease->server_name[DHCP_SNAME_LEN]='\0';
1046 if (!res_hnok(lease->server_name) ) {
1047 warning("Bogus server name %s", lease->server_name );
1048 free_client_lease(lease);
1049 return (NULL);
1050 }
1051
1052 }
1053
1054 /* Ditto for the filename. */
1056 !(packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1)) &&
1057 packet->raw->file[0]) {
1058 /* Don't count on the NUL terminator. */
1059 lease->filename = malloc(DHCP_FILE_LEN + 1);
1060 if (!lease->filename) {
1061 warning("dhcpoffer: no memory for filename.");
1062 free_client_lease(lease);
1063 return (NULL);
1064 }
1065 memcpy(lease->filename, packet->raw->file, DHCP_FILE_LEN);
1066 lease->filename[DHCP_FILE_LEN]='\0';
1067 }
1068 return lease;
1069}
#define DHCP_SNAME_LEN
Definition: dhcp.h:46
int check_option(struct client_lease *l, int option)
Definition: dhclient.c:2197
int res_hnok(const char *dn)
Definition: dhclient.c:2292

Referenced by dhcpack(), and dhcpoffer().

◆ parse_client_lease_declaration()

void parse_client_lease_declaration ( FILE ,
struct client_lease ,
struct interface_info **   
)

◆ parse_client_lease_statement()

void parse_client_lease_statement ( FILE ,
int   
)

◆ parse_client_statement()

void parse_client_statement ( FILE ,
struct interface_info ,
struct client_config  
)

◆ parse_date()

time_t parse_date ( FILE )

◆ parse_hardware_param()

void parse_hardware_param ( FILE ,
struct hardware  
)

◆ parse_interface_declaration()

void parse_interface_declaration ( FILE ,
struct client_config  
)

◆ parse_ip_addr()

int parse_ip_addr ( FILE ,
struct iaddr  
)

◆ parse_lease_time()

void parse_lease_time ( FILE ,
time_t  
)

◆ parse_numeric_aggregate()

unsigned char * parse_numeric_aggregate ( FILE ,
unsigned char ,
int ,
int  ,
int  ,
int   
)

◆ parse_option_decl()

struct dhcp_option * parse_option_decl ( FILE ,
struct option_data  
)

◆ parse_option_list()

int parse_option_list ( FILE ,
u_int8_t  
)

◆ parse_reject_statement()

void parse_reject_statement ( FILE ,
struct client_config  
)

◆ parse_semi()

int parse_semi ( FILE )

◆ parse_string()

char * parse_string ( FILE )

◆ parse_string_list()

void parse_string_list ( FILE ,
struct string_list **  ,
int   
)

◆ parse_warn()

void int int int int parse_warn ( char ,
  ... 
)

◆ parse_X()

int parse_X ( FILE ,
u_int8_t ,
int   
)

◆ peek_token()

int peek_token ( char **  ,
FILE  
)

◆ piaddr()

char * piaddr ( struct iaddr  addr)

Definition at line 6 of file util.c.

6 {
7 struct sockaddr_in sa;
8 memcpy(&sa.sin_addr,addr.iabuf,sizeof(sa.sin_addr));
9 return inet_ntoa( sa.sin_addr );
10}
CHAR FAR *WSAAPI inet_ntoa(IN IN_ADDR in)
Definition: addrconv.c:160
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
GLenum const GLvoid * addr
Definition: glext.h:9621

Referenced by bind_lease(), bootp(), dhcp(), dhcpack(), dhcpnak(), dhcpoffer(), priv_script_write_params(), set_name_servers(), setup_adapter(), and write_client_lease().

◆ pretty_print_option()

char * pretty_print_option ( unsigned int  code,
unsigned char data,
int  len,
int  emit_commas,
int  emit_quotes 
)

Definition at line 396 of file options.c.

398{
399 static char optbuf[32768]; /* XXX */
400 int hunksize = 0, numhunk = -1, numelem = 0;
401 char fmtbuf[32], *op = optbuf;
402 int i, j, k, opleft = sizeof(optbuf);
403 unsigned char *dp = data;
404 struct in_addr foo;
405 char comma;
406
407 /* Code should be between 0 and 255. */
408 if (code > 255)
409 error("pretty_print_option: bad code %d", code);
410
411 if (emit_commas)
412 comma = ',';
413 else
414 comma = ' ';
415
416 /* Figure out the size of the data. */
417 for (i = 0; dhcp_options[code].format[i]; i++) {
418 if (!numhunk) {
419 warning("%s: Excess information in format string: %s",
422 break;
423 }
424 numelem++;
425 fmtbuf[i] = dhcp_options[code].format[i];
426 switch (dhcp_options[code].format[i]) {
427 case 'A':
428 --numelem;
429 fmtbuf[i] = 0;
430 numhunk = 0;
431 break;
432 case 'X':
433 for (k = 0; k < len; k++)
434 if (!isascii(data[k]) ||
435 !isprint(data[k]))
436 break;
437 if (k == len) {
438 fmtbuf[i] = 't';
439 numhunk = -2;
440 } else {
441 fmtbuf[i] = 'x';
442 hunksize++;
443 comma = ':';
444 numhunk = 0;
445 }
446 fmtbuf[i + 1] = 0;
447 break;
448 case 't':
449 fmtbuf[i] = 't';
450 fmtbuf[i + 1] = 0;
451 numhunk = -2;
452 break;
453 case 'I':
454 case 'l':
455 case 'L':
456 hunksize += 4;
457 break;
458 case 's':
459 case 'S':
460 hunksize += 2;
461 break;
462 case 'b':
463 case 'B':
464 case 'f':
465 hunksize++;
466 break;
467 case 'e':
468 break;
469 default:
470 warning("%s: garbage in format string: %s",
473 break;
474 }
475 }
476
477 /* Check for too few bytes... */
478 if (hunksize > len) {
479 warning("%s: expecting at least %d bytes; got %d",
480 dhcp_options[code].name, hunksize, len);
481 return ("<error>");
482 }
483 /* Check for too many bytes... */
484 if (numhunk == -1 && hunksize < len)
485 warning("%s: %d extra bytes",
486 dhcp_options[code].name, len - hunksize);
487
488 /* If this is an array, compute its size. */
489 if (!numhunk)
490 numhunk = len / hunksize;
491 /* See if we got an exact number of hunks. */
492 if (numhunk > 0 && numhunk * hunksize < len)
493 warning("%s: %d extra bytes at end of array",
494 dhcp_options[code].name, len - numhunk * hunksize);
495
496 /* A one-hunk array prints the same as a single hunk. */
497 if (numhunk < 0)
498 numhunk = 1;
499
500 /* Cycle through the array (or hunk) printing the data. */
501 for (i = 0; i < numhunk; i++) {
502 for (j = 0; j < numelem; j++) {
503 int opcount;
504 switch (fmtbuf[j]) {
505 case 't':
506 if (emit_quotes) {
507 *op++ = '"';
508 opleft--;
509 }
510 for (; dp < data + len; dp++) {
511 if (!isascii(*dp) ||
512 !isprint(*dp)) {
513 if (dp + 1 != data + len ||
514 *dp != 0) {
515 _snprintf(op, opleft,
516 "\\%03o", *dp);
517 op += 4;
518 opleft -= 4;
519 }
520 } else if (*dp == '"' ||
521 *dp == '\'' ||
522 *dp == '$' ||
523 *dp == '`' ||
524 *dp == '\\') {
525 *op++ = '\\';
526 *op++ = *dp;
527 opleft -= 2;
528 } else {
529 *op++ = *dp;
530 opleft--;
531 }
532 }
533 if (emit_quotes) {
534 *op++ = '"';
535 opleft--;
536 }
537
538 *op = 0;
539 break;
540 case 'I':
541 foo.s_addr = htonl(getULong(dp));
542 strncpy(op, inet_ntoa(foo), opleft - 1);
543 op[opleft - 1] = ANSI_NULL;
544 opcount = strlen(op);
545 if (opcount >= opleft)
546 goto toobig;
547 opleft -= opcount;
548 dp += 4;
549 break;
550 case 'l':
551 opcount = _snprintf(op, opleft, "%ld",
552 (long)getLong(dp));
553 if (opcount >= opleft || opcount == -1)
554 goto toobig;
555 opleft -= opcount;
556 dp += 4;
557 break;
558 case 'L':
559 opcount = _snprintf(op, opleft, "%ld",
560 (unsigned long)getULong(dp));
561 if (opcount >= opleft || opcount == -1)
562 goto toobig;
563 opleft -= opcount;
564 dp += 4;
565 break;
566 case 's':
567 opcount = _snprintf(op, opleft, "%d",
568 getShort(dp));
569 if (opcount >= opleft || opcount == -1)
570 goto toobig;
571 opleft -= opcount;
572 dp += 2;
573 break;
574 case 'S':
575 opcount = _snprintf(op, opleft, "%d",
576 getUShort(dp));
577 if (opcount >= opleft || opcount == -1)
578 goto toobig;
579 opleft -= opcount;
580 dp += 2;
581 break;
582 case 'b':
583 opcount = _snprintf(op, opleft, "%d",
584 *(char *)dp++);
585 if (opcount >= opleft || opcount == -1)
586 goto toobig;
587 opleft -= opcount;
588 break;
589 case 'B':
590 opcount = _snprintf(op, opleft, "%d", *dp++);
591 if (opcount >= opleft || opcount == -1)
592 goto toobig;
593 opleft -= opcount;
594 break;
595 case 'x':
596 opcount = _snprintf(op, opleft, "%x", *dp++);
597 if (opcount >= opleft || opcount == -1)
598 goto toobig;
599 opleft -= opcount;
600 break;
601 case 'f':
602 opcount = (size_t) strncpy(op, *dp++ ? "true" : "false", opleft - 1);
603 op[opleft - 1] = ANSI_NULL;
604 if (opcount >= opleft)
605 goto toobig;
606 opleft -= opcount;
607 break;
608 default:
609 warning("Unexpected format code %c", fmtbuf[j]);
610 }
611 op += strlen(op);
612 opleft -= strlen(op);
613 if (opleft < 1)
614 goto toobig;
615 if (j + 1 < numelem && comma != ':') {
616 *op++ = ' ';
617 opleft--;
618 }
619 }
620 if (i + 1 < numhunk) {
621 *op++ = comma;
622 opleft--;
623 }
624 if (opleft < 1)
625 goto toobig;
626
627 }
628 return (optbuf);
629 toobig:
630 warning("dhcp option too large");
631 return ("<error>");
632}
#define isprint(c)
Definition: acclib.h:73
int32_t getLong(unsigned char *data)
Definition: util.c:92
int16_t getShort(unsigned char *data)
Definition: util.c:84
UINT op
Definition: effect.c:236
unsigned int size_t
Definition: corecrt.h:203
static int __cdecl _snprintf(char *buffer, size_t size, const char *format,...) __WINE_CRT_PRINTF_ATTR(3
Definition: stdio.h:507
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define htonl(x)
Definition: module.h:214
int k
Definition: mpi.c:3369
#define ANSI_NULL
#define isascii
Definition: ctype.h:742
strncpy
Definition: string.h:335
Definition: inflate.c:139
Definition: tcpip.h:126

Referenced by check_option(), priv_script_write_params(), and write_client_lease().

◆ priv_script_go()

int priv_script_go ( void  )

◆ priv_script_init()

void priv_script_init ( struct interface_info ip,
char reason,
char medium 
)

Definition at line 2005 of file dhclient.c.

2006{
2007 if (ip) {
2008 // XXX Do we need to do anything?
2009 }
2010}

◆ priv_script_write_params()

void priv_script_write_params ( struct interface_info ip,
char prefix,
struct client_lease lease 
)

Definition at line 2013 of file dhclient.c.

2014{
2015 u_int8_t dbuf[1500];
2016 int i, len = 0;
2017
2018#if 0
2019 script_set_env(ip->client, prefix, "ip_address",
2020 piaddr(lease->address));
2021#endif
2022
2023 if (lease->options[DHO_SUBNET_MASK].len &&
2024 (lease->options[DHO_SUBNET_MASK].len <
2025 sizeof(lease->address.iabuf))) {
2026 struct iaddr netmask, subnet, broadcast;
2027
2028 memcpy(netmask.iabuf, lease->options[DHO_SUBNET_MASK].data,
2029 lease->options[DHO_SUBNET_MASK].len);
2030 netmask.len = lease->options[DHO_SUBNET_MASK].len;
2031
2032 subnet = subnet_number(lease->address, netmask);
2033 if (subnet.len) {
2034#if 0
2035 script_set_env(ip->client, prefix, "network_number",
2036 piaddr(subnet));
2037#endif
2038 if (!lease->options[DHO_BROADCAST_ADDRESS].len) {
2039 broadcast = broadcast_addr(subnet, netmask);
2040 if (broadcast.len)
2041#if 0
2042 script_set_env(ip->client, prefix,
2043 "broadcast_address",
2044 piaddr(broadcast));
2045#else
2046 ;
2047#endif
2048 }
2049 }
2050 }
2051
2052#if 0
2053 if (lease->filename)
2054 script_set_env(ip->client, prefix, "filename", lease->filename);
2055 if (lease->server_name)
2056 script_set_env(ip->client, prefix, "server_name",
2057 lease->server_name);
2058#endif
2059
2060 for (i = 0; i < 256; i++) {
2061 u_int8_t *dp = NULL;
2062
2063 if (ip->client->config->defaults[i].len) {
2064 if (lease->options[i].len) {
2065 switch (
2066 ip->client->config->default_actions[i]) {
2067 case ACTION_DEFAULT:
2068 dp = lease->options[i].data;
2069 len = lease->options[i].len;
2070 break;
2071 case ACTION_SUPERSEDE:
2072supersede:
2073 dp = ip->client->
2074 config->defaults[i].data;
2075 len = ip->client->
2076 config->defaults[i].len;
2077 break;
2078 case ACTION_PREPEND:
2079 len = ip->client->
2080 config->defaults[i].len +
2081 lease->options[i].len;
2082 if (len >= sizeof(dbuf)) {
2083 warning("no space to %s %s",
2084 "prepend option",
2086 goto supersede;
2087 }
2088 dp = dbuf;
2089 memcpy(dp,
2090 ip->client->
2091 config->defaults[i].data,
2092 ip->client->
2093 config->defaults[i].len);
2094 memcpy(dp + ip->client->
2095 config->defaults[i].len,
2096 lease->options[i].data,
2097 lease->options[i].len);
2098 dp[len] = '\0';
2099 break;
2100 case ACTION_APPEND:
2101 len = ip->client->
2102 config->defaults[i].len +
2103 lease->options[i].len + 1;
2104 if (len > sizeof(dbuf)) {
2105 warning("no space to %s %s",
2106 "append option",
2108 goto supersede;
2109 }
2110 dp = dbuf;
2111 memcpy(dp,
2112 lease->options[i].data,
2113 lease->options[i].len);
2114 memcpy(dp + lease->options[i].len,
2115 ip->client->
2116 config->defaults[i].data,
2117 ip->client->
2118 config->defaults[i].len);
2119 dp[len-1] = '\0';
2120 }
2121 } else {
2122 dp = ip->client->
2123 config->defaults[i].data;
2124 len = ip->client->
2125 config->defaults[i].len;
2126 }
2127 } else if (lease->options[i].len) {
2128 len = lease->options[i].len;
2129 dp = lease->options[i].data;
2130 } else {
2131 len = 0;
2132 }
2133#if 0
2134 if (len) {
2135 char name[256];
2136
2137 if (dhcp_option_ev_name(name, sizeof(name),
2138 &dhcp_options[i]))
2139 script_set_env(ip->client, prefix, name,
2140 pretty_print_option(i, dp, len, 0, 0));
2141 }
2142#endif
2143 }
2144#if 0
2145 snprintf(tbuf, sizeof(tbuf), "%d", (int)lease->expiry);
2146 script_set_env(ip->client, prefix, "expiry", tbuf);
2147#endif
2148}
char * pretty_print_option(unsigned int code, unsigned char *data, int len, int emit_commas, int emit_quotes)
Definition: options.c:396
struct iaddr broadcast_addr(struct iaddr addr, struct iaddr mask)
Definition: util.c:178
struct iaddr subnet_number(struct iaddr addr, struct iaddr mask)
Definition: util.c:183
#define DHO_BROADCAST_ADDRESS
Definition: dhcp.h:124
#define DHO_SUBNET_MASK
Definition: dhcp.h:97
int dhcp_option_ev_name(char *buf, size_t buflen, struct dhcp_option *option)
Definition: dhclient.c:2151
void script_set_env(struct client_state *, const char *, const char *, const char *)
unsigned char u_int8_t
Definition: rosdhcp.h:37
time_t expiry
Definition: dhcpd.h:155
Character const *const prefix
Definition: tempnam.cpp:195
static const u8_t broadcast[6]
Definition: test_dhcp.c:23
#define snprintf
Definition: wintirpc.h:48

◆ putLong()

void putLong ( unsigned char ,
int32_t   
)

◆ putShort()

void putShort ( unsigned char ,
int   
)

◆ putULong()

void putULong ( unsigned char ,
u_int32_t   
)

◆ putUShort()

void putUShort ( unsigned char ,
unsigned int   
)

◆ read_client_conf()

int read_client_conf ( struct interface_info ifi)

Definition at line 106 of file util.c.

106 {
107 /* What a strange dance */
108 struct client_config *config;
109 char ComputerName [MAX_COMPUTERNAME_LENGTH + 1];
110 LPSTR lpCompName;
111 DWORD ComputerNameSize = sizeof ComputerName / sizeof ComputerName[0];
112 LPSTR lpClassIdentifier = "MSFT 5.0";
113
114 if ((ifi!= NULL) && (ifi->client->config != NULL))
115 config = ifi->client->config;
116 else
117 {
118 warn("util.c read_client_conf poorly implemented!");
119 return 0;
120 }
121
122
123 GetComputerName(ComputerName, & ComputerNameSize);
124 debug("Hostname: %s, length: %lu",
125 ComputerName, ComputerNameSize);
126 /* This never gets freed since it's only called once */
127 lpCompName =
128 HeapAlloc(GetProcessHeap(), 0, ComputerNameSize + 1);
129 if (lpCompName !=NULL) {
130 memcpy(lpCompName, ComputerName, ComputerNameSize + 1);
131 /* Send our hostname, some dhcpds use this to update DNS */
132 config->send_options[DHO_HOST_NAME].data = (u_int8_t*)lpCompName;
133 config->send_options[DHO_HOST_NAME].len = ComputerNameSize;
134 debug("Hostname: %s, length: %d",
135 config->send_options[DHO_HOST_NAME].data,
136 config->send_options[DHO_HOST_NAME].len);
137 } else {
138 error("Failed to allocate heap for hostname");
139 }
140 /* Both Linux and Windows send this */
141 config->send_options[DHO_DHCP_CLIENT_IDENTIFIER].data =
142 ifi->hw_address.haddr;
143 config->send_options[DHO_DHCP_CLIENT_IDENTIFIER].len =
144 ifi->hw_address.hlen;
145
146 /* Set the Vendor Class ID */
147 config->send_options[DHO_DHCP_CLASS_IDENTIFIER].data = (u_int8_t*)lpClassIdentifier;
148 config->send_options[DHO_DHCP_CLASS_IDENTIFIER].len = strlen(lpClassIdentifier);
149
150 /* Setup the requested option list */
151 config->requested_options
152 [config->requested_option_count++] = DHO_SUBNET_MASK;
153 config->requested_options
154 [config->requested_option_count++] = DHO_DOMAIN_NAME;
155 config->requested_options
156 [config->requested_option_count++] = DHO_ROUTERS;
157 config->requested_options
158 [config->requested_option_count++] = DHO_DOMAIN_NAME_SERVERS;
159 config->requested_options
160 [config->requested_option_count++] = DHO_NETBIOS_NAME_SERVERS;
161 config->requested_options
162 [config->requested_option_count++] = DHO_NETBIOS_NODE_TYPE;
163 config->requested_options
164 [config->requested_option_count++] = DHO_NETBIOS_SCOPE;
165 config->requested_options
166 [config->requested_option_count++] = DHO_ROUTER_DISCOVERY;
167 config->requested_options
168 [config->requested_option_count++] = DHO_STATIC_ROUTES;
169 config->requested_options
170 [config->requested_option_count++] = 249;
171 config->requested_options
172 [config->requested_option_count++] = DHO_VENDOR_ENCAPSULATED_OPTIONS;
173
174 warn("util.c read_client_conf poorly implemented!");
175 return 0;
176}
#define DHO_ROUTER_DISCOVERY
Definition: dhcp.h:127
#define DHO_VENDOR_ENCAPSULATED_OPTIONS
Definition: dhcp.h:139
#define DHO_NETBIOS_NAME_SERVERS
Definition: dhcp.h:140
#define DHO_NETBIOS_SCOPE
Definition: dhcp.h:143
#define DHO_NETBIOS_NODE_TYPE
Definition: dhcp.h:142
#define DHO_HOST_NAME
Definition: dhcp.h:108
#define DHO_DOMAIN_NAME
Definition: dhcp.h:111
#define DHO_DOMAIN_NAME_SERVERS
Definition: dhcp.h:102
#define DHO_ROUTERS
Definition: dhcp.h:99
#define DHO_STATIC_ROUTES
Definition: dhcp.h:129
#define DHO_DHCP_CLASS_IDENTIFIER
Definition: dhcp.h:156
struct config_s config
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
unsigned long DWORD
Definition: ntddk_ex.h:95
struct client_state * client
Definition: dhcpd.h:241
struct hardware hw_address
Definition: dhcpd.h:232
char * LPSTR
Definition: typedefs.h:51
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:267
#define GetComputerName
Definition: winbase.h:3549

Referenced by AdapterDiscoveryThread().

◆ read_client_leases()

void read_client_leases ( void  )

◆ receive_packet()

ssize_t receive_packet ( struct interface_info ip,
unsigned char packet_data,
size_t  packet_len,
struct sockaddr_in dest,
struct hardware hardware 
)

Definition at line 34 of file socket.c.

38 {
39 int recv_addr_size = sizeof(*dest);
40 int result;
41
42 if (packet_len > INT_MAX)
43 return WSAEMSGSIZE;
44
45 result =
46 recvfrom (ip -> rfdesc, (char *)packet_data, (int)packet_len, 0,
47 (struct sockaddr *)dest, &recv_addr_size );
48 return result;
49}
INT WSAAPI recvfrom(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags, OUT LPSOCKADDR from, IN OUT INT FAR *fromlen)
Definition: recv.c:87
static char * dest
Definition: rtl.c:135
#define WSAEMSGSIZE
Definition: winerror.h:2856

Referenced by got_one().

◆ reinitialize_interfaces()

void reinitialize_interfaces ( void  )

◆ remove_protocol()

void remove_protocol ( struct protocol proto)

Definition at line 359 of file dispatch.c.

360{
361 struct protocol *p, *next, *prev;
362 struct interface_info *ip = proto->local;
363 struct timeout *t, *q, *u;
364
365 t = NULL;
366 q = timeouts;
367 while (q != NULL)
368 {
369 /* Remove all timeouts for this protocol */
370 if (q->what == ip)
371 {
372 /* Unlink the timeout from previous */
373 if (t)
374 t->next = q->next;
375 else
376 timeouts = q->next;
377
378 /* Advance to the next timeout */
379 u = q->next;
380
381 /* Add it to the free list */
382 q->next = free_timeouts;
384 }
385 else
386 {
387 /* Advance to the next timeout */
388 u = q->next;
389
390 /* Update the previous pointer */
391 t = q;
392 }
393
394 /* Advance */
395 q = u;
396 }
397
398 prev = NULL;
399 for (p = protocols; p; p = next) {
400 next = p->next;
401 if (p == proto) {
402 if (prev)
403 prev->next = p->next;
404 else
405 protocols = p->next;
406 free(p);
407 }
408 }
409}
struct protocol * next
Definition: dhcpd.h:256

Referenced by AdapterDiscoveryThread(), got_one(), Server_AcquireParameters(), Server_EnableDhcp(), Server_ReleaseParameters(), and Server_StaticRefreshParams().

◆ rewrite_client_leases()

void rewrite_client_leases ( struct interface_info ifi)

Definition at line 1917 of file dhclient.c.

1918{
1919 struct client_lease *lp;
1920
1921 if (!leaseFile) {
1923 if (!leaseFile)
1924 error("can't create %s", path_dhclient_db);
1925 } else {
1928 }
1929
1930 for (lp = ifi->client->leases; lp; lp = lp->next)
1931 write_client_lease(ifi, lp, 1);
1932 if (ifi->client->active)
1933 write_client_lease(ifi, ifi->client->active, 1);
1934
1936}
char * path_dhclient_db
Definition: dhclient.c:74
void write_client_lease(struct interface_info *ip, struct client_lease *lease, int rewrite)
Definition: dhclient.c:1939
FILE * leaseFile
Definition: dhclient.c:1914
FILE *CDECL fopen(const char *path, const char *mode)
Definition: file.c:4310
void CDECL rewind(FILE *file)
Definition: file.c:1712
int CDECL fflush(FILE *file)
Definition: file.c:1182

Referenced by write_client_lease().

◆ script_flush_env()

void script_flush_env ( struct client_state )

◆ script_go()

int script_go ( void  )

◆ script_init()

void script_init ( char ,
struct string_list  
)

◆ script_set_env()

void script_set_env ( struct client_state ,
const char ,
const char ,
const char  
)

◆ script_write_params()

void script_write_params ( char ,
struct client_lease  
)

◆ send_decline()

void send_decline ( void ipp)

Definition at line 1537 of file dhclient.c.

1538{
1539 struct interface_info *ip = ipp;
1540
1541 note("DHCPDECLINE on %s to %s port %d", ip->name,
1542 inet_ntoa(sockaddr_broadcast.sin_addr),
1543 ntohs(sockaddr_broadcast.sin_port));
1544
1545 /* Send out a packet. */
1546 (void) send_packet(ip, &ip->client->packet, ip->client->packet_length,
1548}
struct in_addr inaddr_any
Definition: dhclient.c:81
struct sockaddr_in sockaddr_broadcast
Definition: dhclient.c:82
ssize_t send_packet(struct interface_info *ip, struct dhcp_packet *p, size_t size, struct in_addr addr, struct sockaddr_in *broadcast, struct hardware *hardware)
Definition: socket.c:9

◆ send_discover()

void send_discover ( void ipp)

Definition at line 1112 of file dhclient.c.

1113{
1114 struct interface_info *ip = ipp;
1115 int interval, increase = 1;
1117
1118 DH_DbgPrint(MID_TRACE,("Doing discover on interface %p\n",ip));
1119
1120 time(&cur_time);
1121
1122 /* Figure out how long it's been since we started transmitting. */
1123 interval = cur_time - ip->client->first_sending;
1124
1125 /* If we're past the panic timeout, call the script and tell it
1126 we haven't found anything for this interface yet. */
1127 if (interval > ip->client->config->timeout) {
1128 state_panic(ip);
1129 ip->client->first_sending = cur_time;
1130 }
1131
1132 /* If we're selecting media, try the whole list before doing
1133 the exponential backoff, but if we've already received an
1134 offer, stop looping, because we obviously have it right. */
1135 if (!ip->client->offered_leases &&
1136 ip->client->config->media) {
1137 int fail = 0;
1138
1139 if (ip->client->medium) {
1140 ip->client->medium = ip->client->medium->next;
1141 increase = 0;
1142 }
1143 if (!ip->client->medium) {
1144 if (fail)
1145 error("No valid media types for %s!", ip->name);
1146 ip->client->medium = ip->client->config->media;
1147 increase = 1;
1148 }
1149
1150 note("Trying medium \"%s\" %d", ip->client->medium->string,
1151 increase);
1152 /* XXX Support other media types eventually */
1153 }
1154
1155 /*
1156 * If we're supposed to increase the interval, do so. If it's
1157 * currently zero (i.e., we haven't sent any packets yet), set
1158 * it to one; otherwise, add to it a random number between zero
1159 * and two times itself. On average, this means that it will
1160 * double with every transmission.
1161 */
1162 if (increase) {
1163 if (!ip->client->interval)
1164 ip->client->interval =
1165 ip->client->config->initial_interval;
1166 else {
1167 ip->client->interval += (rand() >> 2) %
1168 (2 * ip->client->interval);
1169 }
1170
1171 /* Don't backoff past cutoff. */
1172 if (ip->client->interval >
1173 ip->client->config->backoff_cutoff)
1174 ip->client->interval =
1175 ((ip->client->config->backoff_cutoff / 2)
1176 + ((rand() >> 2) %
1177 ip->client->config->backoff_cutoff));
1178 } else if (!ip->client->interval)
1179 ip->client->interval =
1180 ip->client->config->initial_interval;
1181
1182 /* If the backoff would take us to the panic timeout, just use that
1183 as the interval. */
1184 if (cur_time + ip->client->interval >
1185 ip->client->first_sending + ip->client->config->timeout)
1186 ip->client->interval =
1187 (ip->client->first_sending +
1188 ip->client->config->timeout) - cur_time + 1;
1189
1190 /* Record the number of seconds since we started sending. */
1191 if (interval < 65536)
1192 ip->client->packet.secs = htons(interval);
1193 else
1194 ip->client->packet.secs = htons(65535);
1195 ip->client->secs = ip->client->packet.secs;
1196
1197 note("DHCPDISCOVER on %s to %s port %d interval %ld",
1198 ip->name, inet_ntoa(sockaddr_broadcast.sin_addr),
1199 ntohs(sockaddr_broadcast.sin_port), (long int)ip->client->interval);
1200
1201 /* Send out a packet. */
1202 (void)send_packet(ip, &ip->client->packet, ip->client->packet_length,
1204
1205 DH_DbgPrint(MID_TRACE,("discover timeout: now %x -> then %x\n",
1206 cur_time, cur_time + ip->client->interval));
1207
1208 add_timeout(cur_time + ip->client->interval, send_discover, ip);
1209}
void state_panic(void *ipp)
Definition: dhclient.c:1218
_ACRTIMP int __cdecl rand(void)
Definition: misc.c:59
static void increase(int &a_)
#define htons(x)
Definition: module.h:215

Referenced by dhcpoffer(), send_discover(), state_init(), and state_selecting().

◆ send_packet()

ssize_t send_packet ( struct interface_info ip,
struct dhcp_packet p,
size_t  size,
struct in_addr  addr,
struct sockaddr_in broadcast,
struct hardware hardware 
)

Definition at line 9 of file socket.c.

14 {
15 int result;
16
17 if (size > INT_MAX)
18 return WSAEMSGSIZE;
19
20 result =
21 sendto( ip->wfdesc, (char *)p, (int)size, 0,
22 (struct sockaddr *)broadcast, sizeof(*broadcast) );
23
24 if (result < 0) {
25 note ("send_packet: %x", result);
27 note ("send_packet: please consult README file%s",
28 " regarding broadcast address.");
29 }
30
31 return result;
32}
INT WSAAPI sendto(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags, IN CONST struct sockaddr *to, IN INT tolen)
Definition: send.c:82
#define WSAENETUNREACH
Definition: winerror.h:2867

Referenced by send_decline(), send_discover(), send_release(), and send_request().

◆ send_release()

void send_release ( void ipp)

Definition at line 1551 of file dhclient.c.

1552{
1553 struct interface_info *ip = ipp;
1554 struct sockaddr_in destination;
1555 struct in_addr from;
1556
1557 memset(&destination, 0, sizeof(destination));
1558 memcpy(&destination.sin_addr.s_addr,
1559 ip->client->destination.iabuf,
1560 sizeof(destination.sin_addr.s_addr));
1561 destination.sin_port = htons(REMOTE_PORT);
1562 destination.sin_family = AF_INET;
1563
1564 memcpy(&from, ip->client->active->address.iabuf,
1565 sizeof(from));
1566
1567 note("DHCPRELEASE on %s to %s port %d", ip->name,
1568 inet_ntoa(destination.sin_addr), ntohs(destination.sin_port));
1569
1570 /* Send out a packet. */
1571 (void) send_packet(ip, &ip->client->packet, ip->client->packet_length,
1572 from, &destination, NULL);
1573}
#define REMOTE_PORT
Definition: dhcpd.h:113
#define AF_INET
Definition: tcpip.h:117

Referenced by state_release().

◆ send_request()

void send_request ( void ipp)

Definition at line 1408 of file dhclient.c.

1409{
1410 struct interface_info *ip = ipp;
1411 struct sockaddr_in destination;
1412 struct in_addr from;
1413 int interval;
1415
1416 time(&cur_time);
1417
1418 /* Figure out how long it's been since we started transmitting. */
1419 interval = cur_time - ip->client->first_sending;
1420
1421 /* If we're in the INIT-REBOOT or REQUESTING state and we're
1422 past the reboot timeout, go to INIT and see if we can
1423 DISCOVER an address... */
1424 /* XXX In the INIT-REBOOT state, if we don't get an ACK, it
1425 means either that we're on a network with no DHCP server,
1426 or that our server is down. In the latter case, assuming
1427 that there is a backup DHCP server, DHCPDISCOVER will get
1428 us a new address, but we could also have successfully
1429 reused our old address. In the former case, we're hosed
1430 anyway. This is not a win-prone situation. */
1431 if ((ip->client->state == S_REBOOTING ||
1432 ip->client->state == S_REQUESTING) &&
1433 interval > ip->client->config->reboot_timeout) {
1434 ip->client->state = S_INIT;
1436 state_init(ip);
1437 return;
1438 }
1439
1440 /* If we're in the reboot state, make sure the media is set up
1441 correctly. */
1442 if (ip->client->state == S_REBOOTING &&
1443 !ip->client->medium &&
1444 ip->client->active->medium ) {
1445 /* If the medium we chose won't fly, go to INIT state. */
1446 /* XXX Nothing for now */
1447
1448 /* Record the medium. */
1449 ip->client->medium = ip->client->active->medium;
1450 }
1451
1452 /* If the lease has expired, relinquish the address and go back
1453 to the INIT state. */
1454 if (ip->client->state != S_REQUESTING &&
1455 cur_time > ip->client->active->expiry) {
1456 PDHCP_ADAPTER Adapter = AdapterFindInfo( ip );
1457 /* Run the client script with the new parameters. */
1458 /* No script actions necessary in the expiry case */
1459 /* Now do a preinit on the interface so that we can
1460 discover a new address. */
1461
1462 if( Adapter )
1463 {
1464 DeleteIPAddress( Adapter->NteContext );
1465 Adapter->NteContext = 0;
1466 }
1467
1468 ip->client->state = S_INIT;
1469 state_init(ip);
1470 return;
1471 }
1472
1473 /* Do the exponential backoff... */
1474 if (!ip->client->interval)
1475 ip->client->interval = ip->client->config->initial_interval;
1476 else
1477 ip->client->interval += ((rand() >> 2) %
1478 (2 * ip->client->interval));
1479
1480 /* Don't backoff past cutoff. */
1481 if (ip->client->interval >
1482 ip->client->config->backoff_cutoff)
1483 ip->client->interval =
1484 ((ip->client->config->backoff_cutoff / 2) +
1485 ((rand() >> 2) % ip->client->interval));
1486
1487 /* If the backoff would take us to the expiry time, just set the
1488 timeout to the expiry time. */
1489 if (ip->client->state != S_REQUESTING &&
1490 cur_time + ip->client->interval >
1491 ip->client->active->expiry)
1492 ip->client->interval =
1493 ip->client->active->expiry - cur_time + 1;
1494
1495 /* If the lease T2 time has elapsed, or if we're not yet bound,
1496 broadcast the DHCPREQUEST rather than unicasting. */
1497 memset(&destination, 0, sizeof(destination));
1498 if (ip->client->state == S_REQUESTING ||
1499 ip->client->state == S_REBOOTING ||
1500 cur_time > ip->client->active->rebind)
1501 destination.sin_addr.s_addr = INADDR_BROADCAST;
1502 else
1503 memcpy(&destination.sin_addr.s_addr,
1504 ip->client->destination.iabuf,
1505 sizeof(destination.sin_addr.s_addr));
1506 destination.sin_port = htons(REMOTE_PORT);
1507 destination.sin_family = AF_INET;
1508// destination.sin_len = sizeof(destination);
1509
1510 if (ip->client->state != S_REQUESTING)
1511 memcpy(&from, ip->client->active->address.iabuf,
1512 sizeof(from));
1513 else
1514 from.s_addr = INADDR_ANY;
1515
1516 /* Record the number of seconds since we started sending. */
1517 if (ip->client->state == S_REQUESTING)
1518 ip->client->packet.secs = ip->client->secs;
1519 else {
1520 if (interval < 65536)
1521 ip->client->packet.secs = htons(interval);
1522 else
1523 ip->client->packet.secs = htons(65535);
1524 }
1525
1526 note("DHCPREQUEST on %s to %s port %d", ip->name,
1527 inet_ntoa(destination.sin_addr), ntohs(destination.sin_port));
1528
1529 /* Send out a packet. */
1530 (void) send_packet(ip, &ip->client->packet, ip->client->packet_length,
1531 from, &destination, NULL);
1532
1533 add_timeout(cur_time + ip->client->interval, send_request, ip);
1534}
DWORD WINAPI DeleteIPAddress(ULONG NTEContext)
#define INADDR_BROADCAST
Definition: inet.h:82
#define INADDR_ANY
Definition: inet.h:80
ULONG NteContext
Definition: rosdhcp.h:85

◆ skip_to_semi()

void skip_to_semi ( FILE )

◆ state_bound()

void state_bound ( void ipp)

Definition at line 777 of file dhclient.c.

778{
779 struct interface_info *ip = ipp;
780
782
783 /* T1 has expired. */
784 make_request(ip, ip->client->active);
785 ip->client->xid = ip->client->packet.xid;
786
787 if (ip->client->active->options[DHO_DHCP_SERVER_IDENTIFIER].len == 4) {
788 memcpy(ip->client->destination.iabuf, ip->client->active->
790 ip->client->destination.len = 4;
791 } else
792 ip->client->destination = iaddr_broadcast;
793
794 time(&ip->client->first_sending);
795 ip->client->interval = ip->client->config->initial_interval;
796 ip->client->state = S_RENEWING;
797
798 /* Send the first packet immediately. */
800}
static int state
Definition: maze.c:121
void make_request(struct interface_info *ip, struct client_lease *lease)
Definition: dhclient.c:1659
struct iaddr iaddr_broadcast
Definition: dhclient.c:80
#define ASSERT_STATE(state_is, state_shouldbe)
Definition: dhclient.c:88

Referenced by bind_lease().

◆ state_init()

void state_init ( void ipp)

Definition at line 210 of file dhclient.c.

211{
212 struct interface_info *ip = ipp;
213
215
216 /* Make a DHCPDISCOVER packet, and set appropriate per-interface
217 flags. */
218 make_discover(ip, ip->client->active);
219 ip->client->xid = ip->client->packet.xid;
220 ip->client->destination = iaddr_broadcast;
221 ip->client->state = S_SELECTING;
222 time(&ip->client->first_sending);
223 ip->client->interval = ip->client->config->initial_interval;
224
225 /* Add an immediate timeout to cause the first DHCPDISCOVER packet
226 to go out. */
228}
void make_discover(struct interface_info *ip, struct client_lease *lease)
Definition: dhclient.c:1576

Referenced by AdapterDiscoveryThread(), device_init(), dhcpnak(), send_request(), state_reboot(), state_selecting(), wined3d_cs_create(), wined3d_cs_exec_reset_state(), and wined3d_device_reset().

◆ state_panic()

void state_panic ( void ipp)

Definition at line 1218 of file dhclient.c.

1219{
1220 CHAR szKeyNameBuffer[200] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\";
1221 CHAR Server[] = "255.255.255.255";
1222 CHAR SubnetMask[] = "255.255.0.0";
1223 CHAR AddressBuffer[32];
1224 struct interface_info *ip = ipp;
1225 uint16_t address_low;
1226 int i;
1227 IPAddr IpAddress;
1228 ULONG Buffer[20];
1230 DWORD ret;
1231 HKEY hKey = NULL;
1232 PDHCP_ADAPTER Adapter = AdapterFindInfo(ip);
1234 DWORD lease = 0;
1235 time_t cur_time, never_time = 0x7FFFFFFF;
1236 struct in_addr addr;
1237 DWORD dwAddressType = 0;
1238
1239 note("No DHCPOFFERS received.");
1240
1241 time(&cur_time);
1242
1243 strcat(szKeyNameBuffer, Adapter->DhclientInfo.name);
1244 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, szKeyNameBuffer, 0, KEY_WRITE, &hKey) != ERROR_SUCCESS)
1245 hKey = NULL;
1246
1247 if (Adapter && !Adapter->NteContext)
1248 {
1249 DH_DbgPrint(MID_TRACE,("DHCPCSVC: Failed to receive a response from a DHCP server\n"));
1250 if ((Adapter->AlternateConfiguration != NULL) &&
1251 (Adapter->AlternateConfiguration->IpAddress != 0))
1252 {
1253 /* Use the alternate configuration */
1254 DH_DbgPrint(MID_TRACE,("DHCPCSVC: The alternate configuration will be used.\n"));
1255
1256 /* IPAddress & SubnetMask */
1259 Adapter->IfMib.dwIndex,
1260 &Adapter->NteContext,
1261 &Adapter->NteInstance);
1262 if (!NT_SUCCESS(Status))
1263 DH_DbgPrint(MID_TRACE,("AddIPAddress: %lx\n", Status));
1264
1265 /* DefaultGateway */
1266 if (Adapter->AlternateConfiguration->DefaultGateway != 0)
1267 {
1268 Adapter->RouterMib.dwForwardDest = 0; /* Default route */
1269 Adapter->RouterMib.dwForwardMask = 0;
1270 Adapter->RouterMib.dwForwardMetric1 = 1;
1271 Adapter->RouterMib.dwForwardIfIndex = Adapter->IfMib.dwIndex;
1272
1273 if (Adapter->RouterMib.dwForwardNextHop)
1274 {
1275 /* If we set a default route before, delete it before continuing */
1277 }
1278
1280
1282 if (!NT_SUCCESS(Status))
1283 DH_DbgPrint(MID_TRACE,("CreateIpForwardEntry: %lx\n", Status));
1284 }
1285
1286 if (hKey)
1287 {
1288 addr.S_un.S_addr = htonl(Adapter->AlternateConfiguration->IpAddress);
1289 RtlIpv4AddressToStringA(&addr, AddressBuffer);
1290 RegSetValueExA(hKey, "DhcpIPAddress", 0, REG_SZ, (LPBYTE)AddressBuffer, strlen(AddressBuffer) + 1);
1291 addr.S_un.S_addr = htonl(Adapter->AlternateConfiguration->SubnetMask);
1292 RtlIpv4AddressToStringA(&addr, AddressBuffer);
1293 RegSetValueExA(hKey, "DhcpSubnetMask", 0, REG_SZ, (LPBYTE)AddressBuffer, strlen(AddressBuffer) + 1);
1294 if (Adapter->AlternateConfiguration->DefaultGateway != 0)
1295 {
1296 addr.S_un.S_addr = htonl(Adapter->AlternateConfiguration->DefaultGateway);
1297 RtlIpv4AddressToStringA(&addr, AddressBuffer);
1298 RegSetValueExA(hKey, "DhcpDefaultGateway", 0, REG_SZ, (LPBYTE)AddressBuffer, strlen(AddressBuffer) + 1);
1299 }
1300 else
1301 {
1302 RegDeleteValueA(hKey, "DhcpDefaultGateway");
1303 }
1304 RegSetValueExA(hKey, "DhcpServer", 0, REG_SZ, (LPBYTE)Server, strlen(Server) + 1);
1305 RegDeleteValueA(hKey, "DhcpDomain");
1306
1307 if (Adapter->AlternateConfiguration->DnsServer1 != 0)
1308 {
1309 char *pPtr;
1310 addr.S_un.S_addr = htonl(Adapter->AlternateConfiguration->DnsServer1);
1311 pPtr = RtlIpv4AddressToStringA(&addr, AddressBuffer);
1312 if (Adapter->AlternateConfiguration->DnsServer2 != 0)
1313 {
1314 *pPtr = ' ';
1315 pPtr++;
1316 addr.S_un.S_addr = htonl(Adapter->AlternateConfiguration->DnsServer2);
1318 }
1319
1320 RegSetValueExA(hKey, "DhcpNameServer", 0, REG_SZ, (LPBYTE)AddressBuffer, strlen(AddressBuffer) + 1);
1321 }
1322 else
1323 {
1324 RegDeleteValueA(hKey, "DhcpNameServer");
1325 }
1326
1327 RegDeleteValueA(hKey, "IPAutoconfigurationAddress");
1328 RegDeleteValueA(hKey, "IPAutoconfigurationMask");
1329
1330 RegSetValueExA(hKey, "Lease", 0, REG_DWORD, (LPBYTE)&lease, sizeof(DWORD));
1331 RegSetValueExA(hKey, "LeaseObtainedTime", 0, REG_DWORD, (LPBYTE)&cur_time, sizeof(DWORD));
1332 RegSetValueExA(hKey, "LeaseTerminatesTime", 0, REG_DWORD, (LPBYTE)&never_time, sizeof(DWORD));
1333 RegSetValueExA(hKey, "T1", 0, REG_DWORD, (LPBYTE)&cur_time, sizeof(DWORD));
1334 RegSetValueExA(hKey, "T2", 0, REG_DWORD, (LPBYTE)&cur_time, sizeof(DWORD));
1335 RegSetValueExA(hKey, "AddressType", 0, REG_DWORD, (LPBYTE)&dwAddressType, sizeof(DWORD));
1336 }
1337 }
1338 else
1339 {
1340 /* Generate an automatic private address */
1341 DH_DbgPrint(MID_TRACE,("DHCPCSVC: An automatic private address will be assigned.\n"));
1342
1343 /* FIXME: The address generation code sucks */
1344 srand(0);
1345
1346 for (;;)
1347 {
1348 address_low = rand();
1349 for (i = 0; i < ip->hw_address.hlen; i++)
1350 address_low += ip->hw_address.haddr[i];
1351
1352 IpAddress = htonl(0xA9FE0000 | address_low); // 169.254.X.X
1353
1354 /* Send an ARP request to check if the IP address is already in use */
1355 BufferSize = sizeof(Buffer);
1356 ret = SendARP(IpAddress,
1357 IpAddress,
1358 Buffer,
1359 &BufferSize);
1360 DH_DbgPrint(MID_TRACE,("DHCPCSVC: SendARP returned %lu\n", ret));
1361 if (ret != 0)
1362 {
1363 /* The IP address is not in use */
1364 DH_DbgPrint(MID_TRACE,("DHCPCSVC: Using automatic private address\n"));
1365 Status = AddIPAddress(IpAddress,
1366 htonl(0xFFFF0000), // 255.255.0.0
1367 Adapter->IfMib.dwIndex,
1368 &Adapter->NteContext,
1369 &Adapter->NteInstance);
1370 if (!NT_SUCCESS(Status))
1371 DH_DbgPrint(MID_TRACE,("AddIPAddress: %lx\n", Status));
1372
1373 if (hKey)
1374 {
1375 addr.S_un.S_addr = IpAddress;
1376 RtlIpv4AddressToStringA(&addr, AddressBuffer);
1377 RegSetValueExA(hKey, "DhcpIPAddress", 0, REG_SZ, (LPBYTE)AddressBuffer, strlen(AddressBuffer) + 1);
1378 RegSetValueExA(hKey, "DhcpSubnetMask", 0, REG_SZ, (LPBYTE)SubnetMask, strlen(SubnetMask) + 1);
1379 RegSetValueExA(hKey, "DhcpServer", 0, REG_SZ, (LPBYTE)Server, strlen(Server) + 1);
1380 RegDeleteValueA(hKey, "DhcpDefaultGateway");
1381 RegDeleteValueA(hKey, "DhcpDomain");
1382 RegDeleteValueA(hKey, "DhcpNameServer");
1383
1384 RegSetValueExA(hKey, "IPAutoconfigurationAddress", 0, REG_SZ, (LPBYTE)AddressBuffer, strlen(AddressBuffer) + 1);
1385 RegSetValueExA(hKey, "IPAutoconfigurationMask", 0, REG_SZ, (LPBYTE)SubnetMask, strlen(SubnetMask) + 1);
1386
1387 RegSetValueExA(hKey, "Lease", 0, REG_DWORD, (LPBYTE)&lease, sizeof(DWORD));
1388 RegSetValueExA(hKey, "LeaseObtainedTime", 0, REG_DWORD, (LPBYTE)&cur_time, sizeof(DWORD));
1389 RegSetValueExA(hKey, "LeaseTerminatesTime", 0, REG_DWORD, (LPBYTE)&never_time, sizeof(DWORD));
1390 RegSetValueExA(hKey, "T1", 0, REG_DWORD, (LPBYTE)&cur_time, sizeof(DWORD));
1391 RegSetValueExA(hKey, "T2", 0, REG_DWORD, (LPBYTE)&cur_time, sizeof(DWORD));
1392 dwAddressType = 1;
1393 RegSetValueExA(hKey, "AddressType", 0, REG_DWORD, (LPBYTE)&dwAddressType, sizeof(DWORD));
1394 }
1395
1396 goto done;
1397 }
1398 }
1399 }
1400 }
1401
1402done:
1403 if (hKey)
1405}
LONG NTSTATUS
Definition: precomp.h:26
#define RegCloseKey(hKey)
Definition: registry.h:49
Definition: bufpool.h:45
#define BufferSize
Definition: mmc.h:75
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2287
unsigned short uint16_t
Definition: stdint.h:35
_ACRTIMP void __cdecl srand(unsigned int)
Definition: misc.c:50
return ret
Definition: mutex.c:146
FxAutoRegKey hKey
Status
Definition: gdiplustypes.h:25
DWORD WINAPI AddIPAddress(IPAddr Address, IPMask Netmask, DWORD IfIndex, PULONG NteContext, PULONG NteInstance)
Definition: iphlpapi_main.c:67
DWORD WINAPI DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute)
DWORD WINAPI CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute)
DWORD WINAPI SendARP(IPAddr DestIP, IPAddr SrcIP, PULONG pMacAddr, PULONG PhyAddrLen)
#define REG_SZ
Definition: layer.c:22
#define KEY_WRITE
Definition: nt_native.h:1034
char CHAR
Definition: pedump.c:57
ULONG IPAddr
Definition: pfhook.h:35
#define REG_DWORD
Definition: sdbapi.c:615
static void Server(int port)
Definition: srltest.c:69
ULONG NteInstance
Definition: rosdhcp.h:85
MIB_IPFORWARDROW RouterMib
Definition: rosdhcp.h:82
PALTERNATE_CONFIGURATION AlternateConfiguration
Definition: rosdhcp.h:80
struct interface_info DhclientInfo
Definition: rosdhcp.h:86
MIB_IFROW IfMib
Definition: rosdhcp.h:81
DWORD dwIndex
Definition: ifmib.h:38
DWORD dwForwardNextHop
Definition: ipmib.h:74
DWORD dwForwardMetric1
Definition: ipmib.h:88
IF_INDEX dwForwardIfIndex
Definition: ipmib.h:75
DWORD dwForwardDest
Definition: ipmib.h:71
DWORD dwForwardMask
Definition: ipmib.h:72
NTSYSAPI PSTR NTAPI RtlIpv4AddressToStringA(_In_ const struct in_addr *Addr, _Out_writes_(16) PSTR S)
unsigned char * LPBYTE
Definition: typedefs.h:53
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by send_discover().

◆ state_reboot()

void state_reboot ( void ipp)

Definition at line 172 of file dhclient.c.

173{
174 struct interface_info *ip = ipp;
176
177 /* If we don't remember an active lease, go straight to INIT. */
178 if (!ip->client->active || ip->client->active->is_bootp) {
179 state_init(ip);
180 return;
181 }
182
183 /* We are in the rebooting state. */
184 ip->client->state = S_REBOOTING;
185
186 /* make_request doesn't initialize xid because it normally comes
187 from the DHCPDISCOVER, but we haven't sent a DHCPDISCOVER,
188 so pick an xid now. */
189 ip->client->xid = RtlRandom(&foo);
190
191 /* Make a DHCPREQUEST packet, and set appropriate per-interface
192 flags. */
193 make_request(ip, ip->client->active);
194 ip->client->destination = iaddr_broadcast;
195 time(&ip->client->first_sending);
196 ip->client->interval = ip->client->config->initial_interval;
197
198 /* Zap the medium list... */
199 ip->client->medium = NULL;
200
201 /* Send out the first DHCPREQUEST packet. */
203}

Referenced by Server_AcquireParameters(), and Server_EnableDhcp().

◆ state_release()

void state_release ( void ipp)

Definition at line 231 of file dhclient.c.

232{
233 struct interface_info *ip = ipp;
235
237
238 /* Make a DHCPRELEASE packet, and set appropriate per-interface
239 flags. */
240 make_release(ip, ip->client->active);
241
242 /* make_request doesn't initialize xid because it normally comes
243 from the DHCPDISCOVER, but we haven't sent a DHCPDISCOVER,
244 so pick an xid now. */
245 ip->client->xid = RtlRandom(&foo);
247
248 ip->client->state = S_RELEASED;
250}
void make_release(struct interface_info *ip, struct client_lease *lease)
Definition: dhclient.c:1835
void send_release(void *ipp)
Definition: dhclient.c:1551
void unbind_lease(struct interface_info *ip)
Definition: dhclient.c:749

Referenced by Server_ReleaseParameters().

◆ state_requesting()

void state_requesting ( void )

◆ state_selecting()

void state_selecting ( void ipp)

Definition at line 257 of file dhclient.c.

258{
259 struct interface_info *ip = ipp;
260 struct client_lease *lp, *next, *picked;
262
264
265 time(&cur_time);
266
267 /* Cancel state_selecting and send_discover timeouts, since either
268 one could have got us here. */
271
272 /* We have received one or more DHCPOFFER packets. Currently,
273 the only criterion by which we judge leases is whether or
274 not we get a response when we arp for them. */
275 picked = NULL;
276 for (lp = ip->client->offered_leases; lp; lp = next) {
277 next = lp->next;
278
279 /* Check to see if we got an ARPREPLY for the address
280 in this particular lease. */
281 if (!picked) {
282 if( !check_arp(ip,lp) ) goto freeit;
283 picked = lp;
284 picked->next = NULL;
285 } else {
286freeit:
288 }
289 }
290 ip->client->offered_leases = NULL;
291
292 /* If we just tossed all the leases we were offered, go back
293 to square one. */
294 if (!picked) {
295 ip->client->state = S_INIT;
296 state_init(ip);
297 return;
298 }
299
300 /* If it was a BOOTREPLY, we can just take the address right now. */
301 if (!picked->options[DHO_DHCP_MESSAGE_TYPE].len) {
302 ip->client->new = picked;
303
304 /* Make up some lease expiry times
305 XXX these should be configurable. */
306 ip->client->new->expiry = cur_time + 12000;
307 ip->client->new->renewal += cur_time + 8000;
308 ip->client->new->rebind += cur_time + 10000;
309
310 ip->client->state = S_REQUESTING;
311
312 /* Bind to the address we received. */
313 bind_lease(ip);
314 return;
315 }
316
317 /* Go to the REQUESTING state. */
318 ip->client->destination = iaddr_broadcast;
319 ip->client->state = S_REQUESTING;
320 ip->client->first_sending = cur_time;
321 ip->client->interval = ip->client->config->initial_interval;
322
323 /* Make a DHCPREQUEST packet from the lease we picked. */
324 make_request(ip, picked);
325 ip->client->xid = ip->client->packet.xid;
326
327 /* Toss the lease we picked - we'll get it back in a DHCPACK. */
328 free_client_lease(picked);
329
330 /* Add an immediate timeout to send the first DHCPREQUEST packet. */
332}

Referenced by dhcpoffer(), and state_selecting().

◆ subnet_number()

struct iaddr subnet_number ( struct iaddr  addr,
struct iaddr  mask 
)

Definition at line 183 of file util.c.

183 {
184 struct iaddr bcast = { 0 };
185 return bcast;
186}

Referenced by priv_script_write_params().

◆ unbind_lease()

void unbind_lease ( struct interface_info ip)

Definition at line 749 of file dhclient.c.

750{
751 PDHCP_ADAPTER Adapter;
752
753 if (ip->client->active) {
754 free_client_lease(ip->client->active);
755 ip->client->active = NULL;
756 }
757
758 Adapter = AdapterFindInfo( ip );
759 if (Adapter) {
760 reset_adapter(Adapter);
761 unset_name_servers(Adapter);
762 unset_domain(Adapter);
763 }
764 else {
765 warning("Could not find adapter for info %p\n", ip);
766 return;
767 }
768}
void unset_domain(PDHCP_ADAPTER Adapter)
Definition: dhclient.c:533
void unset_name_servers(PDHCP_ADAPTER Adapter)
Definition: dhclient.c:466
void reset_adapter(PDHCP_ADAPTER Adapter)
Definition: dhclient.c:654

Referenced by state_release().

◆ warning()

void int warning ( char format,
  ... 
)

Definition at line 129 of file uimain.c.

786{
787 va_list ap;
788 char text[512];
789 char text1[512];
790
791 sprintf(text1, "WARNING: ");
794 va_end(ap);
795 strcat(text1, text);
796 mi_warning(text1);
797}
void mi_warning(char *msg)
Definition: win32.c:848

◆ write_client_lease()

void write_client_lease ( struct interface_info ip,
struct client_lease lease,
int  rewrite 
)

Definition at line 1939 of file dhclient.c.

1941{
1942 static int leases_written;
1943 struct tm *t;
1944 int i;
1945
1946 if (!rewrite) {
1947 if (leases_written++ > 20) {
1949 leases_written = 0;
1950 }
1951 }
1952
1953 /* If the lease came from the config file, we don't need to stash
1954 a copy in the lease database. */
1955 if (lease->is_static)
1956 return;
1957
1958 if (!leaseFile) { /* XXX */
1960 if (!leaseFile) {
1961 error("can't create %s", path_dhclient_db);
1962 return;
1963 }
1964 }
1965
1966 fprintf(leaseFile, "lease {\n");
1967 if (lease->is_bootp)
1968 fprintf(leaseFile, " bootp;\n");
1969 fprintf(leaseFile, " interface \"%s\";\n", ip->name);
1970 fprintf(leaseFile, " fixed-address %s;\n", piaddr(lease->address));
1971 if (lease->filename)
1972 fprintf(leaseFile, " filename \"%s\";\n", lease->filename);
1973 if (lease->server_name)
1974 fprintf(leaseFile, " server-name \"%s\";\n",
1975 lease->server_name);
1976 if (lease->medium)
1977 fprintf(leaseFile, " medium \"%s\";\n", lease->medium->string);
1978 for (i = 0; i < 256; i++)
1979 if (lease->options[i].len)
1980 fprintf(leaseFile, " option %s %s;\n",
1982 pretty_print_option(i, lease->options[i].data,
1983 lease->options[i].len, 1, 1));
1984
1985 t = gmtime(&lease->renewal);
1986 if (t)
1987 fprintf(leaseFile, " renew %d %d/%d/%d %02d:%02d:%02d;\n",
1988 t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
1989 t->tm_hour, t->tm_min, t->tm_sec);
1990 t = gmtime(&lease->rebind);
1991 if (t)
1992 fprintf(leaseFile, " rebind %d %d/%d/%d %02d:%02d:%02d;\n",
1993 t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
1994 t->tm_hour, t->tm_min, t->tm_sec);
1995 t = gmtime(&lease->expiry);
1996 if (t)
1997 fprintf(leaseFile, " expire %d %d/%d/%d %02d:%02d:%02d;\n",
1998 t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
1999 t->tm_hour, t->tm_min, t->tm_sec);
2000 fprintf(leaseFile, "}\n");
2002}
void rewrite_client_leases(struct interface_info *ifi)
Definition: dhclient.c:1917
int WINAPIV fprintf(FILE *file, const char *format,...)
Definition: file.c:5549
static struct tm * gmtime(const time_t *t)
Definition: time.h:120
unsigned int is_static
Definition: dhcpd.h:165
time_t renewal
Definition: dhcpd.h:155
time_t rebind
Definition: dhcpd.h:155

Referenced by rewrite_client_leases().

Variable Documentation

◆ bootp_packet_handler

Definition at line 59 of file dispatch.c.

Referenced by got_one(), and init_client().

◆ comment_index

int comment_index
extern

◆ comments

char comments[4096]
extern

◆ cur_time

◆ dhcp_option_default_priority_list

unsigned char dhcp_option_default_priority_list[]
extern

Definition at line 329 of file tables.c.

Referenced by cons_options().

◆ dhcp_options

◆ dhcp_universe

struct universe dhcp_universe
extern

Definition at line 67 of file tables.c.

Referenced by initialize_universes().

◆ eol_token

int eol_token
extern

◆ lexchar

void int int int int int lexchar

Definition at line 311 of file dhcpd.h.

◆ lexline

void int int int int int lexline
extern

◆ log_perror

int log_perror
extern

Definition at line 76 of file dhclient.c.

◆ log_priority

int log_priority
extern

Definition at line 92 of file dhclient.c.

◆ path_dhclient_conf

char* path_dhclient_conf
extern

Definition at line 73 of file dhclient.c.

◆ path_dhclient_db

char* path_dhclient_db
extern

Definition at line 74 of file dhclient.c.

Referenced by rewrite_client_leases(), and write_client_lease().

◆ sizeof_dhcp_option_default_priority_list

int sizeof_dhcp_option_default_priority_list
extern

Definition at line 408 of file tables.c.

Referenced by cons_options().

◆ tlname

char * tlname

Definition at line 312 of file dhcpd.h.

◆ token_line

char* token_line
extern

◆ top_level_config

struct client_config top_level_config
extern

◆ universe_hash

struct hash_table universe_hash
extern

Definition at line 672 of file tables.c.

Referenced by initialize_universes().

◆ warnings_occurred

int warnings_occurred
extern