ISC DHCP  4.3.6b1
A reference DHCPv4 and DHCPv6 implementation
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 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 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
 
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]\n" \
" server0 [ ... serverN]\n\n"

Definition at line 179 of file dhcrelay.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
forward_and_append 
forward_and_replace 
forward_untouched 
discard 

Definition at line 99 of file dhcrelay.c.

Function Documentation

◆ bootp()

void bootp ( struct packet packet)

Definition at line 1876 of file dhcrelay.c.

◆ check_collection()

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

Definition at line 1891 of file dhcrelay.c.

◆ classify()

void classify ( struct packet p,
struct class c 
)

Definition at line 1886 of file dhcrelay.c.

◆ dhcp()

void dhcp ( struct packet packet)

Definition at line 1881 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 1906 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 1896 of file dhcrelay.c.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 229 of file dhcrelay.c.

◆ parse_allow_deny()

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

Definition at line 1901 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.

◆ agent_relay_mode

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.

◆ dhcp_max_agent_option_packet_length

int dhcp_max_agent_option_packet_length = DHCP_MTU_MIN

Definition at line 95 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.

◆ 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

Definition at line 104 of file dhcrelay.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_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 158 of file dhcrelay.c.

◆ remote_port

u_int16_t remote_port

Definition at line 105 of file dhcrelay.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 113 of file dhcrelay.c.