standardize ICMP output

This commit is contained in:
Neale Pickett 2013-07-26 14:08:48 -06:00
parent 306f0c6264
commit 7e6e7f5b40
2 changed files with 5 additions and 3 deletions

4
pcap.h
View File

@ -8,7 +8,9 @@
#define MAGIC 0xa1b2c3d4 #define MAGIC 0xa1b2c3d4
#define MAXFRAME 9000 #define MAXFRAME 9000
/* Described at http://www.tcpdump.org/linktypes.html */ /*
* Described at http://www.tcpdump.org/linktypes.html
*/
#define LINKTYPE_ETHERNET 1 #define LINKTYPE_ETHERNET 1
#define LINKTYPE_RAW 101 #define LINKTYPE_RAW 101

4
pcat.c
View File

@ -67,7 +67,7 @@ process_icmp(struct stream *s, char *saddr_s, char *daddr_s)
uint8_t code = read_uint8(s); uint8_t code = read_uint8(s);
uint16_t checksum = read_uint16be(s); uint16_t checksum = read_uint16be(s);
printf("ICMP %s %s %d ", saddr_s, daddr_s, code); printf("ICMP %d,%d %s %s ", type, code, saddr_s, daddr_s);
} }
void void
@ -147,7 +147,7 @@ print_frame(struct pcap_file *p, struct pcap_pkthdr *hdr, char const *frame)
struct stream *s = &streambuf; struct stream *s = &streambuf;
sinit(s, frame, hdr->caplen); sinit(s, frame, hdr->caplen);
printf("%u.%u ", hdr->ts.tv_sec, hdr->ts.tv_usec); printf("%u.%06u ", hdr->ts.tv_sec, hdr->ts.tv_usec);
switch (p->linktype) { switch (p->linktype) {
case LINKTYPE_ETHERNET: case LINKTYPE_ETHERNET:
print_ethernet(s); print_ethernet(s);