[Dhcp-agent-commits] dhcp-agent dhcp-print.h,NONE,1.1 Makefile.am,1.23,1.24 Makefile.in,1.22,1.23 TO
Status: Alpha
Brought to you by:
actmodern
From: <act...@us...> - 2002-06-18 04:33:44
|
Update of /cvsroot/dhcp-agent/dhcp-agent In directory usw-pr-cvs1:/tmp/cvs-serv15249 Modified Files: Makefile.am Makefile.in TODO dhcp-agent.h dhcp-client-states.c dhcp-client.c dhcp-print.c dhcp-sniff.c dhcp-sniffer-ohandlers.c dhcpsniff.1 Added Files: dhcp-print.h Log Message: added brief mode to sniffer; fixed up Makefile.am to always use dhcp-snprintf now; updated dhcpsniff manpage; --- NEW FILE: dhcp-print.h --- /* $Header: /cvsroot/dhcp-agent/dhcp-agent/dhcp-print.h,v 1.1 2002/06/18 04:33:40 actmodern Exp $ * * Copyright 2002 Thamer Alharbash * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of the authors may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * */ #ifndef DHCP_PRINT_H #define DHCP_PRINT_H /* type for printing packet function. */ typedef void (*print_packet)(rawnet_t *net); /* main printers */ extern void print_dhcp_packet_verbose(rawnet_t *net); extern void print_dhcp_packet_brief(rawnet_t *net); /* Printing functions. */ extern void print_dhcphdr_brief(dhcp_obj *dhcp); extern void print_dhcphdr_verbose(dhcp_obj *dhcp); extern void print_options_verbose(dhcp_obj *dhcp); extern void print_ip_verbose(ip_obj *ip); extern void print_ip_brief(ip_obj *ip); extern void print_magic_cookie_verbose(const char *valid, dhcp_obj *dhcp); extern void print_magic_cookie_brief(const char *valid, dhcp_obj *dhcp); extern void print_timestamp_brief(struct timeval tm); extern void print_timestamp_verbose(struct timeval tm); extern void print_eth_brief(eth_obj *eth); extern void print_eth_verbose(eth_obj *eth); /* Print utility functions. */ extern void print_dhcp_type_message(const unsigned char *data, int len, int printval); extern void print_address_list(const unsigned char *data, int len, int print_val); extern void print_int32(const unsigned char *data, int len, int print_val); extern void print_string(const unsigned char *data, int len, int print_val); extern void print_uint16(const unsigned char *data, int len, int print_val); extern void print_en_bool(const unsigned char *data, int len, int print_val); extern void print_yn_bool(const unsigned char *data, int len, int print_val); extern void print_address_mask_list(const unsigned char *data, int len, int ini_val); extern void print_ubyte(const unsigned char *data, int len, int print_val); extern void print_uint16_list(const unsigned char *data, int len, int print_val); extern void print_uint32(const unsigned char *data, int len, int print_val); extern void print_netbios_node_type(const unsigned char *data, int len, int print_val); extern void print_address_route_list(const unsigned char *data, int len, int ini_val); extern void print_request_options(const unsigned char *data, int len, int printval); extern void dont_handle(const unsigned char *data, int len, int print_val); #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.am,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Makefile.am 17 Jun 2002 13:25:22 -0000 1.23 --- Makefile.am 18 Jun 2002 04:33:40 -0000 1.24 *************** *** 9,13 **** dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ ! dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c @DHCP_SNPRINTF@ \ dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c --- 9,13 ---- dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c \ dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c \ ! dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c \ dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c *************** *** 18,22 **** dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c \ dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c \ ! dhcp-interface.c dhcp-client-conf.c @DHCP_SNPRINTF@ dhcp-files.c \ dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c \ dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ --- 18,22 ---- dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c \ dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c \ ! dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c \ dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c \ dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c \ *************** *** 46,48 **** EXTRA_DIST = $(man_MANS) TODO LICENSE CAVEATS UPGRADING - --- 46,47 ---- Index: Makefile.in =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/Makefile.in,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Makefile.in 17 Jun 2002 13:25:22 -0000 1.22 --- Makefile.in 18 Jun 2002 04:33:40 -0000 1.23 *************** *** 77,86 **** bin_PROGRAMS = dhcpsniff dhcpclient ! dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c @DHCP_SNPRINTF@ dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ ! dhcpclient_SOURCES = dhcp-client.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c dhcp-interface.c dhcp-client-conf.c @DHCP_SNPRINTF@ dhcp-files.c dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c dhcp-parser.c dhcp-varfile.c --- 77,86 ---- bin_PROGRAMS = dhcpsniff dhcpclient ! dhcpsniff_SOURCES = dhcp-sniff.c dhcp-print.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-snprintf.c dhcp-sniffer-ohandlers.c dhcp-rtt.c dhcp-interface.c dhcpsniff_LDADD = @PCAP_LIB@ @DNET_LIB@ ! dhcpclient_SOURCES = dhcp-client.c dhcp-util.c dhcp-align.c dhcp-net.c dhcp-list.c dhcp-com.c dhcp-eth.c dhcp-ip.c dhcp-udp.c dhcp-arp.c dhcp-icmp.c dhcp-log.c dhcp-daemon.c dhcp-client-cache.c dhcp-cache-entry.c dhcp-client-control.c dhcp-interface.c dhcp-client-conf.c dhcp-snprintf.c dhcp-files.c dhcp-client-states.c dhcp-options-strings.c dhcp-convert.c dhcp-sysconf.c dhcp-rtt.c dhcp-packet-build.c dhcp-icmp-discovery.c dhcp-arp-discovery.c dhcp-route.c dhcp-globconf.c dhcp-stringbuffer.c dhcp-parser.c dhcp-varfile.c *************** *** 116,121 **** dhcpsniff_OBJECTS = dhcp-sniff.o dhcp-print.o dhcp-util.o dhcp-align.o \ dhcp-net.o dhcp-list.o dhcp-com.o dhcp-eth.o dhcp-ip.o dhcp-udp.o \ ! dhcp-arp.o dhcp-icmp.o dhcp-log.o dhcp-sniffer-ohandlers.o dhcp-rtt.o \ ! dhcp-interface.o dhcpsniff_DEPENDENCIES = dhcpsniff_LDFLAGS = --- 116,121 ---- dhcpsniff_OBJECTS = dhcp-sniff.o dhcp-print.o dhcp-util.o dhcp-align.o \ dhcp-net.o dhcp-list.o dhcp-com.o dhcp-eth.o dhcp-ip.o dhcp-udp.o \ ! dhcp-arp.o dhcp-icmp.o dhcp-log.o dhcp-snprintf.o \ ! dhcp-sniffer-ohandlers.o dhcp-rtt.o dhcp-interface.o dhcpsniff_DEPENDENCIES = dhcpsniff_LDFLAGS = *************** *** 124,128 **** dhcp-icmp.o dhcp-log.o dhcp-daemon.o dhcp-client-cache.o \ dhcp-cache-entry.o dhcp-client-control.o dhcp-interface.o \ ! dhcp-client-conf.o dhcp-files.o dhcp-client-states.o \ dhcp-options-strings.o dhcp-convert.o dhcp-sysconf.o dhcp-rtt.o \ dhcp-packet-build.o dhcp-icmp-discovery.o dhcp-arp-discovery.o \ --- 124,128 ---- dhcp-icmp.o dhcp-log.o dhcp-daemon.o dhcp-client-cache.o \ dhcp-cache-entry.o dhcp-client-control.o dhcp-interface.o \ ! dhcp-client-conf.o dhcp-snprintf.o dhcp-files.o dhcp-client-states.o \ dhcp-options-strings.o dhcp-convert.o dhcp-sysconf.o dhcp-rtt.o \ dhcp-packet-build.o dhcp-icmp-discovery.o dhcp-arp-discovery.o \ *************** *** 160,165 **** .deps/dhcp-parser.P .deps/dhcp-print.P .deps/dhcp-route.P \ .deps/dhcp-rtt.P .deps/dhcp-sniff.P .deps/dhcp-sniffer-ohandlers.P \ ! .deps/dhcp-stringbuffer.P .deps/dhcp-sysconf.P .deps/dhcp-udp.P \ ! .deps/dhcp-util.P .deps/dhcp-varfile.P SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) --- 160,165 ---- .deps/dhcp-parser.P .deps/dhcp-print.P .deps/dhcp-route.P \ .deps/dhcp-rtt.P .deps/dhcp-sniff.P .deps/dhcp-sniffer-ohandlers.P \ ! .deps/dhcp-snprintf.P .deps/dhcp-stringbuffer.P .deps/dhcp-sysconf.P \ ! .deps/dhcp-udp.P .deps/dhcp-util.P .deps/dhcp-varfile.P SOURCES = $(dhcpsniff_SOURCES) $(dhcpclient_SOURCES) OBJECTS = $(dhcpsniff_OBJECTS) $(dhcpclient_OBJECTS) Index: TODO =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/TODO,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** TODO 17 Jun 2002 02:41:19 -0000 1.28 --- TODO 18 Jun 2002 04:33:40 -0000 1.29 *************** *** 24,29 **** other todo: - -- autoconf script is getting ugly -- methinks its broken and is - barely parsed -- check for duplicates in configure.in and compress them (for example -I and -L flags should not be repeated.) --- 24,27 ---- *************** *** 48,52 **** to be done through it. - -- add a isascii() and a strcasecmp() for portability -- rawnet_is_valid needs more checks. --- 46,49 ---- *************** *** 95,97 **** the applicable dhcp-convert and then build the option wirh create_dhcp_option(data, len, tag) ! --- 92,94 ---- the applicable dhcp-convert and then build the option wirh create_dhcp_option(data, len, tag) ! -- document output from dhcpsniff -- especially how brief mode is layed out. \ No newline at end of file Index: dhcp-agent.h =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-agent.h,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** dhcp-agent.h 17 Jun 2002 13:23:07 -0000 1.59 --- dhcp-agent.h 18 Jun 2002 04:33:40 -0000 1.60 *************** *** 569,599 **** extern int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); - /* Printing functions. */ - - extern void print_dhcphdr_verbose(dhcp_obj *dhcp); - extern void print_options_verbose(dhcp_obj *dhcp); - extern void print_ip(ip_obj *ip); - extern void print_magic_cookie(const char *valid, dhcp_obj *dhcp); - extern void print_timestamp(struct timeval tm); - extern void print_eth(eth_obj *eth); - - /* Print utility functions. */ - - extern void print_dhcp_type_message(const unsigned char *data, int len, int printval); - extern void print_address_list(const unsigned char *data, int len, int print_val); - extern void print_int32(const unsigned char *data, int len, int print_val); - extern void print_string(const unsigned char *data, int len, int print_val); - extern void print_uint16(const unsigned char *data, int len, int print_val); - extern void print_en_bool(const unsigned char *data, int len, int print_val); - extern void print_yn_bool(const unsigned char *data, int len, int print_val); - extern void print_address_mask_list(const unsigned char *data, int len, int ini_val); - extern void print_ubyte(const unsigned char *data, int len, int print_val); - extern void print_uint16_list(const unsigned char *data, int len, int print_val); - extern void print_uint32(const unsigned char *data, int len, int print_val); - extern void print_netbios_node_type(const unsigned char *data, int len, int print_val); - extern void print_address_route_list(const unsigned char *data, int len, int ini_val); - extern void print_request_options(const unsigned char *data, int len, int printval); - extern void dont_handle(const unsigned char *data, int len, int print_val); - /* DHCP obj routines. */ --- 569,572 ---- Index: dhcp-client-states.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client-states.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** dhcp-client-states.c 17 Jun 2002 13:23:07 -0000 1.27 --- dhcp-client-states.c 18 Jun 2002 04:33:40 -0000 1.28 *************** *** 284,291 **** } ! /* Before doing a sysconf, let's make sure no one on the * local subnet is using our address. Do an ARP request * on the local subnet. and check to see if the address ! * is already taken. */ do_sysconf(options, dc); --- 284,293 ---- } ! /* ! * Before doing a sysconf, let's make sure no one on the * local subnet is using our address. Do an ARP request * on the local subnet. and check to see if the address ! * is already taken. FIXME: -- this isn't implemented :-) ! */ do_sysconf(options, dc); Index: dhcp-client.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-client.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** dhcp-client.c 17 Jun 2002 13:23:07 -0000 1.30 --- dhcp-client.c 18 Jun 2002 04:33:40 -0000 1.31 *************** *** 533,535 **** exit(0); } - --- 533,534 ---- Index: dhcp-print.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-print.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** dhcp-print.c 17 Jun 2002 13:23:08 -0000 1.7 --- dhcp-print.c 18 Jun 2002 04:33:40 -0000 1.8 *************** *** 28,31 **** --- 28,138 ---- #include <dhcp-util.h> + /* Print the fixed header briefly.*/ + void print_dhcphdr_brief(dhcp_obj *dhcp) + { + unsigned char op; + struct in_addr in; + unsigned char *hw_ptr; + int i; + + /* op */ + op = dhcp_get_op(dhcp); + printf("op:"); + + switch(op) { + + case DHCP_BOOTP_REQUEST: + printf("req"); + break; + + case DHCP_BOOTP_REPLY: + printf("rpy"); + break; + + default: + printf("%-3d", op); + } + + printf(" "); + + /* Hardware Type field. */ + + printf("hd:"); + switch(dhcp_get_htype(dhcp)) { + + case DLT_NULL: + printf("%s","nul"); + break; + + case DLT_EN10MB: + case DLT_EN3MB: + printf("%s","eth"); + break; + + case DLT_AX25: + printf("%s","ax25"); + break; + + case DLT_PRONET: + printf("%s", "pnet"); + break; + + case DLT_CHAOS: + printf("%s","chas"); + break; + + case DLT_ARCNET: + printf("%s", "slip"); + break; + + case DLT_PPP: + printf("%s", "ppp"); + break; + + case DLT_FDDI: + printf("%s", "fddi"); + break; + + default: + printf("%s", "unkn"); + break; + + } + printf(" "); + + printf("hlen:%d ", dhcp_get_hlen(dhcp)); + printf("hops:%d ", dhcp_get_hops(dhcp)); + printf("xid:%x ", dhcp_get_xid(dhcp)); + printf("secs:%d ", dhcp_get_secs(dhcp)); + + if(dhcp_get_flags(dhcp)) + printf("f:brdcst"); + else + printf("f:none"); + printf(" "); + + in.s_addr = dhcp_get_ciaddr(dhcp); + printf("ciaddr: %s ", inet_ntoa(in)); + + in.s_addr = dhcp_get_yiaddr(dhcp); + printf("yiaddr: %s ", inet_ntoa(in)); + + in.s_addr = dhcp_get_siaddr(dhcp); + printf("siaddr: %s ", inet_ntoa(in)); + + in.s_addr = dhcp_get_giaddr(dhcp); + printf("agaddr: %s ", inet_ntoa(in)); + + printf("chdr: "); + hw_ptr = dhcp_get_chaddr(dhcp); + for(i = 0;i < 16;i++) { + printf("%.2x",*hw_ptr); + hw_ptr++; + } + printf(" "); + fflush(stdout); + } + + /* Print the fixed header verbosely. * *************** *** 593,599 **** } ! /* Print source and destination address. */ ! void print_ip(ip_obj *ip) { struct in_addr in; --- 700,718 ---- } ! /* Print source and destination address (brief). */ ! void print_ip_brief(ip_obj *ip) ! { ! struct in_addr in; ! in.s_addr = ip_get_source_addr(ip); ! printf("srcip: %s ", inet_ntoa(in)); ! ! in.s_addr = ip_get_dest_addr(ip); ! printf("dstip: %s ", inet_ntoa(in)); ! return; ! } ! ! /* Print source and destination address (verbose). */ ! void print_ip_verbose(ip_obj *ip) { struct in_addr in; *************** *** 612,616 **** } ! void print_magic_cookie(const char *status, dhcp_obj *dhcp) { struct in_addr in; --- 731,743 ---- } ! void print_magic_cookie_brief(dhcp_obj *dhcp) ! { ! struct in_addr in; ! ! memcpy(&in.s_addr, &dhcp->magic_cookie, 4); ! printf("cookie: %s ", inet_ntoa(in)); ! return; ! } ! void print_magic_cookie_verbose(const char *status, dhcp_obj *dhcp) { struct in_addr in; *************** *** 624,628 **** } ! void print_timestamp(struct timeval tm) { printf("%lu.%06lu\n", tm.tv_sec, tm.tv_usec); --- 751,761 ---- } ! void print_timestamp_brief(struct timeval tm) ! { ! printf("[%lu.%06lu] ", tm.tv_sec, tm.tv_usec); ! return; ! } ! ! void print_timestamp_verbose(struct timeval tm) { printf("%lu.%06lu\n", tm.tv_sec, tm.tv_usec); *************** *** 630,634 **** } ! void print_eth(eth_obj *eth) { unsigned char *src_eth_addr; --- 763,783 ---- } ! void print_eth_brief(eth_obj *eth) ! { ! unsigned char *src_eth_addr; ! unsigned char *dst_eth_addr; ! ! src_eth_addr = eth_get_src_address(eth); ! dst_eth_addr = eth_get_dst_address(eth); ! ! printf("smac: %x:%x:%x:%x:%x:%x ", src_eth_addr[0], src_eth_addr[1], src_eth_addr[2], ! src_eth_addr[3], src_eth_addr[4], src_eth_addr[5]); ! printf("dmac: %x:%x:%x:%x:%x:%x ", dst_eth_addr[0], dst_eth_addr[1], dst_eth_addr[2], ! dst_eth_addr[3], dst_eth_addr[4], dst_eth_addr[5]); ! ! return; ! } ! ! void print_eth_verbose(eth_obj *eth) { unsigned char *src_eth_addr; *************** *** 644,647 **** --- 793,821 ---- dst_eth_addr[3], dst_eth_addr[4], dst_eth_addr[5]); + return; + } + + void print_dhcp_packet_verbose(rawnet_t *net) + { + print_eth_verbose(net->ether_p); + print_ip_verbose(net->ip_p); + print_dhcphdr_verbose(net->dhcp_p); + if(dhcp_valid_magic_cookie(net->dhcp_p)) + print_magic_cookie_verbose("Good", net->dhcp_p); + else + print_magic_cookie_verbose("Bad", net->dhcp_p); + print_options_verbose(net->dhcp_p); + + return; + } + + void print_dhcp_packet_brief(rawnet_t *net) + { + print_timestamp_brief(net->tstamp); + print_eth_brief(net->ether_p); + print_ip_brief(net->ip_p); + print_dhcphdr_brief(net->dhcp_p); + print_magic_cookie_brief(net->dhcp_p); + return; } Index: dhcp-sniff.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniff.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dhcp-sniff.c 17 Jun 2002 13:23:08 -0000 1.9 --- dhcp-sniff.c 18 Jun 2002 04:33:40 -0000 1.10 *************** *** 1,5 **** /* $Header$ - * - * dhcp-tool Sniffing routines. * * Copyright 2002 Thamer Alharbash --- 1,3 ---- *************** *** 23,30 **** --- 21,31 ---- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * + * dhcp-agent sniffer + * */ #include <dhcp-agent.h> #include <dhcp-util.h> + #include <dhcp-print.h> int interactive = 1; *************** *** 49,52 **** --- 50,54 ---- int sport, dport; char filter_buff[GENERIC_BUFFSIZE]; + print_packet p_packet = print_dhcp_packet_verbose; #if !defined(HAVE_PROGNAME) *************** *** 54,58 **** #endif /* HAVE_PROGNAME */ ! while((c = getopt(argc, argv, "vi:")) != -1) { switch(c) { --- 56,60 ---- #endif /* HAVE_PROGNAME */ ! while((c = getopt(argc, argv, "bvi:")) != -1) { switch(c) { *************** *** 66,69 **** --- 68,76 ---- exit(0); + case 'b': + /* brief mode. */ + p_packet = print_dhcp_packet_brief; + break; + default: usage(argv[0]); *************** *** 110,126 **** if(net->type == RAWNET_DHCP) { - - print_timestamp(net->tstamp); - print_eth(net->ether_p); - print_ip(net->ip_p); - print_dhcphdr_verbose(net->dhcp_p); - - if(dhcp_valid_magic_cookie(net->dhcp_p)) - print_magic_cookie("Good", net->dhcp_p); - else - print_magic_cookie("Bad", net->dhcp_p); ! print_options_verbose(net->dhcp_p); ! printf("\n"); fflush(stdout); --- 117,122 ---- if(net->type == RAWNET_DHCP) { ! p_packet(net); printf("\n"); fflush(stdout); Index: dhcp-sniffer-ohandlers.c =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcp-sniffer-ohandlers.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcp-sniffer-ohandlers.c 17 Jun 2002 13:23:08 -0000 1.2 --- dhcp-sniffer-ohandlers.c 18 Jun 2002 04:33:40 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- #include <dhcp-agent.h> + #include <dhcp-print.h> /* There are 63 DHCP options we handle, Index: dhcpsniff.1 =================================================================== RCS file: /cvsroot/dhcp-agent/dhcp-agent/dhcpsniff.1,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dhcpsniff.1 16 Jun 2002 19:55:47 -0000 1.2 --- dhcpsniff.1 18 Jun 2002 04:33:40 -0000 1.3 *************** *** 1,4 **** .\" $Header$ ! .Dd December, 17, 2001 .Dt DHCPSNIFF 1 .Sh NAME --- 1,4 ---- .\" $Header$ ! .Dd June, 17, 2002 .Dt DHCPSNIFF 1 .Sh NAME *************** *** 7,19 **** .Sh SYNOPSIS .Nm .Op Fl i Ar interface .Sh DESCRIPTION .Nm is a DHCP sniffer. ! It observes DHCP packets on the network and outputs diagnostic-quality ! details of said packets. .Pp The options are as follows: .Bl -tag -width Ds .It Fl i Ar interface Sniff for DHCP packets on --- 7,21 ---- .Sh SYNOPSIS .Nm + .Op Fl b .Op Fl i Ar interface .Sh DESCRIPTION .Nm is a DHCP sniffer. ! It sniffs for DHCP packets on an interface and outputs DHCP packet contents. .Pp The options are as follows: .Bl -tag -width Ds + .It Fl b + Use brief mode. .It Fl i Ar interface Sniff for DHCP packets on *************** *** 25,28 **** .Xr dhcpclient 1 .Sh AUTHORS ! Thamer Al-Harbash .Aq tm...@wh... --- 27,32 ---- .Xr dhcpclient 1 .Sh AUTHORS ! .An Thamer Al-Harbash .Aq tm...@wh... + .An Brian J. Kifiak + .Aq bk...@rt... |