From 4be2a17b36a3b9796c280b117b8b786323a84ae8 Mon Sep 17 00:00:00 2001 From: Neil McKee Date: Tue, 16 Feb 2021 16:09:27 -0800 Subject: [PATCH] add new structures for delay and queue depth --- configure.ac | 2 +- sflowtool.spec | 2 +- src/sflow.h | 30 ++++++++++++++++++++++++++++++ src/sflowtool.c | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 7bc230c..7a035f5 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) -AC_INIT([sflowtool],[5.06]) +AC_INIT([sflowtool],[5.07]) AC_CONFIG_SRCDIR([src/sflowtool.c]) AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) diff --git a/sflowtool.spec b/sflowtool.spec index 6f57b0f..e704093 100644 --- a/sflowtool.spec +++ b/sflowtool.spec @@ -1,6 +1,6 @@ Summary: tool to ascii-print or forward sFlow datagrams Name: sflowtool -Version: 5.06 +Version: 5.07 Release: 1%{?dist} License: https://www.inmon.com/technology/sflowlicense.txt Group: Productivity/Networking/Diagnostic diff --git a/src/sflow.h b/src/sflow.h index 9d1a816..1ed19ed 100644 --- a/src/sflow.h +++ b/src/sflow.h @@ -602,6 +602,14 @@ typedef struct _SFLExtended_decap { uint32_t innerHeaderOffset; } SFLExtended_decap; +/* Selected egress queue */ +/* Output port number must be provided in enclosing structure */ +/* opaque = flow_data; enterprise = 0; format = 1036 */ +typedef struct { + unsigned int queue; /* eqress queue number selected for sampled packet */ +} SFLExtended_egress_queue; +#define XDRSIZ_SFLEXTENDED_EGRESS_Q 4 + /* Software function */ /* Name of software function generating this event */ /* opaque = flow_data; enterprise = 0; format = 1038 */ @@ -610,6 +618,22 @@ typedef struct _SFLExtended_function { } SFLExtended_function; #define SFL_MAX_FUNCTION_SYMBOL_LEN 64 +/* Delay for sampled packet traversing switch */ +/* opaque = flow_data; enterprise = 0; format = 1039 */ +typedef struct { + unsigned int delay; /* transit delay in nanoseconds + 0xffffffff indicates value >= 0xffffffff */ +} SFLExtended_transit_delay; +#define XDRSIZ_SFLEXTENDED_TRANSIT 4 + +/* Queue depth for sampled packet traversing switch */ +/* extended_egress_queue structure must be included */ +/* opaque = flow_data; enterprise = 0; format = 1040 */ +typedef struct { + unsigned int depth; /* queue depth in bytes */ +} SFLExtended_queue_depth; +#define XDRSIZ_SFLEXTENDED_Q_DEPTH 4 + enum SFLFlow_type_tag { /* enterprise = 0, format = ... */ SFLFLOW_HEADER = 1, /* Packet headers are sampled */ @@ -643,7 +667,10 @@ enum SFLFlow_type_tag { SFLFLOW_EX_DECAP_IN = 1028, SFLFLOW_EX_VNI_OUT = 1029, SFLFLOW_EX_VNI_IN = 1030, + SFLFLOW_EX_EGRESS_Q = 1036, SFLFLOW_EX_FUNCTION = 1038, + SFLFLOW_EX_TRANSIT = 1039, + SFLFLOW_EX_Q_DEPTH = 1040, SFLFLOW_EX_SOCKET4 = 2100, SFLFLOW_EX_SOCKET6 = 2101, SFLFLOW_EX_PROXYSOCKET4 = 2102, @@ -693,6 +720,9 @@ typedef union _SFLFlow_type { SFLExtended_TCP_info tcp_info; SFLExtended_entities entities; SFLExtended_function function; + SFLExtended_egress_queue egress_queue; + SFLExtended_queue_depth queue_depth; + SFLExtended_transit_delay transit_delay; } SFLFlow_type; typedef struct _SFLFlow_sample_element { diff --git a/src/sflowtool.c b/src/sflowtool.c index a031317..df89ba0 100644 --- a/src/sflowtool.c +++ b/src/sflowtool.c @@ -3481,6 +3481,17 @@ static void readExtendedEntities(SFSample *sample) sf_log_next32(sample, "entities_dst_index"); } +/*_________________----------------------------__________________ + _________________ readExtendedEgressQueue __________________ + -----------------____________________________------------------ +*/ + +static void readExtendedEgressQueue(SFSample *sample) +{ + sf_logf(sample, "extendedType", "egress_queue"); + sf_log_next32(sample, "egress_queue_id"); +} + /*_________________----------------------------__________________ _________________ readExtendedFunction __________________ -----------------____________________________------------------ @@ -3495,6 +3506,28 @@ static void readExtendedFunction(SFSample *sample) } } +/*_________________----------------------------__________________ + _________________ readExtendedTransitDelay __________________ + -----------------____________________________------------------ +*/ + +static void readExtendedTransitDelay(SFSample *sample) +{ + sf_logf(sample, "extendedType", "transit_delay"); + sf_log_next32(sample, "transit_delay_nS"); +} + +/*_________________----------------------------__________________ + _________________ readExtendedQueueDepth __________________ + -----------------____________________________------------------ +*/ + +static void readExtendedQueueDepth(SFSample *sample) +{ + sf_logf(sample, "extendedType", "queue_depth"); + sf_log_next32(sample, "queue_depth_bytes"); +} + /*_________________---------------------------__________________ _________________ readFlowSample_v2v4 __________________ -----------------___________________________------------------ @@ -3731,6 +3764,9 @@ static void readFlowSample(SFSample *sample, int expanded) case SFLFLOW_EX_VNI_IN: readExtendedVNI(sample, "in_"); break; case SFLFLOW_EX_TCP_INFO: readExtendedTCPInfo(sample); break; case SFLFLOW_EX_ENTITIES: readExtendedEntities(sample); break; + case SFLFLOW_EX_EGRESS_Q: readExtendedEgressQueue(sample); break; + case SFLFLOW_EX_TRANSIT: readExtendedTransitDelay(sample); break; + case SFLFLOW_EX_Q_DEPTH: readExtendedQueueDepth(sample); break; default: skipTLVRecord(sample, tag, length, "flow_sample_element"); break; } lengthCheck(sample, "flow_sample_element", start, length); @@ -3858,6 +3894,7 @@ static void readDiscardSample(SFSample *sample) switch(tag) { case SFLFLOW_HEADER: readFlowSample_header(sample); break; case SFLFLOW_EX_FUNCTION: readExtendedFunction(sample); break; + case SFLFLOW_EX_EGRESS_Q: readExtendedEgressQueue(sample); break; default: skipTLVRecord(sample, tag, length, "discard_sample_element"); break; } lengthCheck(sample, "discard_sample_element", start, length);