Skip to content

Commit c3f5e39

Browse files
committed
Add tcp flags statistic for -s
1 parent 3d94f97 commit c3f5e39

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

man/nfdump.1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ source ports
458458
destination ports
459459
.It Cm port
460460
any (source or destination) ports
461+
.It Cm flags
462+
TCP flags
461463
.It Cm tos
462464
type of service - default src
463465
.It Cm srctos

src/nfdump/nfstat.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ typedef enum {
6464
IS_NUMBER,
6565
IS_HEXNUMBER,
6666
IS_IPADDR,
67+
IS_FLAGS,
6768
IS_MACADDR,
6869
IS_MPLS_LBL,
6970
IS_LATENCY,
@@ -138,6 +139,7 @@ static struct StatParameter_s {
138139
{"port", "Port", {EXgenericFlowID, OFFsrcPort, SIZEsrcPort, 0}, IS_NUMBER, NULL},
139140
{"port", NULL, {EXgenericFlowID, OFFdstPort, SIZEdstPort, 0}, IS_NUMBER, NULL},
140141
{"proto", "Protocol", {EXgenericFlowID, OFFproto, SIZEproto, 0}, IS_NUMBER, NULL},
142+
{"flags", "TCPflags", {EXgenericFlowID, OFFtcpFlags, SIZEtcpFlags, 0}, IS_FLAGS, NULL},
141143
{"srctos", "Src Tos", {EXgenericFlowID, OFFsrcTos, SIZEsrcTos, 0}, IS_NUMBER, NULL},
142144
{"dsttos", "Dst Tos", {EXflowMiscID, OFFdstTos, SIZEdstTos, 0}, IS_NUMBER, NULL},
143145
{"tos", "Tos", {EXgenericFlowID, OFFsrcTos, SIZEsrcTos, 0}, IS_NUMBER, NULL},
@@ -1077,6 +1079,12 @@ static void PrintStatLine(stat_record_t *stat, outputParams_t *outputParams, Sor
10771079
}
10781080
}
10791081
break;
1082+
case IS_FLAGS:
1083+
if (outputParams->printPlain)
1084+
snprintf(valstr, 64, "0x%" PRIx64, hashKey->v1);
1085+
else
1086+
snprintf(valstr, 64, "%8s", FlagsString(hashKey->v1));
1087+
break;
10801088
case IS_MACADDR: {
10811089
uint8_t mac[6];
10821090
for (int i = 0; i < 6; i++) {

0 commit comments

Comments
 (0)