ARL for /proc/net/netstat
Costa Tsaousis (ktsaou) committed
Jan 21, 2017 at 14:43 UTC
590be010eeed5db3151dab1507cfcef45f8c25b9
1 file changed
+178
-558
src/proc_net_netstat.c
+178
-558
@@ -1,176 +1,9 @@
1
#include "common.h"
2
3
-
4
-struct netstat_columns {
5
- char *name;
6
- uint32_t hash;
7
- unsigned long long value;
8
- int multiplier; // not needed everywhere
9
- char *label; // not needed everywhere
10
-};
11
-
12
-static struct netstat_columns tcpext_data[] = {
13
- { "SyncookiesSent", 0, 0, 1, NULL },
14
- { "SyncookiesRecv", 0, 0, 1, NULL },
15
- { "SyncookiesFailed", 0, 0, 1, NULL },
16
- { "EmbryonicRsts", 0, 0, 1, NULL },
17
- { "PruneCalled", 0, 0, 1, NULL },
18
- { "RcvPruned", 0, 0, 1, NULL },
19
- { "OfoPruned", 0, 0, 1, NULL },
20
- { "OutOfWindowIcmps", 0, 0, 1, NULL },
21
- { "LockDroppedIcmps", 0, 0, 1, NULL },
22
- { "ArpFilter", 0, 0, 1, NULL },
23
- { "TW", 0, 0, 1, NULL },
24
- { "TWRecycled", 0, 0, 1, NULL },
25
- { "TWKilled", 0, 0, 1, NULL },
26
- { "PAWSPassive", 0, 0, 1, NULL },
27
- { "PAWSActive", 0, 0, 1, NULL },
28
- { "PAWSEstab", 0, 0, 1, NULL },
29
- { "DelayedACKs", 0, 0, 1, NULL },
30
- { "DelayedACKLocked", 0, 0, 1, NULL },
31
- { "DelayedACKLost", 0, 0, 1, NULL },
32
- { "ListenOverflows", 0, 0, 1, NULL },
33
- { "ListenDrops", 0, 0, 1, NULL },
34
- { "TCPPrequeued", 0, 0, 1, NULL },
35
- { "TCPDirectCopyFromBacklog", 0, 0, 1, NULL },
36
- { "TCPDirectCopyFromPrequeue", 0, 0, 1, NULL },
37
- { "TCPPrequeueDropped", 0, 0, 1, NULL },
38
- { "TCPHPHits", 0, 0, 1, NULL },
39
- { "TCPHPHitsToUser", 0, 0, 1, NULL },
40
- { "TCPPureAcks", 0, 0, 1, NULL },
41
- { "TCPHPAcks", 0, 0, 1, NULL },
42
- { "TCPRenoRecovery", 0, 0, 1, NULL },
43
- { "TCPSackRecovery", 0, 0, 1, NULL },
44
- { "TCPSACKReneging", 0, 0, 1, NULL },
45
- { "TCPFACKReorder", 0, 0, 1, NULL },
46
- { "TCPSACKReorder", 0, 0, 1, NULL },
47
- { "TCPRenoReorder", 0, 0, 1, NULL },
48
- { "TCPTSReorder", 0, 0, 1, NULL },
49
- { "TCPFullUndo", 0, 0, 1, NULL },
50
- { "TCPPartialUndo", 0, 0, 1, NULL },
51
- { "TCPDSACKUndo", 0, 0, 1, NULL },
52
- { "TCPLossUndo", 0, 0, 1, NULL },
53
- { "TCPLostRetransmit", 0, 0, 1, NULL },
54
- { "TCPRenoFailures", 0, 0, 1, NULL },
55
- { "TCPSackFailures", 0, 0, 1, NULL },
56
- { "TCPLossFailures", 0, 0, 1, NULL },
57
- { "TCPFastRetrans", 0, 0, 1, NULL },
58
- { "TCPForwardRetrans", 0, 0, 1, NULL },
59
- { "TCPSlowStartRetrans", 0, 0, 1, NULL },
60
- { "TCPTimeouts", 0, 0, 1, NULL },
61
- { "TCPLossProbes", 0, 0, 1, NULL },
62
- { "TCPLossProbeRecovery", 0, 0, 1, NULL },
63
- { "TCPRenoRecoveryFail", 0, 0, 1, NULL },
64
- { "TCPSackRecoveryFail", 0, 0, 1, NULL },
65
- { "TCPSchedulerFailed", 0, 0, 1, NULL },
66
- { "TCPRcvCollapsed", 0, 0, 1, NULL },
67
- { "TCPDSACKOldSent", 0, 0, 1, NULL },
68
- { "TCPDSACKOfoSent", 0, 0, 1, NULL },
69
- { "TCPDSACKRecv", 0, 0, 1, NULL },
70
- { "TCPDSACKOfoRecv", 0, 0, 1, NULL },
71
- { "TCPAbortOnData", 0, 0, 1, NULL },
72
- { "TCPAbortOnClose", 0, 0, 1, NULL },
73
- { "TCPAbortOnMemory", 0, 0, 1, NULL },
74
- { "TCPAbortOnTimeout", 0, 0, 1, NULL },
75
- { "TCPAbortOnLinger", 0, 0, 1, NULL },
76
- { "TCPAbortFailed", 0, 0, 1, NULL },
77
- { "TCPMemoryPressures", 0, 0, 1, NULL },
78
- { "TCPSACKDiscard", 0, 0, 1, NULL },
79
- { "TCPDSACKIgnoredOld", 0, 0, 1, NULL },
80
- { "TCPDSACKIgnoredNoUndo", 0, 0, 1, NULL },
81
- { "TCPSpuriousRTOs", 0, 0, 1, NULL },
82
- { "TCPMD5NotFound", 0, 0, 1, NULL },
83
- { "TCPMD5Unexpected", 0, 0, 1, NULL },
84
- { "TCPSackShifted", 0, 0, 1, NULL },
85
- { "TCPSackMerged", 0, 0, 1, NULL },
86
- { "TCPSackShiftFallback", 0, 0, 1, NULL },
87
- { "TCPBacklogDrop", 0, 0, 1, NULL },
88
- { "TCPMinTTLDrop", 0, 0, 1, NULL },
89
- { "TCPDeferAcceptDrop", 0, 0, 1, NULL },
90
- { "IPReversePathFilter", 0, 0, 1, NULL },
91
- { "TCPTimeWaitOverflow", 0, 0, 1, NULL },
92
- { "TCPReqQFullDoCookies", 0, 0, 1, NULL },
93
- { "TCPReqQFullDrop", 0, 0, 1, NULL },
94
- { "TCPRetransFail", 0, 0, 1, NULL },
95
- { "TCPRcvCoalesce", 0, 0, 1, NULL },
96
- { "TCPOFOQueue", 0, 0, 1, NULL },
97
- { "TCPOFODrop", 0, 0, 1, NULL },
98
- { "TCPOFOMerge", 0, 0, 1, NULL },
99
- { "TCPChallengeACK", 0, 0, 1, NULL },
100
- { "TCPSYNChallenge", 0, 0, 1, NULL },
101
- { "TCPFastOpenActive", 0, 0, 1, NULL },
102
- { "TCPFastOpenActiveFail", 0, 0, 1, NULL },
103
- { "TCPFastOpenPassive", 0, 0, 1, NULL },
104
- { "TCPFastOpenPassiveFail", 0, 0, 1, NULL },
105
- { "TCPFastOpenListenOverflow", 0, 0, 1, NULL },
106
- { "TCPFastOpenCookieReqd", 0, 0, 1, NULL },
107
- { "TCPSpuriousRtxHostQueues", 0, 0, 1, NULL },
108
- { "BusyPollRxPackets", 0, 0, 1, NULL },
109
- { "TCPAutoCorking", 0, 0, 1, NULL },
110
- { "TCPFromZeroWindowAdv", 0, 0, 1, NULL },
111
- { "TCPToZeroWindowAdv", 0, 0, 1, NULL },
112
- { "TCPWantZeroWindowAdv", 0, 0, 1, NULL },
113
- { "TCPSynRetrans", 0, 0, 1, NULL },
114
- { "TCPOrigDataSent", 0, 0, 1, NULL },
115
- { "TCPHystartTrainDetect", 0, 0, 1, NULL },
116
- { "TCPHystartTrainCwnd", 0, 0, 1, NULL },
117
- { "TCPHystartDelayDetect", 0, 0, 1, NULL },
118
- { "TCPHystartDelayCwnd", 0, 0, 1, NULL },
119
- { "TCPACKSkippedSynRecv", 0, 0, 1, NULL },
120
- { "TCPACKSkippedPAWS", 0, 0, 1, NULL },
121
- { "TCPACKSkippedSeq", 0, 0, 1, NULL },
122
- { "TCPACKSkippedFinWait2", 0, 0, 1, NULL },
123
- { "TCPACKSkippedTimeWait", 0, 0, 1, NULL },
124
- { "TCPACKSkippedChallenge", 0, 0, 1, NULL },
125
- { "TCPWinProbe", 0, 0, 1, NULL },
126
- { "TCPKeepAlive", 0, 0, 1, NULL },
127
- { "TCPMTUPFail", 0, 0, 1, NULL },
128
- { "TCPMTUPSuccess", 0, 0, 1, NULL },
129
- { NULL, 0, 0, 0, NULL }
130
-};
131
-
132
-static struct netstat_columns ipext_data[] = {
133
- { "InNoRoutes", 0, 0, 1, NULL },
134
- { "InTruncatedPkts", 0, 0, 1, NULL },
135
- { "InMcastPkts", 0, 0, 1, NULL },
136
- { "OutMcastPkts", 0, 0, 1, NULL },
137
- { "InBcastPkts", 0, 0, 1, NULL },
138
- { "OutBcastPkts", 0, 0, 1, NULL },
139
- { "InOctets", 0, 0, 1, NULL },
140
- { "OutOctets", 0, 0, 1, NULL },
141
- { "InMcastOctets", 0, 0, 1, NULL },
142
- { "OutMcastOctets", 0, 0, 1, NULL },
143
- { "InBcastOctets", 0, 0, 1, NULL },
144
- { "OutBcastOctets", 0, 0, 1, NULL },
145
- { "InCsumErrors", 0, 0, 1, NULL },
146
- { "InNoECTPkts", 0, 0, 1, NULL },
147
- { "InECT1Pkts", 0, 0, 1, NULL },
148
- { "InECT0Pkts", 0, 0, 1, NULL },
149
- { "InCEPkts", 0, 0, 1, NULL },
150
- { NULL, 0, 0, 0, NULL }
151
-};
152
-
153
-static void hash_array(struct netstat_columns *nc) {
154
- int i;
155
-
156
- for(i = 0; nc[i].name ;i++)
157
- nc[i].hash = simple_hash(nc[i].name);
158
-}
159
-
160
-static unsigned long long *netstat_columns_find(struct netstat_columns *nc, const char *name) {
161
- uint32_t i, hash = simple_hash(name);
162
-
163
- for(i = 0; nc[i].name ;i++)
164
- if(unlikely(nc[i].hash == hash && !strsame(nc[i].name, name)))
165
- return &nc[i].value;
166
-
167
- fatal("Cannot find key '%s' in /proc/net/netstat internal array.", name);
168
-}
169
-
170
-static void parse_line_pair(procfile *ff, struct netstat_columns *nc, size_t header_line, size_t values_line) {
3
+static void parse_line_pair(procfile *ff, ARL_BASE *base, size_t header_line, size_t values_line) {
4
size_t hwords = procfile_linewords(ff, header_line);
5
size_t vwords = procfile_linewords(ff, values_line);
173
- size_t w, i;
6
+ size_t w;
7
8
if(unlikely(vwords > hwords)) {
9
error("File /proc/net/netstat on header line %zu has %zu words, but on value line %zu has %zu words.", header_line, hwords, values_line, vwords);
@@ -178,19 +11,11 @@ static void parse_line_pair(procfile *ff, struct netstat_columns *nc, size_t hea
11
}
12
13
for(w = 1; w < vwords ;w++) {
181
- char *key = procfile_lineword(ff, header_line, w);
182
- uint32_t hash = simple_hash(key);
183
-
184
- for(i = 0 ; nc[i].name ;i++) {
185
- if(unlikely(hash == nc[i].hash && !strsame(key, nc[i].name))) {
186
- nc[i].value = str2ull(procfile_lineword(ff, values_line, w));
187
- break;
188
- }
189
- }
14
+ if(unlikely(arl_check(base, procfile_lineword(ff, header_line, w), procfile_lineword(ff, values_line, w))))
15
+ break;
16
}
17
}
18
193
-
19
int do_proc_net_netstat(int update_every, usec_t dt) {
20
(void)dt;
21
@@ -199,176 +24,55 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
24
static uint32_t hash_ipext = 0, hash_tcpext = 0;
25
static procfile *ff = NULL;
26
202
- static unsigned long long *tcpext_TCPRenoReorder = NULL;
203
- static unsigned long long *tcpext_TCPFACKReorder = NULL;
204
- static unsigned long long *tcpext_TCPSACKReorder = NULL;
205
- static unsigned long long *tcpext_TCPTSReorder = NULL;
206
-
207
- static unsigned long long *tcpext_SyncookiesSent = NULL;
208
- static unsigned long long *tcpext_SyncookiesRecv = NULL;
209
- static unsigned long long *tcpext_SyncookiesFailed = NULL;
210
-
211
- static unsigned long long *tcpext_TCPOFOQueue = NULL; // Number of packets queued in OFO queue
212
- static unsigned long long *tcpext_TCPOFODrop = NULL; // Number of packets meant to be queued in OFO but dropped because socket rcvbuf limit hit.
213
- static unsigned long long *tcpext_TCPOFOMerge = NULL; // Number of packets in OFO that were merged with other packets.
214
- static unsigned long long *tcpext_OfoPruned = NULL; // packets dropped from out-of-order queue because of socket buffer overrun
215
-
216
- static unsigned long long *tcpext_TCPAbortOnData = NULL; // connections reset due to unexpected data
217
- static unsigned long long *tcpext_TCPAbortOnClose = NULL; // connections reset due to early user close
218
- static unsigned long long *tcpext_TCPAbortOnMemory = NULL; // connections aborted due to memory pressure
219
- static unsigned long long *tcpext_TCPAbortOnTimeout = NULL; // connections aborted due to timeout
220
- static unsigned long long *tcpext_TCPAbortOnLinger = NULL; // connections aborted after user close in linger timeout
221
- static unsigned long long *tcpext_TCPAbortFailed = NULL; // times unable to send RST due to no memory
222
-
223
- static unsigned long long *tcpext_TCPMemoryPressures = NULL;
224
-
225
-/*
226
- // connection rejects
227
- static unsigned long long *tcpext_PAWSActive = NULL; // active connections rejected because of time stamp
228
- static unsigned long long *tcpext_PAWSPassive = NULL; // passive connections rejected because of time stamp
229
-
230
- static unsigned long long *tcpext_TCPTimeouts = NULL;
231
-
232
- static unsigned long long *tcpext_TCPDSACKUndo = NULL;
233
- static unsigned long long *tcpext_TCPDSACKOldSent = NULL;
234
- static unsigned long long *tcpext_TCPDSACKOfoSent = NULL;
235
- static unsigned long long *tcpext_TCPDSACKRecv = NULL;
236
- static unsigned long long *tcpext_TCPDSACKOfoRecv = NULL;
237
- static unsigned long long *tcpext_TCPDSACKIgnoredOld = NULL;
238
- static unsigned long long *tcpext_TCPDSACKIgnoredNoUndo = NULL;
239
-
240
-
241
- static unsigned long long *tcpext_EmbryonicRsts = NULL;
242
-
243
- static unsigned long long *tcpext_PruneCalled = NULL;
244
- static unsigned long long *tcpext_RcvPruned = NULL;
245
- static unsigned long long *tcpext_OutOfWindowIcmps = NULL;
246
- static unsigned long long *tcpext_LockDroppedIcmps = NULL;
247
- static unsigned long long *tcpext_ArpFilter = NULL;
248
-
249
- static unsigned long long *tcpext_TW = NULL;
250
- static unsigned long long *tcpext_TWRecycled = NULL;
251
- static unsigned long long *tcpext_TWKilled = NULL;
252
-
253
- static unsigned long long *tcpext_PAWSEstab = NULL;
254
-
255
- static unsigned long long *tcpext_DelayedACKs = NULL;
256
- static unsigned long long *tcpext_DelayedACKLocked = NULL;
257
- static unsigned long long *tcpext_DelayedACKLost = NULL;
258
-
259
- static unsigned long long *tcpext_ListenOverflows = NULL;
260
- static unsigned long long *tcpext_ListenDrops = NULL;
261
-
262
- static unsigned long long *tcpext_TCPPrequeued = NULL;
263
-
264
- static unsigned long long *tcpext_TCPDirectCopyFromBacklog = NULL;
265
- static unsigned long long *tcpext_TCPDirectCopyFromPrequeue = NULL;
266
- static unsigned long long *tcpext_TCPPrequeueDropped = NULL;
267
-
268
- static unsigned long long *tcpext_TCPHPHits = NULL;
269
- static unsigned long long *tcpext_TCPHPHitsToUser = NULL;
270
- static unsigned long long *tcpext_TCPHPAcks = NULL;
271
-
272
- static unsigned long long *tcpext_TCPPureAcks = NULL;
273
- static unsigned long long *tcpext_TCPRenoRecovery = NULL;
274
-
275
- static unsigned long long *tcpext_TCPSackRecovery = NULL;
276
- static unsigned long long *tcpext_TCPSackFailures = NULL;
277
- static unsigned long long *tcpext_TCPSACKReneging = NULL;
278
- static unsigned long long *tcpext_TCPSackRecoveryFail = NULL;
279
- static unsigned long long *tcpext_TCPSACKDiscard = NULL;
280
- static unsigned long long *tcpext_TCPSackShifted = NULL;
281
- static unsigned long long *tcpext_TCPSackMerged = NULL;
282
- static unsigned long long *tcpext_TCPSackShiftFallback = NULL;
283
-
284
-
285
- static unsigned long long *tcpext_TCPFullUndo = NULL;
286
- static unsigned long long *tcpext_TCPPartialUndo = NULL;
287
-
288
- static unsigned long long *tcpext_TCPLossUndo = NULL;
289
- static unsigned long long *tcpext_TCPLostRetransmit = NULL;
290
-
291
- static unsigned long long *tcpext_TCPRenoFailures = NULL;
292
-
293
- static unsigned long long *tcpext_TCPLossFailures = NULL;
294
- static unsigned long long *tcpext_TCPFastRetrans = NULL;
295
- static unsigned long long *tcpext_TCPForwardRetrans = NULL;
296
- static unsigned long long *tcpext_TCPSlowStartRetrans = NULL;
297
- static unsigned long long *tcpext_TCPLossProbes = NULL;
298
- static unsigned long long *tcpext_TCPLossProbeRecovery = NULL;
299
- static unsigned long long *tcpext_TCPRenoRecoveryFail = NULL;
300
- static unsigned long long *tcpext_TCPSchedulerFailed = NULL;
301
- static unsigned long long *tcpext_TCPRcvCollapsed = NULL;
302
-
303
- static unsigned long long *tcpext_TCPSpuriousRTOs = NULL;
304
- static unsigned long long *tcpext_TCPMD5NotFound = NULL;
305
- static unsigned long long *tcpext_TCPMD5Unexpected = NULL;
306
-
307
- static unsigned long long *tcpext_TCPBacklogDrop = NULL;
308
- static unsigned long long *tcpext_TCPMinTTLDrop = NULL;
309
- static unsigned long long *tcpext_TCPDeferAcceptDrop = NULL;
310
- static unsigned long long *tcpext_IPReversePathFilter = NULL;
311
- static unsigned long long *tcpext_TCPTimeWaitOverflow = NULL;
312
- static unsigned long long *tcpext_TCPReqQFullDoCookies = NULL;
313
- static unsigned long long *tcpext_TCPReqQFullDrop = NULL;
314
- static unsigned long long *tcpext_TCPRetransFail = NULL;
315
- static unsigned long long *tcpext_TCPRcvCoalesce = NULL;
316
-
317
- static unsigned long long *tcpext_TCPChallengeACK = NULL;
318
- static unsigned long long *tcpext_TCPSYNChallenge = NULL;
319
-
320
- static unsigned long long *tcpext_TCPFastOpenActive = NULL;
321
- static unsigned long long *tcpext_TCPFastOpenActiveFail = NULL;
322
- static unsigned long long *tcpext_TCPFastOpenPassive = NULL;
323
- static unsigned long long *tcpext_TCPFastOpenPassiveFail = NULL;
324
- static unsigned long long *tcpext_TCPFastOpenListenOverflow = NULL;
325
- static unsigned long long *tcpext_TCPFastOpenCookieReqd = NULL;
326
-
327
- static unsigned long long *tcpext_TCPSpuriousRtxHostQueues = NULL;
328
- static unsigned long long *tcpext_BusyPollRxPackets = NULL;
329
- static unsigned long long *tcpext_TCPAutoCorking = NULL;
330
- static unsigned long long *tcpext_TCPFromZeroWindowAdv = NULL;
331
- static unsigned long long *tcpext_TCPToZeroWindowAdv = NULL;
332
- static unsigned long long *tcpext_TCPWantZeroWindowAdv = NULL;
333
- static unsigned long long *tcpext_TCPSynRetrans = NULL;
334
- static unsigned long long *tcpext_TCPOrigDataSent = NULL;
335
-
336
- static unsigned long long *tcpext_TCPHystartTrainDetect = NULL;
337
- static unsigned long long *tcpext_TCPHystartTrainCwnd = NULL;
338
- static unsigned long long *tcpext_TCPHystartDelayDetect = NULL;
339
- static unsigned long long *tcpext_TCPHystartDelayCwnd = NULL;
340
-
341
- static unsigned long long *tcpext_TCPACKSkippedSynRecv = NULL;
342
- static unsigned long long *tcpext_TCPACKSkippedPAWS = NULL;
343
- static unsigned long long *tcpext_TCPACKSkippedSeq = NULL;
344
- static unsigned long long *tcpext_TCPACKSkippedFinWait2 = NULL;
345
- static unsigned long long *tcpext_TCPACKSkippedTimeWait = NULL;
346
- static unsigned long long *tcpext_TCPACKSkippedChallenge = NULL;
347
-
348
- static unsigned long long *tcpext_TCPWinProbe = NULL;
349
- static unsigned long long *tcpext_TCPKeepAlive = NULL;
350
-
351
- static unsigned long long *tcpext_TCPMTUPFail = NULL;
352
- static unsigned long long *tcpext_TCPMTUPSuccess = NULL;
353
-*/
354
-
355
- static unsigned long long *ipext_InNoRoutes = NULL;
356
- static unsigned long long *ipext_InTruncatedPkts = NULL;
357
- static unsigned long long *ipext_InMcastPkts = NULL;
358
- static unsigned long long *ipext_OutMcastPkts = NULL;
359
- static unsigned long long *ipext_InBcastPkts = NULL;
360
- static unsigned long long *ipext_OutBcastPkts = NULL;
361
- static unsigned long long *ipext_InOctets = NULL;
362
- static unsigned long long *ipext_OutOctets = NULL;
363
- static unsigned long long *ipext_InMcastOctets = NULL;
364
- static unsigned long long *ipext_OutMcastOctets = NULL;
365
- static unsigned long long *ipext_InBcastOctets = NULL;
366
- static unsigned long long *ipext_OutBcastOctets = NULL;
367
- static unsigned long long *ipext_InCsumErrors = NULL;
368
- static unsigned long long *ipext_InNoECTPkts = NULL;
369
- static unsigned long long *ipext_InECT1Pkts = NULL;
370
- static unsigned long long *ipext_InECT0Pkts = NULL;
371
- static unsigned long long *ipext_InCEPkts = NULL;
27
+ ARL_BASE *arl_tcpext = NULL;
28
+
29
+ // Reordering
30
+ static unsigned long long tcpext_TCPRenoReorder = 0;
31
+ static unsigned long long tcpext_TCPFACKReorder = 0;
32
+ static unsigned long long tcpext_TCPSACKReorder = 0;
33
+ static unsigned long long tcpext_TCPTSReorder = 0;
34
+
35
+ // SYN Cookies
36
+ static unsigned long long tcpext_SyncookiesSent = 0;
37
+ static unsigned long long tcpext_SyncookiesRecv = 0;
38
+ static unsigned long long tcpext_SyncookiesFailed = 0;
39
+
40
+ // Out Of Order Queue
41
+ // http://www.spinics.net/lists/netdev/msg204696.html
42
+ static unsigned long long tcpext_TCPOFOQueue = 0; // Number of packets queued in OFO queue
43
+ static unsigned long long tcpext_TCPOFODrop = 0; // Number of packets meant to be queued in OFO but dropped because socket rcvbuf limit hit.
44
+ static unsigned long long tcpext_TCPOFOMerge = 0; // Number of packets in OFO that were merged with other packets.
45
+ static unsigned long long tcpext_OfoPruned = 0; // packets dropped from out-of-order queue because of socket buffer overrun
46
+
47
+ // connection resets
48
+ // https://github.com/ecki/net-tools/blob/bd8bceaed2311651710331a7f8990c3e31be9840/statistics.c
49
+ static unsigned long long tcpext_TCPAbortOnData = 0; // connections reset due to unexpected data
50
+ static unsigned long long tcpext_TCPAbortOnClose = 0; // connections reset due to early user close
51
+ static unsigned long long tcpext_TCPAbortOnMemory = 0; // connections aborted due to memory pressure
52
+ static unsigned long long tcpext_TCPAbortOnTimeout = 0; // connections aborted due to timeout
53
+ static unsigned long long tcpext_TCPAbortOnLinger = 0; // connections aborted after user close in linger timeout
54
+ static unsigned long long tcpext_TCPAbortFailed = 0; // times unable to send RST due to no memory
55
+
56
+ static unsigned long long tcpext_TCPMemoryPressures = 0;
57
+
58
+ ARL_BASE *arl_ipext = NULL;
59
+ static unsigned long long ipext_InNoRoutes = 0;
60
+ static unsigned long long ipext_InTruncatedPkts = 0;
61
+ static unsigned long long ipext_InMcastPkts = 0;
62
+ static unsigned long long ipext_OutMcastPkts = 0;
63
+ static unsigned long long ipext_InBcastPkts = 0;
64
+ static unsigned long long ipext_OutBcastPkts = 0;
65
+ static unsigned long long ipext_InOctets = 0;
66
+ static unsigned long long ipext_OutOctets = 0;
67
+ static unsigned long long ipext_InMcastOctets = 0;
68
+ static unsigned long long ipext_OutMcastOctets = 0;
69
+ static unsigned long long ipext_InBcastOctets = 0;
70
+ static unsigned long long ipext_OutBcastOctets = 0;
71
+ static unsigned long long ipext_InCsumErrors = 0;
72
+ static unsigned long long ipext_InNoECTPkts = 0;
73
+ static unsigned long long ipext_InECT1Pkts = 0;
74
+ static unsigned long long ipext_InECT0Pkts = 0;
75
+ static unsigned long long ipext_InCEPkts = 0;
76
77
if(unlikely(do_bandwidth == -1)) {
78
do_bandwidth = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "bandwidth", CONFIG_ONDEMAND_ONDEMAND);
@@ -385,158 +89,80 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
89
do_tcpext_connaborts = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "TCP connection aborts", CONFIG_ONDEMAND_ONDEMAND);
90
do_tcpext_memory = config_get_boolean_ondemand("plugin:proc:/proc/net/netstat", "TCP memory pressures", CONFIG_ONDEMAND_ONDEMAND);
91
388
- hash_ipext = simple_hash("IpExt");
389
- hash_tcpext = simple_hash("TcpExt");
390
-
391
- hash_array(ipext_data);
392
- hash_array(tcpext_data);
393
-
394
- // Reordering
395
- tcpext_TCPFACKReorder = netstat_columns_find(tcpext_data, "TCPFACKReorder");
396
- tcpext_TCPSACKReorder = netstat_columns_find(tcpext_data, "TCPSACKReorder");
397
- tcpext_TCPRenoReorder = netstat_columns_find(tcpext_data, "TCPRenoReorder");
398
- tcpext_TCPTSReorder = netstat_columns_find(tcpext_data, "TCPTSReorder");
399
-
400
- // SYN Cookies
401
- tcpext_SyncookiesSent = netstat_columns_find(tcpext_data, "SyncookiesSent");
402
- tcpext_SyncookiesRecv = netstat_columns_find(tcpext_data, "SyncookiesRecv");
403
- tcpext_SyncookiesFailed = netstat_columns_find(tcpext_data, "SyncookiesFailed");
404
-
405
- // Out Of Order Queue
406
- // http://www.spinics.net/lists/netdev/msg204696.html
407
- tcpext_TCPOFOQueue = netstat_columns_find(tcpext_data, "TCPOFOQueue"); // Number of packets queued in OFO queue
408
- tcpext_TCPOFODrop = netstat_columns_find(tcpext_data, "TCPOFODrop"); // Number of packets meant to be queued in OFO but dropped because socket rcvbuf limit hit.
409
- tcpext_TCPOFOMerge = netstat_columns_find(tcpext_data, "TCPOFOMerge"); // Number of packets in OFO that were merged with other packets.
410
- tcpext_OfoPruned = netstat_columns_find(tcpext_data, "OfoPruned"); // packets dropped from out-of-order queue because of socket buffer overrun
411
-
412
- // connection resets
413
- // https://github.com/ecki/net-tools/blob/bd8bceaed2311651710331a7f8990c3e31be9840/statistics.c
414
- tcpext_TCPAbortOnData = netstat_columns_find(tcpext_data, "TCPAbortOnData"); // connections reset due to unexpected data
415
- tcpext_TCPAbortOnClose = netstat_columns_find(tcpext_data, "TCPAbortOnClose"); // connections reset due to early user close
416
- tcpext_TCPAbortOnMemory = netstat_columns_find(tcpext_data, "TCPAbortOnMemory"); // connections aborted due to memory pressure
417
- tcpext_TCPAbortOnTimeout = netstat_columns_find(tcpext_data, "TCPAbortOnTimeout"); // connections aborted due to timeout
418
- tcpext_TCPAbortOnLinger = netstat_columns_find(tcpext_data, "TCPAbortOnLinger"); // connections aborted after user close in linger timeout
419
- tcpext_TCPAbortFailed = netstat_columns_find(tcpext_data, "TCPAbortFailed"); // times unable to send RST due to no memory
420
-
421
- tcpext_TCPMemoryPressures = netstat_columns_find(tcpext_data, "TCPMemoryPressures");
422
-
423
- /*
424
- tcpext_EmbryonicRsts = netstat_columns_find(tcpext_data, "EmbryonicRsts");
425
- tcpext_PruneCalled = netstat_columns_find(tcpext_data, "PruneCalled");
426
- tcpext_RcvPruned = netstat_columns_find(tcpext_data, "RcvPruned");
427
- tcpext_OutOfWindowIcmps = netstat_columns_find(tcpext_data, "OutOfWindowIcmps");
428
- tcpext_LockDroppedIcmps = netstat_columns_find(tcpext_data, "LockDroppedIcmps");
429
- tcpext_ArpFilter = netstat_columns_find(tcpext_data, "ArpFilter");
430
- tcpext_TW = netstat_columns_find(tcpext_data, "TW");
431
- tcpext_TWRecycled = netstat_columns_find(tcpext_data, "TWRecycled");
432
- tcpext_TWKilled = netstat_columns_find(tcpext_data, "TWKilled");
433
- tcpext_PAWSPassive = netstat_columns_find(tcpext_data, "PAWSPassive");
434
- tcpext_PAWSActive = netstat_columns_find(tcpext_data, "PAWSActive");
435
- tcpext_PAWSEstab = netstat_columns_find(tcpext_data, "PAWSEstab");
436
- tcpext_DelayedACKs = netstat_columns_find(tcpext_data, "DelayedACKs");
437
- tcpext_DelayedACKLocked = netstat_columns_find(tcpext_data, "DelayedACKLocked");
438
- tcpext_DelayedACKLost = netstat_columns_find(tcpext_data, "DelayedACKLost");
439
- tcpext_ListenOverflows = netstat_columns_find(tcpext_data, "ListenOverflows");
440
- tcpext_ListenDrops = netstat_columns_find(tcpext_data, "ListenDrops");
441
- tcpext_TCPPrequeued = netstat_columns_find(tcpext_data, "TCPPrequeued");
442
- tcpext_TCPDirectCopyFromBacklog = netstat_columns_find(tcpext_data, "TCPDirectCopyFromBacklog");
443
- tcpext_TCPDirectCopyFromPrequeue = netstat_columns_find(tcpext_data, "TCPDirectCopyFromPrequeue");
444
- tcpext_TCPPrequeueDropped = netstat_columns_find(tcpext_data, "TCPPrequeueDropped");
445
- tcpext_TCPHPHits = netstat_columns_find(tcpext_data, "TCPHPHits");
446
- tcpext_TCPHPHitsToUser = netstat_columns_find(tcpext_data, "TCPHPHitsToUser");
447
- tcpext_TCPPureAcks = netstat_columns_find(tcpext_data, "TCPPureAcks");
448
- tcpext_TCPHPAcks = netstat_columns_find(tcpext_data, "TCPHPAcks");
449
- tcpext_TCPRenoRecovery = netstat_columns_find(tcpext_data, "TCPRenoRecovery");
450
- tcpext_TCPSackRecovery = netstat_columns_find(tcpext_data, "TCPSackRecovery");
451
- tcpext_TCPSACKReneging = netstat_columns_find(tcpext_data, "TCPSACKReneging");
452
- tcpext_TCPFullUndo = netstat_columns_find(tcpext_data, "TCPFullUndo");
453
- tcpext_TCPPartialUndo = netstat_columns_find(tcpext_data, "TCPPartialUndo");
454
- tcpext_TCPDSACKUndo = netstat_columns_find(tcpext_data, "TCPDSACKUndo");
455
- tcpext_TCPLossUndo = netstat_columns_find(tcpext_data, "TCPLossUndo");
456
- tcpext_TCPLostRetransmit = netstat_columns_find(tcpext_data, "TCPLostRetransmit");
457
- tcpext_TCPRenoFailures = netstat_columns_find(tcpext_data, "TCPRenoFailures");
458
- tcpext_TCPSackFailures = netstat_columns_find(tcpext_data, "TCPSackFailures");
459
- tcpext_TCPLossFailures = netstat_columns_find(tcpext_data, "TCPLossFailures");
460
- tcpext_TCPFastRetrans = netstat_columns_find(tcpext_data, "TCPFastRetrans");
461
- tcpext_TCPForwardRetrans = netstat_columns_find(tcpext_data, "TCPForwardRetrans");
462
- tcpext_TCPSlowStartRetrans = netstat_columns_find(tcpext_data, "TCPSlowStartRetrans");
463
- tcpext_TCPTimeouts = netstat_columns_find(tcpext_data, "TCPTimeouts");
464
- tcpext_TCPLossProbes = netstat_columns_find(tcpext_data, "TCPLossProbes");
465
- tcpext_TCPLossProbeRecovery = netstat_columns_find(tcpext_data, "TCPLossProbeRecovery");
466
- tcpext_TCPRenoRecoveryFail = netstat_columns_find(tcpext_data, "TCPRenoRecoveryFail");
467
- tcpext_TCPSackRecoveryFail = netstat_columns_find(tcpext_data, "TCPSackRecoveryFail");
468
- tcpext_TCPSchedulerFailed = netstat_columns_find(tcpext_data, "TCPSchedulerFailed");
469
- tcpext_TCPRcvCollapsed = netstat_columns_find(tcpext_data, "TCPRcvCollapsed");
470
- tcpext_TCPDSACKOldSent = netstat_columns_find(tcpext_data, "TCPDSACKOldSent");
471
- tcpext_TCPDSACKOfoSent = netstat_columns_find(tcpext_data, "TCPDSACKOfoSent");
472
- tcpext_TCPDSACKRecv = netstat_columns_find(tcpext_data, "TCPDSACKRecv");
473
- tcpext_TCPDSACKOfoRecv = netstat_columns_find(tcpext_data, "TCPDSACKOfoRecv");
474
- tcpext_TCPSACKDiscard = netstat_columns_find(tcpext_data, "TCPSACKDiscard");
475
- tcpext_TCPDSACKIgnoredOld = netstat_columns_find(tcpext_data, "TCPDSACKIgnoredOld");
476
- tcpext_TCPDSACKIgnoredNoUndo = netstat_columns_find(tcpext_data, "TCPDSACKIgnoredNoUndo");
477
- tcpext_TCPSpuriousRTOs = netstat_columns_find(tcpext_data, "TCPSpuriousRTOs");
478
- tcpext_TCPMD5NotFound = netstat_columns_find(tcpext_data, "TCPMD5NotFound");
479
- tcpext_TCPMD5Unexpected = netstat_columns_find(tcpext_data, "TCPMD5Unexpected");
480
- tcpext_TCPSackShifted = netstat_columns_find(tcpext_data, "TCPSackShifted");
481
- tcpext_TCPSackMerged = netstat_columns_find(tcpext_data, "TCPSackMerged");
482
- tcpext_TCPSackShiftFallback = netstat_columns_find(tcpext_data, "TCPSackShiftFallback");
483
- tcpext_TCPBacklogDrop = netstat_columns_find(tcpext_data, "TCPBacklogDrop");
484
- tcpext_TCPMinTTLDrop = netstat_columns_find(tcpext_data, "TCPMinTTLDrop");
485
- tcpext_TCPDeferAcceptDrop = netstat_columns_find(tcpext_data, "TCPDeferAcceptDrop");
486
- tcpext_IPReversePathFilter = netstat_columns_find(tcpext_data, "IPReversePathFilter");
487
- tcpext_TCPTimeWaitOverflow = netstat_columns_find(tcpext_data, "TCPTimeWaitOverflow");
488
- tcpext_TCPReqQFullDoCookies = netstat_columns_find(tcpext_data, "TCPReqQFullDoCookies");
489
- tcpext_TCPReqQFullDrop = netstat_columns_find(tcpext_data, "TCPReqQFullDrop");
490
- tcpext_TCPRetransFail = netstat_columns_find(tcpext_data, "TCPRetransFail");
491
- tcpext_TCPRcvCoalesce = netstat_columns_find(tcpext_data, "TCPRcvCoalesce");
492
- tcpext_TCPChallengeACK = netstat_columns_find(tcpext_data, "TCPChallengeACK");
493
- tcpext_TCPSYNChallenge = netstat_columns_find(tcpext_data, "TCPSYNChallenge");
494
- tcpext_TCPFastOpenActive = netstat_columns_find(tcpext_data, "TCPFastOpenActive");
495
- tcpext_TCPFastOpenActiveFail = netstat_columns_find(tcpext_data, "TCPFastOpenActiveFail");
496
- tcpext_TCPFastOpenPassive = netstat_columns_find(tcpext_data, "TCPFastOpenPassive");
497
- tcpext_TCPFastOpenPassiveFail = netstat_columns_find(tcpext_data, "TCPFastOpenPassiveFail");
498
- tcpext_TCPFastOpenListenOverflow = netstat_columns_find(tcpext_data, "TCPFastOpenListenOverflow");
499
- tcpext_TCPFastOpenCookieReqd = netstat_columns_find(tcpext_data, "TCPFastOpenCookieReqd");
500
- tcpext_TCPSpuriousRtxHostQueues = netstat_columns_find(tcpext_data, "TCPSpuriousRtxHostQueues");
501
- tcpext_BusyPollRxPackets = netstat_columns_find(tcpext_data, "BusyPollRxPackets");
502
- tcpext_TCPAutoCorking = netstat_columns_find(tcpext_data, "TCPAutoCorking");
503
- tcpext_TCPFromZeroWindowAdv = netstat_columns_find(tcpext_data, "TCPFromZeroWindowAdv");
504
- tcpext_TCPToZeroWindowAdv = netstat_columns_find(tcpext_data, "TCPToZeroWindowAdv");
505
- tcpext_TCPWantZeroWindowAdv = netstat_columns_find(tcpext_data, "TCPWantZeroWindowAdv");
506
- tcpext_TCPSynRetrans = netstat_columns_find(tcpext_data, "TCPSynRetrans");
507
- tcpext_TCPOrigDataSent = netstat_columns_find(tcpext_data, "TCPOrigDataSent");
508
- tcpext_TCPHystartTrainDetect = netstat_columns_find(tcpext_data, "TCPHystartTrainDetect");
509
- tcpext_TCPHystartTrainCwnd = netstat_columns_find(tcpext_data, "TCPHystartTrainCwnd");
510
- tcpext_TCPHystartDelayDetect = netstat_columns_find(tcpext_data, "TCPHystartDelayDetect");
511
- tcpext_TCPHystartDelayCwnd = netstat_columns_find(tcpext_data, "TCPHystartDelayCwnd");
512
- tcpext_TCPACKSkippedSynRecv = netstat_columns_find(tcpext_data, "TCPACKSkippedSynRecv");
513
- tcpext_TCPACKSkippedPAWS = netstat_columns_find(tcpext_data, "TCPACKSkippedPAWS");
514
- tcpext_TCPACKSkippedSeq = netstat_columns_find(tcpext_data, "TCPACKSkippedSeq");
515
- tcpext_TCPACKSkippedFinWait2 = netstat_columns_find(tcpext_data, "TCPACKSkippedFinWait2");
516
- tcpext_TCPACKSkippedTimeWait = netstat_columns_find(tcpext_data, "TCPACKSkippedTimeWait");
517
- tcpext_TCPACKSkippedChallenge = netstat_columns_find(tcpext_data, "TCPACKSkippedChallenge");
518
- tcpext_TCPWinProbe = netstat_columns_find(tcpext_data, "TCPWinProbe");
519
- tcpext_TCPKeepAlive = netstat_columns_find(tcpext_data, "TCPKeepAlive");
520
- tcpext_TCPMTUPFail = netstat_columns_find(tcpext_data, "TCPMTUPFail");
521
- tcpext_TCPMTUPSuccess = netstat_columns_find(tcpext_data, "TCPMTUPSuccess");
522
-*/
523
- ipext_InNoRoutes = netstat_columns_find(ipext_data, "InNoRoutes");
524
- ipext_InTruncatedPkts = netstat_columns_find(ipext_data, "InTruncatedPkts");
525
- ipext_InMcastPkts = netstat_columns_find(ipext_data, "InMcastPkts");
526
- ipext_OutMcastPkts = netstat_columns_find(ipext_data, "OutMcastPkts");
527
- ipext_InBcastPkts = netstat_columns_find(ipext_data, "InBcastPkts");
528
- ipext_OutBcastPkts = netstat_columns_find(ipext_data, "OutBcastPkts");
529
- ipext_InOctets = netstat_columns_find(ipext_data, "InOctets");
530
- ipext_OutOctets = netstat_columns_find(ipext_data, "OutOctets");
531
- ipext_InMcastOctets = netstat_columns_find(ipext_data, "InMcastOctets");
532
- ipext_OutMcastOctets = netstat_columns_find(ipext_data, "OutMcastOctets");
533
- ipext_InBcastOctets = netstat_columns_find(ipext_data, "InBcastOctets");
534
- ipext_OutBcastOctets = netstat_columns_find(ipext_data, "OutBcastOctets");
535
- ipext_InCsumErrors = netstat_columns_find(ipext_data, "InCsumErrors");
536
- ipext_InNoECTPkts = netstat_columns_find(ipext_data, "InNoECTPkts");
537
- ipext_InECT1Pkts = netstat_columns_find(ipext_data, "InECT1Pkts");
538
- ipext_InECT0Pkts = netstat_columns_find(ipext_data, "InECT0Pkts");
539
- ipext_InCEPkts = netstat_columns_find(ipext_data, "InCEPkts");
92
+ arl_tcpext = arl_create(NULL, 60);
93
+
94
+ if(do_tcpext_reorder != CONFIG_ONDEMAND_NO) {
95
+ arl_expect(arl_tcpext, "TCPFACKReorder", &tcpext_TCPFACKReorder);
96
+ arl_expect(arl_tcpext, "TCPSACKReorder", &tcpext_TCPSACKReorder);
97
+ arl_expect(arl_tcpext, "TCPRenoReorder", &tcpext_TCPRenoReorder);
98
+ arl_expect(arl_tcpext, "TCPTSReorder", &tcpext_TCPTSReorder);
99
+ }
100
+
101
+ if(do_tcpext_syscookies != CONFIG_ONDEMAND_NO) {
102
+ arl_expect(arl_tcpext, "SyncookiesSent", &tcpext_SyncookiesSent);
103
+ arl_expect(arl_tcpext, "SyncookiesRecv", &tcpext_SyncookiesRecv);
104
+ arl_expect(arl_tcpext, "SyncookiesFailed", &tcpext_SyncookiesFailed);
105
+ }
106
+
107
+ if(do_tcpext_ofo != CONFIG_ONDEMAND_NO) {
108
+ arl_expect(arl_tcpext, "TCPOFOQueue", &tcpext_TCPOFOQueue);
109
+ arl_expect(arl_tcpext, "TCPOFODrop", &tcpext_TCPOFODrop);
110
+ arl_expect(arl_tcpext, "TCPOFOMerge", &tcpext_TCPOFOMerge);
111
+ arl_expect(arl_tcpext, "OfoPruned", &tcpext_OfoPruned);
112
+ }
113
+
114
+ if(do_tcpext_connaborts != CONFIG_ONDEMAND_NO) {
115
+ arl_expect(arl_tcpext, "TCPAbortOnData", &tcpext_TCPAbortOnData);
116
+ arl_expect(arl_tcpext, "TCPAbortOnClose", &tcpext_TCPAbortOnClose);
117
+ arl_expect(arl_tcpext, "TCPAbortOnMemory", &tcpext_TCPAbortOnMemory);
118
+ arl_expect(arl_tcpext, "TCPAbortOnTimeout", &tcpext_TCPAbortOnTimeout);
119
+ arl_expect(arl_tcpext, "TCPAbortOnLinger", &tcpext_TCPAbortOnLinger);
120
+ arl_expect(arl_tcpext, "TCPAbortFailed", &tcpext_TCPAbortFailed);
121
+ }
122
+
123
+ if(do_tcpext_memory != CONFIG_ONDEMAND_NO) {
124
+ arl_expect(arl_tcpext, "TCPMemoryPressures", &tcpext_TCPMemoryPressures);
125
+ }
126
+
127
+ arl_ipext = arl_create(NULL, 60);
128
+
129
+ if(do_bandwidth != CONFIG_ONDEMAND_NO) {
130
+ arl_expect(arl_tcpext, "InOctets", &ipext_InOctets);
131
+ arl_expect(arl_tcpext, "OutOctets", &ipext_OutOctets);
132
+ }
133
+
134
+ if(do_inerrors != CONFIG_ONDEMAND_NO) {
135
+ arl_expect(arl_tcpext, "InNoRoutes", &ipext_InNoRoutes);
136
+ arl_expect(arl_tcpext, "InTruncatedPkts", &ipext_InTruncatedPkts);
137
+ arl_expect(arl_tcpext, "InCsumErrors", &ipext_InCsumErrors);
138
+ }
139
+
140
+ if(do_mcast != CONFIG_ONDEMAND_NO) {
141
+ arl_expect(arl_tcpext, "InMcastOctets", &ipext_InMcastOctets);
142
+ arl_expect(arl_tcpext, "OutMcastOctets", &ipext_OutMcastOctets);
143
+ }
144
+
145
+ if(do_mcast_p != CONFIG_ONDEMAND_NO) {
146
+ arl_expect(arl_tcpext, "InMcastPkts", &ipext_InMcastPkts);
147
+ arl_expect(arl_tcpext, "OutMcastPkts", &ipext_OutMcastPkts);
148
+ }
149
+
150
+ if(do_bcast != CONFIG_ONDEMAND_NO) {
151
+ arl_expect(arl_tcpext, "InBcastPkts", &ipext_InBcastPkts);
152
+ arl_expect(arl_tcpext, "OutBcastPkts", &ipext_OutBcastPkts);
153
+ }
154
+
155
+ if(do_bcast_p != CONFIG_ONDEMAND_NO) {
156
+ arl_expect(arl_tcpext, "InBcastOctets", &ipext_InBcastOctets);
157
+ arl_expect(arl_tcpext, "OutBcastOctets", &ipext_OutBcastOctets);
158
+ }
159
+
160
+ if(do_ecn != CONFIG_ONDEMAND_NO) {
161
+ arl_expect(arl_tcpext, "InNoECTPkts", &ipext_InNoECTPkts);
162
+ arl_expect(arl_tcpext, "InECT1Pkts", &ipext_InECT1Pkts);
163
+ arl_expect(arl_tcpext, "InECT0Pkts", &ipext_InECT0Pkts);
164
+ arl_expect(arl_tcpext, "InCEPkts", &ipext_InCEPkts);
165
+ }
166
}
167
168
if(unlikely(!ff)) {
@@ -559,23 +185,20 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
185
if(unlikely(hash == hash_ipext && strsame(key, "IpExt") == 0)) {
186
size_t h = l++;
187
562
- if(unlikely(strsame(procfile_lineword(ff, l, 0), "IpExt") != 0)) {
563
- error("Cannot read IpExt line from /proc/net/netstat.");
564
- break;
565
- }
188
words = procfile_linewords(ff, l);
189
if(unlikely(words < 2)) {
190
error("Cannot read /proc/net/netstat IpExt line. Expected 2+ params, read %zu.", words);
191
continue;
192
}
193
572
- parse_line_pair(ff, ipext_data, h, l);
194
+ arl_begin(arl_ipext);
195
+ parse_line_pair(ff, arl_ipext, h, l);
196
197
RRDSET *st;
198
199
// --------------------------------------------------------------------
200
578
- if(do_bandwidth == CONFIG_ONDEMAND_YES || (do_bandwidth == CONFIG_ONDEMAND_ONDEMAND && (*ipext_InOctets || *ipext_OutOctets))) {
201
+ if(do_bandwidth == CONFIG_ONDEMAND_YES || (do_bandwidth == CONFIG_ONDEMAND_ONDEMAND && (ipext_InOctets || ipext_OutOctets))) {
202
do_bandwidth = CONFIG_ONDEMAND_YES;
203
st = rrdset_find("system.ipv4");
204
if(unlikely(!st)) {
@@ -586,14 +209,14 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
209
}
210
else rrdset_next(st);
211
589
- rrddim_set(st, "InOctets", *ipext_InOctets);
590
- rrddim_set(st, "OutOctets", *ipext_OutOctets);
212
+ rrddim_set(st, "InOctets", ipext_InOctets);
213
+ rrddim_set(st, "OutOctets", ipext_OutOctets);
214
rrdset_done(st);
215
}
216
217
// --------------------------------------------------------------------
218
596
- if(do_inerrors == CONFIG_ONDEMAND_YES || (do_inerrors == CONFIG_ONDEMAND_ONDEMAND && (*ipext_InNoRoutes || *ipext_InTruncatedPkts))) {
219
+ if(do_inerrors == CONFIG_ONDEMAND_YES || (do_inerrors == CONFIG_ONDEMAND_ONDEMAND && (ipext_InNoRoutes || ipext_InTruncatedPkts))) {
220
do_inerrors = CONFIG_ONDEMAND_YES;
221
st = rrdset_find("ipv4.inerrors");
222
if(unlikely(!st)) {
@@ -606,15 +229,15 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
229
}
230
else rrdset_next(st);
231
609
- rrddim_set(st, "InNoRoutes", *ipext_InNoRoutes);
610
- rrddim_set(st, "InTruncatedPkts", *ipext_InTruncatedPkts);
611
- rrddim_set(st, "InCsumErrors", *ipext_InCsumErrors);
232
+ rrddim_set(st, "InNoRoutes", ipext_InNoRoutes);
233
+ rrddim_set(st, "InTruncatedPkts", ipext_InTruncatedPkts);
234
+ rrddim_set(st, "InCsumErrors", ipext_InCsumErrors);
235
rrdset_done(st);
236
}
237
238
// --------------------------------------------------------------------
239
617
- if(do_mcast == CONFIG_ONDEMAND_YES || (do_mcast == CONFIG_ONDEMAND_ONDEMAND && (*ipext_InMcastOctets || *ipext_OutMcastOctets))) {
240
+ if(do_mcast == CONFIG_ONDEMAND_YES || (do_mcast == CONFIG_ONDEMAND_ONDEMAND && (ipext_InMcastOctets || ipext_OutMcastOctets))) {
241
do_mcast = CONFIG_ONDEMAND_YES;
242
st = rrdset_find("ipv4.mcast");
243
if(unlikely(!st)) {
@@ -626,14 +249,14 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
249
}
250
else rrdset_next(st);
251
629
- rrddim_set(st, "InMcastOctets", *ipext_InMcastOctets);
630
- rrddim_set(st, "OutMcastOctets", *ipext_OutMcastOctets);
252
+ rrddim_set(st, "InMcastOctets", ipext_InMcastOctets);
253
+ rrddim_set(st, "OutMcastOctets", ipext_OutMcastOctets);
254
rrdset_done(st);
255
}
256
257
// --------------------------------------------------------------------
258
636
- if(do_bcast == CONFIG_ONDEMAND_YES || (do_bcast == CONFIG_ONDEMAND_ONDEMAND && (*ipext_InBcastOctets || *ipext_OutBcastOctets))) {
259
+ if(do_bcast == CONFIG_ONDEMAND_YES || (do_bcast == CONFIG_ONDEMAND_ONDEMAND && (ipext_InBcastOctets || ipext_OutBcastOctets))) {
260
do_bcast = CONFIG_ONDEMAND_YES;
261
st = rrdset_find("ipv4.bcast");
262
if(unlikely(!st)) {
@@ -645,14 +268,14 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
268
}
269
else rrdset_next(st);
270
648
- rrddim_set(st, "InBcastOctets", *ipext_InBcastOctets);
649
- rrddim_set(st, "OutBcastOctets", *ipext_OutBcastOctets);
271
+ rrddim_set(st, "InBcastOctets", ipext_InBcastOctets);
272
+ rrddim_set(st, "OutBcastOctets", ipext_OutBcastOctets);
273
rrdset_done(st);
274
}
275
276
// --------------------------------------------------------------------
277
655
- if(do_mcast_p == CONFIG_ONDEMAND_YES || (do_mcast_p == CONFIG_ONDEMAND_ONDEMAND && (*ipext_InMcastPkts || *ipext_OutMcastPkts))) {
278
+ if(do_mcast_p == CONFIG_ONDEMAND_YES || (do_mcast_p == CONFIG_ONDEMAND_ONDEMAND && (ipext_InMcastPkts || ipext_OutMcastPkts))) {
279
do_mcast_p = CONFIG_ONDEMAND_YES;
280
st = rrdset_find("ipv4.mcastpkts");
281
if(unlikely(!st)) {
@@ -664,14 +287,14 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
287
}
288
else rrdset_next(st);
289
667
- rrddim_set(st, "InMcastPkts", *ipext_InMcastPkts);
668
- rrddim_set(st, "OutMcastPkts", *ipext_OutMcastPkts);
290
+ rrddim_set(st, "InMcastPkts", ipext_InMcastPkts);
291
+ rrddim_set(st, "OutMcastPkts", ipext_OutMcastPkts);
292
rrdset_done(st);
293
}
294
295
// --------------------------------------------------------------------
296
674
- if(do_bcast_p == CONFIG_ONDEMAND_YES || (do_bcast_p == CONFIG_ONDEMAND_ONDEMAND && (*ipext_InBcastPkts || *ipext_OutBcastPkts))) {
297
+ if(do_bcast_p == CONFIG_ONDEMAND_YES || (do_bcast_p == CONFIG_ONDEMAND_ONDEMAND && (ipext_InBcastPkts || ipext_OutBcastPkts))) {
298
do_bcast_p = CONFIG_ONDEMAND_YES;
299
st = rrdset_find("ipv4.bcastpkts");
300
if(unlikely(!st)) {
@@ -683,14 +306,14 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
306
}
307
else rrdset_next(st);
308
686
- rrddim_set(st, "InBcastPkts", *ipext_InBcastPkts);
687
- rrddim_set(st, "OutBcastPkts", *ipext_OutBcastPkts);
309
+ rrddim_set(st, "InBcastPkts", ipext_InBcastPkts);
310
+ rrddim_set(st, "OutBcastPkts", ipext_OutBcastPkts);
311
rrdset_done(st);
312
}
313
314
// --------------------------------------------------------------------
315
693
- if(do_ecn == CONFIG_ONDEMAND_YES || (do_ecn == CONFIG_ONDEMAND_ONDEMAND && (*ipext_InCEPkts || *ipext_InECT0Pkts || *ipext_InECT1Pkts || *ipext_InNoECTPkts))) {
316
+ if(do_ecn == CONFIG_ONDEMAND_YES || (do_ecn == CONFIG_ONDEMAND_ONDEMAND && (ipext_InCEPkts || ipext_InECT0Pkts || ipext_InECT1Pkts || ipext_InNoECTPkts))) {
317
do_ecn = CONFIG_ONDEMAND_YES;
318
st = rrdset_find("ipv4.ecnpkts");
319
if(unlikely(!st)) {
@@ -704,33 +327,30 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
327
}
328
else rrdset_next(st);
329
707
- rrddim_set(st, "InCEPkts", *ipext_InCEPkts);
708
- rrddim_set(st, "InNoECTPkts", *ipext_InNoECTPkts);
709
- rrddim_set(st, "InECT0Pkts", *ipext_InECT0Pkts);
710
- rrddim_set(st, "InECT1Pkts", *ipext_InECT1Pkts);
330
+ rrddim_set(st, "InCEPkts", ipext_InCEPkts);
331
+ rrddim_set(st, "InNoECTPkts", ipext_InNoECTPkts);
332
+ rrddim_set(st, "InECT0Pkts", ipext_InECT0Pkts);
333
+ rrddim_set(st, "InECT1Pkts", ipext_InECT1Pkts);
334
rrdset_done(st);
335
}
336
}
337
else if(unlikely(hash == hash_tcpext && strsame(key, "TcpExt") == 0)) {
338
size_t h = l++;
339
717
- if(unlikely(strsame(procfile_lineword(ff, l, 0), "TcpExt") != 0)) {
718
- error("Cannot read TcpExt line from /proc/net/netstat.");
719
- break;
720
- }
340
words = procfile_linewords(ff, l);
341
if(unlikely(words < 2)) {
342
error("Cannot read /proc/net/netstat TcpExt line. Expected 2+ params, read %zu.", words);
343
continue;
344
}
345
727
- parse_line_pair(ff, tcpext_data, h, l);
346
+ arl_begin(arl_tcpext);
347
+ parse_line_pair(ff, arl_tcpext, h, l);
348
349
RRDSET *st;
350
351
// --------------------------------------------------------------------
352
733
- if(do_tcpext_memory == CONFIG_ONDEMAND_YES || (do_tcpext_memory == CONFIG_ONDEMAND_ONDEMAND && (*tcpext_TCPMemoryPressures))) {
353
+ if(do_tcpext_memory == CONFIG_ONDEMAND_YES || (do_tcpext_memory == CONFIG_ONDEMAND_ONDEMAND && (tcpext_TCPMemoryPressures))) {
354
do_tcpext_memory = CONFIG_ONDEMAND_YES;
355
st = rrdset_find("ipv4.tcpmemorypressures");
356
if(unlikely(!st)) {
@@ -740,13 +360,13 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
360
}
361
else rrdset_next(st);
362
743
- rrddim_set(st, "TCPMemoryPressures", *tcpext_TCPMemoryPressures);
363
+ rrddim_set(st, "TCPMemoryPressures", tcpext_TCPMemoryPressures);
364
rrdset_done(st);
365
}
366
367
// --------------------------------------------------------------------
368
749
- if(do_tcpext_connaborts == CONFIG_ONDEMAND_YES || (do_tcpext_connaborts == CONFIG_ONDEMAND_ONDEMAND && (*tcpext_TCPAbortOnData || *tcpext_TCPAbortOnClose || *tcpext_TCPAbortOnMemory || *tcpext_TCPAbortOnTimeout || *tcpext_TCPAbortOnLinger || *tcpext_TCPAbortFailed))) {
369
+ if(do_tcpext_connaborts == CONFIG_ONDEMAND_YES || (do_tcpext_connaborts == CONFIG_ONDEMAND_ONDEMAND && (tcpext_TCPAbortOnData || tcpext_TCPAbortOnClose || tcpext_TCPAbortOnMemory || tcpext_TCPAbortOnTimeout || tcpext_TCPAbortOnLinger || tcpext_TCPAbortFailed))) {
370
do_tcpext_connaborts = CONFIG_ONDEMAND_YES;
371
st = rrdset_find("ipv4.tcpconnaborts");
372
if(unlikely(!st)) {
@@ -761,17 +381,17 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
381
}
382
else rrdset_next(st);
383
764
- rrddim_set(st, "TCPAbortOnData", *tcpext_TCPAbortOnData);
765
- rrddim_set(st, "TCPAbortOnClose", *tcpext_TCPAbortOnClose);
766
- rrddim_set(st, "TCPAbortOnMemory", *tcpext_TCPAbortOnMemory);
767
- rrddim_set(st, "TCPAbortOnTimeout", *tcpext_TCPAbortOnTimeout);
768
- rrddim_set(st, "TCPAbortOnLinger", *tcpext_TCPAbortOnLinger);
769
- rrddim_set(st, "TCPAbortFailed", *tcpext_TCPAbortFailed);
384
+ rrddim_set(st, "TCPAbortOnData", tcpext_TCPAbortOnData);
385
+ rrddim_set(st, "TCPAbortOnClose", tcpext_TCPAbortOnClose);
386
+ rrddim_set(st, "TCPAbortOnMemory", tcpext_TCPAbortOnMemory);
387
+ rrddim_set(st, "TCPAbortOnTimeout", tcpext_TCPAbortOnTimeout);
388
+ rrddim_set(st, "TCPAbortOnLinger", tcpext_TCPAbortOnLinger);
389
+ rrddim_set(st, "TCPAbortFailed", tcpext_TCPAbortFailed);
390
rrdset_done(st);
391
}
392
// --------------------------------------------------------------------
393
774
- if(do_tcpext_reorder == CONFIG_ONDEMAND_YES || (do_tcpext_reorder == CONFIG_ONDEMAND_ONDEMAND && (*tcpext_TCPRenoReorder || *tcpext_TCPFACKReorder || *tcpext_TCPSACKReorder || *tcpext_TCPTSReorder))) {
394
+ if(do_tcpext_reorder == CONFIG_ONDEMAND_YES || (do_tcpext_reorder == CONFIG_ONDEMAND_ONDEMAND && (tcpext_TCPRenoReorder || tcpext_TCPFACKReorder || tcpext_TCPSACKReorder || tcpext_TCPTSReorder))) {
395
do_tcpext_reorder = CONFIG_ONDEMAND_YES;
396
st = rrdset_find("ipv4.tcpreorders");
397
if(unlikely(!st)) {
@@ -784,16 +404,16 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
404
}
405
else rrdset_next(st);
406
787
- rrddim_set(st, "TCPTSReorder", *tcpext_TCPTSReorder);
788
- rrddim_set(st, "TCPSACKReorder", *tcpext_TCPSACKReorder);
789
- rrddim_set(st, "TCPFACKReorder", *tcpext_TCPFACKReorder);
790
- rrddim_set(st, "TCPRenoReorder", *tcpext_TCPRenoReorder);
407
+ rrddim_set(st, "TCPTSReorder", tcpext_TCPTSReorder);
408
+ rrddim_set(st, "TCPSACKReorder", tcpext_TCPSACKReorder);
409
+ rrddim_set(st, "TCPFACKReorder", tcpext_TCPFACKReorder);
410
+ rrddim_set(st, "TCPRenoReorder", tcpext_TCPRenoReorder);
411
rrdset_done(st);
412
}
413
414
// --------------------------------------------------------------------
415
796
- if(do_tcpext_ofo == CONFIG_ONDEMAND_YES || (do_tcpext_ofo == CONFIG_ONDEMAND_ONDEMAND && (*tcpext_TCPOFOQueue || *tcpext_TCPOFODrop || *tcpext_TCPOFOMerge))) {
416
+ if(do_tcpext_ofo == CONFIG_ONDEMAND_YES || (do_tcpext_ofo == CONFIG_ONDEMAND_ONDEMAND && (tcpext_TCPOFOQueue || tcpext_TCPOFODrop || tcpext_TCPOFOMerge))) {
417
do_tcpext_ofo = CONFIG_ONDEMAND_YES;
418
st = rrdset_find("ipv4.tcpofo");
419
if(unlikely(!st)) {
@@ -806,16 +426,16 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
426
}
427
else rrdset_next(st);
428
809
- rrddim_set(st, "TCPOFOQueue", *tcpext_TCPOFOQueue);
810
- rrddim_set(st, "TCPOFODrop", *tcpext_TCPOFODrop);
811
- rrddim_set(st, "TCPOFOMerge", *tcpext_TCPOFOMerge);
812
- rrddim_set(st, "OfoPruned", *tcpext_OfoPruned);
429
+ rrddim_set(st, "TCPOFOQueue", tcpext_TCPOFOQueue);
430
+ rrddim_set(st, "TCPOFODrop", tcpext_TCPOFODrop);
431
+ rrddim_set(st, "TCPOFOMerge", tcpext_TCPOFOMerge);
432
+ rrddim_set(st, "OfoPruned", tcpext_OfoPruned);
433
rrdset_done(st);
434
}
435
436
// --------------------------------------------------------------------
437
818
- if(do_tcpext_syscookies == CONFIG_ONDEMAND_YES || (do_tcpext_syscookies == CONFIG_ONDEMAND_ONDEMAND && (*tcpext_SyncookiesSent || *tcpext_SyncookiesRecv || *tcpext_SyncookiesFailed))) {
438
+ if(do_tcpext_syscookies == CONFIG_ONDEMAND_YES || (do_tcpext_syscookies == CONFIG_ONDEMAND_ONDEMAND && (tcpext_SyncookiesSent || tcpext_SyncookiesRecv || tcpext_SyncookiesFailed))) {
439
do_tcpext_syscookies = CONFIG_ONDEMAND_YES;
440
st = rrdset_find("ipv4.tcpsyncookies");
441
if(unlikely(!st)) {
@@ -827,9 +447,9 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
447
}
448
else rrdset_next(st);
449
830
- rrddim_set(st, "SyncookiesRecv", *tcpext_SyncookiesRecv);
831
- rrddim_set(st, "SyncookiesSent", *tcpext_SyncookiesSent);
832
- rrddim_set(st, "SyncookiesFailed", *tcpext_SyncookiesFailed);
450
+ rrddim_set(st, "SyncookiesRecv", tcpext_SyncookiesRecv);
451
+ rrddim_set(st, "SyncookiesSent", tcpext_SyncookiesSent);
452
+ rrddim_set(st, "SyncookiesFailed", tcpext_SyncookiesFailed);
453
rrdset_done(st);
454
}
455