summaryrefslogtreecommitdiff
path: root/dissector.h
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-04-29 22:45:53 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-04-29 22:45:53 +0200
commitec2c6ad0658638552ca547a695953609f3b7bd9c (patch)
tree34d853a77debb507e2842a0100a749705e5142f8 /dissector.h
parent3006fab58f7dd70078ffa92e542691b4f8f94abb (diff)
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 <dborkman@redhat.com>
Diffstat (limited to 'dissector.h')
-rw-r--r--dissector.h18
1 files changed, 16 insertions, 2 deletions
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;
}
}