From ec2c6ad0658638552ca547a695953609f3b7bd9c Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Mon, 29 Apr 2013 22:45:53 +0200 Subject: dissector: show sw/hw timestamp source Now, with PF_PACKET's extension, we can see what kind of sw/hw timestamp is being reported to us [1]. Thus, report it in the dissector. [1] http://thread.gmane.org/gmane.linux.network/266878/ Signed-off-by: Daniel Borkmann --- dissector.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'dissector.h') diff --git a/dissector.h b/dissector.h index fc2cd5a..d211e06 100644 --- a/dissector.h +++ b/dissector.h @@ -13,6 +13,7 @@ #include "ring.h" #include "tprintf.h" #include "pcap_io.h" +#include "built_in.h" #define PRINT_NORM 0 #define PRINT_LESS 1 @@ -32,6 +33,18 @@ static const char * const packet_types[256]={ extern char *if_indextoname(unsigned ifindex, char *ifname); +static inline const char *__show_ts_source(uint32_t status) +{ + if (status & TP_STATUS_TS_RAW_HARDWARE) + return "(raw hw ts)"; + else if (status & TP_STATUS_TS_SYS_HARDWARE) + return "(sys hw ts)"; + else if (status & TP_STATUS_TS_SOFTWARE) + return "(sw ts)"; + else + return ""; +} + static inline void show_frame_hdr(struct frame_map *hdr, int mode) { char tmp[IFNAMSIZ]; @@ -47,11 +60,12 @@ static inline void show_frame_hdr(struct frame_map *hdr, int mode) hdr->tp_h.tp_len); break; default: - tprintf("%s %s %u %us.%uns\n", + tprintf("%s %s %u %us.%uns %s\n", packet_types[hdr->s_ll.sll_pkttype] ? : "?", if_indextoname(hdr->s_ll.sll_ifindex, tmp) ? : "?", hdr->tp_h.tp_len, hdr->tp_h.tp_sec, - hdr->tp_h.tp_nsec); + hdr->tp_h.tp_nsec, + __show_ts_source(hdr->tp_h.tp_status)); break; } } -- cgit v1.2.3-54-g00ecf ext.git/log/Documentation?h=nds-private-remove'>logtreecommitdiff
ModeNameSize