33 # define send_packet trace_packet_send 44 struct sockaddr_in to;
54 int peer_has_leases = 0;
63 snprintf (msgbuf,
sizeof msgbuf,
"BOOTREQUEST from %s via %s",
69 :
packet -> interface -> name);
72 log_info (
"%s: network unknown", msgbuf);
97 host_reference(&host, h,
MDL);
103 host_dereference(&hp,
MDL);
106 host_reference(&hp, host,
MDL);
107 host_dereference(&host,
MDL);
117 log_info(
"%s: BOOTP from dynamic client and no " 118 "dynamic leases", msgbuf);
122 #if defined(FAILOVER_PROTOCOL) 125 dhcp_failover_state_t *peer;
141 log_info(
"%s: load balance to peer %s",
163 for (i =
packet -> class_count; i > 0; i--) {
186 log_info (
"%s: bootp disallowed", msgbuf);
197 log_info (
"%s: booting disallowed", msgbuf);
202 memset (&outgoing, 0,
sizeof outgoing);
203 memset (&raw, 0,
sizeof raw);
214 options, i),
MDL))) {
237 option_code_hash_lookup(&oc->
option,
259 packet -> options, options,
287 packet -> options, options,
292 memset (&d1, 0,
sizeof d1);
297 packet -> options, options,
319 packet -> options, options,
325 0, (
sizeof raw.
file) - d1.
len);
335 packet -> options, options,
353 #if defined(DHCPv6) && defined(DHCP4o6) 357 log_info(
"DHCP4o6 BOOTREPLY for %s to %s (%s) via %s",
359 ((hp != NULL) && (hp->
name != NULL)) ?
360 hp -> name :
"unknown",
371 log_fatal(
"No memory to store DHCP4o6 reply.");
389 log_error(
"%s: Interface %s appears to have no IPv4 " 390 "addresses, and so dhcpd cannot select a source " 397 log_info(
"BOOTREPLY for %s to %s (%s) via %s",
399 ((hp != NULL) && (hp->
name != NULL)) ? hp -> name :
"unknown",
408 to.sin_family = AF_INET;
410 to.sin_len =
sizeof to;
412 memset (to.sin_zero, 0,
sizeof to.sin_zero);
424 log_error (
"%s:%d: Failed to send %d byte long " 425 "packet over %s interface.",
MDL,
432 }
else if (norelay == 2) {
461 log_error (
"%s:%d: Failed to send %d byte long packet over %s" 473 host_dereference (&hp,
MDL);
475 host_dereference (&host,
MDL);
#define DHCP_FIXED_NON_UDP
int find_lease(struct lease **, struct packet *, struct shared_network *, int *, int *, struct lease *, const char *, int)
char sname[DHCP_SNAME_LEN]
void save_option(struct universe *universe, struct option_state *options, struct option_cache *oc)
const char * piaddr(const struct iaddr addr)
int option_cache_dereference(struct option_cache **ptr, const char *file, int line)
struct universe server_universe
int execute_statements(struct binding_value **result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *out_options, struct binding_scope **scope, struct executable_statement *statements, struct on_star *on_star)
char * print_hw_addr(int htype, const int hlen, const unsigned char *data) const
struct in_addr * addresses
struct universe dhcp_universe
void data_string_forget(struct data_string *data, const char *file, int line)
struct option_cache * fixed_addr
int log_error(const char *,...) __attribute__((__format__(__printf__
int allocate_lease(struct lease **, struct packet *, struct pool *, int *)
dhcp_failover_state_t * failover_peer
int find_hosts_by_haddr(struct host_decl **, int, const unsigned char *, unsigned, const char *, int)
struct option_state * options
int locate_network(struct packet *)
void log_fatal(const char *,...) __attribute__((__format__(__printf__
int option_cache_allocate(struct option_cache **cptr, const char *file, int line)
void execute_statements_in_scope(struct binding_value **result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *out_options, struct binding_scope **scope, struct group *group, struct group *limiting_group, struct on_star *on_star)
struct interface_info * fallback_interface
int option_state_allocate(struct option_state **ptr, const char *file, int line)
int evaluate_option_cache(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct option_cache *oc, const char *file, int line)
#define SV_ALWAYS_BROADCAST
int buffer_allocate(struct buffer **ptr, unsigned len, const char *file, int line)
struct class * classes[PACKET_MAX_CLASSES]
struct interface_info * interface
#define SV_ALWAYS_REPLY_RFC1048
ssize_t send_packet(struct interface_info *, struct packet *, struct dhcp_packet *, size_t, struct in_addr, struct sockaddr_in *, struct hardware *)
int cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, struct lease *lease, struct client_state *client_state, int mms, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, int overload_avail, int terminate, int bootpp, struct data_string *prl, const char *vuname)
struct host_decl * n_ipaddr
int load_balance_mine(struct packet *, dhcp_failover_state_t *)
struct option_cache * lookup_option(struct universe *universe, struct option_state *options, unsigned code)
struct in_addr limited_broadcast
int int log_info(const char *,...) __attribute__((__format__(__printf__
struct shared_network * shared_network
void bootp(struct packet *packet)
void use_host_decl_name(struct packet *, struct lease *, struct option_state *)
Adds hostname option when use-host-decl-names is enabled.
struct data_string * dhcp4o6_response
int option_state_dereference(struct option_state **ptr, const char *file, int line)
int evaluate_boolean_option_cache(int *ignorep, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct option_cache *oc, const char *file, int line)
int make_const_data(struct expression **expr, const unsigned char *data, unsigned len, int terminated, int allocate, const char *file, int line)
void ack_lease(struct packet *, struct lease *, unsigned int, TIME, char *, int, struct host_decl *)
struct interface_info * interface
u_int8_t hbuf[HARDWARE_ADDR_LEN+1]
struct ipv6_pool ** pools
option_code_hash_t * code_hash
int can_unicast_without_arp(struct interface_info *)
struct executable_statement * on_commit
const unsigned char * data
struct binding_scope * scope
unsigned char options[DHCP_MAX_OPTION_LEN]