[dhcp-agent-commits] dhcp-agent/src dhcp-print.c,1.7,1.8
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2003-06-28 02:08:27
|
Update of /cvsroot/dhcp-agent/dhcp-agent/src In directory sc8-pr-cvs1:/tmp/cvs-serv31610/src Modified Files: dhcp-print.c Log Message: fixed up dhcp-sniff to work around new dhcp object Index: dhcp-print.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-print.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-print.c 27 Jun 2003 23:11:29 -0000 1.7 --- dhcp-print.c 28 Jun 2003 02:08:24 -0000 1.8 *************** *** 508,512 **** memcpy(&val, data, 4); ! printf("%d", val); return; --- 508,512 ---- memcpy(&val, data, 4); ! val = ntohl(val); printf("%d", val); return; *************** *** 524,528 **** --- 524,530 ---- } + memcpy(&val, data, 4); + val = ntohl(val); printf("%u", val); *************** *** 542,545 **** --- 544,548 ---- memcpy(&val, data, 2); + val = ntohs(val); printf("%u", val); *************** *** 673,676 **** --- 676,680 ---- uint8_t tag; int print_val; + uint8_t *val; dhcp_reset_option_seek(dhcp); *************** *** 681,690 **** * we can assume that the code will always be valid. */ tag = dhcp_opt_get_tag(option); print_val = printf("%s", option_handlers[tag].prefix); print_val += printf(": "); ! option_handlers[tag].handle_option(dhcp_opt_get_host_data(option), dhcp_opt_get_total_len(option), print_val); printf("\n"); } --- 685,701 ---- * we can assume that the code will always be valid. */ + /* FIXME: eventually this will have to be rewritten. the + * sniffer, prior to the new dhcp object, expected data + * in network form. just ask for it here. */ + tag = dhcp_opt_get_tag(option); print_val = printf("%s", option_handlers[tag].prefix); print_val += printf(": "); ! ! val = dhcp_opt_get_network_data(option); ! option_handlers[tag].handle_option(val, dhcp_opt_get_total_len(option), print_val); + xfree(val); printf("\n"); } |