[Dhcp-agent-commits] CVS: dhcp-agent TODO,1.16,1.17 configure.in,1.11,1.12 dhcp-agent.h,1.39,1.40 dh
Status: Alpha
Brought to you by:
actmodern
From: Thamer Al-H. <act...@us...> - 2002-05-25 20:55:39
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv5307 Modified Files: TODO configure.in dhcp-agent.h dhcp-client-control.c dhcp-convert.c dhcp-files.c dhcp-icmp-discovery.c Log Message: fixed up conversion for integers to be proper for C99 Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TODO 25 May 2002 14:02:29 -0000 1.16 --- TODO 25 May 2002 20:55:36 -0000 1.17 *************** *** 35,46 **** unwanted packets. -- implement decline, and inform in the client. - -- fix up things which break data hiding. they're beginning to creep. - -- make option handlers point to global strings -- save space. -- add check in validate_to_string for conformity with DHCP RFC on character set. -- other minor optimizations which would be nice are noted in FIXMEs all over the code. - -- add icmp ping routines so that optimal routers/hosts can be - detected. -- make more uses of different xid. currently only one per reboot is chosen. this is compliant with the rfc, but not really good. --- 35,42 ---- *************** *** 57,66 **** dependencies. the sniffer for example, only needs the packet parsing routines. - -- net->hw_addr is broken. i don't like it being at that level. - we should always specify our hardware address at a higher - level on a per-use basis and thus give us control over - how much Marla is faking it. - -- would be nice to have more unpredictable random numbers - by using devices like /dev/urandom explicitly if available. - -- fix overflow issue in dhcp-icmp-discovery (icmp_do_echo) - -- add global config options which can be gotten anywhere in the code --- 53,54 ---- Index: configure.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/configure.in,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** configure.in 19 May 2002 00:35:35 -0000 1.11 --- configure.in 25 May 2002 20:55:36 -0000 1.12 *************** *** 83,87 **** AC_MSG_ERROR(`libdnet not found http://libdnet.sourceforge.net/ to get a copy', 1)) DNET_INC="" ! p else --- 83,87 ---- AC_MSG_ERROR(`libdnet not found http://libdnet.sourceforge.net/ to get a copy', 1)) DNET_INC="" ! else Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** dhcp-agent.h 25 May 2002 15:18:00 -0000 1.39 --- dhcp-agent.h 25 May 2002 20:55:36 -0000 1.40 *************** *** 30,33 **** --- 30,35 ---- # define DHCP_AGENT_H + #define __STDC_FORMAT_MACROS /* we need the stdint type macros. */ + # include <stdlib.h> # include <stdio.h> Index: dhcp-client-control.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-control.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dhcp-client-control.c 25 May 2002 15:18:01 -0000 1.17 --- dhcp-client-control.c 25 May 2002 20:55:36 -0000 1.18 *************** *** 105,109 **** static void update_dhcp_xid(dhcp_client_control_t *dc) { ! dc->xid = dhcp_gen_xid(); /* this is redone at discover_request too */ return; } --- 105,109 ---- static void update_dhcp_xid(dhcp_client_control_t *dc) { ! dc->xid = dhcp_gen_xid(); return; } Index: dhcp-convert.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-convert.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-convert.c 25 May 2002 14:02:30 -0000 1.9 --- dhcp-convert.c 25 May 2002 20:55:36 -0000 1.10 *************** *** 428,437 **** case sizeof(int32_t): string = xmalloc(INT32_T_STRING_SIZE); ! snprintf(string, INT32_T_STRING_SIZE, "%d", *(int32_t *)data); break; case sizeof(int16_t): string = xmalloc(INT16_T_STRING_SIZE); ! snprintf(string, INT16_T_STRING_SIZE, "%hd", *(int16_t *)data); break; --- 428,437 ---- case sizeof(int32_t): string = xmalloc(INT32_T_STRING_SIZE); ! snprintf(string, INT32_T_STRING_SIZE, "%"PRIi32"", *(int32_t *)data); break; case sizeof(int16_t): string = xmalloc(INT16_T_STRING_SIZE); ! snprintf(string, INT16_T_STRING_SIZE, "%"PRIi16"", *(int16_t *)data); break; *************** *** 448,457 **** case sizeof(uint32_t): string = xmalloc(UINT32_T_STRING_SIZE); ! snprintf(string, UINT32_T_STRING_SIZE, "%u", *(uint32_t *)data); break; case sizeof(uint16_t): string = xmalloc(UINT16_T_STRING_SIZE); ! snprintf(string, UINT16_T_STRING_SIZE, "%hu", *(uint16_t *)data); break; --- 448,457 ---- case sizeof(uint32_t): string = xmalloc(UINT32_T_STRING_SIZE); ! snprintf(string, UINT32_T_STRING_SIZE, "%"PRIu32"", *(uint32_t *)data); break; case sizeof(uint16_t): string = xmalloc(UINT16_T_STRING_SIZE); ! snprintf(string, UINT16_T_STRING_SIZE, "%"PRIu16"", *(uint16_t *)data); break; *************** *** 481,502 **** case sizeof(int32_t): ! ! tmp = malloc(sizeof(int32_t)); ! *tmp = ntohl(* (int32_t *)data); ! int_to_string(tmp, data_len, size, si); ! string = int_to_string(tmp, data_len, size, si); ! xfree(tmp); ! ! break; case sizeof(int16_t): ! ! tmp = malloc(sizeof(int16_t)); ! *tmp = ntohl(* (int16_t *)data); ! int_to_string(tmp, data_len, size, si); ! string = int_to_string(tmp, data_len, size, si); ! xfree(tmp); ! ! break; default: --- 481,498 ---- case sizeof(int32_t): ! { ! int32_t tmp; ! tmp = ntohl(* (int32_t *)data); ! string = int_to_string((void *)&tmp, data_len, size, si); ! break; ! } case sizeof(int16_t): ! { ! int16_t tmp; ! tmp = ntohl(* (int16_t *)data); ! string = int_to_string((void *)&tmp, data_len, size, si); ! break; ! } default: *************** *** 509,530 **** switch(size) { ! case sizeof(uint32_t): ! tmp = malloc(sizeof(uint32_t)); ! *tmp = ntohl(* (uint32_t *)data); ! int_to_string(tmp, data_len, size, si); ! string = int_to_string(tmp, data_len, size, si); ! xfree(tmp); ! break; case sizeof(uint16_t): ! ! tmp = malloc(sizeof(uint16_t)); ! *tmp = ntohl(* (uint16_t *)data); ! int_to_string(tmp, data_len, size, si); ! string = int_to_string(tmp, data_len, size, si); ! xfree(tmp); ! break; default: --- 505,525 ---- switch(size) { ! case sizeof(uint32_t): + { + uint32_t tmp; + tmp = ntohl(* (uint32_t *)data); + string = int_to_string((void *)&tmp, data_len, size, si); + break; ! } case sizeof(uint16_t): ! { ! uint16_t tmp; ! tmp = ntohl(* (uint16_t *)data); ! string = int_to_string((void *)&tmp, data_len, size, si); ! break; ! } default: *************** *** 568,572 **** char *uint16_to_string(const unsigned char *data, int len) { ! return(int_to_string(data, len, sizeof(int16_t), 0)); } char *int16_to_string(const unsigned char *data, int len) --- 563,567 ---- char *uint16_to_string(const unsigned char *data, int len) { ! return(int_to_string(data, len, sizeof(uint16_t), 0)); } char *int16_to_string(const unsigned char *data, int len) Index: dhcp-files.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-files.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-files.c 25 May 2002 14:02:30 -0000 1.7 --- dhcp-files.c 25 May 2002 20:55:36 -0000 1.8 *************** *** 25,28 **** --- 25,29 ---- #include <dhcp-agent.h> + #include <dhcp-file.h> static char *line_buff = NULL; Index: dhcp-icmp-discovery.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-icmp-discovery.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dhcp-icmp-discovery.c 25 May 2002 15:18:01 -0000 1.8 --- dhcp-icmp-discovery.c 25 May 2002 20:55:36 -0000 1.9 *************** *** 114,122 **** difference = timeval_diff(before, after); - /* milliseconds are accurate enough for us. - * FIXME: the integer may overflow if our - * rtt mechanism is setup to wait for too long before a - * timeout. */ - latency = (difference.tv_sec * 1000); latency += (difference.tv_usec/1000); --- 114,117 ---- *************** *** 142,146 **** eth_addr_t dest_mac; - /* FIXME:x get rid of this magic number -- global config options? */ int *sends = glob_conf_get_val(CLIENT_ICMP_RETRIES); --- 137,140 ---- *************** *** 185,190 **** * largest latency multiplied by two. This severely hurts * a host's average, but it's the right thing to do as ! * long as we're doing it fairly to everyone. ! * FIXME: we do need a better way to deal with this. */ /* check our latency if it's all -1 */ --- 179,183 ---- * largest latency multiplied by two. This severely hurts * a host's average, but it's the right thing to do as ! * long as we're doing it fairly to everyone. */ /* check our latency if it's all -1 */ |