projects
/
my-code
/
hdw-sniff.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d77d321
)
fixed ip stuff
author
hackbard
<hackbard>
Sun, 17 Nov 2002 16:59:12 +0000
(16:59 +0000)
committer
hackbard
<hackbard>
Sun, 17 Nov 2002 16:59:12 +0000
(16:59 +0000)
hdw-sniff.c
patch
|
blob
|
history
diff --git
a/hdw-sniff.c
b/hdw-sniff.c
index
816e778
..
fc67686
100644
(file)
--- a/
hdw-sniff.c
+++ b/
hdw-sniff.c
@@
-228,16
+228,16
@@
void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header,
printf("service = %x ",ntohs(ip_hdr->tos));
printf("total_length(dec.) = %d \n",ntohs(ip_hdr->tot_len));
printf("source_ip: ");
printf("service = %x ",ntohs(ip_hdr->tos));
printf("total_length(dec.) = %d \n",ntohs(ip_hdr->tot_len));
printf("source_ip: ");
- for(i=
3;i>=0;--
i) {
+ for(i=
0;i<=3;++
i) {
printf("%d%s",
printf("%d%s",
-
ip_hdr->saddr&0xff<<i
,
- (i==
0
?"\n":"."));
+
(ip_hdr->saddr&(0xff<<(8*i)))>>(8*i)
,
+ (i==
3
?"\n":"."));
}
printf("destination_ip: ");
}
printf("destination_ip: ");
- for(i=
3;i>=0;--
i) {
+ for(i=
0;i<=3;++
i) {
printf("%d%s",
printf("%d%s",
-
ip_hdr->daddr&0xff<<i
,
- (i==
0
?"\n":"."));
+
(ip_hdr->daddr&(0xff<<(8*i)))>>(8*i)
,
+ (i==
3
?"\n":"."));
}
printf("ip_id = %x ",ntohs(ip_hdr->id));
printf("ip_offset = %x \n",ntohs(ip_hdr->frag_off));
}
printf("ip_id = %x ",ntohs(ip_hdr->id));
printf("ip_offset = %x \n",ntohs(ip_hdr->frag_off));