ISC DHCP 4.4.3-P1
A reference DHCPv4 and DHCPv6 implementation
 
Loading...
Searching...
No Matches
dhcrelay.c File Reference
#include "dhcpd.h"
#include <syslog.h>
#include <signal.h>
#include <sys/time.h>
#include <isc/file.h>

Go to the source code of this file.

Data Structures

struct  server_list
 

Macros

#define DHCRELAY_USAGE
 

Enumerations

enum  { forward_and_append , forward_and_replace , forward_untouched , discard }
 

Functions

int add_relay_agent_options (struct interface_info *, struct dhcp_packet *, unsigned, struct in_addr)
 
int find_interface_by_agent_option (struct dhcp_packet *, struct interface_info **, u_int8_t *, int)
 
int strip_relay_agent_options (struct interface_info *, struct interface_info **, struct dhcp_packet *, unsigned)
 
int main (int argc, char **argv)
 
void bootp (struct packet *packet)
 
void dhcp (struct packet *packet)
 
void classify (struct packet *p, struct class *c)
 
int check_collection (struct packet *p, struct lease *l, struct collection *c)
 
isc_result_t find_class (struct class **class, const char *c1, const char *c2, int i)
 
int parse_allow_deny (struct option_cache **oc, struct parse *p, int i)
 
isc_result_t dhcp_set_control_state (control_object_state_t oldstate, control_object_state_t newstate)
 

Variables

TIME default_lease_time = 43200
 
TIME max_lease_time = 86400
 
struct tree_cache * global_options [256]
 
struct optionrequested_opts [2]
 
int lexline
 
int lexchar
 
char * token_line
 
char * tlname
 
const char * path_dhcrelay_pid = _PATH_DHCRELAY_PID
 
isc_boolean_t no_dhcrelay_pid = ISC_FALSE
 
isc_boolean_t no_pid_file = ISC_FALSE
 
int bogus_agent_drops = 0
 
int bogus_giaddr_drops = 0
 
int client_packets_relayed = 0
 
int server_packet_errors = 0
 
int server_packets_relayed = 0
 
int client_packet_errors = 0
 
int add_agent_options = 0
 
int add_rfc3527_suboption = 0
 
int agent_option_errors = 0
 
int drop_agent_mismatches = 0
 
int corrupt_agent_options = 0
 
int missing_agent_option = 0
 
int bad_circuit_id = 0
 
int missing_circuit_id = 0
 
int max_hop_count = 10
 
int no_daemon = 0
 
int dfd [2] = { -1, -1 }
 
int dhcp_max_agent_option_packet_length = DHCP_MTU_MIN
 
enum { ... }  agent_relay_mode = forward_and_replace
 
u_int16_t local_port
 
u_int16_t remote_port
 
struct server_listservers
 
struct interface_infouplink = NULL
 
isc_boolean_t use_fake_gw = ISC_FALSE
 
struct in_addr gw = {0}
 
char * progname
 

Macro Definition Documentation

◆ DHCRELAY_USAGE

#define DHCRELAY_USAGE
Value:
"Usage: %s [-d] [-q] [-a] [-D] [-A <length>] [-c <hops>] [-p <port>]\n" \
" [-pf <pid-file>] [--no-pid]\n" \
" [-m append|replace|forward|discard]\n" \
" [-i interface0 [ ... -i interfaceN]\n" \
" [-iu interface0 [ ... -iu interfaceN]\n" \
" [-id interface0 [ ... -id interfaceN]\n" \
" [-U interface] [-g <ip-address>]\n" \
" server0 [ ... serverN]\n\n" \
" %s {--version|--help|-h}"

Definition at line 228 of file dhcrelay.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
forward_and_append 
forward_and_replace 
forward_untouched 
discard 

Definition at line 102 of file dhcrelay.c.

Function Documentation

◆ add_relay_agent_options()

int add_relay_agent_options ( struct interface_info * ip,
struct dhcp_packet * packet,
unsigned length,
struct in_addr giaddr )
extern

Definition at line 1252 of file dhcrelay.c.

◆ bootp()

void bootp ( struct packet * packet)

Definition at line 2121 of file dhcrelay.c.

◆ check_collection()

int check_collection ( struct packet * p,
struct lease * l,
struct collection * c )

Definition at line 2143 of file dhcrelay.c.

◆ classify()

void classify ( struct packet * p,
struct class * c )

Definition at line 2138 of file dhcrelay.c.

◆ dhcp()

void dhcp ( struct packet * packet)

Definition at line 2126 of file dhcrelay.c.

◆ dhcp_set_control_state()

isc_result_t dhcp_set_control_state ( control_object_state_t oldstate,
control_object_state_t newstate )

Definition at line 2158 of file dhcrelay.c.

◆ find_class()

isc_result_t find_class ( struct class ** class,
const char * c1,
const char * c2,
int i )

