]>
The Tcpdump Group git mirrors - tcpdump/blob - print-arista.c
1 // Copyright (c) 2018 Arista Networks, Inc. All rights reserved.
3 /* \summary: EtherType protocol for Arista Networks printer */
9 #include <netdissect-stdinc.h>
13 #include "netdissect.h"
14 #include "interface.h"
16 #include "addrtoname.h"
18 #define ARISTA_SUBTYPE_TIMESTAMP 0x01
20 #define ARISTA_TIMESTAMP_V1 0x10
21 #define ARISTA_TIMESTAMP_V2 0x20
24 arista_ethertype_print(netdissect_options
*ndo
, const u_char
*bp
, u_int len _U_
)
28 u_short bytesConsumed
= 0;
31 ndo
->ndo_protocol
= "arista";
33 subTypeId
= GET_BE_U_2(bp
);
35 version
= GET_BE_U_2(bp
);
39 ND_PRINT("SubType: 0x%1X, Version: 0x%02x, ", subTypeId
, version
);
41 // TapAgg Header Timestamping
42 if (subTypeId
== ARISTA_SUBTYPE_TIMESTAMP
) {
43 // Timestamp has 32-bit lsb in nanosec and remaining msb in sec
46 case ARISTA_TIMESTAMP_V1
:
47 ND_PRINT("Timestamp TAI(64-bit)");
48 ND_PRINT(": Seconds: %u,", GET_BE_U_4(bp
));
49 ND_PRINT(" Nanoseconds: %u, ", GET_BE_U_4(bp
+ 4));
50 bytesConsumed
+= size
+ 8;
52 case ARISTA_TIMESTAMP_V2
:
53 ND_PRINT("Timestamp (48-bit)");
54 ND_PRINT(": Seconds %u,", GET_BE_U_2(bp
));
55 ND_PRINT(" Nanoseconds %u, ", GET_BE_U_4(bp
+ 2));
56 bytesConsumed
+= size
+ 6;
59 ND_PRINT("Unknown timestamp Version 0x%02X ", version
);