From 23d7b1c1fb8a1806fd7823528a728ca12220e527 Mon Sep 17 00:00:00 2001 From: hackbard Date: Sat, 7 Sep 2002 12:22:05 +0000 Subject: [PATCH] ip address support added --- hdw-sniff.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hdw-sniff.c b/hdw-sniff.c index d6f2b0c..f6a8bc9 100644 --- a/hdw-sniff.c +++ b/hdw-sniff.c @@ -82,17 +82,15 @@ int main(int argc, char *argv[]) { ip_hdr=(struct ip *)(package+sizeof(struct ethhdr)); printf("version = %x ",ntohs(ip_hdr->ip_v)); printf("header_length = %x \n",ntohs(ip_hdr->ip_hl)); - // i=0; - //printf("service = %x ",*(ip_hdr->ip_tos)); - //printf("total_length(dec.) = %hu \n",*(ip_hdr->ip_len)); - //printf("ip_addresses: source = "); - //for(i=0;i<4;i++) - // printf("%x%s",ntohl(ip_hdr->ip_src), - // (i==3?"\n":".")); + printf("service = %x ",ntohs(ip_hdr->ip_tos)); + printf("total_length(dec.) = %d \n",ntohs(ip_hdr->ip_len)); + printf("ip_addresses: source = "); + printf("%s\tdestination = %s\n",inet_ntoa(ip_hdr->ip_src), + inet_ntoa(ip_hdr->ip_dst)); } - printf("rest:\n"); + printf("all_hex_dump:\n"); for(i=sizeof(struct ethhdr);i