Definition at line 2148 of file dhcrelay.c.

◆ find_interface_by_agent_option()

int find_interface_by_agent_option ( struct dhcp_packet * packet,
struct interface_info ** out,
u_int8_t * buf,
int len )
extern

Definition at line 1188 of file dhcrelay.c.

◆ main()

int main ( int argc,
char ** argv )

Definition at line 291 of file dhcrelay.c.

◆ parse_allow_deny()

int parse_allow_deny ( struct option_cache ** oc,
struct parse * p,
int i )

Definition at line 2153 of file dhcrelay.c.

◆ strip_relay_agent_options()

int strip_relay_agent_options ( struct interface_info * in,
struct interface_info ** out,
struct dhcp_packet * packet,
unsigned length )
extern

Definition at line 1051 of file dhcrelay.c.

Variable Documentation

◆ add_agent_options

int add_agent_options = 0

Definition at line 72 of file dhcrelay.c.

◆ add_rfc3527_suboption

int add_rfc3527_suboption = 0

Definition at line 73 of file dhcrelay.c.

◆ agent_option_errors

int agent_option_errors = 0

Definition at line 75 of file dhcrelay.c.

◆ []

enum { ... } agent_relay_mode

◆ bad_circuit_id

int bad_circuit_id = 0

Definition at line 83 of file dhcrelay.c.

◆ bogus_agent_drops

int bogus_agent_drops = 0

Definition at line 61 of file dhcrelay.c.

◆ bogus_giaddr_drops

int bogus_giaddr_drops = 0

Definition at line 65 of file dhcrelay.c.

◆ client_packet_errors

int client_packet_errors = 0

Definition at line 70 of file dhcrelay.c.

◆ client_packets_relayed

int client_packets_relayed = 0

Definition at line 67 of file dhcrelay.c.

◆ corrupt_agent_options

int corrupt_agent_options = 0

Definition at line 79 of file dhcrelay.c.

◆ default_lease_time

TIME default_lease_time = 43200

Definition at line 44 of file dhcrelay.c.

◆ dfd

int dfd[2] = { -1, -1 }

Definition at line 90 of file dhcrelay.c.

◆ dhcp_max_agent_option_packet_length

int dhcp_max_agent_option_packet_length = DHCP_MTU_MIN

Definition at line 98 of file dhcrelay.c.

◆ drop_agent_mismatches

int drop_agent_mismatches = 0

Definition at line 77 of file dhcrelay.c.

◆ global_options

struct tree_cache* global_options[256]

Definition at line 46 of file dhcrelay.c.

◆ gw

struct in_addr gw = {0}

Definition at line 118 of file dhcrelay.c.

◆ lexchar

int lexchar

Definition at line 52 of file dhcrelay.c.

◆ lexline

int lexline

Definition at line 51 of file dhcrelay.c.

◆ local_port

u_int16_t local_port
extern

Definition at line 48 of file discover.c.

◆ max_hop_count

int max_hop_count = 10

Definition at line 87 of file dhcrelay.c.

◆ max_lease_time

TIME max_lease_time = 86400

Definition at line 45 of file dhcrelay.c.

◆ missing_agent_option

int missing_agent_option = 0

Definition at line 81 of file dhcrelay.c.

◆ missing_circuit_id

int missing_circuit_id = 0

Definition at line 85 of file dhcrelay.c.

◆ no_daemon

int no_daemon = 0

Definition at line 89 of file dhcrelay.c.

◆ no_dhcrelay_pid

isc_boolean_t no_dhcrelay_pid = ISC_FALSE

Definition at line 57 of file dhcrelay.c.

◆ no_pid_file

isc_boolean_t no_pid_file = ISC_FALSE

Definition at line 59 of file dhcrelay.c.

◆ path_dhcrelay_pid

const char* path_dhcrelay_pid = _PATH_DHCRELAY_PID

Definition at line 56 of file dhcrelay.c.

◆ progname

char* progname

Definition at line 170 of file dhcrelay.c.

◆ remote_port

u_int16_t remote_port
extern

Definition at line 49 of file discover.c.

◆ requested_opts

struct option* requested_opts[2]

Definition at line 48 of file dhcrelay.c.

◆ server_packet_errors

int server_packet_errors = 0

Definition at line 68 of file dhcrelay.c.

◆ server_packets_relayed

int server_packets_relayed = 0

Definition at line 69 of file dhcrelay.c.

◆ servers

struct server_list * servers

◆ tlname

char* tlname

Definition at line 54 of file dhcrelay.c.

◆ token_line

char* token_line

Definition at line 53 of file dhcrelay.c.

◆ uplink

struct interface_info* uplink = NULL

Definition at line 116 of file dhcrelay.c.

◆ use_fake_gw

isc_boolean_t use_fake_gw = ISC_FALSE

Definition at line 117 of file dhcrelay.c.