Thread: [dhcp-agent-commits] dhcp-agent/src dhcp-server-conf.c,1.12,1.13 dhcp-server-conf.h,1.9,1.10 dhcp-se
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2003-08-06 04:28:36
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv4803 Modified Files: dhcp-server-conf.c dhcp-server-conf.h dhcp-server-defaults.h Log Message: added max-message-size variable Index: dhcp-server-conf.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dhcp-server-conf.c 27 Jul 2003 03:16:41 -0000 1.12 --- dhcp-server-conf.c 6 Aug 2003 04:28:33 -0000 1.13 *************** *** 41,44 **** --- 41,45 ---- "default-renew-percent", "default-rebind-percent", + "max-message-size", "poll-timeout" }; *************** *** 47,50 **** --- 48,52 ---- SERVER_VAR_RENEW_PERCENT, SERVER_VAR_REBIND_PERCENT, + SERVER_VAR_MAX_MESSAGE_SIZE, SERVER_VAR_POLL_TIMEOUT, }; *************** *** 210,213 **** --- 212,220 ---- } + uint16_t server_conf_get_max_message_size(server_conf_t *sc) + { + return sc->max_message_size; + } + /* * * * * * * * * * * *************** *** 250,253 **** --- 257,272 ---- } + /* set variable utility routines. */ + static int server_conf_set_uint16(server_conf_t *server_conf, uint16_t *var, const char *var_value) + { + if(!is_unsigned_numeric(var_value)) { + ERROR_MESSAGE("value not unsigned numeric as expected : %s\n", var_value); + return 1; + } + + sscanf(var_value, "%"SCNu16, var); + return 0; + } + /* set variable. */ static int server_conf_set_variable(server_conf_t *server_conf, arg_symbol_t var_symbol, const char *var_value) *************** *** 255,297 **** switch(var_symbol) { ! case SERVER_VAR_RENEW_PERCENT: ! ! if(!is_unsigned_numeric(var_value)) { ! ERROR_MESSAGE("value not unsigned numeric as expected : %s\n", var_value); ! return 1; ! } ! sscanf(var_value, "%"SCNu16, &server_conf->default_renew_percent); if(server_conf->default_renew_percent > 100) { /* check if the percent is higher than it should be. */ FATAL_MESSAGE("value specified for default-renew-percent is an illegal percent (over 100)"); } ! ! break; case SERVER_VAR_REBIND_PERCENT: ! if(!is_unsigned_numeric(var_value)) { ! ERROR_MESSAGE("value not unsigned numeric as expected : %s", var_value); ! return 1; ! } ! ! sscanf(var_value, "%"SCNu16, &server_conf->default_rebind_percent); ! if(server_conf->default_renew_percent > 100) { /* check if the percent is higher than it should be. */ ! FATAL_MESSAGE("value specified for default-rebind-percent is an illegal percent (over 100)"); } ! ! break; case SERVER_VAR_POLL_TIMEOUT: ! ! if(!is_unsigned_numeric(var_value)) { ! ERROR_MESSAGE("value not unsigned numeric as expected : %s\n", var_value); ! return 1; ! } ! ! sscanf(var_value, "%"SCNu16, &server_conf->poll_timeout); ! break; default: --- 274,298 ---- switch(var_symbol) { ! case SERVER_VAR_MAX_MESSAGE_SIZE: ! return server_conf_set_uint16(server_conf, &server_conf->max_message_size, var_value); ! case SERVER_VAR_RENEW_PERCENT: + server_conf_set_uint16(server_conf, &server_conf->default_renew_percent, var_value); if(server_conf->default_renew_percent > 100) { /* check if the percent is higher than it should be. */ FATAL_MESSAGE("value specified for default-renew-percent is an illegal percent (over 100)"); } ! return 0; case SERVER_VAR_REBIND_PERCENT: ! server_conf_set_uint16(server_conf, &server_conf->default_rebind_percent, var_value); if(server_conf->default_renew_percent > 100) { /* check if the percent is higher than it should be. */ ! FATAL_MESSAGE("value specified for default-renew-percent is an illegal percent (over 100)"); } ! return 0; case SERVER_VAR_POLL_TIMEOUT: ! return server_conf_set_uint16(server_conf, &server_conf->poll_timeout, var_value); default: *************** *** 300,305 **** return 1; } - - return 0; } --- 301,304 ---- *************** *** 699,705 **** /* set defaults. */ ! sc->default_rebind_percent = SERVER_DEFAULT_REBIND_PERCENT; ! sc->default_renew_percent = SERVER_DEFAULT_RENEW_PERCENT; ! sc->poll_timeout = SERVER_DEFAULT_POLL_TIMEOUT; sc->assume_interface_subnet = 1; /* default is yes. */ --- 698,706 ---- /* set defaults. */ ! sc->default_rebind_percent = SERVER_DEFAULT_REBIND_PERCENT; ! sc->default_renew_percent = SERVER_DEFAULT_RENEW_PERCENT; ! sc->poll_timeout = SERVER_DEFAULT_POLL_TIMEOUT; ! sc->max_message_size = SERVER_DEFAULT_MAX_MESSAGE_SIZE; ! sc->assume_interface_subnet = 1; /* default is yes. */ Index: dhcp-server-conf.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-conf.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-server-conf.h 27 Jul 2003 03:13:48 -0000 1.9 --- dhcp-server-conf.h 6 Aug 2003 04:28:33 -0000 1.10 *************** *** 38,41 **** --- 38,42 ---- uint16_t default_renew_percent; /* percent of expiry to assign as renew time. */ uint16_t poll_timeout; /* poll timeout -- used in server event processing. */ + uint16_t max_message_size; /* default max message size. */ uint8_t assume_interface_subnet; /* assume the interface has the correct local subnet configured. */ *************** *** 48,52 **** enum var_symbols { SERVER_VAR_RENEW_PERCENT = 0, SERVER_VAR_REBIND_PERCENT, SERVER_VAR_POLL_TIMEOUT, ! SERVER_VAR_ASSUME_LOCAL_SUBNET_FROM_INTERFACE }; enum directive_types { DIRECTIVE_SET = 0, DIRECTIVE_RANGE_LEASE, DIRECTIVE_HOSTNAME_LEASE, DIRECTIVE_MAC_LEASE, DIRECTIVE_OPTION, DIRECTIVE_LOCAL_SUBNET, DIRECTIVE_SUBNET, DIRECTIVE_ENABLE }; --- 49,53 ---- enum var_symbols { SERVER_VAR_RENEW_PERCENT = 0, SERVER_VAR_REBIND_PERCENT, SERVER_VAR_POLL_TIMEOUT, ! SERVER_VAR_MAX_MESSAGE_SIZE, SERVER_VAR_ASSUME_LOCAL_SUBNET_FROM_INTERFACE }; enum directive_types { DIRECTIVE_SET = 0, DIRECTIVE_RANGE_LEASE, DIRECTIVE_HOSTNAME_LEASE, DIRECTIVE_MAC_LEASE, DIRECTIVE_OPTION, DIRECTIVE_LOCAL_SUBNET, DIRECTIVE_SUBNET, DIRECTIVE_ENABLE }; *************** *** 59,62 **** --- 60,64 ---- extern uint16_t server_conf_get_poll_timeout(server_conf_t *sc); + extern uint16_t server_conf_get_max_message_size(server_conf_t *sc); #endif /* DHCP_SERVER_CONF_H */ Index: dhcp-server-defaults.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-defaults.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-server-defaults.h 15 Jul 2003 10:56:34 -0000 1.2 --- dhcp-server-defaults.h 6 Aug 2003 04:28:33 -0000 1.3 *************** *** 45,47 **** --- 45,50 ---- #define SERVER_DEFAULT_POLL_TIMEOUT 5 + /* recommended size in RFC791 (572 - ip header length - udp header length) */ + #define SERVER_DEFAULT_MAX_MESSAGE_SIZE 544 + #endif /* DHCP_SERVER_DEFAULTS_H */ |