1 /*
2 pmacct (Promiscuous mode IP Accounting package)
3 pmacct is Copyright (C) 2003-2020 by Paolo Lucente
4 */
5
6 /*
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22 /* includes */
23 #include "pmacct.h"
24 #include "addr.h"
25 #include "nfacctd.h"
26 #include "pmacct-data.h"
27 #include "plugin_hooks.h"
28 #include "cfg_handlers.h"
29 #include "bgp/bgp.h"
30
parse_truefalse(char * value_ptr)31 int parse_truefalse(char *value_ptr)
32 {
33 int value;
34
35 lower_string(value_ptr);
36
37 if (!strcmp("true", value_ptr)) value = TRUE;
38 else if (!strcmp("false", value_ptr)) value = FALSE;
39 else value = ERR;
40
41 return value;
42 }
43
parse_truefalse_nonzero(char * value_ptr)44 int parse_truefalse_nonzero(char *value_ptr)
45 {
46 int value;
47
48 lower_string(value_ptr);
49
50 if (!strcmp("true", value_ptr)) value = TRUE;
51 else if (!strcmp("false", value_ptr)) value = FALSE_NONZERO;
52 else value = ERR;
53
54 return value;
55 }
56
validate_truefalse(int value)57 int validate_truefalse(int value)
58 {
59 if (value == TRUE || value == FALSE) return SUCCESS;
60 else return ERR;
61 }
62
cfg_key_legacy_warning(char * filename,char * cfg_key)63 void cfg_key_legacy_warning(char *filename, char *cfg_key)
64 {
65 Log(LOG_WARNING, "WARN: [%s] Configuration key '%s' is legacy and will be discontinued in the next major release.\n", filename, cfg_key);
66 }
67
cfg_key_debug(char * filename,char * name,char * value_ptr)68 int cfg_key_debug(char *filename, char *name, char *value_ptr)
69 {
70 struct plugins_list_entry *list = plugins_list;
71 int value, changes = 0;
72
73 value = parse_truefalse(value_ptr);
74 if (value < 0) return ERR;
75
76 if (!name) for (; list; list = list->next, changes++) list->cfg.debug = value;
77 else {
78 for (; list; list = list->next) {
79 if (!strcmp(name, list->name)) {
80 list->cfg.debug = value;
81 changes++;
82 break;
83 }
84 }
85 }
86
87 return changes;
88 }
89
cfg_key_debug_internal_msg(char * filename,char * name,char * value_ptr)90 int cfg_key_debug_internal_msg(char *filename, char *name, char *value_ptr)
91 {
92 struct plugins_list_entry *list = plugins_list;
93 int value, changes = 0;
94
95 value = parse_truefalse(value_ptr);
96 if (value < 0) return ERR;
97
98 if (!name) for (; list; list = list->next, changes++) list->cfg.debug_internal_msg = value;
99 else {
100 for (; list; list = list->next) {
101 if (!strcmp(name, list->name)) {
102 list->cfg.debug_internal_msg = value;
103 changes++;
104 break;
105 }
106 }
107 }
108
109 return changes;
110 }
111
cfg_key_syslog(char * filename,char * name,char * value_ptr)112 int cfg_key_syslog(char *filename, char *name, char *value_ptr)
113 {
114 struct plugins_list_entry *list = plugins_list;
115 int changes = 0;
116
117 if (!name) for (; list; list = list->next, changes++) list->cfg.syslog = value_ptr;
118 else {
119 for (; list; list = list->next) {
120 if (!strcmp(name, list->name)) {
121 list->cfg.syslog = value_ptr;
122 changes++;
123 break;
124 }
125 }
126 }
127
128 return changes;
129 }
130
cfg_key_logfile(char * filename,char * name,char * value_ptr)131 int cfg_key_logfile(char *filename, char *name, char *value_ptr)
132 {
133 struct plugins_list_entry *list = plugins_list;
134 int changes = 0;
135
136 for (; list; list = list->next, changes++) list->cfg.logfile = value_ptr;
137 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'logfile'. Globalized.\n", filename);
138
139 return changes;
140 }
141
cfg_key_pidfile(char * filename,char * name,char * value_ptr)142 int cfg_key_pidfile(char *filename, char *name, char *value_ptr)
143 {
144 struct plugins_list_entry *list = plugins_list;
145 int changes = 0;
146
147 for (; list; list = list->next, changes++) list->cfg.pidfile = value_ptr;
148 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pidfile'. Globalized.\n", filename);
149
150 return changes;
151 }
152
cfg_key_daemonize(char * filename,char * name,char * value_ptr)153 int cfg_key_daemonize(char *filename, char *name, char *value_ptr)
154 {
155 struct plugins_list_entry *list = plugins_list;
156 int value, changes = 0;
157
158 value = parse_truefalse(value_ptr);
159 if (value < 0) return ERR;
160
161 for (; list; list = list->next, changes++) list->cfg.daemon = value;
162 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'daemonize'. Globalized.\n", filename);
163
164 return changes;
165 }
166
cfg_key_use_ip_next_hop(char * filename,char * name,char * value_ptr)167 int cfg_key_use_ip_next_hop(char *filename, char *name, char *value_ptr)
168 {
169 struct plugins_list_entry *list = plugins_list;
170 int value, changes = 0;
171
172 value = parse_truefalse(value_ptr);
173 if (value < 0) return ERR;
174
175 for (; list; list = list->next, changes++) list->cfg.use_ip_next_hop = value;
176 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'use_ip_next_hop'. Globalized.\n", filename);
177
178 return changes;
179 }
180
cfg_key_decode_arista_trailer(char * filename,char * name,char * value_ptr)181 int cfg_key_decode_arista_trailer(char *filename, char *name, char *value_ptr)
182 {
183 struct plugins_list_entry *list = plugins_list;
184 int value, changes = 0;
185
186 value = parse_truefalse(value_ptr);
187 if (value < 0) return ERR;
188
189 for (; list; list = list->next, changes++) list->cfg.decode_arista_trailer = value;
190 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'decode_arista_trailer'. Globalized.\n", filename);
191
192 return changes;
193 }
194
cfg_key_aggregate(char * filename,char * name,char * value_ptr)195 int cfg_key_aggregate(char *filename, char *name, char *value_ptr)
196 {
197 struct plugins_list_entry *list = plugins_list;
198 struct custom_primitives_ptrs cpptrs;
199 char *count_token;
200 u_int32_t changes = 0;
201 u_int64_t value[3];
202
203 trim_all_spaces(value_ptr);
204 lower_string(value_ptr);
205 memset(&value, 0, sizeof(value));
206 memset(&cpptrs, 0, sizeof(cpptrs));
207
208 while ((count_token = extract_token(&value_ptr, ','))) {
209 if (!strcmp(count_token, "src_host")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_HOST, count_token);
210 else if (!strcmp(count_token, "dst_host")) cfg_set_aggregate(filename, value, COUNT_INT_DST_HOST, count_token);
211 else if (!strcmp(count_token, "src_net")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_NET, count_token);
212 else if (!strcmp(count_token, "dst_net")) cfg_set_aggregate(filename, value, COUNT_INT_DST_NET, count_token);
213 else if (!strcmp(count_token, "sum")) cfg_set_aggregate(filename, value, COUNT_INT_SUM_HOST, count_token);
214 else if (!strcmp(count_token, "src_port")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_PORT, count_token);
215 else if (!strcmp(count_token, "dst_port")) cfg_set_aggregate(filename, value, COUNT_INT_DST_PORT, count_token);
216 else if (!strcmp(count_token, "proto")) cfg_set_aggregate(filename, value, COUNT_INT_IP_PROTO, count_token);
217 #if defined (HAVE_L2)
218 else if (!strcmp(count_token, "src_mac")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_MAC, count_token);
219 else if (!strcmp(count_token, "dst_mac")) cfg_set_aggregate(filename, value, COUNT_INT_DST_MAC, count_token);
220 else if (!strcmp(count_token, "vlan")) cfg_set_aggregate(filename, value, COUNT_INT_VLAN, count_token);
221 else if (!strcmp(count_token, "sum_mac")) cfg_set_aggregate(filename, value, COUNT_INT_SUM_MAC, count_token);
222 #else
223 else if (!strcmp(count_token, "src_mac") || !strcmp(count_token, "dst_mac") ||
224 !strcmp(count_token, "vlan") || !strcmp(count_token, "sum_mac")) {
225 Log(LOG_WARNING, "WARN: [%s] pmacct was compiled with --disable-l2 but 'aggregate' contains a L2 primitive. Ignored.\n", filename);
226 }
227 #endif
228 else if (!strcmp(count_token, "tos")) cfg_set_aggregate(filename, value, COUNT_INT_IP_TOS, count_token);
229 else if (!strcmp(count_token, "none")) cfg_set_aggregate(filename, value, COUNT_INT_NONE, count_token);
230 else if (!strcmp(count_token, "src_as")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_AS, count_token);
231 else if (!strcmp(count_token, "dst_as")) cfg_set_aggregate(filename, value, COUNT_INT_DST_AS, count_token);
232 else if (!strcmp(count_token, "sum_host")) cfg_set_aggregate(filename, value, COUNT_INT_SUM_HOST, count_token);
233 else if (!strcmp(count_token, "sum_net")) cfg_set_aggregate(filename, value, COUNT_INT_SUM_NET, count_token);
234 else if (!strcmp(count_token, "sum_as")) cfg_set_aggregate(filename, value, COUNT_INT_SUM_AS, count_token);
235 else if (!strcmp(count_token, "sum_port")) cfg_set_aggregate(filename, value, COUNT_INT_SUM_PORT, count_token);
236 else if (!strcmp(count_token, "tag")) cfg_set_aggregate(filename, value, COUNT_INT_TAG, count_token);
237 else if (!strcmp(count_token, "tag2")) cfg_set_aggregate(filename, value, COUNT_INT_TAG2, count_token);
238 else if (!strcmp(count_token, "flows")) cfg_set_aggregate(filename, value, COUNT_INT_FLOWS, count_token);
239 else if (!strcmp(count_token, "class_legacy")) cfg_set_aggregate(filename, value, COUNT_INT_CLASS, count_token); // XXX: to deprecate
240 else if (!strcmp(count_token, "class_frame")) { // XXX: to deprecate
241 if (config.acct_type == ACCT_NF) {
242 #if defined (WITH_NDPI)
243 cfg_set_aggregate(filename, value, COUNT_INT_NDPI_CLASS, count_token);
244 #else
245 Log(LOG_WARNING, "WARN: [%s] Class aggregation not possible due to missing --enable-ndpi\n", filename);
246 #endif
247 }
248 }
249 else if (!strcmp(count_token, "class")) { // XXX: to conciliate and merge with 'class_legacy' and 'class_frame'
250 if (config.acct_type == ACCT_NF) {
251 cfg_set_aggregate(filename, value, COUNT_INT_CLASS, count_token);
252 }
253 else if (config.acct_type == ACCT_PM || config.acct_type == ACCT_SF) {
254 #if defined (WITH_NDPI)
255 cfg_set_aggregate(filename, value, COUNT_INT_NDPI_CLASS, count_token);
256 #else
257 Log(LOG_WARNING, "WARN: [%s] Class aggregation not possible due to missing --enable-ndpi\n", filename);
258 #endif
259 }
260 }
261 else if (!strcmp(count_token, "tcpflags")) cfg_set_aggregate(filename, value, COUNT_INT_TCPFLAGS, count_token);
262 else if (!strcmp(count_token, "std_comm")) cfg_set_aggregate(filename, value, COUNT_INT_STD_COMM, count_token);
263 else if (!strcmp(count_token, "ext_comm")) cfg_set_aggregate(filename, value, COUNT_INT_EXT_COMM, count_token);
264 else if (!strcmp(count_token, "lrg_comm")) cfg_set_aggregate(filename, value, COUNT_INT_LRG_COMM, count_token);
265 else if (!strcmp(count_token, "as_path")) cfg_set_aggregate(filename, value, COUNT_INT_AS_PATH, count_token);
266 else if (!strcmp(count_token, "local_pref")) cfg_set_aggregate(filename, value, COUNT_INT_LOCAL_PREF, count_token);
267 else if (!strcmp(count_token, "med")) cfg_set_aggregate(filename, value, COUNT_INT_MED, count_token);
268 else if (!strcmp(count_token, "peer_src_as")) cfg_set_aggregate(filename, value, COUNT_INT_PEER_SRC_AS, count_token);
269 else if (!strcmp(count_token, "peer_dst_as")) cfg_set_aggregate(filename, value, COUNT_INT_PEER_DST_AS, count_token);
270 else if (!strcmp(count_token, "peer_src_ip")) cfg_set_aggregate(filename, value, COUNT_INT_PEER_SRC_IP, count_token);
271 else if (!strcmp(count_token, "peer_dst_ip")) cfg_set_aggregate(filename, value, COUNT_INT_PEER_DST_IP, count_token);
272 else if (!strcmp(count_token, "src_as_path")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_AS_PATH, count_token);
273 else if (!strcmp(count_token, "src_std_comm")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_STD_COMM, count_token);
274 else if (!strcmp(count_token, "src_ext_comm")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_EXT_COMM, count_token);
275 else if (!strcmp(count_token, "src_lrg_comm")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_LRG_COMM, count_token);
276 else if (!strcmp(count_token, "src_local_pref")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_LOCAL_PREF, count_token);
277 else if (!strcmp(count_token, "src_med")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_MED, count_token);
278 else if (!strcmp(count_token, "in_iface")) cfg_set_aggregate(filename, value, COUNT_INT_IN_IFACE, count_token);
279 else if (!strcmp(count_token, "out_iface")) cfg_set_aggregate(filename, value, COUNT_INT_OUT_IFACE, count_token);
280 else if (!strcmp(count_token, "src_mask")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_NMASK, count_token);
281 else if (!strcmp(count_token, "dst_mask")) cfg_set_aggregate(filename, value, COUNT_INT_DST_NMASK, count_token);
282 else if (!strcmp(count_token, "cos")) cfg_set_aggregate(filename, value, COUNT_INT_COS, count_token);
283 else if (!strcmp(count_token, "etype")) cfg_set_aggregate(filename, value, COUNT_INT_ETHERTYPE, count_token);
284 else if (!strcmp(count_token, "mpls_vpn_rd")) cfg_set_aggregate(filename, value, COUNT_INT_MPLS_VPN_RD, count_token);
285 else if (!strcmp(count_token, "mpls_pw_id")) cfg_set_aggregate(filename, value, COUNT_INT_MPLS_PW_ID, count_token);
286 else if (!strcmp(count_token, "sampling_rate")) cfg_set_aggregate(filename, value, COUNT_INT_SAMPLING_RATE, count_token);
287 else if (!strcmp(count_token, "sampling_direction")) cfg_set_aggregate(filename, value, COUNT_INT_SAMPLING_DIRECTION, count_token);
288 else if (!strcmp(count_token, "src_host_country")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_HOST_COUNTRY, count_token);
289 else if (!strcmp(count_token, "dst_host_country")) cfg_set_aggregate(filename, value, COUNT_INT_DST_HOST_COUNTRY, count_token);
290 else if (!strcmp(count_token, "post_nat_src_host")) cfg_set_aggregate(filename, value, COUNT_INT_POST_NAT_SRC_HOST, count_token);
291 else if (!strcmp(count_token, "post_nat_dst_host")) cfg_set_aggregate(filename, value, COUNT_INT_POST_NAT_DST_HOST, count_token);
292 else if (!strcmp(count_token, "post_nat_src_port")) cfg_set_aggregate(filename, value, COUNT_INT_POST_NAT_SRC_PORT, count_token);
293 else if (!strcmp(count_token, "post_nat_dst_port")) cfg_set_aggregate(filename, value, COUNT_INT_POST_NAT_DST_PORT, count_token);
294 else if (!strcmp(count_token, "nat_event")) cfg_set_aggregate(filename, value, COUNT_INT_NAT_EVENT, count_token);
295 else if (!strcmp(count_token, "fw_event")) cfg_set_aggregate(filename, value, COUNT_INT_NAT_EVENT, count_token);
296 else if (!strcmp(count_token, "timestamp_start")) cfg_set_aggregate(filename, value, COUNT_INT_TIMESTAMP_START, count_token);
297 else if (!strcmp(count_token, "timestamp_end")) cfg_set_aggregate(filename, value, COUNT_INT_TIMESTAMP_END, count_token);
298 else if (!strcmp(count_token, "timestamp_arrival")) cfg_set_aggregate(filename, value, COUNT_INT_TIMESTAMP_ARRIVAL, count_token);
299 else if (!strcmp(count_token, "mpls_label_top")) cfg_set_aggregate(filename, value, COUNT_INT_MPLS_LABEL_TOP, count_token);
300 else if (!strcmp(count_token, "mpls_label_bottom")) cfg_set_aggregate(filename, value, COUNT_INT_MPLS_LABEL_BOTTOM, count_token);
301 else if (!strcmp(count_token, "mpls_stack_depth")) cfg_set_aggregate(filename, value, COUNT_INT_MPLS_STACK_DEPTH, count_token);
302 else if (!strcmp(count_token, "label")) cfg_set_aggregate(filename, value, COUNT_INT_LABEL, count_token);
303 else if (!strcmp(count_token, "export_proto_seqno")) cfg_set_aggregate(filename, value, COUNT_INT_EXPORT_PROTO_SEQNO, count_token);
304 else if (!strcmp(count_token, "export_proto_version")) cfg_set_aggregate(filename, value, COUNT_INT_EXPORT_PROTO_VERSION, count_token);
305 else if (!strcmp(count_token, "export_proto_sysid")) cfg_set_aggregate(filename, value, COUNT_INT_EXPORT_PROTO_SYSID, count_token);
306 else if (!strcmp(count_token, "src_host_pocode")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_HOST_POCODE, count_token);
307 else if (!strcmp(count_token, "dst_host_pocode")) cfg_set_aggregate(filename, value, COUNT_INT_DST_HOST_POCODE, count_token);
308 else if (!strcmp(count_token, "src_host_coords")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_HOST_COORDS, count_token);
309 else if (!strcmp(count_token, "dst_host_coords")) cfg_set_aggregate(filename, value, COUNT_INT_DST_HOST_COORDS, count_token);
310 else if (!strcmp(count_token, "tunnel_src_mac")) cfg_set_aggregate(filename, value, COUNT_INT_TUNNEL_SRC_MAC, count_token);
311 else if (!strcmp(count_token, "tunnel_dst_mac")) cfg_set_aggregate(filename, value, COUNT_INT_TUNNEL_DST_MAC, count_token);
312 else if (!strcmp(count_token, "tunnel_src_host")) cfg_set_aggregate(filename, value, COUNT_INT_TUNNEL_SRC_HOST, count_token);
313 else if (!strcmp(count_token, "tunnel_dst_host")) cfg_set_aggregate(filename, value, COUNT_INT_TUNNEL_DST_HOST, count_token);
314 else if (!strcmp(count_token, "tunnel_proto")) cfg_set_aggregate(filename, value, COUNT_INT_TUNNEL_IP_PROTO, count_token);
315 else if (!strcmp(count_token, "tunnel_tos")) cfg_set_aggregate(filename, value, COUNT_INT_TUNNEL_IP_TOS, count_token);
316 else if (!strcmp(count_token, "tunnel_src_port")) cfg_set_aggregate(filename, value, COUNT_INT_TUNNEL_SRC_PORT, count_token);
317 else if (!strcmp(count_token, "tunnel_dst_port")) cfg_set_aggregate(filename, value, COUNT_INT_TUNNEL_DST_PORT, count_token);
318 else if (!strcmp(count_token, "src_roa")) cfg_set_aggregate(filename, value, COUNT_INT_SRC_ROA, count_token);
319 else if (!strcmp(count_token, "dst_roa")) cfg_set_aggregate(filename, value, COUNT_INT_DST_ROA, count_token);
320 else if (!strcmp(count_token, "vxlan")) cfg_set_aggregate(filename, value, COUNT_INT_VXLAN, count_token);
321 else {
322 cpptrs.primitive[cpptrs.num].name = count_token;
323 cpptrs.num++;
324 }
325 }
326
327 if (!name) for (; list; list = list->next, changes++) {
328 list->cfg.what_to_count = value[1];
329 list->cfg.what_to_count_2 = value[2];
330 memcpy(&list->cfg.cpptrs, &cpptrs, sizeof(cpptrs));
331 }
332 else {
333 for (; list; list = list->next) {
334 if (!strcmp(name, list->name)) {
335 list->cfg.what_to_count = value[1];
336 list->cfg.what_to_count_2 = value[2];
337 memcpy(&list->cfg.cpptrs, &cpptrs, sizeof(cpptrs));
338 changes++;
339 break;
340 }
341 }
342 }
343
344 return changes;
345 }
346
cfg_key_aggregate_primitives(char * filename,char * name,char * value_ptr)347 int cfg_key_aggregate_primitives(char *filename, char *name, char *value_ptr)
348 {
349 struct plugins_list_entry *list = plugins_list;
350 int changes = 0;
351
352 for (; list; list = list->next, changes++) list->cfg.aggregate_primitives = value_ptr;
353 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'aggregate_primitives'. Globalized.\n", filename);
354
355 return changes;
356 }
357
cfg_key_proc_name(char * filename,char * name,char * value_ptr)358 int cfg_key_proc_name(char *filename, char *name, char *value_ptr)
359 {
360 struct plugins_list_entry *list = plugins_list;
361 int changes = 0;
362
363 for (; list; list = list->next, changes++) list->cfg.proc_name = value_ptr;
364 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key '[nf|pm|sf|u]acctd_proc_name'. Globalized.\n", filename);
365
366 return changes;
367 }
368
cfg_key_proc_priority(char * filename,char * name,char * value_ptr)369 int cfg_key_proc_priority(char *filename, char *name, char *value_ptr)
370 {
371 struct plugins_list_entry *list = plugins_list;
372 int value, changes = 0;
373
374 value = atoi(value_ptr);
375
376 if (!name) for (; list; list = list->next, changes++) list->cfg.proc_priority = value;
377 else {
378 for (; list; list = list->next) {
379 if (!strcmp(name, list->name)) {
380 list->cfg.proc_priority = value;
381 changes++;
382 break;
383 }
384 }
385 }
386
387 return changes;
388 }
389
cfg_key_cluster_name(char * filename,char * name,char * value_ptr)390 int cfg_key_cluster_name(char *filename, char *name, char *value_ptr)
391 {
392 struct plugins_list_entry *list = plugins_list;
393 int changes = 0;
394
395 for (; list; list = list->next, changes++) list->cfg.cluster_name = value_ptr;
396 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'cluster_name'. Globalized.\n", filename);
397
398 return changes;
399 }
400
cfg_key_cluster_id(char * filename,char * name,char * value_ptr)401 int cfg_key_cluster_id(char *filename, char *name, char *value_ptr)
402 {
403 struct plugins_list_entry *list = plugins_list;
404 int value, changes = 0;
405
406 value = atoi(value_ptr);
407
408 for (; list; list = list->next, changes++) list->cfg.cluster_id = value;
409 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'cluster_id'. Globalized.\n", filename);
410
411 return changes;
412 }
413
cfg_key_redis_host(char * filename,char * name,char * value_ptr)414 int cfg_key_redis_host(char *filename, char *name, char *value_ptr)
415 {
416 struct plugins_list_entry *list = plugins_list;
417 int changes = 0;
418
419 for (; list; list = list->next, changes++) list->cfg.redis_host = value_ptr;
420 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'redis_host'. Globalized.\n", filename);
421
422 return changes;
423 }
424
cfg_key_redis_db(char * filename,char * name,char * value_ptr)425 int cfg_key_redis_db(char *filename, char *name, char *value_ptr)
426 {
427 struct plugins_list_entry *list = plugins_list;
428 int value, changes = 0;
429
430 value = atoi(value_ptr);
431
432 for (; list; list = list->next, changes++) list->cfg.redis_db = value;
433 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'redis_db'. Globalized.\n", filename);
434
435 return changes;
436 }
437
cfg_key_snaplen(char * filename,char * name,char * value_ptr)438 int cfg_key_snaplen(char *filename, char *name, char *value_ptr)
439 {
440 struct plugins_list_entry *list = plugins_list;
441 int value, changes = 0;
442
443 value = atoi(value_ptr);
444 if (value < DEFAULT_SNAPLEN) {
445 Log(LOG_WARNING, "WARN: [%s] 'snaplen' has to be >= %d.\n", filename, DEFAULT_SNAPLEN);
446 return ERR;
447 }
448
449 for (; list; list = list->next, changes++) list->cfg.snaplen = value;
450 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'snaplen'. Globalized.\n", filename);
451
452 return changes;
453 }
454
cfg_key_aggregate_filter(char * filename,char * name,char * value_ptr)455 int cfg_key_aggregate_filter(char *filename, char *name, char *value_ptr)
456 {
457 struct plugins_list_entry *list = plugins_list;
458 int changes = 0;
459
460 if (!name) {
461 Log(LOG_ERR, "ERROR: [%s] aggregation filter cannot be global. Not loaded.\n", filename);
462 changes++;
463 }
464 else {
465 for (; list; list = list->next) {
466 if (!strcmp(name, list->name)) {
467 list->cfg.a_filter = value_ptr;
468 changes++;
469 break;
470 }
471 }
472 }
473
474 return changes;
475 }
476
cfg_key_pre_tag_filter(char * filename,char * name,char * value_ptr)477 int cfg_key_pre_tag_filter(char *filename, char *name, char *value_ptr)
478 {
479 struct plugins_list_entry *list = plugins_list;
480 int changes = 0;
481
482 if (!name) {
483 Log(LOG_ERR, "ERROR: [%s] TAG filter cannot be global. Not loaded.\n", filename);
484 changes++;
485 }
486 else {
487 for (; list; list = list->next) {
488 if (!strcmp(name, list->name)) {
489 changes = load_tags(filename, &list->cfg.ptf, value_ptr);
490 break;
491 }
492 }
493 }
494
495 return changes;
496 }
497
cfg_key_pre_tag2_filter(char * filename,char * name,char * value_ptr)498 int cfg_key_pre_tag2_filter(char *filename, char *name, char *value_ptr)
499 {
500 struct plugins_list_entry *list = plugins_list;
501 int changes = 0;
502
503 if (!name) {
504 Log(LOG_ERR, "ERROR: [%s] TAG2 filter cannot be global. Not loaded.\n", filename);
505 changes++;
506 }
507 else {
508 for (; list; list = list->next) {
509 if (!strcmp(name, list->name)) {
510 changes = load_tags(filename, &list->cfg.pt2f, value_ptr);
511 break;
512 }
513 }
514 }
515
516 return changes;
517 }
518
cfg_key_pre_tag_label_filter(char * filename,char * name,char * value_ptr)519 int cfg_key_pre_tag_label_filter(char *filename, char *name, char *value_ptr)
520 {
521 struct plugins_list_entry *list = plugins_list;
522 int changes = 0;
523
524 if (!name) {
525 Log(LOG_ERR, "ERROR: [%s] LABEL filter cannot be global. Not loaded.\n", filename);
526 changes++;
527 }
528 else {
529 for (; list; list = list->next) {
530 if (!strcmp(name, list->name)) {
531 changes = load_labels(filename, &list->cfg.ptlf, value_ptr);
532 break;
533 }
534 }
535 }
536
537 return changes;
538 }
539
540
cfg_key_pcap_filter(char * filename,char * name,char * value_ptr)541 int cfg_key_pcap_filter(char *filename, char *name, char *value_ptr)
542 {
543 struct plugins_list_entry *list = plugins_list;
544 int changes = 0;
545
546 for (; list; list = list->next, changes++) list->cfg.clbuf = value_ptr;
547 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pcap_filter'. Globalized.\n", filename);
548
549 return changes;
550 }
551
cfg_key_pcap_protocol(char * filename,char * name,char * value_ptr)552 int cfg_key_pcap_protocol(char *filename, char *name, char *value_ptr)
553 {
554 struct plugins_list_entry *list = plugins_list;
555 int value, changes = 0;
556
557 value = strtol(value_ptr, NULL, 0);
558 for (; list; list = list->next, changes++) list->cfg.pcap_protocol = value;
559 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pcap_protocol'. Globalized.\n", filename);
560
561 return changes;
562 }
563
cfg_key_pcap_direction(char * filename,char * name,char * value_ptr)564 int cfg_key_pcap_direction(char *filename, char *name, char *value_ptr)
565 {
566 struct plugins_list_entry *list = plugins_list;
567 int changes = 0, value = 0;
568
569 lower_string(value_ptr);
570 if (!strncmp(value_ptr, "in", strlen("in"))) value = PCAP_D_IN;
571 else if (!strncmp(value_ptr, "out", strlen("out"))) value = PCAP_D_OUT;
572 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'pcap_direction' value.\n", filename);
573
574 for (; list; list = list->next, changes++) list->cfg.pcap_direction = value;
575 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pcap_direction'. Globalized.\n", filename);
576
577 return changes;
578 }
579
cfg_key_pcap_ifindex(char * filename,char * name,char * value_ptr)580 int cfg_key_pcap_ifindex(char *filename, char *name, char *value_ptr)
581 {
582 struct plugins_list_entry *list = plugins_list;
583 int changes = 0, value = 0;
584
585 lower_string(value_ptr);
586 if (!strncmp(value_ptr, "sys", strlen("sys"))) value = PCAP_IFINDEX_SYS;
587 else if (!strncmp(value_ptr, "hash", strlen("hash"))) value = PCAP_IFINDEX_HASH;
588 else if (!strncmp(value_ptr, "map", strlen("map"))) value = PCAP_IFINDEX_MAP;
589 else if (!strncmp(value_ptr, "none", strlen("none"))) value = PCAP_IFINDEX_NONE;
590 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'pcap_ifindex' value.\n", filename);
591
592 for (; list; list = list->next, changes++) list->cfg.pcap_ifindex = value;
593 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pcap_ifindex'. Globalized.\n", filename);
594
595 return changes;
596 }
597
cfg_key_pcap_interfaces_map(char * filename,char * name,char * value_ptr)598 int cfg_key_pcap_interfaces_map(char *filename, char *name, char *value_ptr)
599 {
600 struct plugins_list_entry *list = plugins_list;
601 int changes = 0;
602
603 for (; list; list = list->next, changes++) list->cfg.pcap_interfaces_map = value_ptr;
604 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pcap_interfaces_map'. Globalized.\n", filename);
605
606 return changes;
607 }
608
cfg_key_pcap_interface(char * filename,char * name,char * value_ptr)609 int cfg_key_pcap_interface(char *filename, char *name, char *value_ptr)
610 {
611 struct plugins_list_entry *list = plugins_list;
612 int changes = 0;
613
614 for (; list; list = list->next, changes++) list->cfg.pcap_if = value_ptr;
615 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pcap_interface'. Globalized.\n", filename);
616
617 return changes;
618 }
619
cfg_key_files_umask(char * filename,char * name,char * value_ptr)620 int cfg_key_files_umask(char *filename, char *name, char *value_ptr)
621 {
622 struct plugins_list_entry *list = plugins_list;
623 int value, changes = 0;
624 char *endp;
625
626 value = strtoul(value_ptr, &endp, 8);
627 if (value < 2) {
628 Log(LOG_WARNING, "WARN: [%s] 'files_umask' has to be >= '002'.\n", filename);
629 return ERR;
630 }
631
632 if (!name) for (; list; list = list->next, changes++) list->cfg.files_umask = value & 0666;
633 else {
634 for (; list; list = list->next) {
635 if (!strcmp(name, list->name)) {
636 list->cfg.files_umask = value & 0666;
637 changes++;
638 break;
639 }
640 }
641 }
642
643 return changes;
644 }
645
cfg_key_files_uid(char * filename,char * name,char * value_ptr)646 int cfg_key_files_uid(char *filename, char *name, char *value_ptr)
647 {
648 struct plugins_list_entry *list = plugins_list;
649 struct passwd *user = NULL;
650 int value, changes = 0;
651
652 user = getpwnam(value_ptr);
653 if (!user) {
654 value = atoi(value_ptr);
655 if (value_ptr && !value && value_ptr[0] != '0');
656 else user = getpwuid(value);
657 }
658
659 if (user) value = user->pw_uid;
660 else {
661 Log(LOG_ERR, "WARN: [%s] Invalid 'files_uid'.\n", filename);
662 return ERR;
663 }
664
665 if (!name) for (; list; list = list->next, changes++) list->cfg.files_uid = value;
666 else {
667 for (; list; list = list->next) {
668 if (!strcmp(name, list->name)) {
669 list->cfg.files_uid = value;
670 changes++;
671 break;
672 }
673 }
674 }
675
676 return changes;
677 }
678
cfg_key_files_gid(char * filename,char * name,char * value_ptr)679 int cfg_key_files_gid(char *filename, char *name, char *value_ptr)
680 {
681 struct plugins_list_entry *list = plugins_list;
682 struct group *group = NULL;
683 u_int32_t value, changes = 0;
684
685 group = getgrnam(value_ptr);
686 if (!group) {
687 value = atoi(value_ptr);
688 if (value_ptr && !value && value_ptr[0] != '0');
689 else group = getgrgid(value);
690 }
691
692 if (group) value = group->gr_gid;
693 else {
694 Log(LOG_ERR, "WARN: [%s] Invalid 'files_gid'.\n", filename);
695 return ERR;
696 }
697
698 if (!name) for (; list; list = list->next, changes++) list->cfg.files_gid = value;
699 else {
700 for (; list; list = list->next) {
701 if (!strcmp(name, list->name)) {
702 list->cfg.files_gid = value;
703 changes++;
704 break;
705 }
706 }
707 }
708
709 return changes;
710 }
711
cfg_key_pcap_interface_wait(char * filename,char * name,char * value_ptr)712 int cfg_key_pcap_interface_wait(char *filename, char *name, char *value_ptr)
713 {
714 struct plugins_list_entry *list = plugins_list;
715 int value, changes = 0;
716
717 value = parse_truefalse(value_ptr);
718 if (value < 0) return ERR;
719
720 for (; list; list = list->next, changes++) list->cfg.pcap_if_wait = value;
721 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pcap_interface_wait'. Globalized.\n", filename);
722
723 return changes;
724 }
725
cfg_key_pcap_savefile_wait(char * filename,char * name,char * value_ptr)726 int cfg_key_pcap_savefile_wait(char *filename, char *name, char *value_ptr)
727 {
728 struct plugins_list_entry *list = plugins_list;
729 int value, changes = 0;
730
731 value = parse_truefalse(value_ptr);
732 if (value < 0) return ERR;
733
734 for (; list; list = list->next, changes++) list->cfg.pcap_sf_wait = value;
735 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pcap_savefile_wait'. Globalized.\n", filename);
736
737 return changes;
738 }
739
cfg_key_pcap_savefile_delay(char * filename,char * name,char * value_ptr)740 int cfg_key_pcap_savefile_delay(char *filename, char *name, char *value_ptr)
741 {
742 struct plugins_list_entry *list = plugins_list;
743 int value, changes = 0;
744
745 value = atoi(value_ptr);
746 if (value < 0) {
747 Log(LOG_WARNING, "WARN: [%s] 'pcap_savefile_delay' has to be >= 0.\n", filename);
748 return ERR;
749 }
750
751 for (; list; list = list->next, changes++) list->cfg.pcap_sf_delay = value;
752 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pcap_savefile_delay'. Globalized.\n", filename);
753
754 return changes;
755 }
756
cfg_key_pcap_savefile_replay(char * filename,char * name,char * value_ptr)757 int cfg_key_pcap_savefile_replay(char *filename, char *name, char *value_ptr)
758 {
759 struct plugins_list_entry *list = plugins_list;
760 int value, changes = 0;
761
762 value = atoi(value_ptr);
763 if (value < 0) {
764 Log(LOG_WARNING, "WARN: [%s] 'pcap_savefile_replay' has to be >= 0.\n", filename);
765 return ERR;
766 }
767 else if (value == 0) value = -1;
768
769 for (; list; list = list->next, changes++) list->cfg.pcap_sf_replay = value;
770 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pcap_savefile_replay'. Globalized.\n", filename);
771
772 return changes;
773 }
774
cfg_key_promisc(char * filename,char * name,char * value_ptr)775 int cfg_key_promisc(char *filename, char *name, char *value_ptr)
776 {
777 struct plugins_list_entry *list = plugins_list;
778 int value, changes = 0;
779
780 value = parse_truefalse(value_ptr);
781 if (value < 0) return ERR;
782
783 for (; list; list = list->next, changes++) list->cfg.promisc = value;
784 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'promisc'. Globalized.\n", filename);
785
786 return changes;
787 }
788
cfg_key_imt_path(char * filename,char * name,char * value_ptr)789 int cfg_key_imt_path(char *filename, char *name, char *value_ptr)
790 {
791 struct plugins_list_entry *list = plugins_list;
792 int changes = 0;
793
794 if (!name) for (; list; list = list->next, changes++) list->cfg.imt_plugin_path = value_ptr;
795 else {
796 for (; list; list = list->next) {
797 if (!strcmp(name, list->name)) {
798 list->cfg.imt_plugin_path = value_ptr;
799 changes++;
800 break;
801 }
802 }
803 }
804
805 return changes;
806 }
807
cfg_key_imt_passwd(char * filename,char * name,char * value_ptr)808 int cfg_key_imt_passwd(char *filename, char *name, char *value_ptr)
809 {
810 struct plugins_list_entry *list = plugins_list;
811 int changes = 0;
812
813 if (!name) for (; list; list = list->next, changes++) list->cfg.imt_plugin_passwd = value_ptr;
814 else {
815 for (; list; list = list->next) {
816 if (!strcmp(name, list->name)) {
817 list->cfg.imt_plugin_passwd = value_ptr;
818 changes++;
819 break;
820 }
821 }
822 }
823
824 return changes;
825 }
826
cfg_key_imt_buckets(char * filename,char * name,char * value_ptr)827 int cfg_key_imt_buckets(char *filename, char *name, char *value_ptr)
828 {
829 struct plugins_list_entry *list = plugins_list;
830 int value, changes = 0;
831
832 value = atoi(value_ptr);
833 if (value <= 0) {
834 Log(LOG_WARNING, "WARN: [%s] 'imt_buckets' has to be > 0.\n", filename);
835 return ERR;
836 }
837
838 if (!name) for (; list; list = list->next, changes++) list->cfg.buckets = value;
839 else {
840 for (; list; list = list->next) {
841 if (!strcmp(name, list->name)) {
842 list->cfg.buckets = value;
843 changes++;
844 break;
845 }
846 }
847 }
848
849 return changes;
850 }
851
cfg_key_imt_mem_pools_number(char * filename,char * name,char * value_ptr)852 int cfg_key_imt_mem_pools_number(char *filename, char *name, char *value_ptr)
853 {
854 struct plugins_list_entry *list = plugins_list;
855 int value, changes = 0;
856
857 value = atoi(value_ptr);
858 if (value < 0) {
859 Log(LOG_WARNING, "WARN: [%s] 'imt_mem_pools_number' has to be >= 0.\n", filename);
860 return ERR;
861 }
862
863 if (!name) for (; list; list = list->next, changes++) list->cfg.num_memory_pools = value;
864 else {
865 for (; list; list = list->next) {
866 if (!strcmp(name, list->name)) {
867 list->cfg.num_memory_pools = value;
868 changes++;
869 break;
870 }
871 }
872 }
873
874 return changes;
875 }
876
cfg_key_imt_mem_pools_size(char * filename,char * name,char * value_ptr)877 int cfg_key_imt_mem_pools_size(char *filename, char *name, char *value_ptr)
878 {
879 struct plugins_list_entry *list = plugins_list;
880 int value, changes = 0;
881
882 /* legal values should be >= sizeof(struct acc), though we are unable to check
883 this condition here. Thus, this function will just cut clearly wrong values
884 ie. < = 0. Strict checks will be accomplished later, by the memory plugin */
885 value = atoi(value_ptr);
886 if (value <= 0) {
887 Log(LOG_WARNING, "WARN: [%s] 'imt_mem_pools_size' has to be > 0.\n", filename);
888 return ERR;
889 }
890
891 if (!name) for (; list; list = list->next, changes++) list->cfg.memory_pool_size = value;
892 else {
893 for (; list; list = list->next) {
894 if (!strcmp(name, list->name)) {
895 list->cfg.memory_pool_size = value;
896 changes++;
897 break;
898 }
899 }
900 }
901
902 return changes;
903 }
904
cfg_key_sql_db(char * filename,char * name,char * value_ptr)905 int cfg_key_sql_db(char *filename, char *name, char *value_ptr)
906 {
907 struct plugins_list_entry *list = plugins_list;
908 int changes = 0;
909
910 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_db = value_ptr;
911 else {
912 for (; list; list = list->next) {
913 if (!strcmp(name, list->name)) {
914 list->cfg.sql_db = value_ptr;
915 changes++;
916 break;
917 }
918 }
919 }
920
921 return changes;
922 }
923
cfg_key_sql_table(char * filename,char * name,char * value_ptr)924 int cfg_key_sql_table(char *filename, char *name, char *value_ptr)
925 {
926 struct plugins_list_entry *list = plugins_list;
927 int changes = 0;
928
929 /* validations: we allow only a) certain variable names, b) a maximum of 32 variables
930 and c) a maximum table name length of 64 chars */
931 {
932 int num = 0;
933 char *c, *ptr = value_ptr;
934
935 while ((c = strchr(ptr, '%'))) {
936 c++;
937 ptr = c;
938 switch (*c) {
939 case 'd':
940 num++;
941 break;
942 case 'H':
943 num++;
944 break;
945 case 'm':
946 num++;
947 break;
948 case 'M':
949 num++;
950 break;
951 case 'w':
952 num++;
953 break;
954 case 'W':
955 num++;
956 break;
957 case 'Y':
958 num++;
959 break;
960 case 's':
961 num++;
962 break;
963 case 'S':
964 num++;
965 break;
966 case 'z':
967 num++;
968 break;
969 default:
970 Log(LOG_ERR, "ERROR: [%s] sql_table, %%%c not supported.\n", filename, *c);
971 exit(1);
972 break;
973 }
974 }
975
976 if (num > 32) {
977 Log(LOG_ERR, "ERROR: [%s] sql_table, exceeded the maximum allowed variables (32) into the table name.\n", filename);
978 exit(1);
979 }
980 }
981
982 if (strlen(value_ptr) > 64) {
983 Log(LOG_ERR, "ERROR: [%s] sql_table, exceeded the maximum SQL table name length (64).\n", filename);
984 exit(1);
985 }
986
987 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_table = value_ptr;
988 else {
989 for (; list; list = list->next) {
990 if (!strcmp(name, list->name)) {
991 list->cfg.sql_table = value_ptr;
992 changes++;
993 break;
994 }
995 }
996 }
997
998 return changes;
999 }
1000
cfg_key_print_output_file(char * filename,char * name,char * value_ptr)1001 int cfg_key_print_output_file(char *filename, char *name, char *value_ptr)
1002 {
1003 struct plugins_list_entry *list = plugins_list;
1004 int changes = 0;
1005
1006 /* validations: we allow only a) certain variable names, b) a maximum of 32 variables */
1007 {
1008 int num = 0;
1009 char *c, *ptr = value_ptr;
1010
1011 while ((c = strchr(ptr, '%'))) {
1012 c++;
1013 ptr = c;
1014 switch (*c) {
1015 case 'd':
1016 num++;
1017 break;
1018 case 'H':
1019 num++;
1020 break;
1021 case 'm':
1022 num++;
1023 break;
1024 case 'M':
1025 num++;
1026 break;
1027 case 'w':
1028 num++;
1029 break;
1030 case 'W':
1031 num++;
1032 break;
1033 case 'Y':
1034 num++;
1035 break;
1036 case 's':
1037 num++;
1038 break;
1039 case 'S':
1040 num++;
1041 break;
1042 case 'z':
1043 num++;
1044 break;
1045 default:
1046 Log(LOG_ERR, "ERROR: [%s] print_output_file, %%%c not supported.\n", filename, *c);
1047 exit(1);
1048 break;
1049 }
1050 }
1051
1052 if (num > 32) {
1053 Log(LOG_ERR, "ERROR: [%s] print_output_file, exceeded the maximum allowed variables (32) into the filename.\n", filename);
1054 exit(1);
1055 }
1056 }
1057
1058 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_table = value_ptr;
1059 else {
1060 for (; list; list = list->next) {
1061 if (!strcmp(name, list->name)) {
1062 list->cfg.sql_table = value_ptr;
1063 changes++;
1064 break;
1065 }
1066 }
1067 }
1068
1069 return changes;
1070 }
1071
cfg_key_print_latest_file(char * filename,char * name,char * value_ptr)1072 int cfg_key_print_latest_file(char *filename, char *name, char *value_ptr)
1073 {
1074 struct plugins_list_entry *list = plugins_list;
1075 int changes = 0;
1076
1077 if (strchr(value_ptr, '%')) {
1078 Log(LOG_ERR, "ERROR: [%s] invalid 'print_latest_file' value: time-based '%%' variables not allowed.\n", filename);
1079 return TRUE;
1080 }
1081
1082 if (!name) for (; list; list = list->next, changes++) list->cfg.print_latest_file = value_ptr;
1083 else {
1084 for (; list; list = list->next) {
1085 if (!strcmp(name, list->name)) {
1086 list->cfg.print_latest_file = value_ptr;
1087 changes++;
1088 break;
1089 }
1090 }
1091 }
1092
1093 return changes;
1094 }
1095
cfg_key_print_output_file_append(char * filename,char * name,char * value_ptr)1096 int cfg_key_print_output_file_append(char *filename, char *name, char *value_ptr)
1097 {
1098 struct plugins_list_entry *list = plugins_list;
1099 int value, changes = 0;
1100
1101 value = parse_truefalse(value_ptr);
1102 if (value < 0) return ERR;
1103
1104 if (!name) for (; list; list = list->next, changes++) list->cfg.print_output_file_append = value;
1105 else {
1106 for (; list; list = list->next) {
1107 if (!strcmp(name, list->name)) {
1108 list->cfg.print_output_file_append = value;
1109 changes++;
1110 break;
1111 }
1112 }
1113 }
1114
1115 return changes;
1116 }
1117
cfg_key_print_write_empty_file(char * filename,char * name,char * value_ptr)1118 int cfg_key_print_write_empty_file(char *filename, char *name, char *value_ptr)
1119 {
1120 struct plugins_list_entry *list = plugins_list;
1121 int value, changes = 0;
1122
1123 value = parse_truefalse(value_ptr);
1124 if (value < 0) return ERR;
1125
1126 if (!name) for (; list; list = list->next, changes++) list->cfg.print_write_empty_file = value;
1127 else {
1128 for (; list; list = list->next) {
1129 if (!strcmp(name, list->name)) {
1130 list->cfg.print_write_empty_file = value;
1131 changes++;
1132 break;
1133 }
1134 }
1135 }
1136
1137 return changes;
1138 }
1139
cfg_key_print_output_lock_file(char * filename,char * name,char * value_ptr)1140 int cfg_key_print_output_lock_file(char *filename, char *name, char *value_ptr)
1141 {
1142 struct plugins_list_entry *list = plugins_list;
1143 int changes = 0;
1144
1145 if (!name) for (; list; list = list->next, changes++) list->cfg.print_output_lock_file = value_ptr;
1146 else {
1147 for (; list; list = list->next) {
1148 if (!strcmp(name, list->name)) {
1149 list->cfg.print_output_lock_file = value_ptr;
1150 changes++;
1151 break;
1152 }
1153 }
1154 }
1155
1156 return changes;
1157 }
1158
cfg_key_sql_table_schema(char * filename,char * name,char * value_ptr)1159 int cfg_key_sql_table_schema(char *filename, char *name, char *value_ptr)
1160 {
1161 struct plugins_list_entry *list = plugins_list;
1162 int changes = 0;
1163
1164 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_table_schema = value_ptr;
1165 else {
1166 for (; list; list = list->next) {
1167 if (!strcmp(name, list->name)) {
1168 list->cfg.sql_table_schema = value_ptr;
1169 changes++;
1170 break;
1171 }
1172 }
1173 }
1174
1175 return changes;
1176 }
1177
cfg_key_sql_table_version(char * filename,char * name,char * value_ptr)1178 int cfg_key_sql_table_version(char *filename, char *name, char *value_ptr)
1179 {
1180 struct plugins_list_entry *list = plugins_list;
1181 int value, changes = 0;
1182
1183 value = atoi(value_ptr);
1184 if (value <= 0) {
1185 Log(LOG_ERR, "ERROR: [%s] invalid 'sql_table_version' value.\n", filename);
1186 exit(1);
1187 }
1188
1189 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_table_version = value;
1190 else {
1191 for (; list; list = list->next) {
1192 if (!strcmp(name, list->name)) {
1193 list->cfg.sql_table_version = value;
1194 changes++;
1195 break;
1196 }
1197 }
1198 }
1199
1200 return changes;
1201 }
1202
cfg_key_sql_table_type(char * filename,char * name,char * value_ptr)1203 int cfg_key_sql_table_type(char *filename, char *name, char *value_ptr)
1204 {
1205 struct plugins_list_entry *list = plugins_list;
1206 int changes = 0;
1207
1208 lower_string(value_ptr);
1209 if (!strcmp(value_ptr, "bgp"));
1210 else if (!strcmp(value_ptr, "original"));
1211 else {
1212 Log(LOG_WARNING, "WARN: [%s] Invalid sql_table_type value '%s'\n", filename, value_ptr);
1213 return ERR;
1214 }
1215
1216 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_table_type = value_ptr;
1217 else {
1218 for (; list; list = list->next) {
1219 if (!strcmp(name, list->name)) {
1220 list->cfg.sql_table_type = value_ptr;
1221 changes++;
1222 break;
1223 }
1224 }
1225 }
1226
1227 return changes;
1228 }
1229
cfg_key_sql_data(char * filename,char * name,char * value_ptr)1230 int cfg_key_sql_data(char *filename, char *name, char *value_ptr)
1231 {
1232 struct plugins_list_entry *list = plugins_list;
1233 int changes = 0;
1234
1235 lower_string(value_ptr);
1236
1237 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_data = value_ptr;
1238 else {
1239 for (; list; list = list->next) {
1240 if (!strcmp(name, list->name)) {
1241 list->cfg.sql_data = value_ptr;
1242 changes++;
1243 break;
1244 }
1245 }
1246 }
1247
1248 return changes;
1249 }
1250
cfg_key_sql_conn_ca_file(char * filename,char * name,char * value_ptr)1251 int cfg_key_sql_conn_ca_file(char *filename, char *name, char *value_ptr)
1252 {
1253 struct plugins_list_entry *list = plugins_list;
1254 int changes = 0;
1255
1256 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_conn_ca_file = value_ptr;
1257 else {
1258 for (; list; list = list->next) {
1259 if (!strcmp(name, list->name)) {
1260 list->cfg.sql_conn_ca_file = value_ptr;
1261 changes++;
1262 break;
1263 }
1264 }
1265 }
1266
1267 return changes;
1268 }
1269
cfg_key_sql_host(char * filename,char * name,char * value_ptr)1270 int cfg_key_sql_host(char *filename, char *name, char *value_ptr)
1271 {
1272 struct plugins_list_entry *list = plugins_list;
1273 int changes = 0;
1274
1275 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_host = value_ptr;
1276 else {
1277 for (; list; list = list->next) {
1278 if (!strcmp(name, list->name)) {
1279 list->cfg.sql_host = value_ptr;
1280 changes++;
1281 break;
1282 }
1283 }
1284 }
1285
1286 return changes;
1287 }
1288
cfg_key_sql_port(char * filename,char * name,char * value_ptr)1289 int cfg_key_sql_port(char *filename, char *name, char *value_ptr)
1290 {
1291 struct plugins_list_entry *list = plugins_list;
1292 int value, changes = 0;
1293
1294 value = atoi(value_ptr);
1295 if (value <= 0) {
1296 Log(LOG_ERR, "WARN: [%s] 'sql_port' has to be > 0.\n", filename);
1297 return ERR;
1298 }
1299
1300 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_port = value;
1301 else {
1302 for (; list; list = list->next) {
1303 if (!strcmp(name, list->name)) {
1304 list->cfg.sql_port = value;
1305 changes++;
1306 break;
1307 }
1308 }
1309 }
1310
1311 return changes;
1312 }
1313
cfg_key_sql_recovery_backup_host(char * filename,char * name,char * value_ptr)1314 int cfg_key_sql_recovery_backup_host(char *filename, char *name, char *value_ptr)
1315 {
1316 struct plugins_list_entry *list = plugins_list;
1317 int changes = 0;
1318
1319 cfg_key_legacy_warning(filename, "sql_backup_host");
1320
1321 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_backup_host = value_ptr;
1322 else {
1323 for (; list; list = list->next) {
1324 if (!strcmp(name, list->name)) {
1325 list->cfg.sql_backup_host = value_ptr;
1326 changes++;
1327 break;
1328 }
1329 }
1330 }
1331
1332 return changes;
1333 }
1334
cfg_key_dump_max_writers(char * filename,char * name,char * value_ptr)1335 int cfg_key_dump_max_writers(char *filename, char *name, char *value_ptr)
1336 {
1337 struct plugins_list_entry *list = plugins_list;
1338 int value, changes = 0;
1339
1340 value = atoi(value_ptr);
1341 if (value < 1 || value >= 100) {
1342 Log(LOG_WARNING, "WARN: [%s] invalid 'dump_max_writers' value). Allowed values are: 1 <= dump_max_writers < 100.\n", filename);
1343 return ERR;
1344 }
1345
1346 if (!name) for (; list; list = list->next, changes++) list->cfg.dump_max_writers = value;
1347 else {
1348 for (; list; list = list->next) {
1349 if (!strcmp(name, list->name)) {
1350 list->cfg.dump_max_writers = value;
1351 changes++;
1352 break;
1353 }
1354 }
1355 }
1356
1357 return changes;
1358 }
1359
cfg_key_sql_trigger_exec(char * filename,char * name,char * value_ptr)1360 int cfg_key_sql_trigger_exec(char *filename, char *name, char *value_ptr)
1361 {
1362 struct plugins_list_entry *list = plugins_list;
1363 int changes = 0;
1364
1365 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_trigger_exec = value_ptr;
1366 else {
1367 for (; list; list = list->next) {
1368 if (!strcmp(name, list->name)) {
1369 list->cfg.sql_trigger_exec = value_ptr;
1370 changes++;
1371 break;
1372 }
1373 }
1374 }
1375
1376 return changes;
1377 }
1378
cfg_key_sql_trigger_time(char * filename,char * name,char * value_ptr)1379 int cfg_key_sql_trigger_time(char *filename, char *name, char *value_ptr)
1380 {
1381 struct plugins_list_entry *list = plugins_list;
1382 int changes = 0, t, t_howmany;
1383
1384 parse_time(filename, value_ptr, &t, &t_howmany);
1385
1386 if (!name) {
1387 for (; list; list = list->next, changes++) {
1388 list->cfg.sql_trigger_time = t;
1389 list->cfg.sql_trigger_time_howmany = t_howmany;
1390 }
1391 }
1392 else {
1393 for (; list; list = list->next) {
1394 if (!strcmp(name, list->name)) {
1395 list->cfg.sql_trigger_time = t;
1396 list->cfg.sql_trigger_time_howmany = t_howmany;
1397 changes++;
1398 break;
1399 }
1400 }
1401 }
1402
1403 return changes;
1404 }
1405
cfg_key_sql_user(char * filename,char * name,char * value_ptr)1406 int cfg_key_sql_user(char *filename, char *name, char *value_ptr)
1407 {
1408 struct plugins_list_entry *list = plugins_list;
1409 int changes = 0;
1410
1411 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_user = value_ptr;
1412 else {
1413 for (; list; list = list->next) {
1414 if (!strcmp(name, list->name)) {
1415 list->cfg.sql_user = value_ptr;
1416 changes++;
1417 break;
1418 }
1419 }
1420 }
1421
1422 return changes;
1423 }
1424
cfg_key_sql_passwd(char * filename,char * name,char * value_ptr)1425 int cfg_key_sql_passwd(char *filename, char *name, char *value_ptr)
1426 {
1427 struct plugins_list_entry *list = plugins_list;
1428 int changes = 0;
1429
1430 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_passwd = value_ptr;
1431 else {
1432 for (; list; list = list->next) {
1433 if (!strcmp(name, list->name)) {
1434 list->cfg.sql_passwd = value_ptr;
1435 changes++;
1436 break;
1437 }
1438 }
1439 }
1440
1441 return changes;
1442 }
1443
cfg_key_sql_refresh_time(char * filename,char * name,char * value_ptr)1444 int cfg_key_sql_refresh_time(char *filename, char *name, char *value_ptr)
1445 {
1446 struct plugins_list_entry *list = plugins_list;
1447 int value, changes = 0, i, len = strlen(value_ptr);
1448
1449 for (i = 0; i < len; i++) {
1450 if (!isdigit(value_ptr[i]) && !isspace(value_ptr[i])) {
1451 Log(LOG_ERR, "WARN: [%s] 'sql_refresh_time' is expected in secs but contains non-digit chars: '%c'\n", filename, value_ptr[i]);
1452 return ERR;
1453 }
1454 }
1455
1456 value = atoi(value_ptr);
1457 if (value <= 0) {
1458 Log(LOG_ERR, "WARN: [%s] 'sql_refresh_time' has to be > 0.\n", filename);
1459 return ERR;
1460 }
1461
1462 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_refresh_time = value;
1463 else {
1464 for (; list; list = list->next) {
1465 if (!strcmp(name, list->name)) {
1466 list->cfg.sql_refresh_time = value;
1467 changes++;
1468 break;
1469 }
1470 }
1471 }
1472
1473 return changes;
1474 }
1475
cfg_key_sql_startup_delay(char * filename,char * name,char * value_ptr)1476 int cfg_key_sql_startup_delay(char *filename, char *name, char *value_ptr)
1477 {
1478 struct plugins_list_entry *list = plugins_list;
1479 int value, changes = 0;
1480
1481 value = atoi(value_ptr);
1482 if (value < 0) {
1483 Log(LOG_ERR, "WARN: [%s] 'sql_startup_delay' has to be >= 0.\n", filename);
1484 return ERR;
1485 }
1486
1487 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_startup_delay = value;
1488 else {
1489 for (; list; list = list->next) {
1490 if (!strcmp(name, list->name)) {
1491 list->cfg.sql_startup_delay = value;
1492 changes++;
1493 break;
1494 }
1495 }
1496 }
1497
1498 return changes;
1499 }
1500
cfg_key_sql_optimize_clauses(char * filename,char * name,char * value_ptr)1501 int cfg_key_sql_optimize_clauses(char *filename, char *name, char *value_ptr)
1502 {
1503 struct plugins_list_entry *list = plugins_list;
1504 int value, changes = 0;
1505
1506 value = parse_truefalse(value_ptr);
1507 if (value < 0) return ERR;
1508
1509 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_optimize_clauses = value;
1510 else {
1511 for (; list; list = list->next) {
1512 if (!strcmp(name, list->name)) {
1513 list->cfg.sql_optimize_clauses = value;
1514 changes++;
1515 break;
1516 }
1517 }
1518 }
1519
1520 return changes;
1521 }
1522
cfg_key_sql_history_roundoff(char * filename,char * name,char * value_ptr)1523 int cfg_key_sql_history_roundoff(char *filename, char *name, char *value_ptr)
1524 {
1525 struct plugins_list_entry *list = plugins_list;
1526 int changes = 0;
1527 int i, check, len;
1528
1529 len = strlen(value_ptr);
1530 for (i = 0, check = 0; i < len; i++) {
1531 if (value_ptr[i] == 'd') check |= COUNT_DAILY;
1532 if (value_ptr[i] == 'w') check |= COUNT_WEEKLY;
1533 if (value_ptr[i] == 'M') check |= COUNT_MONTHLY;
1534 }
1535 if (((check & COUNT_DAILY) || (check & COUNT_MONTHLY)) && (check & COUNT_WEEKLY)) {
1536 Log(LOG_ERR, "WARN: [%s] 'sql_history_roundoff' 'w' is not compatible with either 'd' or 'M'.\n", filename);
1537 return ERR;
1538 }
1539
1540 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_history_roundoff = value_ptr;
1541 else {
1542 for (; list; list = list->next) {
1543 if (!strcmp(name, list->name)) {
1544 list->cfg.sql_history_roundoff = value_ptr;
1545 changes++;
1546 break;
1547 }
1548 }
1549 }
1550
1551 return changes;
1552 }
1553
cfg_key_sql_history(char * filename,char * name,char * value_ptr)1554 int cfg_key_sql_history(char *filename, char *name, char *value_ptr)
1555 {
1556 struct plugins_list_entry *list = plugins_list;
1557 int changes = 0, sql_history, sql_history_howmany;
1558
1559 parse_time(filename, value_ptr, &sql_history, &sql_history_howmany);
1560
1561 if (!name) {
1562 for (; list; list = list->next, changes++) {
1563 list->cfg.sql_history = sql_history;
1564 list->cfg.sql_history_howmany = sql_history_howmany;
1565 }
1566 }
1567 else {
1568 for (; list; list = list->next) {
1569 if (!strcmp(name, list->name)) {
1570 list->cfg.sql_history = sql_history;
1571 list->cfg.sql_history_howmany = sql_history_howmany;
1572 changes++;
1573 break;
1574 }
1575 }
1576 }
1577
1578 return changes;
1579 }
1580
cfg_key_sql_history_offset(char * filename,char * name,char * value_ptr)1581 int cfg_key_sql_history_offset(char *filename, char *name, char *value_ptr)
1582 {
1583 struct plugins_list_entry *list = plugins_list;
1584 int value, changes = 0;
1585
1586 value = atoi(value_ptr);
1587 if (value < 0) {
1588 Log(LOG_ERR, "WARN: [%s] 'sql_history_offset' has to be >= 0.\n", filename);
1589 return ERR;
1590 }
1591
1592 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_history_offset = value;
1593 else {
1594 for (; list; list = list->next) {
1595 if (!strcmp(name, list->name)) {
1596 list->cfg.sql_history_offset = value;
1597 changes++;
1598 break;
1599 }
1600 }
1601 }
1602
1603 return changes;
1604 }
1605
1606
cfg_key_timestamps_since_epoch(char * filename,char * name,char * value_ptr)1607 int cfg_key_timestamps_since_epoch(char *filename, char *name, char *value_ptr)
1608 {
1609 struct plugins_list_entry *list = plugins_list;
1610 int value, changes = 0;
1611
1612 value = parse_truefalse(value_ptr);
1613 if (value < 0) return ERR;
1614
1615 if (!name) for (; list; list = list->next, changes++) list->cfg.timestamps_since_epoch = value;
1616 else {
1617 for (; list; list = list->next) {
1618 if (!strcmp(name, list->name)) {
1619 list->cfg.timestamps_since_epoch = value;
1620 changes++;
1621 break;
1622 }
1623 }
1624 }
1625
1626 return changes;
1627 }
1628
cfg_key_sql_cache_entries(char * filename,char * name,char * value_ptr)1629 int cfg_key_sql_cache_entries(char *filename, char *name, char *value_ptr)
1630 {
1631 struct plugins_list_entry *list = plugins_list;
1632 int value, changes = 0;
1633
1634 value = atoi(value_ptr);
1635 if (value <= 0) {
1636 Log(LOG_WARNING, "WARN: [%s] 'sql_cache_entries' has to be > 0.\n", filename);
1637 return ERR;
1638 }
1639
1640 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_cache_entries = value;
1641 else {
1642 for (; list; list = list->next) {
1643 if (!strcmp(name, list->name)) {
1644 list->cfg.sql_cache_entries = value;
1645 changes++;
1646 break;
1647 }
1648 }
1649 }
1650
1651 return changes;
1652 }
1653
cfg_key_sql_dont_try_update(char * filename,char * name,char * value_ptr)1654 int cfg_key_sql_dont_try_update(char *filename, char *name, char *value_ptr)
1655 {
1656 struct plugins_list_entry *list = plugins_list;
1657 int value, changes = 0;
1658
1659 value = parse_truefalse(value_ptr);
1660 if (value < 0) return ERR;
1661
1662 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_dont_try_update = value;
1663 else {
1664 for (; list; list = list->next) {
1665 if (!strcmp(name, list->name)) {
1666 list->cfg.sql_dont_try_update = value;
1667 changes++;
1668 break;
1669 }
1670 }
1671 }
1672
1673 return changes;
1674 }
1675
cfg_key_sql_preprocess(char * filename,char * name,char * value_ptr)1676 int cfg_key_sql_preprocess(char *filename, char *name, char *value_ptr)
1677 {
1678 struct plugins_list_entry *list = plugins_list;
1679 int changes = 0;
1680
1681 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_preprocess = value_ptr;
1682 else {
1683 for (; list; list = list->next) {
1684 if (!strcmp(name, list->name)) {
1685 list->cfg.sql_preprocess = value_ptr;
1686 changes++;
1687 break;
1688 }
1689 }
1690 }
1691
1692 return changes;
1693 }
1694
cfg_key_sql_preprocess_type(char * filename,char * name,char * value_ptr)1695 int cfg_key_sql_preprocess_type(char *filename, char *name, char *value_ptr)
1696 {
1697 struct plugins_list_entry *list = plugins_list;
1698 int changes = 0, value = 0;
1699
1700 lower_string(value_ptr);
1701 if (!strncmp(value_ptr, "any", 3)) value = FALSE;
1702 if (!strncmp(value_ptr, "all", 3)) value = TRUE;
1703
1704 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_preprocess_type = value;
1705 else {
1706 for (; list; list = list->next) {
1707 if (!strcmp(name, list->name)) {
1708 list->cfg.sql_preprocess_type = value;
1709 changes++;
1710 break;
1711 }
1712 }
1713 }
1714
1715 return changes;
1716 }
1717
cfg_key_sql_multi_values(char * filename,char * name,char * value_ptr)1718 int cfg_key_sql_multi_values(char *filename, char *name, char *value_ptr)
1719 {
1720 struct plugins_list_entry *list = plugins_list;
1721 int changes = 0, value = 0;
1722
1723 value = atoi(value_ptr);
1724 if (value < 0) {
1725 Log(LOG_WARNING, "WARN: [%s] 'sql_multi_values' has to be >= 0.\n", filename);
1726 return ERR;
1727 }
1728
1729 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_multi_values = value;
1730 else {
1731 for (; list; list = list->next) {
1732 if (!strcmp(name, list->name)) {
1733 list->cfg.sql_multi_values = value;
1734 changes++;
1735 break;
1736 }
1737 }
1738 }
1739
1740 return changes;
1741 }
1742
cfg_key_mongo_insert_batch(char * filename,char * name,char * value_ptr)1743 int cfg_key_mongo_insert_batch(char *filename, char *name, char *value_ptr)
1744 {
1745 struct plugins_list_entry *list = plugins_list;
1746 int changes = 0, value = 0;
1747
1748 value = atoi(value_ptr);
1749 if (value <= 0) {
1750 Log(LOG_WARNING, "WARN: [%s] 'mongo_insert_batch' has to be > 0.\n", filename);
1751 return ERR;
1752 }
1753
1754 if (!name) for (; list; list = list->next, changes++) list->cfg.mongo_insert_batch = value;
1755 else {
1756 for (; list; list = list->next) {
1757 if (!strcmp(name, list->name)) {
1758 list->cfg.mongo_insert_batch = value;
1759 changes++;
1760 break;
1761 }
1762 }
1763 }
1764
1765 return changes;
1766 }
1767
cfg_key_message_broker_output(char * filename,char * name,char * value_ptr)1768 int cfg_key_message_broker_output(char *filename, char *name, char *value_ptr)
1769 {
1770 struct plugins_list_entry *list = plugins_list;
1771 int value, changes = 0;
1772
1773 lower_string(value_ptr);
1774 if (!strcmp(value_ptr, "json")) {
1775 #ifdef WITH_JANSSON
1776 value = PRINT_OUTPUT_JSON;
1777 #else
1778 value = PRINT_OUTPUT_JSON;
1779 Log(LOG_WARNING, "WARN: [%s] 'message_broker_output' set to json but will produce no output (missing --enable-jansson).\n", filename);
1780 #endif
1781 }
1782 else if (!strcmp(value_ptr, "avro") || !strcmp(value_ptr, "avro_bin")) {
1783 #ifdef WITH_AVRO
1784 value = PRINT_OUTPUT_AVRO_BIN;
1785 #else
1786 value = PRINT_OUTPUT_AVRO_BIN;
1787 Log(LOG_WARNING, "WARN: [%s] 'message_broker_output' set to avro but will produce no output (missing --enable-avro).\n", filename);
1788 #endif
1789 }
1790 else if (!strcmp(value_ptr, "avro_json")) {
1791 #ifdef WITH_AVRO
1792 value = PRINT_OUTPUT_AVRO_JSON;
1793 #else
1794 value = PRINT_OUTPUT_AVRO_JSON;
1795 Log(LOG_WARNING, "WARN: [%s] 'message_broker_output' set to avro but will produce no output (missing --enable-avro).\n", filename);
1796 #endif
1797 }
1798 else if (!strcmp(value_ptr, "custom")) {
1799 value = PRINT_OUTPUT_CUSTOM;
1800 }
1801 else {
1802 Log(LOG_WARNING, "WARN: [%s] Invalid 'message_broker_output' value '%s'\n", filename, value_ptr);
1803 return ERR;
1804 }
1805
1806 if (!name) for (; list; list = list->next, changes++) list->cfg.message_broker_output = value;
1807 else {
1808 for (; list; list = list->next) {
1809 if (!strcmp(name, list->name)) {
1810 list->cfg.message_broker_output = value;
1811 changes++;
1812 break;
1813 }
1814 }
1815 }
1816
1817 return changes;
1818 }
1819
cfg_key_avro_buffer_size(char * filename,char * name,char * value_ptr)1820 int cfg_key_avro_buffer_size(char *filename, char *name, char *value_ptr)
1821 {
1822 struct plugins_list_entry *list = plugins_list;
1823 u_int64_t value, changes = 0;
1824 char *endptr;
1825
1826 value = strtoull(value_ptr, &endptr, 10);
1827 if (value <= 0) {
1828 Log(LOG_WARNING, "WARN: [%s] 'avro_buffer_size' has to be > 0.\n", filename);
1829 return ERR;
1830 }
1831
1832 if (!name) for (; list; list = list->next, changes++) list->cfg.avro_buffer_size = value;
1833 else {
1834 for (; list; list = list->next) {
1835 if (!strcmp(name, list->name)) {
1836 list->cfg.avro_buffer_size = value;
1837 changes++;
1838 break;
1839 }
1840 }
1841 }
1842
1843 return changes;
1844 }
1845
cfg_key_avro_schema_file(char * filename,char * name,char * value_ptr)1846 int cfg_key_avro_schema_file(char *filename, char *name, char *value_ptr)
1847 {
1848 struct plugins_list_entry *list = plugins_list;
1849 int changes = 0;
1850
1851 if (!name) for (; list; list = list->next, changes++) list->cfg.avro_schema_file = value_ptr;
1852 else {
1853 for (; list; list = list->next) {
1854 if (!strcmp(name, list->name)) {
1855 list->cfg.avro_schema_file = value_ptr;
1856 changes++;
1857 break;
1858 }
1859 }
1860 }
1861
1862 return changes;
1863 }
1864
cfg_key_amqp_exchange_type(char * filename,char * name,char * value_ptr)1865 int cfg_key_amqp_exchange_type(char *filename, char *name, char *value_ptr)
1866 {
1867 struct plugins_list_entry *list = plugins_list;
1868 int changes = 0;
1869
1870 if (!name) for (; list; list = list->next, changes++) list->cfg.amqp_exchange_type = value_ptr;
1871 else {
1872 for (; list; list = list->next) {
1873 if (!strcmp(name, list->name)) {
1874 list->cfg.amqp_exchange_type = value_ptr;
1875 changes++;
1876 break;
1877 }
1878 }
1879 }
1880
1881 return changes;
1882 }
1883
cfg_key_amqp_persistent_msg(char * filename,char * name,char * value_ptr)1884 int cfg_key_amqp_persistent_msg(char *filename, char *name, char *value_ptr)
1885 {
1886 struct plugins_list_entry *list = plugins_list;
1887 int value, changes = 0;
1888
1889 value = parse_truefalse(value_ptr);
1890 if (value < 0) return ERR;
1891
1892 if (!name) for (; list; list = list->next, changes++) list->cfg.amqp_persistent_msg = value;
1893 else {
1894 for (; list; list = list->next) {
1895 if (!strcmp(name, list->name)) {
1896 list->cfg.amqp_persistent_msg = value;
1897 changes++;
1898 break;
1899 }
1900 }
1901 }
1902
1903 return changes;
1904 }
1905
cfg_key_amqp_frame_max(char * filename,char * name,char * value_ptr)1906 int cfg_key_amqp_frame_max(char *filename, char *name, char *value_ptr)
1907 {
1908 struct plugins_list_entry *list = plugins_list;
1909 u_int32_t value, changes = 0;
1910 char *endptr;
1911
1912 value = strtoul(value_ptr, &endptr, 10);
1913 if (value <= 0) {
1914 Log(LOG_WARNING, "WARN: [%s] 'amqp_frame_max' has to be > 0.\n", filename);
1915 return ERR;
1916 }
1917
1918 if (!name) for (; list; list = list->next, changes++) list->cfg.amqp_frame_max = value;
1919 else {
1920 for (; list; list = list->next) {
1921 if (!strcmp(name, list->name)) {
1922 list->cfg.amqp_frame_max = value;
1923 changes++;
1924 break;
1925 }
1926 }
1927 }
1928
1929 return changes;
1930 }
1931
cfg_key_amqp_heartbeat_interval(char * filename,char * name,char * value_ptr)1932 int cfg_key_amqp_heartbeat_interval(char *filename, char *name, char *value_ptr)
1933 {
1934 struct plugins_list_entry *list = plugins_list;
1935 u_int32_t value, changes = 0;
1936 char *endptr;
1937
1938 value = strtoul(value_ptr, &endptr, 10);
1939
1940 if (!name) for (; list; list = list->next, changes++) list->cfg.amqp_heartbeat_interval = value;
1941 else {
1942 for (; list; list = list->next) {
1943 if (!strcmp(name, list->name)) {
1944 list->cfg.amqp_heartbeat_interval = value;
1945 changes++;
1946 break;
1947 }
1948 }
1949 }
1950
1951 return changes;
1952 }
1953
cfg_key_amqp_vhost(char * filename,char * name,char * value_ptr)1954 int cfg_key_amqp_vhost(char *filename, char *name, char *value_ptr)
1955 {
1956 struct plugins_list_entry *list = plugins_list;
1957 int changes = 0;
1958
1959 if (!name) for (; list; list = list->next, changes++) list->cfg.amqp_vhost = value_ptr;
1960 else {
1961 for (; list; list = list->next) {
1962 if (!strcmp(name, list->name)) {
1963 list->cfg.amqp_vhost = value_ptr;
1964 changes++;
1965 break;
1966 }
1967 }
1968 }
1969
1970 return changes;
1971 }
1972
cfg_key_amqp_routing_key_rr(char * filename,char * name,char * value_ptr)1973 int cfg_key_amqp_routing_key_rr(char *filename, char *name, char *value_ptr)
1974 {
1975 struct plugins_list_entry *list = plugins_list;
1976 int changes = 0, value = 0;
1977
1978 value = atoi(value_ptr);
1979 if (value < 0) {
1980 Log(LOG_WARNING, "WARN: [%s] 'amqp_routing_key_rr' has to be >= 0.\n", filename);
1981 return ERR;
1982 }
1983
1984 if (!name) for (; list; list = list->next, changes++) list->cfg.amqp_routing_key_rr = value;
1985 else {
1986 for (; list; list = list->next) {
1987 if (!strcmp(name, list->name)) {
1988 list->cfg.amqp_routing_key_rr = value;
1989 changes++;
1990 break;
1991 }
1992 }
1993 }
1994
1995 return changes;
1996 }
1997
cfg_key_amqp_avro_schema_routing_key(char * filename,char * name,char * value_ptr)1998 int cfg_key_amqp_avro_schema_routing_key(char *filename, char *name, char *value_ptr)
1999 {
2000 struct plugins_list_entry *list = plugins_list;
2001 int changes = 0;
2002
2003 if (!name) for (; list; list = list->next, changes++) list->cfg.amqp_avro_schema_routing_key = value_ptr;
2004 else {
2005 for (; list; list = list->next) {
2006 if (!strcmp(name, list->name)) {
2007 list->cfg.amqp_avro_schema_routing_key = value_ptr;
2008 changes++;
2009 break;
2010 }
2011 }
2012 }
2013
2014 return changes;
2015 }
2016
cfg_key_amqp_avro_schema_refresh_time(char * filename,char * name,char * value_ptr)2017 int cfg_key_amqp_avro_schema_refresh_time(char *filename, char *name, char *value_ptr)
2018 {
2019 struct plugins_list_entry *list = plugins_list;
2020 int changes = 0, value = 0;
2021
2022 value = atoi(value_ptr);
2023 if (value <= 0) {
2024 Log(LOG_WARNING, "WARN: [%s] 'amqp_avro_schema_refresh_time' has to be > 0.\n", filename);
2025 return ERR;
2026 }
2027
2028 if (!name) for (; list; list = list->next, changes++) list->cfg.amqp_avro_schema_refresh_time = value;
2029 else {
2030 for (; list; list = list->next) {
2031 if (!strcmp(name, list->name)) {
2032 list->cfg.amqp_avro_schema_refresh_time = value;
2033 changes++;
2034 break;
2035 }
2036 }
2037 }
2038
2039 return changes;
2040 }
2041
cfg_key_kafka_broker_port(char * filename,char * name,char * value_ptr)2042 int cfg_key_kafka_broker_port(char *filename, char *name, char *value_ptr)
2043 {
2044 struct plugins_list_entry *list = plugins_list;
2045 int value, changes = 0;
2046
2047 value = atoi(value_ptr);
2048 if ((value <= 0) || (value > 65535)) {
2049 Log(LOG_ERR, "WARN: [%s] 'kafka_broker_port' has to be in the range 1-65535.\n", filename);
2050 return ERR;
2051 }
2052
2053 if (!name) for (; list; list = list->next, changes++) list->cfg.kafka_broker_port = value;
2054 else {
2055 for (; list; list = list->next) {
2056 if (!strcmp(name, list->name)) {
2057 list->cfg.kafka_broker_port = value;
2058 changes++;
2059 break;
2060 }
2061 }
2062 }
2063
2064 return changes;
2065 }
2066
cfg_key_kafka_partition(char * filename,char * name,char * value_ptr)2067 int cfg_key_kafka_partition(char *filename, char *name, char *value_ptr)
2068 {
2069 struct plugins_list_entry *list = plugins_list;
2070 int value, changes = 0;
2071
2072 value = atoi(value_ptr);
2073 if (value < -1) {
2074 Log(LOG_ERR, "WARN: [%s] 'kafka_partition' has to be >= -1.\n", filename);
2075 return ERR;
2076 }
2077
2078 if (!value) value = FALSE_NONZERO;
2079
2080 if (!name) for (; list; list = list->next, changes++) list->cfg.kafka_partition = value;
2081 else {
2082 for (; list; list = list->next) {
2083 if (!strcmp(name, list->name)) {
2084 list->cfg.kafka_partition = value;
2085 changes++;
2086 break;
2087 }
2088 }
2089 }
2090
2091 return changes;
2092 }
2093
cfg_key_kafka_partition_dynamic(char * filename,char * name,char * value_ptr)2094 int cfg_key_kafka_partition_dynamic(char *filename, char *name, char *value_ptr)
2095 {
2096 struct plugins_list_entry *list = plugins_list;
2097 int value, changes = 0;
2098
2099 value = parse_truefalse(value_ptr);
2100 if (value < 0) return ERR;
2101
2102 if (!name) for (; list; list = list->next, changes++) list->cfg.kafka_partition_dynamic = value;
2103 else {
2104 for (; list; list = list->next) {
2105 if (!strcmp(name, list->name)) {
2106 list->cfg.kafka_partition_dynamic = value;
2107 changes++;
2108 break;
2109 }
2110 }
2111 }
2112
2113 return changes;
2114 }
2115
cfg_key_kafka_partition_key(char * filename,char * name,char * value_ptr)2116 int cfg_key_kafka_partition_key(char *filename, char *name, char *value_ptr)
2117 {
2118 struct plugins_list_entry *list = plugins_list;
2119 int value_len, changes = 0;
2120
2121 value_len = strlen(value_ptr);
2122 lower_string(value_ptr);
2123
2124 if (!name) for (; list; list = list->next, changes++) {
2125 list->cfg.kafka_partition_key = value_ptr;
2126 list->cfg.kafka_partition_keylen = value_len;
2127 }
2128 else {
2129 for (; list; list = list->next) {
2130 if (!strcmp(name, list->name)) {
2131 list->cfg.kafka_partition_key = value_ptr;
2132 list->cfg.kafka_partition_keylen = value_len;
2133 changes++;
2134 break;
2135 }
2136 }
2137 }
2138
2139 return changes;
2140 }
2141
cfg_key_kafka_avro_schema_topic(char * filename,char * name,char * value_ptr)2142 int cfg_key_kafka_avro_schema_topic(char *filename, char *name, char *value_ptr)
2143 {
2144 struct plugins_list_entry *list = plugins_list;
2145 int changes = 0;
2146
2147 cfg_key_legacy_warning(filename, "kafka_avro_schema_topic");
2148
2149 if (!name) for (; list; list = list->next, changes++) list->cfg.kafka_avro_schema_topic = value_ptr;
2150 else {
2151 for (; list; list = list->next) {
2152 if (!strcmp(name, list->name)) {
2153 list->cfg.kafka_avro_schema_topic = value_ptr;
2154 changes++;
2155 break;
2156 }
2157 }
2158 }
2159
2160 return changes;
2161 }
2162
cfg_key_kafka_avro_schema_refresh_time(char * filename,char * name,char * value_ptr)2163 int cfg_key_kafka_avro_schema_refresh_time(char *filename, char *name, char *value_ptr)
2164 {
2165 struct plugins_list_entry *list = plugins_list;
2166 int changes = 0, value = 0;
2167
2168 cfg_key_legacy_warning(filename, "kafka_avro_schema_refresh_time");
2169
2170 value = atoi(value_ptr);
2171 if (value <= 0) {
2172 Log(LOG_WARNING, "WARN: [%s] 'kakfa_avro_schema_refresh_time' has to be > 0.\n", filename);
2173 return ERR;
2174 }
2175
2176 if (!name) for (; list; list = list->next, changes++) list->cfg.kafka_avro_schema_refresh_time = value;
2177 else {
2178 for (; list; list = list->next) {
2179 if (!strcmp(name, list->name)) {
2180 list->cfg.kafka_avro_schema_refresh_time = value;
2181 changes++;
2182 break;
2183 }
2184 }
2185 }
2186
2187 return changes;
2188 }
2189
cfg_key_kafka_avro_schema_registry(char * filename,char * name,char * value_ptr)2190 int cfg_key_kafka_avro_schema_registry(char *filename, char *name, char *value_ptr)
2191 {
2192 struct plugins_list_entry *list = plugins_list;
2193 int changes = 0;
2194
2195 if (!name) for (; list; list = list->next, changes++) list->cfg.kafka_avro_schema_registry = value_ptr;
2196 else {
2197 for (; list; list = list->next) {
2198 if (!strcmp(name, list->name)) {
2199 list->cfg.kafka_avro_schema_registry = value_ptr;
2200 changes++;
2201 break;
2202 }
2203 }
2204 }
2205
2206 return changes;
2207 }
2208
cfg_key_kafka_config_file(char * filename,char * name,char * value_ptr)2209 int cfg_key_kafka_config_file(char *filename, char *name, char *value_ptr)
2210 {
2211 struct plugins_list_entry *list = plugins_list;
2212 int changes = 0;
2213
2214 if (!name) for (; list; list = list->next, changes++) list->cfg.kafka_config_file = value_ptr;
2215 else {
2216 for (; list; list = list->next) {
2217 if (!strcmp(name, list->name)) {
2218 list->cfg.kafka_config_file = value_ptr;
2219 changes++;
2220 break;
2221 }
2222 }
2223 }
2224
2225 return changes;
2226 }
2227
cfg_key_sql_locking_style(char * filename,char * name,char * value_ptr)2228 int cfg_key_sql_locking_style(char *filename, char *name, char *value_ptr)
2229 {
2230 struct plugins_list_entry *list = plugins_list;
2231 int changes = 0;
2232
2233 lower_string(value_ptr);
2234
2235 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_locking_style = value_ptr;
2236 else {
2237 for (; list; list = list->next) {
2238 if (!strcmp(name, list->name)) {
2239 list->cfg.sql_locking_style = value_ptr;
2240 changes++;
2241 break;
2242 }
2243 }
2244 }
2245
2246 return changes;
2247 }
2248
cfg_key_sql_use_copy(char * filename,char * name,char * value_ptr)2249 int cfg_key_sql_use_copy(char *filename, char *name, char *value_ptr)
2250 {
2251 struct plugins_list_entry *list = plugins_list;
2252 int value, changes = 0;
2253
2254 value = parse_truefalse(value_ptr);
2255 if (value < 0) return ERR;
2256
2257 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_use_copy = value;
2258 else {
2259 for (; list; list = list->next) {
2260 if (!strcmp(name, list->name)) {
2261 list->cfg.sql_use_copy = value;
2262 changes++;
2263 break;
2264 }
2265 }
2266 }
2267
2268 return changes;
2269 }
2270
cfg_key_sql_delimiter(char * filename,char * name,char * value_ptr)2271 int cfg_key_sql_delimiter(char *filename, char *name, char *value_ptr)
2272 {
2273 struct plugins_list_entry *list = plugins_list;
2274 int changes = 0;
2275
2276 /* delimiter is only one character */
2277 if (strlen(value_ptr) != 1) {
2278 Log(LOG_WARNING, "WARN: [%s] 'sql_delimiter' length has to be 1.\n", filename);
2279 return ERR;
2280 }
2281
2282 if (!name) for (; list; list = list->next, changes++) list->cfg.sql_delimiter = value_ptr;
2283 else {
2284 for (; list; list = list->next) {
2285 if (!strcmp(name, list->name)) {
2286 list->cfg.sql_delimiter = value_ptr;
2287 changes++;
2288 break;
2289 }
2290 }
2291 }
2292
2293 return changes;
2294 }
2295
cfg_key_timestamps_rfc3339(char * filename,char * name,char * value_ptr)2296 int cfg_key_timestamps_rfc3339(char *filename, char *name, char *value_ptr)
2297 {
2298 struct plugins_list_entry *list = plugins_list;
2299 int value, changes = 0;
2300
2301 value = parse_truefalse(value_ptr);
2302 if (value < 0) return ERR;
2303
2304 if (!name) for (; list; list = list->next, changes++) list->cfg.timestamps_rfc3339 = value;
2305 else {
2306 for (; list; list = list->next) {
2307 if (!strcmp(name, list->name)) {
2308 list->cfg.timestamps_rfc3339 = value;
2309 changes++;
2310 break;
2311 }
2312 }
2313 }
2314
2315 return changes;
2316 }
2317
cfg_key_timestamps_utc(char * filename,char * name,char * value_ptr)2318 int cfg_key_timestamps_utc(char *filename, char *name, char *value_ptr)
2319 {
2320 struct plugins_list_entry *list = plugins_list;
2321 int value, changes = 0;
2322
2323 value = parse_truefalse(value_ptr);
2324 if (value < 0) return ERR;
2325
2326 if (!name) for (; list; list = list->next, changes++) list->cfg.timestamps_utc = value;
2327 else {
2328 for (; list; list = list->next) {
2329 if (!strcmp(name, list->name)) {
2330 list->cfg.timestamps_utc = value;
2331 changes++;
2332 break;
2333 }
2334 }
2335 }
2336
2337 return changes;
2338 }
2339
cfg_key_timestamps_secs(char * filename,char * name,char * value_ptr)2340 int cfg_key_timestamps_secs(char *filename, char *name, char *value_ptr)
2341 {
2342 struct plugins_list_entry *list = plugins_list;
2343 int value, changes = 0;
2344
2345 value = parse_truefalse(value_ptr);
2346 if (value < 0) return ERR;
2347
2348 if (!name) for (; list; list = list->next, changes++) list->cfg.timestamps_secs = value;
2349 else {
2350 for (; list; list = list->next) {
2351 if (!strcmp(name, list->name)) {
2352 list->cfg.timestamps_secs = value;
2353 changes++;
2354 break;
2355 }
2356 }
2357 }
2358
2359 return changes;
2360 }
2361
cfg_key_plugin_pipe_size(char * filename,char * name,char * value_ptr)2362 int cfg_key_plugin_pipe_size(char *filename, char *name, char *value_ptr)
2363 {
2364 struct plugins_list_entry *list = plugins_list;
2365 u_int64_t value, changes = 0;
2366 char *endptr;
2367
2368 /* legal values should be >= sizeof(struct pkt_data)+sizeof(struct ch_buf_hdr)
2369 though we are unable to check this condition here. Thus, this function will
2370 just cut clearly wrong values ie. < = 0. Strict checks will be accomplished
2371 later, by the load_plugins() */
2372 value = strtoull(value_ptr, &endptr, 10);
2373 if (value <= 0) {
2374 Log(LOG_WARNING, "WARN: [%s] 'plugin_pipe_size' has to be > 0.\n", filename);
2375 return ERR;
2376 }
2377
2378 if (!name) for (; list; list = list->next, changes++) list->cfg.pipe_size = value;
2379 else {
2380 for (; list; list = list->next) {
2381 if (!strcmp(name, list->name)) {
2382 list->cfg.pipe_size = value;
2383 changes++;
2384 break;
2385 }
2386 }
2387 }
2388
2389 return changes;
2390 }
2391
cfg_key_plugin_pipe_zmq(char * filename,char * name,char * value_ptr)2392 int cfg_key_plugin_pipe_zmq(char *filename, char *name, char *value_ptr)
2393 {
2394 struct plugins_list_entry *list = plugins_list;
2395 int value, changes = 0;
2396
2397 value = parse_truefalse(value_ptr);
2398 if (value < 0) return ERR;
2399
2400 if (!name) for (; list; list = list->next, changes++) list->cfg.pipe_zmq = value;
2401 else {
2402 for (; list; list = list->next) {
2403 if (!strcmp(name, list->name)) {
2404 list->cfg.pipe_zmq = value;
2405 changes++;
2406 break;
2407 }
2408 }
2409 }
2410
2411 return changes;
2412 }
2413
cfg_key_plugin_pipe_zmq_retry(char * filename,char * name,char * value_ptr)2414 int cfg_key_plugin_pipe_zmq_retry(char *filename, char *name, char *value_ptr)
2415 {
2416 struct plugins_list_entry *list = plugins_list;
2417 int value, changes = 0;
2418
2419 value = atoi(value_ptr);
2420 if (value <= 0) {
2421 Log(LOG_ERR, "WARN: [%s] 'plugin_pipe_zmq_retry' has to be > 0.\n", filename);
2422 return ERR;
2423 }
2424
2425 if (!name) for (; list; list = list->next, changes++) list->cfg.pipe_zmq_retry = value;
2426 else {
2427 for (; list; list = list->next) {
2428 if (!strcmp(name, list->name)) {
2429 list->cfg.pipe_zmq_retry = value;
2430 changes++;
2431 break;
2432 }
2433 }
2434 }
2435
2436 return changes;
2437 }
2438
cfg_key_plugin_pipe_zmq_profile(char * filename,char * name,char * value_ptr)2439 int cfg_key_plugin_pipe_zmq_profile(char *filename, char *name, char *value_ptr)
2440 {
2441
2442 int changes = 0;
2443 lower_string(value_ptr);
2444
2445 #ifdef WITH_ZMQ
2446 struct plugins_list_entry *list = plugins_list;
2447 int value;
2448 if (!name) for (; list; list = list->next, changes++) {
2449 value = p_zmq_plugin_pipe_set_profile(&list->cfg, value_ptr);
2450 if (value < 0) return ERR;
2451 }
2452 else {
2453 for (; list; list = list->next) {
2454 if (!strcmp(name, list->name)) {
2455 value = p_zmq_plugin_pipe_set_profile(&list->cfg, value_ptr);
2456 if (value < 0) return ERR;
2457
2458 changes++;
2459 break;
2460 }
2461 }
2462 }
2463 #endif
2464
2465 return changes;
2466 }
2467
cfg_key_plugin_pipe_zmq_hwm(char * filename,char * name,char * value_ptr)2468 int cfg_key_plugin_pipe_zmq_hwm(char *filename, char *name, char *value_ptr)
2469 {
2470 struct plugins_list_entry *list = plugins_list;
2471 int value, changes = 0;
2472
2473 value = atoi(value_ptr);
2474 if (value < 0) {
2475 Log(LOG_ERR, "WARN: [%s] 'plugin_pipe_zmq_hwm' has to be >= 0.\n", filename);
2476 return ERR;
2477 }
2478
2479 if (!name) for (; list; list = list->next, changes++) list->cfg.pipe_zmq_hwm = value;
2480 else {
2481 for (; list; list = list->next) {
2482 if (!strcmp(name, list->name)) {
2483 list->cfg.pipe_zmq_hwm = value;
2484 changes++;
2485 break;
2486 }
2487 }
2488 }
2489
2490 return changes;
2491 }
2492
cfg_key_plugin_exit_any(char * filename,char * name,char * value_ptr)2493 int cfg_key_plugin_exit_any(char *filename, char *name, char *value_ptr)
2494 {
2495 struct plugins_list_entry *list = plugins_list;
2496 int value, changes = 0;
2497
2498 value = parse_truefalse(value_ptr);
2499 if (value < 0) return ERR;
2500
2501 for (; list; list = list->next, changes++) list->cfg.plugin_exit_any = value;
2502 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'plugin_exit_any'. Globalized.\n", filename);
2503
2504 return changes;
2505 }
2506
cfg_key_nfacctd_pipe_size(char * filename,char * name,char * value_ptr)2507 int cfg_key_nfacctd_pipe_size(char *filename, char *name, char *value_ptr)
2508 {
2509 struct plugins_list_entry *list = plugins_list;
2510 u_int64_t value, changes = 0;
2511 char *endptr;
2512
2513 value = strtoull(value_ptr, &endptr, 10);
2514 if (!value || value > INT_MAX) {
2515 Log(LOG_WARNING, "WARN: [%s] '[nf|sf|pm]acctd_pipe_size' has to be > 0 and <= INT_MAX.\n", filename);
2516 return ERR;
2517 }
2518
2519 for (; list; list = list->next, changes++) list->cfg.nfacctd_pipe_size = value;
2520 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key '[nf|sf|pm]acctd_pipe_size'. Globalized.\n", filename);
2521
2522 return changes;
2523 }
2524
cfg_key_nfacctd_pro_rating(char * filename,char * name,char * value_ptr)2525 int cfg_key_nfacctd_pro_rating(char *filename, char *name, char *value_ptr)
2526 {
2527 struct plugins_list_entry *list = plugins_list;
2528 int value, changes = 0;
2529
2530 value = parse_truefalse(value_ptr);
2531 if (value < 0) return ERR;
2532
2533 if (!name) for (; list; list = list->next, changes++) list->cfg.nfacctd_pro_rating = value;
2534 else {
2535 for (; list; list = list->next) {
2536 if (!strcmp(name, list->name)) {
2537 list->cfg.nfacctd_pro_rating = value;
2538 changes++;
2539 break;
2540 }
2541 }
2542 }
2543
2544 return changes;
2545 }
2546
cfg_key_nfacctd_templates_file(char * filename,char * name,char * value_ptr)2547 int cfg_key_nfacctd_templates_file(char *filename, char *name, char *value_ptr)
2548 {
2549 struct plugins_list_entry *list = plugins_list;
2550 int changes = 0;
2551
2552 for (; list; list = list->next, changes++) list->cfg.nfacctd_templates_file = value_ptr;
2553 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_templates_file'. Globalized.\n", filename);
2554
2555 return changes;
2556 }
2557
cfg_key_nfacctd_templates_receiver(char * filename,char * name,char * value_ptr)2558 int cfg_key_nfacctd_templates_receiver(char *filename, char *name, char *value_ptr)
2559 {
2560 struct plugins_list_entry *list = plugins_list;
2561 int changes = 0;
2562
2563 for (; list; list = list->next, changes++) list->cfg.nfacctd_templates_receiver = value_ptr;
2564 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_templates_receiver'. Globalized.\n", filename);
2565
2566 return changes;
2567 }
2568
cfg_key_nfacctd_templates_port(char * filename,char * name,char * value_ptr)2569 int cfg_key_nfacctd_templates_port(char *filename, char *name, char *value_ptr)
2570 {
2571 struct plugins_list_entry *list = plugins_list;
2572 int value, changes = 0;
2573
2574 value = atoi(value_ptr);
2575 if ((value <= 0) || (value > 65535)) {
2576 Log(LOG_ERR, "WARN: [%s] 'nfacctd_templates_port' has to be in the range 1-65535.\n", filename);
2577 return ERR;
2578 }
2579
2580 for (; list; list = list->next, changes++) list->cfg.nfacctd_templates_port = value;
2581 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_templates_port'. Globalized.\n", filename);
2582
2583 return changes;
2584 }
2585
cfg_key_nfacctd_stitching(char * filename,char * name,char * value_ptr)2586 int cfg_key_nfacctd_stitching(char *filename, char *name, char *value_ptr)
2587 {
2588 struct plugins_list_entry *list = plugins_list;
2589 int value, changes = 0;
2590
2591 value = parse_truefalse(value_ptr);
2592 if (value < 0) return ERR;
2593
2594 if (!name) for (; list; list = list->next, changes++) list->cfg.nfacctd_stitching = value;
2595 else {
2596 for (; list; list = list->next) {
2597 if (!strcmp(name, list->name)) {
2598 list->cfg.nfacctd_stitching = value;
2599 changes++;
2600 break;
2601 }
2602 }
2603 }
2604
2605 return changes;
2606 }
2607
cfg_key_nfacctd_account_options(char * filename,char * name,char * value_ptr)2608 int cfg_key_nfacctd_account_options(char *filename, char *name, char *value_ptr)
2609 {
2610 struct plugins_list_entry *list = plugins_list;
2611 int value, changes = 0;
2612
2613 value = parse_truefalse(value_ptr);
2614 if (value < 0) return ERR;
2615
2616 for (; list; list = list->next, changes++) list->cfg.nfacctd_account_options = value;
2617 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_account_options'. Globalized.\n", filename);
2618
2619 return changes;
2620 }
2621
cfg_key_bgp_daemon_pipe_size(char * filename,char * name,char * value_ptr)2622 int cfg_key_bgp_daemon_pipe_size(char *filename, char *name, char *value_ptr)
2623 {
2624 struct plugins_list_entry *list = plugins_list;
2625 u_int64_t value, changes = 0;
2626 char *endptr;
2627
2628 value = strtoull(value_ptr, &endptr, 10);
2629 if (!value || value > INT_MAX) {
2630 Log(LOG_WARNING, "WARN: [%s] 'bgp_daemon_pipe_size' has to be > 0 and <= INT_MAX.\n", filename);
2631 return ERR;
2632 }
2633
2634 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_pipe_size = value;
2635 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_pipe_size'. Globalized.\n", filename);
2636
2637 return changes;
2638 }
2639
cfg_key_plugin_buffer_size(char * filename,char * name,char * value_ptr)2640 int cfg_key_plugin_buffer_size(char *filename, char *name, char *value_ptr)
2641 {
2642 struct plugins_list_entry *list = plugins_list;
2643 u_int64_t value, changes = 0;
2644 char *endptr;
2645
2646 /* legal values should be >= sizeof(struct pkt_data) and < plugin_pipe_size
2647 value, if any though we are unable to check this condition here. Thus, this
2648 function will just cut clearly wrong values ie. < = 0. Strict checks will
2649 be accomplished later, by the load_plugins() */
2650 value = strtoull(value_ptr, &endptr, 10);
2651 if (value <= 0) {
2652 Log(LOG_WARNING, "WARN: [%s] 'plugin_buffer_size' has to be > 0.\n", filename);
2653 return ERR;
2654 }
2655
2656 if (!name) for (; list; list = list->next, changes++) list->cfg.buffer_size = value;
2657 else {
2658 for (; list; list = list->next) {
2659 if (!strcmp(name, list->name)) {
2660 list->cfg.buffer_size = value;
2661 changes++;
2662 break;
2663 }
2664 }
2665 }
2666
2667 return changes;
2668 }
2669
cfg_key_networks_mask(char * filename,char * name,char * value_ptr)2670 int cfg_key_networks_mask(char *filename, char *name, char *value_ptr)
2671 {
2672 struct plugins_list_entry *list = plugins_list;
2673 int value, changes = 0;
2674
2675 value = atoi(value_ptr);
2676 if (value <= 0) {
2677 Log(LOG_WARNING, "WARN: [%s] 'networks_mask' has to be > 0.\n", filename);
2678 return ERR;
2679 }
2680
2681 if (!name) for (; list; list = list->next, changes++) list->cfg.networks_mask = value;
2682 else {
2683 for (; list; list = list->next) {
2684 if (!strcmp(name, list->name)) {
2685 list->cfg.networks_mask = value;
2686 changes++;
2687 break;
2688 }
2689 }
2690 }
2691
2692 return changes;
2693 }
2694
cfg_key_networks_file(char * filename,char * name,char * value_ptr)2695 int cfg_key_networks_file(char *filename, char *name, char *value_ptr)
2696 {
2697 struct plugins_list_entry *list = plugins_list;
2698 int changes = 0;
2699
2700 if (!name) for (; list; list = list->next, changes++) list->cfg.networks_file = value_ptr;
2701 else {
2702 for (; list; list = list->next) {
2703 if (!strcmp(name, list->name)) {
2704 list->cfg.networks_file = value_ptr;
2705 changes++;
2706 break;
2707 }
2708 }
2709 }
2710
2711 return changes;
2712 }
2713
cfg_key_networks_file_filter(char * filename,char * name,char * value_ptr)2714 int cfg_key_networks_file_filter(char *filename, char *name, char *value_ptr)
2715 {
2716 struct plugins_list_entry *list = plugins_list;
2717 int value, changes = 0;
2718
2719 value = parse_truefalse(value_ptr);
2720 if (value < 0) return ERR;
2721
2722 if (!name) for (; list; list = list->next, changes++) list->cfg.networks_file_filter = value;
2723 else {
2724 for (; list; list = list->next) {
2725 if (!strcmp(name, list->name)) {
2726 list->cfg.networks_file_filter = value;
2727 changes++;
2728 break;
2729 }
2730 }
2731 }
2732
2733 return changes;
2734 }
2735
cfg_key_networks_file_no_lpm(char * filename,char * name,char * value_ptr)2736 int cfg_key_networks_file_no_lpm(char *filename, char *name, char *value_ptr)
2737 {
2738 struct plugins_list_entry *list = plugins_list;
2739 int value, changes = 0;
2740
2741 value = parse_truefalse(value_ptr);
2742 if (value < 0) return ERR;
2743
2744 if (!name) for (; list; list = list->next, changes++) list->cfg.networks_file_no_lpm = value;
2745 else {
2746 for (; list; list = list->next) {
2747 if (!strcmp(name, list->name)) {
2748 list->cfg.networks_file_no_lpm = value;
2749 changes++;
2750 break;
2751 }
2752 }
2753 }
2754
2755 return changes;
2756 }
2757
cfg_key_networks_no_mask_if_zero(char * filename,char * name,char * value_ptr)2758 int cfg_key_networks_no_mask_if_zero(char *filename, char *name, char *value_ptr)
2759 {
2760 struct plugins_list_entry *list = plugins_list;
2761 int value, changes = 0;
2762
2763 value = parse_truefalse(value_ptr);
2764 if (value < 0) return ERR;
2765
2766 if (!name) for (; list; list = list->next, changes++) list->cfg.networks_no_mask_if_zero = value;
2767 else {
2768 for (; list; list = list->next) {
2769 if (!strcmp(name, list->name)) {
2770 list->cfg.networks_no_mask_if_zero = value;
2771 changes++;
2772 break;
2773 }
2774 }
2775 }
2776
2777 return changes;
2778 }
2779
cfg_key_networks_cache_entries(char * filename,char * name,char * value_ptr)2780 int cfg_key_networks_cache_entries(char *filename, char *name, char *value_ptr)
2781 {
2782 struct plugins_list_entry *list = plugins_list;
2783 int value, changes = 0;
2784
2785 value = atoi(value_ptr);
2786 if (value <= 0) {
2787 Log(LOG_WARNING, "WARN: [%s] 'networks_cache_entries' has to be > 0.\n", filename);
2788 return ERR;
2789 }
2790
2791 if (!name) for (; list; list = list->next, changes++) list->cfg.networks_cache_entries = value;
2792 else {
2793 for (; list; list = list->next) {
2794 if (!strcmp(name, list->name)) {
2795 list->cfg.networks_cache_entries = value;
2796 changes++;
2797 break;
2798 }
2799 }
2800 }
2801
2802 return changes;
2803 }
2804
cfg_key_ports_file(char * filename,char * name,char * value_ptr)2805 int cfg_key_ports_file(char *filename, char *name, char *value_ptr)
2806 {
2807 struct plugins_list_entry *list = plugins_list;
2808 int changes = 0;
2809
2810 if (!name) for (; list; list = list->next, changes++) list->cfg.ports_file = value_ptr;
2811 else {
2812 for (; list; list = list->next) {
2813 if (!strcmp(name, list->name)) {
2814 list->cfg.ports_file = value_ptr;
2815 changes++;
2816 break;
2817 }
2818 }
2819 }
2820
2821 return changes;
2822 }
2823
cfg_key_maps_refresh(char * filename,char * name,char * value_ptr)2824 int cfg_key_maps_refresh(char *filename, char *name, char *value_ptr)
2825 {
2826 struct plugins_list_entry *list = plugins_list;
2827 int value, changes = 0;
2828
2829 value = parse_truefalse(value_ptr);
2830 if (value < 0) return ERR;
2831
2832 for (; list; list = list->next, changes++) list->cfg.maps_refresh = value;
2833 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'maps_refresh'. Globalized.\n", filename);
2834
2835 return changes;
2836 }
2837
cfg_key_print_cache_entries(char * filename,char * name,char * value_ptr)2838 int cfg_key_print_cache_entries(char *filename, char *name, char *value_ptr)
2839 {
2840 struct plugins_list_entry *list = plugins_list;
2841 int value, changes = 0;
2842
2843 value = atoi(value_ptr);
2844 if (value <= 0) {
2845 Log(LOG_ERR, "WARN: [%s] 'print_cache_entries' has to be > 0.\n", filename);
2846 return ERR;
2847 }
2848
2849 if (!name) for (; list; list = list->next, changes++) list->cfg.print_cache_entries = value;
2850 else {
2851 for (; list; list = list->next) {
2852 if (!strcmp(name, list->name)) {
2853 list->cfg.print_cache_entries = value;
2854 changes++;
2855 break;
2856 }
2857 }
2858 }
2859
2860 return changes;
2861 }
2862
cfg_key_print_markers(char * filename,char * name,char * value_ptr)2863 int cfg_key_print_markers(char *filename, char *name, char *value_ptr)
2864 {
2865 struct plugins_list_entry *list = plugins_list;
2866 int value, changes = 0;
2867
2868 value = parse_truefalse(value_ptr);
2869 if (value < 0) return ERR;
2870
2871 if (!name) for (; list; list = list->next, changes++) list->cfg.print_markers = value;
2872 else {
2873 for (; list; list = list->next) {
2874 if (!strcmp(name, list->name)) {
2875 list->cfg.print_markers = value;
2876 changes++;
2877 break;
2878 }
2879 }
2880 }
2881
2882 return changes;
2883 }
2884
cfg_key_print_output(char * filename,char * name,char * value_ptr)2885 int cfg_key_print_output(char *filename, char *name, char *value_ptr)
2886 {
2887 struct plugins_list_entry *list = plugins_list;
2888 int value, changes = 0;
2889
2890 lower_string(value_ptr);
2891 if (!strcmp(value_ptr, "formatted"))
2892 value = PRINT_OUTPUT_FORMATTED;
2893 else if (!strcmp(value_ptr, "csv"))
2894 value = PRINT_OUTPUT_CSV;
2895 else if (!strcmp(value_ptr, "json")) {
2896 #ifdef WITH_JANSSON
2897 value = PRINT_OUTPUT_JSON;
2898 #else
2899 value = PRINT_OUTPUT_JSON;
2900 Log(LOG_WARNING, "WARN: [%s] print_output set to json but will produce no output (missing --enable-jansson).\n", filename);
2901 #endif
2902 }
2903 else if (!strcmp(value_ptr, "event_formatted")) {
2904 value = PRINT_OUTPUT_FORMATTED;
2905 value |= PRINT_OUTPUT_EVENT;
2906 }
2907 else if (!strcmp(value_ptr, "event_csv")) {
2908 value = PRINT_OUTPUT_CSV;
2909 value |= PRINT_OUTPUT_EVENT;
2910 }
2911 else if (!strcmp(value_ptr, "avro") || !strcmp(value_ptr, "avro_bin")) {
2912 #ifdef WITH_AVRO
2913 value = PRINT_OUTPUT_AVRO_BIN;
2914 #else
2915 value = PRINT_OUTPUT_AVRO_BIN;
2916 Log(LOG_WARNING, "WARN: [%s] print_output set to avro but will produce no output (missing --enable-avro).\n", filename);
2917 #endif
2918 }
2919 else if (!strcmp(value_ptr, "avro_json")) {
2920 #ifdef WITH_AVRO
2921 value = PRINT_OUTPUT_AVRO_JSON;
2922 #else
2923 value = PRINT_OUTPUT_AVRO_JSON;
2924 Log(LOG_WARNING, "WARN: [%s] print_output set to avro but will produce no output (missing --enable-avro).\n", filename);
2925 #endif
2926 }
2927 else if (!strcmp(value_ptr, "custom")) {
2928 value = PRINT_OUTPUT_CUSTOM;
2929 }
2930 else {
2931 Log(LOG_WARNING, "WARN: [%s] Invalid print output value '%s'\n", filename, value_ptr);
2932 return ERR;
2933 }
2934
2935 if (!name) for (; list; list = list->next, changes++) list->cfg.print_output = value;
2936 else {
2937 for (; list; list = list->next) {
2938 if (!strcmp(name, list->name)) {
2939 list->cfg.print_output = value;
2940 changes++;
2941 break;
2942 }
2943 }
2944 }
2945
2946 return changes;
2947 }
2948
cfg_key_print_output_separator(char * filename,char * name,char * value_ptr)2949 int cfg_key_print_output_separator(char *filename, char *name, char *value_ptr)
2950 {
2951 struct plugins_list_entry *list = plugins_list;
2952 int changes = 0;
2953
2954 if (strlen(value_ptr) != 1) {
2955 if (!strcmp(value_ptr, "\\t") || !strcmp(value_ptr, "\\s"));
2956 else {
2957 Log(LOG_WARNING, "WARN: [%s] Invalid print_output_separator value '%s'. Only one char allowed.\n", filename, value_ptr);
2958 return ERR;
2959 }
2960 }
2961
2962 if (!name) for (; list; list = list->next, changes++) list->cfg.print_output_separator = value_ptr;
2963 else {
2964 for (; list; list = list->next) {
2965 if (!strcmp(name, list->name)) {
2966 list->cfg.print_output_separator = value_ptr;
2967 changes++;
2968 break;
2969 }
2970 }
2971 }
2972
2973 return changes;
2974 }
2975
cfg_key_num_protos(char * filename,char * name,char * value_ptr)2976 int cfg_key_num_protos(char *filename, char *name, char *value_ptr)
2977 {
2978 struct plugins_list_entry *list = plugins_list;
2979 int value, changes = 0;
2980
2981 value = parse_truefalse(value_ptr);
2982 if (value < 0) return ERR;
2983
2984 if (!name) for (; list; list = list->next, changes++) list->cfg.num_protos = value;
2985 else {
2986 for (; list; list = list->next) {
2987 if (!strcmp(name, list->name)) {
2988 list->cfg.num_protos = value;
2989 changes++;
2990 break;
2991 }
2992 }
2993 }
2994
2995 return changes;
2996 }
2997
cfg_key_num_hosts(char * filename,char * name,char * value_ptr)2998 int cfg_key_num_hosts(char *filename, char *name, char *value_ptr)
2999 {
3000 struct plugins_list_entry *list = plugins_list;
3001 int value, changes = 0;
3002
3003 value = parse_truefalse(value_ptr);
3004 if (value < 0) return ERR;
3005
3006 if (!name) for (; list; list = list->next, changes++) list->cfg.num_hosts = value;
3007 else {
3008 for (; list; list = list->next) {
3009 if (!strcmp(name, list->name)) {
3010 list->cfg.num_hosts = value;
3011 changes++;
3012 break;
3013 }
3014 }
3015 }
3016
3017 return changes;
3018 }
3019
cfg_key_post_tag(char * filename,char * name,char * value_ptr)3020 int cfg_key_post_tag(char *filename, char *name, char *value_ptr)
3021 {
3022 struct plugins_list_entry *list = plugins_list;
3023 pm_id_t value, changes = 0;
3024 char *endptr;
3025
3026 value = strtoull(value_ptr, &endptr, 10);
3027 if (value < 1) {
3028 Log(LOG_ERR, "WARN: [%s] 'post_tag' cannot be zero.\n", filename);
3029 return ERR;
3030 }
3031
3032 if (!name) for (; list; list = list->next, changes++) list->cfg.post_tag = value;
3033 else {
3034 for (; list; list = list->next) {
3035 if (!strcmp(name, list->name)) {
3036 list->cfg.post_tag = value;
3037 changes++;
3038 break;
3039 }
3040 }
3041 }
3042
3043 return changes;
3044 }
3045
cfg_key_post_tag2(char * filename,char * name,char * value_ptr)3046 int cfg_key_post_tag2(char *filename, char *name, char *value_ptr)
3047 {
3048 struct plugins_list_entry *list = plugins_list;
3049 pm_id_t value, changes = 0;
3050 char *endptr;
3051
3052 value = strtoull(value_ptr, &endptr, 10);
3053 if (value < 1) {
3054 Log(LOG_ERR, "WARN: [%s] 'post_tag2' cannot be zero.\n", filename);
3055 return ERR;
3056 }
3057
3058 if (!name) for (; list; list = list->next, changes++) list->cfg.post_tag2 = value;
3059 else {
3060 for (; list; list = list->next) {
3061 if (!strcmp(name, list->name)) {
3062 list->cfg.post_tag2 = value;
3063 changes++;
3064 break;
3065 }
3066 }
3067 }
3068
3069 return changes;
3070 }
3071
cfg_key_sampling_rate(char * filename,char * name,char * value_ptr)3072 int cfg_key_sampling_rate(char *filename, char *name, char *value_ptr)
3073 {
3074 struct plugins_list_entry *list = plugins_list;
3075 int value, changes = 0;
3076
3077 value = atoi(value_ptr);
3078 if (value < 1) {
3079 Log(LOG_ERR, "WARN: [%s] 'sampling_rate' has to be >= 1.\n", filename);
3080 return ERR;
3081 }
3082
3083 if (!name) for (; list; list = list->next, changes++) list->cfg.sampling_rate = value;
3084 else {
3085 for (; list; list = list->next) {
3086 if (!strcmp(name, list->name)) {
3087 list->cfg.sampling_rate = value;
3088 changes++;
3089 break;
3090 }
3091 }
3092 }
3093
3094 return changes;
3095 }
3096
cfg_key_sampling_map(char * filename,char * name,char * value_ptr)3097 int cfg_key_sampling_map(char *filename, char *name, char *value_ptr)
3098 {
3099 struct plugins_list_entry *list = plugins_list;
3100 int changes = 0;
3101
3102 for (; list; list = list->next, changes++) list->cfg.sampling_map = value_ptr;
3103 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sampling_map'. Globalized.\n", filename);
3104
3105 return changes;
3106 }
3107
cfg_key_nfacctd_port(char * filename,char * name,char * value_ptr)3108 int cfg_key_nfacctd_port(char *filename, char *name, char *value_ptr)
3109 {
3110 struct plugins_list_entry *list = plugins_list;
3111 int value, changes = 0;
3112
3113 value = atoi(value_ptr);
3114 if ((value <= 0) || (value > 65535)) {
3115 Log(LOG_ERR, "WARN: [%s] 'nfacctd_port' has to be in the range 1-65535.\n", filename);
3116 return ERR;
3117 }
3118
3119 for (; list; list = list->next, changes++) list->cfg.nfacctd_port = value;
3120 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_port'. Globalized.\n", filename);
3121
3122 return changes;
3123 }
3124
cfg_key_nfacctd_ip(char * filename,char * name,char * value_ptr)3125 int cfg_key_nfacctd_ip(char *filename, char *name, char *value_ptr)
3126 {
3127 struct plugins_list_entry *list = plugins_list;
3128 int changes = 0;
3129
3130 for (; list; list = list->next, changes++) list->cfg.nfacctd_ip = value_ptr;
3131 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_ip'. Globalized.\n", filename);
3132
3133 return changes;
3134 }
3135
cfg_key_nfacctd_kafka_broker_host(char * filename,char * name,char * value_ptr)3136 int cfg_key_nfacctd_kafka_broker_host(char *filename, char *name, char *value_ptr)
3137 {
3138 struct plugins_list_entry *list = plugins_list;
3139 int changes = 0;
3140
3141 for (; list; list = list->next, changes++) list->cfg.nfacctd_kafka_broker_host = value_ptr;
3142 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_kafka_broker_host'. Globalized.\n", filename);
3143
3144 return changes;
3145 }
3146
cfg_key_nfacctd_kafka_broker_port(char * filename,char * name,char * value_ptr)3147 int cfg_key_nfacctd_kafka_broker_port(char *filename, char *name, char *value_ptr)
3148 {
3149 struct plugins_list_entry *list = plugins_list;
3150 int value, changes = 0;
3151
3152 value = atoi(value_ptr);
3153 if ((value <= 0) || (value > 65535)) {
3154 Log(LOG_ERR, "WARN: [%s] 'nfacctd_kafka_broker_port' has to be in the range 1-65535.\n", filename);
3155 return ERR;
3156 }
3157
3158 for (; list; list = list->next, changes++) list->cfg.nfacctd_kafka_broker_port = value;
3159 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_kafka_broker_port'. Globalized.\n", filename);
3160
3161 return changes;
3162 }
3163
cfg_key_nfacctd_kafka_topic(char * filename,char * name,char * value_ptr)3164 int cfg_key_nfacctd_kafka_topic(char *filename, char *name, char *value_ptr)
3165 {
3166 struct plugins_list_entry *list = plugins_list;
3167 int changes = 0;
3168
3169 for (; list; list = list->next, changes++) list->cfg.nfacctd_kafka_topic = value_ptr;
3170 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_kafka_topic'. Globalized.\n", filename);
3171
3172 return changes;
3173 }
3174
cfg_key_nfacctd_kafka_config_file(char * filename,char * name,char * value_ptr)3175 int cfg_key_nfacctd_kafka_config_file(char *filename, char *name, char *value_ptr)
3176 {
3177 struct plugins_list_entry *list = plugins_list;
3178 int changes = 0;
3179
3180 for (; list; list = list->next, changes++) list->cfg.nfacctd_kafka_config_file = value_ptr;
3181 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_kafka_config_file'. Globalized.\n", filename);
3182
3183 return changes;
3184 }
3185
cfg_key_nfacctd_zmq_address(char * filename,char * name,char * value_ptr)3186 int cfg_key_nfacctd_zmq_address(char *filename, char *name, char *value_ptr)
3187 {
3188 struct plugins_list_entry *list = plugins_list;
3189 int changes = 0;
3190
3191 for (; list; list = list->next, changes++) list->cfg.nfacctd_zmq_address = value_ptr;
3192 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_zmq_address'. Globalized.\n", filename);
3193
3194 return changes;
3195 }
3196
cfg_key_nfacctd_allow_file(char * filename,char * name,char * value_ptr)3197 int cfg_key_nfacctd_allow_file(char *filename, char *name, char *value_ptr)
3198 {
3199 struct plugins_list_entry *list = plugins_list;
3200 int changes = 0;
3201
3202 for (; list; list = list->next, changes++) list->cfg.nfacctd_allow_file = value_ptr;
3203 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_allow_file'. Globalized.\n", filename);
3204
3205 return changes;
3206 }
3207
cfg_key_bgp_daemon_allow_file(char * filename,char * name,char * value_ptr)3208 int cfg_key_bgp_daemon_allow_file(char *filename, char *name, char *value_ptr)
3209 {
3210 struct plugins_list_entry *list = plugins_list;
3211 int changes = 0;
3212
3213 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_allow_file = value_ptr;
3214 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_allow_file'. Globalized.\n", filename);
3215
3216 return changes;
3217 }
3218
cfg_key_bgp_daemon_md5_file(char * filename,char * name,char * value_ptr)3219 int cfg_key_bgp_daemon_md5_file(char *filename, char *name, char *value_ptr)
3220 {
3221 struct plugins_list_entry *list = plugins_list;
3222 int changes = 0;
3223
3224 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_md5_file = value_ptr;
3225 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_md5_file'. Globalized.\n", filename);
3226
3227 return changes;
3228 }
3229
cfg_key_pre_tag_map(char * filename,char * name,char * value_ptr)3230 int cfg_key_pre_tag_map(char *filename, char *name, char *value_ptr)
3231 {
3232 struct plugins_list_entry *list = plugins_list;
3233 int changes = 0;
3234
3235 if (!name) for (; list; list = list->next, changes++) list->cfg.pre_tag_map = value_ptr;
3236 else {
3237 for (; list; list = list->next) {
3238 if (!strcmp(name, list->name)) {
3239 list->cfg.pre_tag_map = value_ptr;
3240 changes++;
3241 break;
3242 }
3243 }
3244 }
3245
3246 return changes;
3247 }
3248
cfg_key_maps_entries(char * filename,char * name,char * value_ptr)3249 int cfg_key_maps_entries(char *filename, char *name, char *value_ptr)
3250 {
3251 struct plugins_list_entry *list = plugins_list;
3252 int value, changes = 0;
3253
3254 value = atoi(value_ptr);
3255 if (value <= 0) {
3256 Log(LOG_ERR, "WARN: [%s] 'maps_entries' has to be > 0.\n", filename);
3257 return ERR;
3258 }
3259
3260 if (!name) for (; list; list = list->next, changes++) list->cfg.maps_entries = value;
3261 else {
3262 for (; list; list = list->next) {
3263 if (!strcmp(name, list->name)) {
3264 list->cfg.maps_entries = value;
3265 changes++;
3266 break;
3267 }
3268 }
3269 }
3270
3271 return changes;
3272 }
3273
cfg_key_maps_row_len(char * filename,char * name,char * value_ptr)3274 int cfg_key_maps_row_len(char *filename, char *name, char *value_ptr)
3275 {
3276 struct plugins_list_entry *list = plugins_list;
3277 int value, changes = 0;
3278
3279 value = atoi(value_ptr);
3280 if (value <= 0) {
3281 Log(LOG_ERR, "WARN: [%s] 'maps_row_len' has to be > 0.\n", filename);
3282 return ERR;
3283 }
3284
3285 if (!name) for (; list; list = list->next, changes++) list->cfg.maps_row_len = value;
3286 else {
3287 for (; list; list = list->next) {
3288 if (!strcmp(name, list->name)) {
3289 list->cfg.maps_row_len = value;
3290 changes++;
3291 break;
3292 }
3293 }
3294 }
3295
3296 return changes;
3297 }
3298
cfg_key_maps_index(char * filename,char * name,char * value_ptr)3299 int cfg_key_maps_index(char *filename, char *name, char *value_ptr)
3300 {
3301 struct plugins_list_entry *list = plugins_list;
3302 int value, changes = 0;
3303
3304 value = parse_truefalse(value_ptr);
3305 if (value < 0) return ERR;
3306
3307 for (; list; list = list->next, changes++) list->cfg.maps_index = value;
3308 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'maps_index'. Globalized.\n", filename);
3309
3310 return changes;
3311 }
3312
cfg_key_nfacctd_time_secs(char * filename,char * name,char * value_ptr)3313 int cfg_key_nfacctd_time_secs(char *filename, char *name, char *value_ptr)
3314 {
3315 struct plugins_list_entry *list = plugins_list;
3316 int value, changes = 0;
3317
3318 value = parse_truefalse(value_ptr);
3319 if (value < 0) return ERR;
3320
3321 for (; list; list = list->next, changes++) {
3322 if (!list->cfg.nfacctd_time) {
3323 if (value) list->cfg.nfacctd_time = NF_TIME_SECS;
3324 }
3325 else Log(LOG_WARNING, "WARN: [%s] Possibly 'nfacctd_time_new: true' set. 'nfacctd_time_secs' ignored.\n", filename);
3326 }
3327 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_time_secs'. Globalized.\n", filename);
3328
3329 return changes;
3330 }
3331
cfg_key_nfacctd_time_new(char * filename,char * name,char * value_ptr)3332 int cfg_key_nfacctd_time_new(char *filename, char *name, char *value_ptr)
3333 {
3334 struct plugins_list_entry *list = plugins_list;
3335 int value, changes = 0;
3336
3337 value = parse_truefalse(value_ptr);
3338 if (value < 0) return ERR;
3339
3340 for (; list; list = list->next, changes++) {
3341 if (!list->cfg.nfacctd_time) {
3342 if (value) {
3343 list->cfg.nfacctd_time = NF_TIME_NEW;
3344 list->cfg.nfacctd_time_new = TRUE;
3345 }
3346 }
3347 else Log(LOG_WARNING, "WARN: [%s] Possibly 'nfacctd_time_secs: true' set. 'nfacctd_time_new' ignored.\n", filename);
3348 }
3349 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_time_new'. Globalized.\n", filename);
3350
3351 return changes;
3352 }
3353
cfg_key_nfacctd_mcast_groups(char * filename,char * name,char * value_ptr)3354 int cfg_key_nfacctd_mcast_groups(char *filename, char *name, char *value_ptr)
3355 {
3356 struct plugins_list_entry *list = plugins_list;
3357 struct host_addr tmp_addr;
3358 char *count_token;
3359 u_int32_t changes = 0;
3360 u_int8_t idx = 0, more = 0;
3361
3362 trim_all_spaces(value_ptr);
3363 memset(mcast_groups, 0, sizeof(mcast_groups));
3364
3365 while ((count_token = extract_token(&value_ptr, ','))) {
3366 memset(&tmp_addr, 0, sizeof(tmp_addr));
3367 str_to_addr(count_token, &tmp_addr);
3368 if (is_multicast(&tmp_addr)) {
3369 if (idx < MAX_MCAST_GROUPS) {
3370 memcpy(&mcast_groups[idx], &tmp_addr, sizeof(tmp_addr));
3371 idx++;
3372 }
3373 else more++;
3374 }
3375 }
3376
3377 for (; list; list = list->next, changes++); /* Nothing to do because of the global array, just rolling changes counters */
3378 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for keys '[nfacctd|sfacctd]_mcast_groups'. Globalized.\n",
3379 filename);
3380 if (more) Log(LOG_WARNING, "WARN: [%s] Only the first %u (on a total of %u) multicast groups will be joined.\n",
3381 filename, MAX_MCAST_GROUPS, MAX_MCAST_GROUPS+more);
3382
3383 return changes;
3384 }
3385
cfg_key_bgp_daemon(char * filename,char * name,char * value_ptr)3386 int cfg_key_bgp_daemon(char *filename, char *name, char *value_ptr)
3387 {
3388 struct plugins_list_entry *list = plugins_list;
3389 int value, changes = 0;
3390
3391 lower_string(value_ptr);
3392
3393 if (!strcmp(value_ptr, "false"))
3394 value = BGP_DAEMON_NONE;
3395 else if (!strcmp(value_ptr, "true"))
3396 value = BGP_DAEMON_ONLINE;
3397 else {
3398 Log(LOG_ERR, "WARN: [%s] Invalid 'bgp_daemon' value '%s'\n", filename, value_ptr);
3399 return ERR;
3400 }
3401
3402 for (; list; list = list->next, changes++) list->cfg.bgp_daemon = value;
3403 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon'. Globalized.\n", filename);
3404
3405 return changes;
3406 }
3407
cfg_key_bgp_daemon_aspath_radius(char * filename,char * name,char * value_ptr)3408 int cfg_key_bgp_daemon_aspath_radius(char *filename, char *name, char *value_ptr)
3409 {
3410 struct plugins_list_entry *list = plugins_list;
3411 int value, changes = 0;
3412
3413 value = atoi(value_ptr);
3414 if (value < 1) {
3415 Log(LOG_ERR, "WARN: [%s] 'bgp_aspath_radius' has to be >= 1.\n", filename);
3416 return ERR;
3417 }
3418
3419 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_aspath_radius = value;
3420 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_aspath_radius'. Globalized.\n", filename);
3421
3422 return changes;
3423 }
3424
cfg_key_bgp_daemon_stdcomm_pattern(char * filename,char * name,char * value_ptr)3425 int cfg_key_bgp_daemon_stdcomm_pattern(char *filename, char *name, char *value_ptr)
3426 {
3427 struct plugins_list_entry *list = plugins_list;
3428 int changes = 0;
3429
3430 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_stdcomm_pattern = value_ptr;
3431 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_stdcomm_pattern'. Globalized.\n", filename);
3432
3433 return changes;
3434 }
3435
cfg_key_bgp_daemon_extcomm_pattern(char * filename,char * name,char * value_ptr)3436 int cfg_key_bgp_daemon_extcomm_pattern(char *filename, char *name, char *value_ptr)
3437 {
3438 struct plugins_list_entry *list = plugins_list;
3439 int changes = 0;
3440
3441 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_extcomm_pattern = value_ptr;
3442 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_extcomm_pattern'. Globalized.\n", filename);
3443
3444 return changes;
3445 }
3446
cfg_key_bgp_daemon_lrgcomm_pattern(char * filename,char * name,char * value_ptr)3447 int cfg_key_bgp_daemon_lrgcomm_pattern(char *filename, char *name, char *value_ptr)
3448 {
3449 struct plugins_list_entry *list = plugins_list;
3450 int changes = 0;
3451
3452 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_lrgcomm_pattern = value_ptr;
3453 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_lrgcomm_pattern'. Globalized.\n", filename);
3454
3455 return changes;
3456 }
3457
cfg_key_bgp_daemon_stdcomm_pattern_to_asn(char * filename,char * name,char * value_ptr)3458 int cfg_key_bgp_daemon_stdcomm_pattern_to_asn(char *filename, char *name, char *value_ptr)
3459 {
3460 struct plugins_list_entry *list = plugins_list;
3461 int changes = 0;
3462
3463 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_stdcomm_pattern_to_asn = value_ptr;
3464 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_stdcomm_pattern_to_asn'. Globalized.\n", filename);
3465
3466 return changes;
3467 }
3468
cfg_key_bgp_daemon_lrgcomm_pattern_to_asn(char * filename,char * name,char * value_ptr)3469 int cfg_key_bgp_daemon_lrgcomm_pattern_to_asn(char *filename, char *name, char *value_ptr)
3470 {
3471 struct plugins_list_entry *list = plugins_list;
3472 int changes = 0;
3473
3474 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_lrgcomm_pattern_to_asn = value_ptr;
3475 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_lrgcomm_pattern_to_asn'. Globalized.\n", filename);
3476
3477 return changes;
3478 }
3479
cfg_key_bgp_blackhole_stdcomm_list(char * filename,char * name,char * value_ptr)3480 int cfg_key_bgp_blackhole_stdcomm_list(char *filename, char *name, char *value_ptr)
3481 {
3482 struct plugins_list_entry *list = plugins_list;
3483 int changes = 0;
3484
3485 for (; list; list = list->next, changes++) list->cfg.bgp_blackhole_stdcomm_list = value_ptr;
3486 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_blackhole_stdcomm_list'. Globalized.\n", filename);
3487
3488 return changes;
3489 }
3490
cfg_key_bgp_daemon_peer_src_as_type(char * filename,char * name,char * value_ptr)3491 int cfg_key_bgp_daemon_peer_src_as_type(char *filename, char *name, char *value_ptr)
3492 {
3493 struct plugins_list_entry *list = plugins_list;
3494 int value = BGP_SRC_PRIMITIVES_UNK, changes = 0;
3495
3496 lower_string(value_ptr);
3497 if (!strncmp(value_ptr, "netflow", strlen("netflow"))) value = BGP_SRC_PRIMITIVES_KEEP;
3498 else if (!strncmp(value_ptr, "sflow", strlen("sflow"))) value = BGP_SRC_PRIMITIVES_KEEP;
3499 else if (!strncmp(value_ptr, "map", strlen("map"))) value = BGP_SRC_PRIMITIVES_MAP;
3500 else if (!strncmp(value_ptr, "bgp", strlen("bgp"))) value = BGP_SRC_PRIMITIVES_BGP;
3501 else if (!strncmp(value_ptr, "fallback", strlen("fallback")) ||
3502 !strncmp(value_ptr, "longest", strlen("longest"))) {
3503 value = BGP_SRC_PRIMITIVES_KEEP;
3504 value |= BGP_SRC_PRIMITIVES_BGP;
3505 }
3506 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'bgp_peer_src_as_type' value.\n", filename);
3507
3508 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_peer_as_src_type = value;
3509 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_peer_src_as_type'. Globalized.\n", filename);
3510
3511 return changes;
3512 }
3513
cfg_key_bgp_daemon_src_std_comm_type(char * filename,char * name,char * value_ptr)3514 int cfg_key_bgp_daemon_src_std_comm_type(char *filename, char *name, char *value_ptr)
3515 {
3516 struct plugins_list_entry *list = plugins_list;
3517 int value = BGP_SRC_PRIMITIVES_UNK, changes = 0;
3518
3519 lower_string(value_ptr);
3520 if (!strncmp(value_ptr, "bgp", strlen("bgp"))) value = BGP_SRC_PRIMITIVES_BGP;
3521 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'bgp_src_std_comm_type' value.\n", filename);
3522
3523 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_src_std_comm_type = value;
3524 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_src_std_comm_type'. Globalized.\n", filename);
3525
3526 return changes;
3527 }
3528
cfg_key_bgp_daemon_src_ext_comm_type(char * filename,char * name,char * value_ptr)3529 int cfg_key_bgp_daemon_src_ext_comm_type(char *filename, char *name, char *value_ptr)
3530 {
3531 struct plugins_list_entry *list = plugins_list;
3532 int value = BGP_SRC_PRIMITIVES_UNK, changes = 0;
3533
3534 lower_string(value_ptr);
3535 if (!strncmp(value_ptr, "bgp", strlen("bgp"))) value = BGP_SRC_PRIMITIVES_BGP;
3536 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'bgp_src_ext_comm_type' value.\n", filename);
3537
3538 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_src_ext_comm_type = value;
3539 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_src_ext_comm_type'. Globalized.\n", filename);
3540
3541 return changes;
3542 }
3543
cfg_key_bgp_daemon_src_lrg_comm_type(char * filename,char * name,char * value_ptr)3544 int cfg_key_bgp_daemon_src_lrg_comm_type(char *filename, char *name, char *value_ptr)
3545 {
3546 struct plugins_list_entry *list = plugins_list;
3547 int value = BGP_SRC_PRIMITIVES_UNK, changes = 0;
3548
3549 lower_string(value_ptr);
3550 if (!strncmp(value_ptr, "bgp", strlen("bgp"))) value = BGP_SRC_PRIMITIVES_BGP;
3551 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'bgp_src_lrg_comm_type' value.\n", filename);
3552
3553 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_src_lrg_comm_type = value;
3554 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_src_lrg_comm_type'. Globalized.\n", filename);
3555
3556 return changes;
3557 }
3558
cfg_key_bgp_daemon_src_as_path_type(char * filename,char * name,char * value_ptr)3559 int cfg_key_bgp_daemon_src_as_path_type(char *filename, char *name, char *value_ptr)
3560 {
3561 struct plugins_list_entry *list = plugins_list;
3562 int value = BGP_SRC_PRIMITIVES_UNK, changes = 0;
3563
3564 lower_string(value_ptr);
3565 if (!strncmp(value_ptr, "bgp", strlen("bgp"))) value = BGP_SRC_PRIMITIVES_BGP;
3566 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'bgp_src_as_path_type' value.\n", filename);
3567
3568 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_src_as_path_type = value;
3569 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_src_as_path_type'. Globalized.\n", filename);
3570
3571 return changes;
3572 }
3573
cfg_key_bgp_daemon_src_local_pref_type(char * filename,char * name,char * value_ptr)3574 int cfg_key_bgp_daemon_src_local_pref_type(char *filename, char *name, char *value_ptr)
3575 {
3576 struct plugins_list_entry *list = plugins_list;
3577 int value = BGP_SRC_PRIMITIVES_UNK, changes = 0;
3578
3579 lower_string(value_ptr);
3580 if (!strncmp(value_ptr, "map", strlen("map"))) value = BGP_SRC_PRIMITIVES_MAP;
3581 else if (!strncmp(value_ptr, "bgp", strlen("bgp"))) value = BGP_SRC_PRIMITIVES_BGP;
3582 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'bgp_src_local_pref_type' value.\n", filename);
3583
3584 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_src_local_pref_type = value;
3585 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_src_local_pref_type'. Globalized.\n", filename);
3586
3587 return changes;
3588 }
3589
cfg_key_bgp_daemon_src_med_type(char * filename,char * name,char * value_ptr)3590 int cfg_key_bgp_daemon_src_med_type(char *filename, char *name, char *value_ptr)
3591 {
3592 struct plugins_list_entry *list = plugins_list;
3593 int value = BGP_SRC_PRIMITIVES_UNK, changes = 0;
3594
3595 lower_string(value_ptr);
3596 if (!strncmp(value_ptr, "map", strlen("map"))) value = BGP_SRC_PRIMITIVES_MAP;
3597 else if (!strncmp(value_ptr, "bgp", strlen("bgp"))) value = BGP_SRC_PRIMITIVES_BGP;
3598 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'bgp_src_med_type' value.\n", filename);
3599
3600 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_src_med_type = value;
3601 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_src_med_type'. Globalized.\n", filename);
3602
3603 return changes;
3604 }
3605
cfg_key_bgp_daemon_src_roa_type(char * filename,char * name,char * value_ptr)3606 int cfg_key_bgp_daemon_src_roa_type(char *filename, char *name, char *value_ptr)
3607 {
3608 struct plugins_list_entry *list = plugins_list;
3609 int value = BGP_SRC_PRIMITIVES_UNK, changes = 0;
3610
3611 lower_string(value_ptr);
3612 if (!strncmp(value_ptr, "bgp", strlen("bgp"))) value = BGP_SRC_PRIMITIVES_BGP;
3613 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'bgp_src_roa_type' value.\n", filename);
3614
3615 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_src_roa_type = value;
3616 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_src_roa_type'. Globalized.\n", filename);
3617
3618 return changes;
3619 }
3620
cfg_key_bgp_daemon_peer_as_skip_subas(char * filename,char * name,char * value_ptr)3621 int cfg_key_bgp_daemon_peer_as_skip_subas(char *filename, char *name, char *value_ptr)
3622 {
3623 struct plugins_list_entry *list = plugins_list;
3624 int value, changes = 0;
3625
3626 value = parse_truefalse(value_ptr);
3627 if (value < 0) return ERR;
3628
3629 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_peer_as_skip_subas = value;
3630 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_peer_as_skip_subas'. Globalized.\n", filename);
3631
3632 return changes;
3633 }
3634
cfg_key_bgp_daemon_src_local_pref_map(char * filename,char * name,char * value_ptr)3635 int cfg_key_bgp_daemon_src_local_pref_map(char *filename, char *name, char *value_ptr)
3636 {
3637 struct plugins_list_entry *list = plugins_list;
3638 int changes = 0;
3639
3640 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_src_local_pref_map = value_ptr;
3641 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_src_local_pref_map'. Globalized.\n", filename);
3642
3643 return changes;
3644 }
3645
cfg_key_bgp_daemon_peer_src_as_map(char * filename,char * name,char * value_ptr)3646 int cfg_key_bgp_daemon_peer_src_as_map(char *filename, char *name, char *value_ptr)
3647 {
3648 struct plugins_list_entry *list = plugins_list;
3649 int changes = 0;
3650
3651 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_peer_as_src_map = value_ptr;
3652 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_peer_src_as_map'. Globalized.\n", filename);
3653
3654 return changes;
3655 }
3656
cfg_key_bgp_daemon_src_med_map(char * filename,char * name,char * value_ptr)3657 int cfg_key_bgp_daemon_src_med_map(char *filename, char *name, char *value_ptr)
3658 {
3659 struct plugins_list_entry *list = plugins_list;
3660 int changes = 0;
3661
3662 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_src_med_map = value_ptr;
3663 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_src_med_map'. Globalized.\n", filename);
3664
3665 return changes;
3666 }
3667
cfg_key_bgp_daemon_to_xflow_agent_map(char * filename,char * name,char * value_ptr)3668 int cfg_key_bgp_daemon_to_xflow_agent_map(char *filename, char *name, char *value_ptr)
3669 {
3670 struct plugins_list_entry *list = plugins_list;
3671 int changes = 0;
3672
3673 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_to_xflow_agent_map = value_ptr;
3674 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_to_agent_map'. Globalized.\n", filename);
3675
3676 return changes;
3677 }
3678
cfg_key_nfacctd_flow_to_rd_map(char * filename,char * name,char * value_ptr)3679 int cfg_key_nfacctd_flow_to_rd_map(char *filename, char *name, char *value_ptr)
3680 {
3681 struct plugins_list_entry *list = plugins_list;
3682 int changes = 0;
3683
3684 for (; list; list = list->next, changes++) list->cfg.nfacctd_flow_to_rd_map = value_ptr;
3685 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'flow_to_rd_map'. Globalized.\n", filename);
3686
3687 return changes;
3688 }
3689
cfg_key_bgp_daemon_follow_default(char * filename,char * name,char * value_ptr)3690 int cfg_key_bgp_daemon_follow_default(char *filename, char *name, char *value_ptr)
3691 {
3692 struct plugins_list_entry *list = plugins_list;
3693 int value, changes = 0;
3694
3695 value = atoi(value_ptr);
3696
3697 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_follow_default = value;
3698 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_follow_default'. Globalized.\n", filename);
3699
3700 return changes;
3701 }
3702
cfg_key_bgp_daemon_follow_nexthop(char * filename,char * name,char * value_ptr)3703 int cfg_key_bgp_daemon_follow_nexthop(char *filename, char *name, char *value_ptr)
3704 {
3705 struct plugins_list_entry *list = plugins_list;
3706 char *count_token;
3707 int changes = 0, idx = 0, valid = 0;
3708
3709 trim_all_spaces(value_ptr);
3710
3711 while ((count_token = extract_token(&value_ptr, ',')) && idx < FOLLOW_BGP_NH_ENTRIES) {
3712 for (list = plugins_list; list; list = list->next) {
3713 valid = str2prefix(count_token, &list->cfg.bgp_daemon_follow_nexthop[idx]);
3714 if (!valid) {
3715 Log(LOG_WARNING, "WARN: [%s] bgp_follow_nexthop: invalid IP prefix '%s'.\n", filename, count_token);
3716 break;
3717 }
3718 }
3719 if (valid) idx++;
3720 }
3721
3722 changes = idx;
3723 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_follow_nexthop'. Globalized.\n", filename);
3724
3725 return changes;
3726 }
3727
cfg_key_bgp_daemon_follow_nexthop_external(char * filename,char * name,char * value_ptr)3728 int cfg_key_bgp_daemon_follow_nexthop_external(char *filename, char *name, char *value_ptr)
3729 {
3730 struct plugins_list_entry *list = plugins_list;
3731 int value, changes = 0;
3732
3733 value = parse_truefalse(value_ptr);
3734 if (value < 0) return ERR;
3735
3736 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_follow_nexthop_external = value;
3737 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_follow_nexthop_external'. Globalized.\n", filename);
3738
3739 return changes;
3740 }
3741
cfg_key_bgp_daemon_disable_router_id_check(char * filename,char * name,char * value_ptr)3742 int cfg_key_bgp_daemon_disable_router_id_check(char *filename, char *name, char *value_ptr)
3743 {
3744 struct plugins_list_entry *list = plugins_list;
3745 int value, changes = 0;
3746
3747 value = parse_truefalse(value_ptr);
3748 if (value < 0) return ERR;
3749
3750 for (; list; list = list->next, changes++) list->cfg.bgp_disable_router_id_check = value;
3751 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_disable_router_id_check'. Globalized.\n", filename);
3752
3753 return changes;
3754 }
3755
cfg_key_bgp_daemon_neighbors_file(char * filename,char * name,char * value_ptr)3756 int cfg_key_bgp_daemon_neighbors_file(char *filename, char *name, char *value_ptr)
3757 {
3758 struct plugins_list_entry *list = plugins_list;
3759 int changes = 0;
3760
3761 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_neighbors_file = value_ptr;
3762 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_neighbors_file'. Globalized.\n", filename);
3763
3764 return changes;
3765 }
3766
cfg_key_bgp_daemon_max_peers(char * filename,char * name,char * value_ptr)3767 int cfg_key_bgp_daemon_max_peers(char *filename, char *name, char *value_ptr)
3768 {
3769 struct plugins_list_entry *list = plugins_list;
3770 int value, changes = 0;
3771
3772 value = atoi(value_ptr);
3773 if (value < 1) {
3774 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_max_peers' has to be >= 1.\n", filename);
3775 return ERR;
3776 }
3777
3778 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_max_peers = value;
3779 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_max_peers'. Globalized.\n", filename);
3780
3781 return changes;
3782 }
3783
cfg_key_bgp_daemon_ip(char * filename,char * name,char * value_ptr)3784 int cfg_key_bgp_daemon_ip(char *filename, char *name, char *value_ptr)
3785 {
3786 struct plugins_list_entry *list = plugins_list;
3787 int changes = 0;
3788
3789 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_ip = value_ptr;
3790 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_ip'. Globalized.\n", filename);
3791
3792 return changes;
3793 }
3794
cfg_key_bgp_daemon_id(char * filename,char * name,char * value_ptr)3795 int cfg_key_bgp_daemon_id(char *filename, char *name, char *value_ptr)
3796 {
3797 struct plugins_list_entry *list = plugins_list;
3798 int changes = 0;
3799
3800 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_id = value_ptr;
3801 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_id'. Globalized.\n", filename);
3802
3803 return changes;
3804 }
3805
cfg_key_bgp_daemon_as(char * filename,char * name,char * value_ptr)3806 int cfg_key_bgp_daemon_as(char *filename, char *name, char *value_ptr)
3807 {
3808 struct plugins_list_entry *list = plugins_list;
3809 int changes = 0;
3810 char *endptr;
3811 as_t value;
3812
3813 value = strtoul(value_ptr, &endptr, 10);
3814
3815 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_as = value;
3816 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_as'. Globalized.\n", filename);
3817
3818 return changes;
3819 }
3820
cfg_key_bgp_daemon_port(char * filename,char * name,char * value_ptr)3821 int cfg_key_bgp_daemon_port(char *filename, char *name, char *value_ptr)
3822 {
3823 struct plugins_list_entry *list = plugins_list;
3824 int value, changes = 0;
3825
3826 value = atoi(value_ptr);
3827 if ((value <= 0) || (value > 65535)) {
3828 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_port' has to be in the range 1-65535.\n", filename);
3829 return ERR;
3830 }
3831
3832 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_port = value;
3833 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_port'. Globalized.\n", filename);
3834
3835 return changes;
3836 }
3837
cfg_key_bgp_lg(char * filename,char * name,char * value_ptr)3838 int cfg_key_bgp_lg(char *filename, char *name, char *value_ptr)
3839 {
3840 struct plugins_list_entry *list = plugins_list;
3841 int value, changes = 0;
3842
3843 value = parse_truefalse(value_ptr);
3844 if (value < 0) return ERR;
3845
3846 for (; list; list = list->next, changes++) list->cfg.bgp_lg = value;
3847 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_lg'. Globalized.\n", filename);
3848
3849 return changes;
3850 }
3851
cfg_key_bgp_lg_ip(char * filename,char * name,char * value_ptr)3852 int cfg_key_bgp_lg_ip(char *filename, char *name, char *value_ptr)
3853 {
3854 struct plugins_list_entry *list = plugins_list;
3855 int changes = 0;
3856
3857 for (; list; list = list->next, changes++) list->cfg.bgp_lg_ip = value_ptr;
3858 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_lg_ip'. Globalized.\n", filename);
3859
3860 return changes;
3861 }
3862
cfg_key_bgp_lg_port(char * filename,char * name,char * value_ptr)3863 int cfg_key_bgp_lg_port(char *filename, char *name, char *value_ptr)
3864 {
3865 struct plugins_list_entry *list = plugins_list;
3866 int value, changes = 0;
3867
3868 value = atoi(value_ptr);
3869 if ((value <= 0) || (value > 65535)) {
3870 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_lg_port' has to be in the range 1-65535.\n", filename);
3871 return ERR;
3872 }
3873
3874 for (; list; list = list->next, changes++) list->cfg.bgp_lg_port = value;
3875 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_lg_port'. Globalized.\n", filename);
3876
3877 return changes;
3878 }
3879
cfg_key_bgp_lg_threads(char * filename,char * name,char * value_ptr)3880 int cfg_key_bgp_lg_threads(char *filename, char *name, char *value_ptr)
3881 {
3882 struct plugins_list_entry *list = plugins_list;
3883 int value, changes = 0;
3884
3885 value = atoi(value_ptr);
3886 if (value <= 0) {
3887 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_lg_threads' has to be > 0.\n", filename);
3888 return ERR;
3889 }
3890
3891 for (; list; list = list->next, changes++) list->cfg.bgp_lg_threads = value;
3892 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_lg_threads'. Globalized.\n", filename);
3893
3894 return changes;
3895 }
3896
cfg_key_bgp_lg_user(char * filename,char * name,char * value_ptr)3897 int cfg_key_bgp_lg_user(char *filename, char *name, char *value_ptr)
3898 {
3899 struct plugins_list_entry *list = plugins_list;
3900 int changes = 0;
3901
3902 for (; list; list = list->next, changes++) list->cfg.bgp_lg_user = value_ptr;
3903 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_lg_user'. Globalized.\n", filename);
3904
3905 return changes;
3906 }
3907
cfg_key_bgp_lg_passwd(char * filename,char * name,char * value_ptr)3908 int cfg_key_bgp_lg_passwd(char *filename, char *name, char *value_ptr)
3909 {
3910 struct plugins_list_entry *list = plugins_list;
3911 int changes = 0;
3912
3913 for (; list; list = list->next, changes++) list->cfg.bgp_lg_passwd = value_ptr;
3914 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_lg_passwd'. Globalized.\n", filename);
3915
3916 return changes;
3917 }
3918
cfg_key_bgp_xconnect_map(char * filename,char * name,char * value_ptr)3919 int cfg_key_bgp_xconnect_map(char *filename, char *name, char *value_ptr)
3920 {
3921 struct plugins_list_entry *list = plugins_list;
3922 int changes = 0;
3923
3924 for (; list; list = list->next, changes++) list->cfg.bgp_xconnect_map = value_ptr;
3925 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_xconnect_map'. Globalized.\n", filename);
3926
3927 return changes;
3928 }
3929
cfg_key_bgp_daemon_ip_precedence(char * filename,char * name,char * value_ptr)3930 int cfg_key_bgp_daemon_ip_precedence(char *filename, char *name, char *value_ptr)
3931 {
3932 struct plugins_list_entry *list = plugins_list;
3933 int value, changes = 0;
3934
3935 value = atoi(value_ptr);
3936 if ((value < 0) || (value > 7)) {
3937 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_ipprec' has to be in the range 0-7.\n", filename);
3938 return ERR;
3939 }
3940
3941 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_ipprec = value;
3942 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_ipprec'. Globalized.\n", filename);
3943
3944 return changes;
3945 }
3946
cfg_key_bgp_daemon_table_peer_buckets(char * filename,char * name,char * value_ptr)3947 int cfg_key_bgp_daemon_table_peer_buckets(char *filename, char *name, char *value_ptr)
3948 {
3949 struct plugins_list_entry *list = plugins_list;
3950 int value, changes = 0;
3951
3952 value = atoi(value_ptr);
3953 if ((value <= 0) || (value > 1000)) {
3954 Log(LOG_ERR, "WARN: [%s] 'bgp_table_peer_buckets' has to be in the range 1-1000.\n", filename);
3955 return ERR;
3956 }
3957
3958 for (; list; list = list->next, changes++) list->cfg.bgp_table_peer_buckets = value;
3959 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_peer_buckets'. Globalized.\n", filename);
3960
3961 return changes;
3962 }
3963
cfg_key_bgp_daemon_table_per_peer_buckets(char * filename,char * name,char * value_ptr)3964 int cfg_key_bgp_daemon_table_per_peer_buckets(char *filename, char *name, char *value_ptr)
3965 {
3966 struct plugins_list_entry *list = plugins_list;
3967 int value, changes = 0;
3968
3969 value = atoi(value_ptr);
3970 if ((value <= 0) || (value > 128)) {
3971 Log(LOG_ERR, "WARN: [%s] 'bgp_table_per_peer_buckets' has to be in the range 1-128.\n", filename);
3972 return ERR;
3973 }
3974
3975 for (; list; list = list->next, changes++) list->cfg.bgp_table_per_peer_buckets = value;
3976 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_per_peer_buckets'. Globalized.\n", filename);
3977
3978 return changes;
3979 }
3980
cfg_key_bgp_daemon_table_attr_hash_buckets(char * filename,char * name,char * value_ptr)3981 int cfg_key_bgp_daemon_table_attr_hash_buckets(char *filename, char *name, char *value_ptr)
3982 {
3983 struct plugins_list_entry *list = plugins_list;
3984 int value, changes = 0;
3985
3986 value = atoi(value_ptr);
3987 if ((value <= 0) || (value > 1000000)) {
3988 Log(LOG_ERR, "WARN: [%s] 'bgp_table_attr_hash_buckets' has to be in the range 1-1000000.\n", filename);
3989 return ERR;
3990 }
3991
3992 for (; list; list = list->next, changes++) list->cfg.bgp_table_attr_hash_buckets = value;
3993 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_attr_hash_buckets'. Globalized.\n", filename);
3994
3995 return changes;
3996 }
3997
cfg_key_bgp_daemon_table_per_peer_hash(char * filename,char * name,char * value_ptr)3998 int cfg_key_bgp_daemon_table_per_peer_hash(char *filename, char *name, char *value_ptr)
3999 {
4000 struct plugins_list_entry *list = plugins_list;
4001 int value = BGP_ASPATH_HASH_PATHID, changes = 0;
4002
4003 lower_string(value_ptr);
4004 if (!strncmp(value_ptr, "path_id", strlen("path_id"))) value = BGP_ASPATH_HASH_PATHID;
4005 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'bgp_table_per_peer_hash' value.\n", filename);
4006
4007 for (; list; list = list->next, changes++) list->cfg.bgp_table_per_peer_hash = value;
4008 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_per_peer_hash'. Globalized.\n", filename);
4009
4010 return changes;
4011 }
4012
cfg_key_bgp_daemon_batch_interval(char * filename,char * name,char * value_ptr)4013 int cfg_key_bgp_daemon_batch_interval(char *filename, char *name, char *value_ptr)
4014 {
4015 struct plugins_list_entry *list = plugins_list;
4016 int value, changes = 0;
4017
4018 value = atoi(value_ptr);
4019 if (value < 0) {
4020 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_batch_interval' has to be >= 0.\n", filename);
4021 return ERR;
4022 }
4023
4024 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_batch_interval = value;
4025 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_batch_interval'. Globalized.\n", filename);
4026
4027 return changes;
4028 }
4029
cfg_key_bgp_daemon_batch(char * filename,char * name,char * value_ptr)4030 int cfg_key_bgp_daemon_batch(char *filename, char *name, char *value_ptr)
4031 {
4032 struct plugins_list_entry *list = plugins_list;
4033 int value, changes = 0;
4034
4035 value = atoi(value_ptr);
4036 if (value < 0) {
4037 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_batch' has to be >= 0.\n", filename);
4038 return ERR;
4039 }
4040
4041 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_batch = value;
4042 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_batch'. Globalized.\n", filename);
4043
4044 return changes;
4045 }
4046
cfg_key_bmp_daemon(char * filename,char * name,char * value_ptr)4047 int cfg_key_bmp_daemon(char *filename, char *name, char *value_ptr)
4048 {
4049 struct plugins_list_entry *list = plugins_list;
4050 int value, changes = 0;
4051
4052 value = parse_truefalse(value_ptr);
4053 if (value < 0) return ERR;
4054
4055 for (; list; list = list->next, changes++) list->cfg.bmp_daemon = value;
4056 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon'. Globalized.\n", filename);
4057
4058 return changes;
4059 }
4060
cfg_key_bmp_daemon_ip(char * filename,char * name,char * value_ptr)4061 int cfg_key_bmp_daemon_ip(char *filename, char *name, char *value_ptr)
4062 {
4063 struct plugins_list_entry *list = plugins_list;
4064 int changes = 0;
4065
4066 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_ip = value_ptr;
4067 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_ip'. Globalized.\n", filename);
4068
4069 return changes;
4070 }
4071
cfg_key_bmp_daemon_port(char * filename,char * name,char * value_ptr)4072 int cfg_key_bmp_daemon_port(char *filename, char *name, char *value_ptr)
4073 {
4074 struct plugins_list_entry *list = plugins_list;
4075 int value, changes = 0;
4076
4077 value = atoi(value_ptr);
4078 if ((value <= 0) || (value > 65535)) {
4079 Log(LOG_ERR, "WARN: [%s] 'bmp_daemon_port' has to be in the range 1-65535.\n", filename);
4080 return ERR;
4081 }
4082
4083 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_port = value;
4084 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_port'. Globalized.\n", filename);
4085
4086 return changes;
4087 }
4088
cfg_key_bmp_daemon_pipe_size(char * filename,char * name,char * value_ptr)4089 int cfg_key_bmp_daemon_pipe_size(char *filename, char *name, char *value_ptr)
4090 {
4091 struct plugins_list_entry *list = plugins_list;
4092 u_int64_t value, changes = 0;
4093 char *endptr;
4094
4095 value = strtoull(value_ptr, &endptr, 10);
4096 if (!value || value > INT_MAX) {
4097 Log(LOG_WARNING, "WARN: [%s] 'bmp_daemon_pipe_size' has to be > 0 and <= INT_MAX.\n", filename);
4098 return ERR;
4099 }
4100
4101 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_pipe_size = value;
4102 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_pipe_size'. Globalized.\n", filename);
4103
4104 return changes;
4105 }
4106
cfg_key_bmp_daemon_max_peers(char * filename,char * name,char * value_ptr)4107 int cfg_key_bmp_daemon_max_peers(char *filename, char *name, char *value_ptr)
4108 {
4109 struct plugins_list_entry *list = plugins_list;
4110 int value, changes = 0;
4111
4112 value = atoi(value_ptr);
4113 if (value < 1) {
4114 Log(LOG_ERR, "WARN: [%s] 'bmp_daemon_max_peers' has to be >= 1.\n", filename);
4115 return ERR;
4116 }
4117
4118 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_max_peers = value;
4119 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_max_peers'. Globalized.\n", filename);
4120
4121 return changes;
4122 }
4123
cfg_key_bmp_daemon_allow_file(char * filename,char * name,char * value_ptr)4124 int cfg_key_bmp_daemon_allow_file(char *filename, char *name, char *value_ptr)
4125 {
4126 struct plugins_list_entry *list = plugins_list;
4127 int changes = 0;
4128
4129 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_allow_file = value_ptr;
4130 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_allow_file'. Globalized.\n", filename);
4131
4132 return changes;
4133 }
4134
cfg_key_bmp_daemon_ip_precedence(char * filename,char * name,char * value_ptr)4135 int cfg_key_bmp_daemon_ip_precedence(char *filename, char *name, char *value_ptr)
4136 {
4137 struct plugins_list_entry *list = plugins_list;
4138 int value, changes = 0;
4139
4140 value = atoi(value_ptr);
4141 if ((value < 0) || (value > 7)) {
4142 Log(LOG_ERR, "WARN: [%s] 'bmp_daemon_ipprec' has to be in the range 0-7.\n", filename);
4143 return ERR;
4144 }
4145
4146 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_ipprec = value;
4147 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_ipprec'. Globalized.\n", filename);
4148
4149 return changes;
4150 }
4151
cfg_key_bmp_daemon_batch_interval(char * filename,char * name,char * value_ptr)4152 int cfg_key_bmp_daemon_batch_interval(char *filename, char *name, char *value_ptr)
4153 {
4154 struct plugins_list_entry *list = plugins_list;
4155 int value, changes = 0;
4156
4157 value = atoi(value_ptr);
4158 if (value < 0) {
4159 Log(LOG_ERR, "WARN: [%s] 'bmp_daemon_batch_interval' has to be >= 0.\n", filename);
4160 return ERR;
4161 }
4162
4163 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_batch_interval = value;
4164 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_batch_interval'. Globalized.\n", filename);
4165
4166 return changes;
4167 }
4168
cfg_key_bmp_daemon_batch(char * filename,char * name,char * value_ptr)4169 int cfg_key_bmp_daemon_batch(char *filename, char *name, char *value_ptr)
4170 {
4171 struct plugins_list_entry *list = plugins_list;
4172 int value, changes = 0;
4173
4174 value = atoi(value_ptr);
4175 if (value < 0) {
4176 Log(LOG_ERR, "WARN: [%s] 'bmp_daemon_batch' has to be >= 0.\n", filename);
4177 return ERR;
4178 }
4179
4180 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_batch = value;
4181 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_batch'. Globalized.\n", filename);
4182
4183 return changes;
4184 }
4185
cfg_key_bmp_daemon_table_peer_buckets(char * filename,char * name,char * value_ptr)4186 int cfg_key_bmp_daemon_table_peer_buckets(char *filename, char *name, char *value_ptr)
4187 {
4188 struct plugins_list_entry *list = plugins_list;
4189 int value, changes = 0;
4190
4191 value = atoi(value_ptr);
4192 if ((value <= 0) || (value > 1000)) {
4193 Log(LOG_ERR, "WARN: [%s] 'bmp_table_peer_buckets' has to be in the range 1-1000.\n", filename);
4194 return ERR;
4195 }
4196
4197 for (; list; list = list->next, changes++) list->cfg.bmp_table_peer_buckets = value;
4198 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_table_peer_buckets'. Globalized.\n", filename);
4199
4200 return changes;
4201 }
4202
cfg_key_bmp_daemon_table_per_peer_buckets(char * filename,char * name,char * value_ptr)4203 int cfg_key_bmp_daemon_table_per_peer_buckets(char *filename, char *name, char *value_ptr)
4204 {
4205 struct plugins_list_entry *list = plugins_list;
4206 int value, changes = 0;
4207
4208 value = atoi(value_ptr);
4209 if ((value <= 0) || (value > 128)) {
4210 Log(LOG_ERR, "WARN: [%s] 'bmp_table_per_peer_buckets' has to be in the range 1-128.\n", filename);
4211 return ERR;
4212 }
4213
4214 for (; list; list = list->next, changes++) list->cfg.bmp_table_per_peer_buckets = value;
4215 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_table_per_peer_buckets'. Globalized.\n", filename);
4216
4217 return changes;
4218 }
4219
cfg_key_bmp_daemon_table_attr_hash_buckets(char * filename,char * name,char * value_ptr)4220 int cfg_key_bmp_daemon_table_attr_hash_buckets(char *filename, char *name, char *value_ptr)
4221 {
4222 struct plugins_list_entry *list = plugins_list;
4223 int value, changes = 0;
4224
4225 value = atoi(value_ptr);
4226 if ((value <= 0) || (value > 1000000)) {
4227 Log(LOG_ERR, "WARN: [%s] 'bmp_table_attr_hash_buckets' has to be in the range 1-1000000.\n", filename);
4228 return ERR;
4229 }
4230
4231 for (; list; list = list->next, changes++) list->cfg.bmp_table_attr_hash_buckets = value;
4232 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_table_attr_hash_buckets'. Globalized.\n", filename);
4233
4234 return changes;
4235 }
4236
cfg_key_bmp_daemon_table_per_peer_hash(char * filename,char * name,char * value_ptr)4237 int cfg_key_bmp_daemon_table_per_peer_hash(char *filename, char *name, char *value_ptr)
4238 {
4239 struct plugins_list_entry *list = plugins_list;
4240 int value = BGP_ASPATH_HASH_PATHID, changes = 0;
4241
4242 lower_string(value_ptr);
4243 if (!strncmp(value_ptr, "path_id", strlen("path_id"))) value = BGP_ASPATH_HASH_PATHID;
4244 else Log(LOG_WARNING, "WARN: [%s] Ignoring unknown 'bmp_table_per_peer_hash' value.\n", filename);
4245
4246 for (; list; list = list->next, changes++) list->cfg.bmp_table_per_peer_hash = value;
4247 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_table_per_peer_hash'. Globalized.\n", filename);
4248
4249 return changes;
4250 }
4251
cfg_key_bmp_daemon_msglog_file(char * filename,char * name,char * value_ptr)4252 int cfg_key_bmp_daemon_msglog_file(char *filename, char *name, char *value_ptr)
4253 {
4254 struct plugins_list_entry *list = plugins_list;
4255 int changes = 0;
4256
4257 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_file = value_ptr;
4258 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_file'. Globalized.\n", filename);
4259
4260 return changes;
4261 }
4262
cfg_key_bmp_daemon_msglog_avro_schema_file(char * filename,char * name,char * value_ptr)4263 int cfg_key_bmp_daemon_msglog_avro_schema_file(char *filename, char *name, char *value_ptr)
4264 {
4265 struct plugins_list_entry *list = plugins_list;
4266 int changes = 0;
4267
4268 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_avro_schema_file = value_ptr;
4269 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_avro_schema_file'. Globalized.\n", filename);
4270
4271 return changes;
4272 }
4273
cfg_key_bmp_daemon_msglog_output(char * filename,char * name,char * value_ptr)4274 int cfg_key_bmp_daemon_msglog_output(char *filename, char *name, char *value_ptr)
4275 {
4276 struct plugins_list_entry *list = plugins_list;
4277 int value, changes = 0;
4278
4279 lower_string(value_ptr);
4280 if (!strcmp(value_ptr, "json")) {
4281 #ifdef WITH_JANSSON
4282 value = PRINT_OUTPUT_JSON;
4283 #else
4284 value = PRINT_OUTPUT_JSON;
4285 Log(LOG_WARNING, "WARN: [%s] bmp_daemon_msglog_output set to json but will produce no output (missing --enable-jansson).\n", filename);
4286 #endif
4287 }
4288 else if (!strcmp(value_ptr, "avro") || !strcmp(value_ptr, "avro_bin")) {
4289 #ifdef WITH_AVRO
4290 value = PRINT_OUTPUT_AVRO_BIN;
4291 #else
4292 value = PRINT_OUTPUT_AVRO_BIN;
4293 Log(LOG_WARNING, "WARN: [%s] 'bmp_daemon_msglog_output' set to avro but will produce no output (missing --enable-avro).\n", filename);
4294 #endif
4295 }
4296 else if (!strcmp(value_ptr, "avro_json")) {
4297 #ifdef WITH_AVRO
4298 value = PRINT_OUTPUT_AVRO_JSON;
4299 #else
4300 value = PRINT_OUTPUT_AVRO_JSON;
4301 Log(LOG_WARNING, "WARN: [%s] 'bmp_daemon_msglog_output' set to avro but will produce no output (missing --enable-avro).\n", filename);
4302 #endif
4303 }
4304 else {
4305 Log(LOG_WARNING, "WARN: [%s] Invalid bmp_daemon_msglog_output value '%s'\n", filename, value_ptr);
4306 return ERR;
4307 }
4308
4309 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_output = value;
4310 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_output'. Globalized.\n", filename);
4311
4312 return changes;
4313 }
4314
cfg_key_bmp_daemon_msglog_amqp_host(char * filename,char * name,char * value_ptr)4315 int cfg_key_bmp_daemon_msglog_amqp_host(char *filename, char *name, char *value_ptr)
4316 {
4317 struct plugins_list_entry *list = plugins_list;
4318 int changes = 0;
4319
4320 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_host = value_ptr;
4321 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_host'. Globalized.\n", filename);
4322
4323 return changes;
4324 }
4325
cfg_key_bmp_daemon_msglog_amqp_vhost(char * filename,char * name,char * value_ptr)4326 int cfg_key_bmp_daemon_msglog_amqp_vhost(char *filename, char *name, char *value_ptr)
4327 {
4328 struct plugins_list_entry *list = plugins_list;
4329 int changes = 0;
4330
4331 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_vhost = value_ptr;
4332 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_vhost'. Globalized.\n", filename);
4333
4334 return changes;
4335 }
4336
cfg_key_bmp_daemon_msglog_amqp_user(char * filename,char * name,char * value_ptr)4337 int cfg_key_bmp_daemon_msglog_amqp_user(char *filename, char *name, char *value_ptr)
4338 {
4339 struct plugins_list_entry *list = plugins_list;
4340 int changes = 0;
4341
4342 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_user = value_ptr;
4343 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_user'. Globalized.\n", filename);
4344
4345 return changes;
4346 }
4347
cfg_key_bmp_daemon_msglog_amqp_passwd(char * filename,char * name,char * value_ptr)4348 int cfg_key_bmp_daemon_msglog_amqp_passwd(char *filename, char *name, char *value_ptr)
4349 {
4350 struct plugins_list_entry *list = plugins_list;
4351 int changes = 0;
4352
4353 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_passwd = value_ptr;
4354 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_passwd'. Globalized.\n", filename);
4355
4356 return changes;
4357 }
4358
cfg_key_bmp_daemon_msglog_amqp_exchange(char * filename,char * name,char * value_ptr)4359 int cfg_key_bmp_daemon_msglog_amqp_exchange(char *filename, char *name, char *value_ptr)
4360 {
4361 struct plugins_list_entry *list = plugins_list;
4362 int changes = 0;
4363
4364 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_exchange = value_ptr;
4365 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_exchange'. Globalized.\n", filename);
4366
4367 return changes;
4368 }
4369
cfg_key_bmp_daemon_msglog_amqp_exchange_type(char * filename,char * name,char * value_ptr)4370 int cfg_key_bmp_daemon_msglog_amqp_exchange_type(char *filename, char *name, char *value_ptr)
4371 {
4372 struct plugins_list_entry *list = plugins_list;
4373 int changes = 0;
4374
4375 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_exchange_type = value_ptr;
4376 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_exchange_type'. Globalized.\n", filename);
4377
4378 return changes;
4379 }
4380
cfg_key_bmp_daemon_msglog_amqp_routing_key(char * filename,char * name,char * value_ptr)4381 int cfg_key_bmp_daemon_msglog_amqp_routing_key(char *filename, char *name, char *value_ptr)
4382 {
4383 struct plugins_list_entry *list = plugins_list;
4384 int changes = 0;
4385
4386 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_routing_key = value_ptr;
4387 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_routing_key'. Globalized.\n", filename);
4388
4389 return changes;
4390 }
4391
cfg_key_bmp_daemon_msglog_amqp_routing_key_rr(char * filename,char * name,char * value_ptr)4392 int cfg_key_bmp_daemon_msglog_amqp_routing_key_rr(char *filename, char *name, char *value_ptr)
4393 {
4394 struct plugins_list_entry *list = plugins_list;
4395 int changes = 0, value = 0;
4396
4397 value = atoi(value_ptr);
4398 if (value < 0) {
4399 Log(LOG_WARNING, "WARN: [%s] 'bmp_daemon_msglog_amqp_routing_key_rr' has to be >= 0.\n", filename);
4400 return ERR;
4401 }
4402
4403 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_routing_key_rr = value;
4404 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_routing_key_rr'. Globalized.\n", filename);
4405
4406 return changes;
4407 }
4408
cfg_key_bmp_daemon_msglog_amqp_persistent_msg(char * filename,char * name,char * value_ptr)4409 int cfg_key_bmp_daemon_msglog_amqp_persistent_msg(char *filename, char *name, char *value_ptr)
4410 {
4411 struct plugins_list_entry *list = plugins_list;
4412 int value, changes = 0;
4413
4414 value = parse_truefalse(value_ptr);
4415 if (value < 0) return ERR;
4416
4417 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_persistent_msg = value;
4418 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_persistent_msg'. Globalized.\n", filename);
4419
4420 return changes;
4421 }
4422
cfg_key_bmp_daemon_msglog_amqp_frame_max(char * filename,char * name,char * value_ptr)4423 int cfg_key_bmp_daemon_msglog_amqp_frame_max(char *filename, char *name, char *value_ptr)
4424 {
4425 struct plugins_list_entry *list = plugins_list;
4426 u_int32_t value, changes = 0;
4427 char *endptr;
4428
4429 value = strtoul(value_ptr, &endptr, 10);
4430 if (value <= 0) {
4431 Log(LOG_WARNING, "WARN: [%s] 'bmp_daemon_msglog_amqp_frame_max' has to be > 0.\n", filename);
4432 return ERR;
4433 }
4434
4435 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_frame_max = value;
4436 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_frame_max'. Globalized.\n", filename);
4437
4438 return changes;
4439 }
4440
cfg_key_bmp_daemon_msglog_amqp_heartbeat_interval(char * filename,char * name,char * value_ptr)4441 int cfg_key_bmp_daemon_msglog_amqp_heartbeat_interval(char *filename, char *name, char *value_ptr)
4442 {
4443 struct plugins_list_entry *list = plugins_list;
4444 u_int32_t value, changes = 0;
4445 char *endptr;
4446
4447 value = strtoul(value_ptr, &endptr, 10);
4448
4449 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_heartbeat_interval = value;
4450 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_heartbeat_interval'. Globalized.\n", filename);
4451
4452 return changes;
4453 }
4454
cfg_key_bmp_daemon_msglog_amqp_retry(char * filename,char * name,char * value_ptr)4455 int cfg_key_bmp_daemon_msglog_amqp_retry(char *filename, char *name, char *value_ptr)
4456 {
4457 struct plugins_list_entry *list = plugins_list;
4458 int value, changes = 0;
4459
4460 value = atoi(value_ptr);
4461 if (value <= 0) {
4462 Log(LOG_ERR, "WARN: [%s] 'bmp_daemon_msglog_amqp_retry' has to be > 0.\n", filename);
4463 return ERR;
4464 }
4465
4466 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_amqp_retry = value;
4467 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_amqp_retry'. Globalized.\n", filename);
4468
4469 return changes;
4470 }
4471
cfg_key_bmp_daemon_dump_file(char * filename,char * name,char * value_ptr)4472 int cfg_key_bmp_daemon_dump_file(char *filename, char *name, char *value_ptr)
4473 {
4474 struct plugins_list_entry *list = plugins_list;
4475 int changes = 0;
4476
4477 for (; list; list = list->next, changes++) list->cfg.bmp_dump_file = value_ptr;
4478 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_file'. Globalized.\n", filename);
4479
4480 return changes;
4481 }
4482
cfg_key_bmp_daemon_dump_latest_file(char * filename,char * name,char * value_ptr)4483 int cfg_key_bmp_daemon_dump_latest_file(char *filename, char *name, char *value_ptr)
4484 {
4485 struct plugins_list_entry *list = plugins_list;
4486 int changes = 0;
4487
4488 for (; list; list = list->next, changes++) list->cfg.bmp_dump_latest_file = value_ptr;
4489 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_latest_file'. Globalized.\n", filename);
4490
4491 return changes;
4492 }
4493
cfg_key_bmp_daemon_dump_avro_schema_file(char * filename,char * name,char * value_ptr)4494 int cfg_key_bmp_daemon_dump_avro_schema_file(char *filename, char *name, char *value_ptr)
4495 {
4496 struct plugins_list_entry *list = plugins_list;
4497 int changes = 0;
4498
4499 for (; list; list = list->next, changes++) list->cfg.bmp_dump_avro_schema_file = value_ptr;
4500 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_avro_schema_file'. Globalized.\n", filename);
4501
4502 return changes;
4503 }
4504
cfg_key_bmp_daemon_dump_output(char * filename,char * name,char * value_ptr)4505 int cfg_key_bmp_daemon_dump_output(char *filename, char *name, char *value_ptr)
4506 {
4507 struct plugins_list_entry *list = plugins_list;
4508 int value, changes = 0;
4509
4510 lower_string(value_ptr);
4511 if (!strcmp(value_ptr, "json")) {
4512 #ifdef WITH_JANSSON
4513 value = PRINT_OUTPUT_JSON;
4514 #else
4515 value = PRINT_OUTPUT_JSON;
4516 Log(LOG_WARNING, "WARN: [%s] bmp_dump_output set to json but will produce no output (missing --enable-jansson).\n", filename);
4517 #endif
4518 }
4519 else if (!strcmp(value_ptr, "avro") || !strcmp(value_ptr, "avro_bin")) {
4520 #ifdef WITH_AVRO
4521 value = PRINT_OUTPUT_AVRO_BIN;
4522 #else
4523 value = PRINT_OUTPUT_AVRO_BIN;
4524 Log(LOG_WARNING, "WARN: [%s] bmp_dump_output set to avro but will produce no output (missing --enable-avro).\n", filename);
4525 #endif
4526 }
4527 else if (!strcmp(value_ptr, "avro_json")) {
4528 #ifdef WITH_AVRO
4529 value = PRINT_OUTPUT_AVRO_JSON;
4530 #else
4531 value = PRINT_OUTPUT_AVRO_JSON;
4532 Log(LOG_WARNING, "WARN: [%s] bmp_dump_output set to avro but will produce no output (missing --enable-avro).\n", filename);
4533 #endif
4534 }
4535 else {
4536 Log(LOG_WARNING, "WARN: [%s] Invalid bmp_dump_output value '%s'\n", filename, value_ptr);
4537 return ERR;
4538 }
4539
4540 for (; list; list = list->next, changes++) list->cfg.bmp_dump_output = value;
4541 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_output'. Globalized.\n", filename);
4542
4543 return changes;
4544 }
4545
cfg_key_bmp_daemon_dump_refresh_time(char * filename,char * name,char * value_ptr)4546 int cfg_key_bmp_daemon_dump_refresh_time(char *filename, char *name, char *value_ptr)
4547 {
4548 struct plugins_list_entry *list = plugins_list;
4549 int value, changes = 0, i, len = strlen(value_ptr);
4550
4551 for (i = 0; i < len; i++) {
4552 if (!isdigit(value_ptr[i]) && !isspace(value_ptr[i])) {
4553 Log(LOG_ERR, "WARN: [%s] 'bmp_dump_refresh_time' is expected in secs but contains non-digit chars: '%c'\n", filename, value_ptr[i]);
4554 return ERR;
4555 }
4556 }
4557
4558 value = atoi(value_ptr);
4559 if (value < 60 || value > 86400) {
4560 Log(LOG_ERR, "WARN: [%s] 'bmp_dump_refresh_time' value has to be >= 60 and <= 86400 secs.\n", filename);
4561 return ERR;
4562 }
4563
4564 for (; list; list = list->next, changes++) list->cfg.bmp_dump_refresh_time = value;
4565 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_refresh_time'. Globalized.\n", filename);
4566
4567 return changes;
4568 }
4569
cfg_key_bmp_daemon_dump_amqp_host(char * filename,char * name,char * value_ptr)4570 int cfg_key_bmp_daemon_dump_amqp_host(char *filename, char *name, char *value_ptr)
4571 {
4572 struct plugins_list_entry *list = plugins_list;
4573 int changes = 0;
4574
4575 for (; list; list = list->next, changes++) list->cfg.bmp_dump_amqp_host = value_ptr;
4576 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_amqp_host'. Globalized.\n", filename);
4577
4578 return changes;
4579 }
4580
cfg_key_bmp_daemon_dump_amqp_vhost(char * filename,char * name,char * value_ptr)4581 int cfg_key_bmp_daemon_dump_amqp_vhost(char *filename, char *name, char *value_ptr)
4582 {
4583 struct plugins_list_entry *list = plugins_list;
4584 int changes = 0;
4585
4586 for (; list; list = list->next, changes++) list->cfg.bmp_dump_amqp_vhost = value_ptr;
4587 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_amqp_vhost'. Globalized.\n", filename);
4588
4589 return changes;
4590 }
4591
cfg_key_bmp_daemon_dump_amqp_user(char * filename,char * name,char * value_ptr)4592 int cfg_key_bmp_daemon_dump_amqp_user(char *filename, char *name, char *value_ptr)
4593 {
4594 struct plugins_list_entry *list = plugins_list;
4595 int changes = 0;
4596
4597 for (; list; list = list->next, changes++) list->cfg.bmp_dump_amqp_user = value_ptr;
4598 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_amqp_user'. Globalized.\n", filename);
4599
4600 return changes;
4601 }
4602
cfg_key_bmp_daemon_dump_amqp_passwd(char * filename,char * name,char * value_ptr)4603 int cfg_key_bmp_daemon_dump_amqp_passwd(char *filename, char *name, char *value_ptr)
4604 {
4605 struct plugins_list_entry *list = plugins_list;
4606 int changes = 0;
4607
4608 for (; list; list = list->next, changes++) list->cfg.bmp_dump_amqp_passwd = value_ptr;
4609 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_amqp_passwd'. Globalized.\n", filename);
4610
4611 return changes;
4612 }
4613
cfg_key_bmp_daemon_dump_amqp_exchange(char * filename,char * name,char * value_ptr)4614 int cfg_key_bmp_daemon_dump_amqp_exchange(char *filename, char *name, char *value_ptr)
4615 {
4616 struct plugins_list_entry *list = plugins_list;
4617 int changes = 0;
4618
4619 for (; list; list = list->next, changes++) list->cfg.bmp_dump_amqp_exchange = value_ptr;
4620 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_amqp_exchange'. Globalized.\n", filename);
4621
4622 return changes;
4623 }
4624
cfg_key_bmp_daemon_dump_amqp_exchange_type(char * filename,char * name,char * value_ptr)4625 int cfg_key_bmp_daemon_dump_amqp_exchange_type(char *filename, char *name, char *value_ptr)
4626 {
4627 struct plugins_list_entry *list = plugins_list;
4628 int changes = 0;
4629
4630 for (; list; list = list->next, changes++) list->cfg.bmp_dump_amqp_exchange_type = value_ptr;
4631 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_amqp_exchange_type'. Globalized.\n", filename);
4632
4633 return changes;
4634 }
4635
cfg_key_bmp_daemon_dump_amqp_routing_key(char * filename,char * name,char * value_ptr)4636 int cfg_key_bmp_daemon_dump_amqp_routing_key(char *filename, char *name, char *value_ptr)
4637 {
4638 struct plugins_list_entry *list = plugins_list;
4639 int changes = 0;
4640
4641 for (; list; list = list->next, changes++) list->cfg.bmp_dump_amqp_routing_key = value_ptr;
4642 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_amqp_routing_key'. Globalized.\n", filename);
4643
4644 return changes;
4645 }
4646
cfg_key_bmp_daemon_dump_amqp_routing_key_rr(char * filename,char * name,char * value_ptr)4647 int cfg_key_bmp_daemon_dump_amqp_routing_key_rr(char *filename, char *name, char *value_ptr)
4648 {
4649 struct plugins_list_entry *list = plugins_list;
4650 int changes = 0, value = 0;
4651
4652 value = atoi(value_ptr);
4653 if (value < 0) {
4654 Log(LOG_WARNING, "WARN: [%s] 'bmp_dump_amqp_routing_key_rr' has to be >= 0.\n", filename);
4655 return ERR;
4656 }
4657
4658 for (; list; list = list->next, changes++) list->cfg.bmp_dump_amqp_routing_key_rr = value;
4659 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_amqp_routing_key_rr'. Globalized.\n", filename);
4660
4661 return changes;
4662 }
4663
cfg_key_bmp_daemon_dump_amqp_persistent_msg(char * filename,char * name,char * value_ptr)4664 int cfg_key_bmp_daemon_dump_amqp_persistent_msg(char *filename, char *name, char *value_ptr)
4665 {
4666 struct plugins_list_entry *list = plugins_list;
4667 int value, changes = 0;
4668
4669 value = parse_truefalse(value_ptr);
4670 if (value < 0) return ERR;
4671
4672 for (; list; list = list->next, changes++) list->cfg.bmp_dump_amqp_persistent_msg = value;
4673 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_amqp_persistent_msg'. Globalized.\n", filename);
4674
4675 return changes;
4676 }
4677
cfg_key_bmp_daemon_dump_amqp_frame_max(char * filename,char * name,char * value_ptr)4678 int cfg_key_bmp_daemon_dump_amqp_frame_max(char *filename, char *name, char *value_ptr)
4679 {
4680 struct plugins_list_entry *list = plugins_list;
4681 u_int32_t value, changes = 0;
4682 char *endptr;
4683
4684 value = strtoul(value_ptr, &endptr, 10);
4685 if (value <= 0) {
4686 Log(LOG_WARNING, "WARN: [%s] 'bmp_dump_amqp_frame_max' has to be > 0.\n", filename);
4687 return ERR;
4688 }
4689
4690 for (; list; list = list->next, changes++) list->cfg.bmp_dump_amqp_frame_max = value;
4691 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_amqp_frame_max'. Globalized.\n", filename);
4692
4693 return changes;
4694 }
4695
cfg_key_bmp_daemon_dump_amqp_heartbeat_interval(char * filename,char * name,char * value_ptr)4696 int cfg_key_bmp_daemon_dump_amqp_heartbeat_interval(char *filename, char *name, char *value_ptr)
4697 {
4698 struct plugins_list_entry *list = plugins_list;
4699 u_int32_t value, changes = 0;
4700 char *endptr;
4701
4702 value = strtoul(value_ptr, &endptr, 10);
4703
4704 for (; list; list = list->next, changes++) list->cfg.bmp_dump_amqp_heartbeat_interval = value;
4705 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_amqp_heartbeat_interval'. Globalized.\n", filename);
4706
4707 return changes;
4708 }
4709
cfg_key_nfacctd_isis(char * filename,char * name,char * value_ptr)4710 int cfg_key_nfacctd_isis(char *filename, char *name, char *value_ptr)
4711 {
4712 struct plugins_list_entry *list = plugins_list;
4713 int value, changes = 0;
4714
4715 value = parse_truefalse(value_ptr);
4716 if (value < 0) return ERR;
4717
4718 for (; list; list = list->next, changes++) list->cfg.nfacctd_isis = value;
4719 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'isis_daemon'. Globalized.\n", filename);
4720
4721 return changes;
4722 }
4723
cfg_key_nfacctd_isis_ip(char * filename,char * name,char * value_ptr)4724 int cfg_key_nfacctd_isis_ip(char *filename, char *name, char *value_ptr)
4725 {
4726 struct plugins_list_entry *list = plugins_list;
4727 int changes = 0;
4728
4729 for (; list; list = list->next, changes++) list->cfg.nfacctd_isis_ip = value_ptr;
4730 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'isis_daemon_ip'. Globalized.\n", filename);
4731
4732 return changes;
4733 }
4734
cfg_key_nfacctd_isis_net(char * filename,char * name,char * value_ptr)4735 int cfg_key_nfacctd_isis_net(char *filename, char *name, char *value_ptr)
4736 {
4737 struct plugins_list_entry *list = plugins_list;
4738 int changes = 0;
4739
4740 for (; list; list = list->next, changes++) list->cfg.nfacctd_isis_net = value_ptr;
4741 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'isis_daemon_net'. Globalized.\n", filename);
4742
4743 return changes;
4744 }
4745
cfg_key_nfacctd_isis_iface(char * filename,char * name,char * value_ptr)4746 int cfg_key_nfacctd_isis_iface(char *filename, char *name, char *value_ptr)
4747 {
4748 struct plugins_list_entry *list = plugins_list;
4749 int changes = 0;
4750
4751 for (; list; list = list->next, changes++) list->cfg.nfacctd_isis_iface = value_ptr;
4752 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'isis_daemon_iface'. Globalized.\n", filename);
4753
4754 return changes;
4755 }
4756
cfg_key_nfacctd_isis_mtu(char * filename,char * name,char * value_ptr)4757 int cfg_key_nfacctd_isis_mtu(char *filename, char *name, char *value_ptr)
4758 {
4759 struct plugins_list_entry *list = plugins_list;
4760 int value, changes = 0;
4761
4762 value = atoi(value_ptr);
4763 if (value < SNAPLEN_ISIS_MIN) {
4764 Log(LOG_WARNING, "WARN: [%s] 'isis_daemon_mtu' has to be >= %d.\n", filename, SNAPLEN_ISIS_MIN);
4765 return ERR;
4766 }
4767
4768 for (; list; list = list->next, changes++) list->cfg.nfacctd_isis_mtu = value;
4769 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'isis_daemon_mtu'. Globalized.\n", filename);
4770
4771 return changes;
4772 }
4773
cfg_key_nfacctd_isis_msglog(char * filename,char * name,char * value_ptr)4774 int cfg_key_nfacctd_isis_msglog(char *filename, char *name, char *value_ptr)
4775 {
4776 struct plugins_list_entry *list = plugins_list;
4777 int value, changes = 0;
4778
4779 value = parse_truefalse(value_ptr);
4780 if (value < 0) return ERR;
4781
4782 for (; list; list = list->next, changes++) list->cfg.nfacctd_isis_msglog = value;
4783 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'isis_daemon_msglog'. Globalized.\n", filename);
4784
4785 return changes;
4786 }
4787
cfg_key_igp_daemon_map(char * filename,char * name,char * value_ptr)4788 int cfg_key_igp_daemon_map(char *filename, char *name, char *value_ptr)
4789 {
4790 struct plugins_list_entry *list = plugins_list;
4791 int changes = 0;
4792
4793 for (; list; list = list->next, changes++) list->cfg.igp_daemon_map = value_ptr;
4794 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'igp_daemon_map'. Globalized.\n", filename);
4795
4796 return changes;
4797 }
4798
cfg_key_igp_daemon_map_msglog(char * filename,char * name,char * value_ptr)4799 int cfg_key_igp_daemon_map_msglog(char *filename, char *name, char *value_ptr)
4800 {
4801 struct plugins_list_entry *list = plugins_list;
4802 int changes = 0;
4803
4804 for (; list; list = list->next, changes++) list->cfg.igp_daemon_map_msglog = value_ptr;
4805 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'igp_daemon_map_msglog'. Globalized.\n", filename);
4806
4807 return changes;
4808 }
4809
cfg_key_pmacctd_force_frag_handling(char * filename,char * name,char * value_ptr)4810 int cfg_key_pmacctd_force_frag_handling(char *filename, char *name, char *value_ptr)
4811 {
4812 struct plugins_list_entry *list = plugins_list;
4813 int value, changes = 0;
4814
4815 value = parse_truefalse(value_ptr);
4816 if (value < 0) return ERR;
4817
4818 for (; list; list = list->next, changes++) list->cfg.handle_fragments = value;
4819 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pmacctd_force_frag_handling'. Globalized.\n", filename);
4820
4821 return changes;
4822 }
4823
cfg_key_pmacctd_frag_buffer_size(char * filename,char * name,char * value_ptr)4824 int cfg_key_pmacctd_frag_buffer_size(char *filename, char *name, char *value_ptr)
4825 {
4826 struct plugins_list_entry *list = plugins_list;
4827 int value, changes = 0;
4828
4829 value = atoi(value_ptr);
4830 if (value <= 0) {
4831 Log(LOG_ERR, "WARN: [%s] 'pmacctd_frag_buffer_size' has to be > 0.\n", filename);
4832 return ERR;
4833 }
4834
4835 for (; list; list = list->next, changes++) list->cfg.frag_bufsz = value;
4836 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pmacctd_frag_buffer_size'. Globalized.\n", filename);
4837
4838 return changes;
4839 }
4840
cfg_key_pmacctd_flow_buffer_size(char * filename,char * name,char * value_ptr)4841 int cfg_key_pmacctd_flow_buffer_size(char *filename, char *name, char *value_ptr)
4842 {
4843 struct plugins_list_entry *list = plugins_list;
4844 int value, changes = 0;
4845
4846 value = atoi(value_ptr);
4847 if (value <= 0) {
4848 Log(LOG_ERR, "WARN: [%s] 'pmacctd_flow_buffer_size' has to be > 0.\n", filename);
4849 return ERR;
4850 }
4851
4852 for (; list; list = list->next, changes++) list->cfg.flow_bufsz = value;
4853 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pmacctd_flow_buffer_size'. Globalized.\n", filename);
4854
4855 return changes;
4856 }
4857
cfg_key_pmacctd_flow_buffer_buckets(char * filename,char * name,char * value_ptr)4858 int cfg_key_pmacctd_flow_buffer_buckets(char *filename, char *name, char *value_ptr)
4859 {
4860 struct plugins_list_entry *list = plugins_list;
4861 int value, changes = 0;
4862
4863 value = atoi(value_ptr);
4864 if (value <= 0) {
4865 Log(LOG_WARNING, "WARN: [%s] 'flow_buffer_buckets' has to be > 0.\n", filename);
4866 return ERR;
4867 }
4868
4869 for (; list; list = list->next, changes++) list->cfg.flow_hashsz = value;
4870 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pmacctd_flow_buffer_buckets'. Globalized.\n", filename);
4871
4872 return changes;
4873 }
4874
cfg_key_pmacctd_conntrack_buffer_size(char * filename,char * name,char * value_ptr)4875 int cfg_key_pmacctd_conntrack_buffer_size(char *filename, char *name, char *value_ptr)
4876 {
4877 struct plugins_list_entry *list = plugins_list;
4878 int value, changes = 0;
4879
4880 value = atoi(value_ptr);
4881 if (value <= 0) {
4882 Log(LOG_ERR, "WARN: [%s] 'pmacctd_conntrack_buffer_size' has to be > 0.\n", filename);
4883 return ERR;
4884 }
4885
4886 for (; list; list = list->next, changes++) list->cfg.conntrack_bufsz = value;
4887 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pmacctd_conntrack_buffer_size'. Globalized.\n", filename);
4888
4889 return changes;
4890 }
4891
cfg_key_pmacctd_flow_lifetime(char * filename,char * name,char * value_ptr)4892 int cfg_key_pmacctd_flow_lifetime(char *filename, char *name, char *value_ptr)
4893 {
4894 struct plugins_list_entry *list = plugins_list;
4895 int value, changes = 0;
4896
4897 value = atoi(value_ptr);
4898 if (value <= 0) {
4899 Log(LOG_ERR, "WARN: [%s] 'pmacctd_flow_lifetime' has to be > 0.\n", filename);
4900 return ERR;
4901 }
4902
4903 for (; list; list = list->next, changes++) list->cfg.flow_lifetime = value;
4904 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pmacctd_flow_lifetime'. Globalized.\n", filename);
4905
4906 return changes;
4907 }
4908
cfg_key_pmacctd_flow_tcp_lifetime(char * filename,char * name,char * value_ptr)4909 int cfg_key_pmacctd_flow_tcp_lifetime(char *filename, char *name, char *value_ptr)
4910 {
4911 struct plugins_list_entry *list = plugins_list;
4912 int value, changes = 0;
4913
4914 value = atoi(value_ptr);
4915 if (value <= 0) {
4916 Log(LOG_ERR, "WARN: [%s] 'pmacctd_flow_tcp_lifetime' has to be > 0.\n", filename);
4917 return ERR;
4918 }
4919
4920 for (; list; list = list->next, changes++) list->cfg.flow_tcp_lifetime = value;
4921 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pmacctd_flow_tcp_lifetime'. Globalized.\n", filename);
4922
4923 return changes;
4924 }
4925
cfg_key_pmacctd_ext_sampling_rate(char * filename,char * name,char * value_ptr)4926 int cfg_key_pmacctd_ext_sampling_rate(char *filename, char *name, char *value_ptr)
4927 {
4928 struct plugins_list_entry *list = plugins_list;
4929 int value, changes = 0;
4930
4931 value = atoi(value_ptr);
4932 if (value < 1) {
4933 Log(LOG_ERR, "WARN: [%s] 'pmacctd_ext_sampling_rate' has to be >= 1.\n", filename);
4934 return ERR;
4935 }
4936
4937 for (; list; list = list->next, changes++) list->cfg.ext_sampling_rate = value;
4938 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pmacctd_ext_sampling_rate'. Globalized.\n", filename);
4939
4940 return changes;
4941 }
4942
cfg_key_pmacctd_nonroot(char * filename,char * name,char * value_ptr)4943 int cfg_key_pmacctd_nonroot(char *filename, char *name, char *value_ptr)
4944 {
4945 struct plugins_list_entry *list = plugins_list;
4946 int value, changes = 0;
4947
4948 value = parse_truefalse(value_ptr);
4949 if (value < 0) return ERR;
4950
4951 for (; list; list = list->next, changes++) list->cfg.pmacctd_nonroot = value;
4952 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pmacctd_nonroot'. Globalized.\n", filename);
4953
4954 return changes;
4955 }
4956
cfg_key_sfacctd_renormalize(char * filename,char * name,char * value_ptr)4957 int cfg_key_sfacctd_renormalize(char *filename, char *name, char *value_ptr)
4958 {
4959 struct plugins_list_entry *list = plugins_list;
4960 int value, changes = 0;
4961
4962 value = parse_truefalse(value_ptr);
4963 if (value < 0) return ERR;
4964
4965 for (; list; list = list->next, changes++) list->cfg.sfacctd_renormalize = value;
4966 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_renormalize'. Globalized.\n", filename);
4967
4968 return changes;
4969 }
4970
cfg_key_sfacctd_counter_file(char * filename,char * name,char * value_ptr)4971 int cfg_key_sfacctd_counter_file(char *filename, char *name, char *value_ptr)
4972 {
4973 struct plugins_list_entry *list = plugins_list;
4974 int changes = 0;
4975
4976 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_file = value_ptr;
4977 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_file'. Globalized.\n", filename);
4978
4979 return changes;
4980 }
4981
cfg_key_sfacctd_counter_output(char * filename,char * name,char * value_ptr)4982 int cfg_key_sfacctd_counter_output(char *filename, char *name, char *value_ptr)
4983 {
4984 struct plugins_list_entry *list = plugins_list;
4985 int value, changes = 0;
4986
4987 lower_string(value_ptr);
4988 if (!strcmp(value_ptr, "json")) {
4989 #ifdef WITH_JANSSON
4990 value = PRINT_OUTPUT_JSON;
4991 #else
4992 value = PRINT_OUTPUT_JSON;
4993 Log(LOG_WARNING, "WARN: [%s] sfacctd_counter_output set to json but will produce no output (missing --enable-jansson).\n", filename);
4994 #endif
4995 }
4996 else {
4997 Log(LOG_WARNING, "WARN: [%s] Invalid sfacctd_counter_output value '%s'\n", filename, value_ptr);
4998 return ERR;
4999 }
5000
5001 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_output = value;
5002 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_output'. Globalized.\n", filename);
5003
5004 return changes;
5005 }
5006
cfg_key_sfacctd_counter_amqp_host(char * filename,char * name,char * value_ptr)5007 int cfg_key_sfacctd_counter_amqp_host(char *filename, char *name, char *value_ptr)
5008 {
5009 struct plugins_list_entry *list = plugins_list;
5010 int changes = 0;
5011
5012 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_amqp_host = value_ptr;
5013 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_amqp_host'. Globalized.\n", filename);
5014
5015 return changes;
5016 }
5017
cfg_key_sfacctd_counter_amqp_vhost(char * filename,char * name,char * value_ptr)5018 int cfg_key_sfacctd_counter_amqp_vhost(char *filename, char *name, char *value_ptr)
5019 {
5020 struct plugins_list_entry *list = plugins_list;
5021 int changes = 0;
5022
5023 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_amqp_vhost = value_ptr;
5024 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_amqp_vhost'. Globalized.\n", filename);
5025
5026 return changes;
5027 }
5028
cfg_key_sfacctd_counter_amqp_user(char * filename,char * name,char * value_ptr)5029 int cfg_key_sfacctd_counter_amqp_user(char *filename, char *name, char *value_ptr)
5030 {
5031 struct plugins_list_entry *list = plugins_list;
5032 int changes = 0;
5033
5034 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_amqp_user = value_ptr;
5035 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_amqp_user'. Globalized.\n", filename);
5036
5037 return changes;
5038 }
5039
cfg_key_sfacctd_counter_amqp_passwd(char * filename,char * name,char * value_ptr)5040 int cfg_key_sfacctd_counter_amqp_passwd(char *filename, char *name, char *value_ptr)
5041 {
5042 struct plugins_list_entry *list = plugins_list;
5043 int changes = 0;
5044
5045 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_amqp_passwd = value_ptr;
5046 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_amqp_passwd'. Globalized.\n", filename);
5047
5048 return changes;
5049 }
5050
cfg_key_sfacctd_counter_amqp_exchange(char * filename,char * name,char * value_ptr)5051 int cfg_key_sfacctd_counter_amqp_exchange(char *filename, char *name, char *value_ptr)
5052 {
5053 struct plugins_list_entry *list = plugins_list;
5054 int changes = 0;
5055
5056 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_amqp_exchange = value_ptr;
5057 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_amqp_exchange'. Globalized.\n", filename);
5058
5059 return changes;
5060 }
5061
cfg_key_sfacctd_counter_amqp_exchange_type(char * filename,char * name,char * value_ptr)5062 int cfg_key_sfacctd_counter_amqp_exchange_type(char *filename, char *name, char *value_ptr)
5063 {
5064 struct plugins_list_entry *list = plugins_list;
5065 int changes = 0;
5066
5067 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_amqp_exchange_type = value_ptr;
5068 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_amqp_exchange_type'. Globalized.\n", filename);
5069
5070 return changes;
5071 }
5072
cfg_key_sfacctd_counter_amqp_routing_key(char * filename,char * name,char * value_ptr)5073 int cfg_key_sfacctd_counter_amqp_routing_key(char *filename, char *name, char *value_ptr)
5074 {
5075 struct plugins_list_entry *list = plugins_list;
5076 int changes = 0;
5077
5078 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_amqp_routing_key = value_ptr;
5079 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_amqp_routing_key'. Globalized.\n", filename);
5080
5081 return changes;
5082 }
5083
cfg_key_sfacctd_counter_amqp_persistent_msg(char * filename,char * name,char * value_ptr)5084 int cfg_key_sfacctd_counter_amqp_persistent_msg(char *filename, char *name, char *value_ptr)
5085 {
5086 struct plugins_list_entry *list = plugins_list;
5087 int value, changes = 0;
5088
5089 value = parse_truefalse(value_ptr);
5090 if (value < 0) return ERR;
5091
5092 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_amqp_persistent_msg = value;
5093 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_amqp_persistent_msg'. Globalized.\n", filename);
5094
5095 return changes;
5096 }
5097
cfg_key_sfacctd_counter_amqp_frame_max(char * filename,char * name,char * value_ptr)5098 int cfg_key_sfacctd_counter_amqp_frame_max(char *filename, char *name, char *value_ptr)
5099 {
5100 struct plugins_list_entry *list = plugins_list;
5101 u_int32_t value, changes = 0;
5102 char *endptr;
5103
5104 value = strtoul(value_ptr, &endptr, 10);
5105 if (value <= 0) {
5106 Log(LOG_WARNING, "WARN: [%s] 'sfacctd_counter_amqp_frame_max' has to be > 0.\n", filename);
5107 return ERR;
5108 }
5109
5110 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_amqp_frame_max = value;
5111 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_amqp_frame_max'. Globalized.\n", filename);
5112
5113 return changes;
5114 }
5115
cfg_key_sfacctd_counter_amqp_heartbeat_interval(char * filename,char * name,char * value_ptr)5116 int cfg_key_sfacctd_counter_amqp_heartbeat_interval(char *filename, char *name, char *value_ptr)
5117 {
5118 struct plugins_list_entry *list = plugins_list;
5119 u_int32_t value, changes = 0;
5120 char *endptr;
5121
5122 value = strtoul(value_ptr, &endptr, 10);
5123
5124 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_amqp_heartbeat_interval = value;
5125 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_amqp_heartbeat_interval'. Globalized.\n", filename);
5126
5127 return changes;
5128 }
5129
cfg_key_sfacctd_counter_amqp_retry(char * filename,char * name,char * value_ptr)5130 int cfg_key_sfacctd_counter_amqp_retry(char *filename, char *name, char *value_ptr)
5131 {
5132 struct plugins_list_entry *list = plugins_list;
5133 int value, changes = 0;
5134
5135 value = atoi(value_ptr);
5136 if (value <= 0) {
5137 Log(LOG_ERR, "WARN: [%s] 'sfacctd_counter_amqp_retry' has to be > 0.\n", filename);
5138 return ERR;
5139 }
5140
5141 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_amqp_retry = value;
5142 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_amqp_retry'. Globalized.\n", filename);
5143
5144 return changes;
5145 }
5146
cfg_key_sfacctd_counter_kafka_broker_host(char * filename,char * name,char * value_ptr)5147 int cfg_key_sfacctd_counter_kafka_broker_host(char *filename, char *name, char *value_ptr)
5148 {
5149 struct plugins_list_entry *list = plugins_list;
5150 int changes = 0;
5151
5152 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_kafka_broker_host = value_ptr;
5153 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_kafka_broker_host'. Globalized.\n", filename);
5154
5155 return changes;
5156 }
5157
cfg_key_sfacctd_counter_kafka_broker_port(char * filename,char * name,char * value_ptr)5158 int cfg_key_sfacctd_counter_kafka_broker_port(char *filename, char *name, char *value_ptr)
5159 {
5160 struct plugins_list_entry *list = plugins_list;
5161 int value, changes = 0;
5162
5163 value = atoi(value_ptr);
5164 if ((value <= 0) || (value > 65535)) {
5165 Log(LOG_ERR, "WARN: [%s] 'sfacctd_counter_kafka_broker_port' has to be in the range 1-65535.\n", filename);
5166 return ERR;
5167 }
5168
5169 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_kafka_broker_port = value;
5170 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_kafka_broker_port'. Globalized.\n", filename);
5171
5172 return changes;
5173 }
5174
cfg_key_sfacctd_counter_kafka_topic(char * filename,char * name,char * value_ptr)5175 int cfg_key_sfacctd_counter_kafka_topic(char *filename, char *name, char *value_ptr)
5176 {
5177 struct plugins_list_entry *list = plugins_list;
5178 int changes = 0;
5179
5180 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_kafka_topic = value_ptr;
5181 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_kafka_topic'. Globalized.\n", filename);
5182
5183 return changes;
5184 }
5185
cfg_key_sfacctd_counter_kafka_partition(char * filename,char * name,char * value_ptr)5186 int cfg_key_sfacctd_counter_kafka_partition(char *filename, char *name, char *value_ptr)
5187 {
5188 struct plugins_list_entry *list = plugins_list;
5189 int value, changes = 0;
5190
5191 value = atoi(value_ptr);
5192 if (value < -1) {
5193 Log(LOG_ERR, "WARN: [%s] 'sfacctd_counter_kafka_partition' has to be >= -1.\n", filename);
5194 return ERR;
5195 }
5196
5197 if (!value) value = FALSE_NONZERO;
5198
5199 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_kafka_partition = value;
5200 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_kafka_partition'. Globalized.\n", filename);
5201
5202 return changes;
5203 }
5204
cfg_key_sfacctd_counter_kafka_partition_key(char * filename,char * name,char * value_ptr)5205 int cfg_key_sfacctd_counter_kafka_partition_key(char *filename, char *name, char *value_ptr)
5206 {
5207 struct plugins_list_entry *list = plugins_list;
5208 int value_len, changes = 0;
5209
5210 value_len = strlen(value_ptr);
5211
5212 for (; list; list = list->next, changes++) {
5213 list->cfg.sfacctd_counter_kafka_partition_key = value_ptr;
5214 list->cfg.sfacctd_counter_kafka_partition_keylen = value_len;
5215 }
5216 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_kafka_partition_key'. Globalized.\n", filename);
5217
5218 return changes;
5219 }
5220
cfg_key_sfacctd_counter_kafka_retry(char * filename,char * name,char * value_ptr)5221 int cfg_key_sfacctd_counter_kafka_retry(char *filename, char *name, char *value_ptr)
5222 {
5223 struct plugins_list_entry *list = plugins_list;
5224 int value, changes = 0;
5225
5226 value = atoi(value_ptr);
5227 if (value <= 0) {
5228 Log(LOG_ERR, "WARN: [%s] 'sfacctd_counter_kafka_retry' has to be > 0.\n", filename);
5229 return ERR;
5230 }
5231
5232 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_kafka_retry = value;
5233 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_kafka_retry'. Globalized.\n", filename);
5234
5235 return changes;
5236 }
5237
cfg_key_sfacctd_counter_kafka_config_file(char * filename,char * name,char * value_ptr)5238 int cfg_key_sfacctd_counter_kafka_config_file(char *filename, char *name, char *value_ptr)
5239 {
5240 struct plugins_list_entry *list = plugins_list;
5241 int changes = 0;
5242
5243 for (; list; list = list->next, changes++) list->cfg.sfacctd_counter_kafka_config_file = value_ptr;
5244 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'sfacctd_counter_kafka_config_file'. Globalized.\n", filename);
5245
5246 return changes;
5247 }
5248
cfg_key_pcap_savefile(char * filename,char * name,char * value_ptr)5249 int cfg_key_pcap_savefile(char *filename, char *name, char *value_ptr)
5250 {
5251 struct plugins_list_entry *list = plugins_list;
5252 int changes = 0;
5253
5254 for (; list; list = list->next, changes++) list->cfg.pcap_savefile = value_ptr;
5255 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'pcap_savefile'. Globalized.\n", filename);
5256
5257 return changes;
5258 }
5259
cfg_key_nfacctd_as_new(char * filename,char * name,char * value_ptr)5260 int cfg_key_nfacctd_as_new(char *filename, char *name, char *value_ptr)
5261 {
5262 struct plugins_list_entry *list = plugins_list;
5263 int value, changes = 0;
5264
5265 lower_string(value_ptr);
5266 if (!strcmp(value_ptr, "false") /* legacy */ || !strcmp(value_ptr, "netflow") || !strcmp(value_ptr, "sflow")) {
5267 if (config.acct_type == ACCT_NF || config.acct_type == ACCT_SF) value = NF_AS_KEEP;
5268 else {
5269 Log(LOG_ERR, "WARN: [%s] Invalid AS aggregation value '%s'\n", filename, value_ptr);
5270 return ERR;
5271 }
5272 }
5273 else if (!strcmp(value_ptr, "true") /* legacy */ || !strcmp(value_ptr, "file"))
5274 value = NF_AS_NEW;
5275 else if (!strcmp(value_ptr, "bgp") || !strcmp(value_ptr, "bmp"))
5276 value = NF_AS_BGP;
5277 else if (!strcmp(value_ptr, "fallback") || !strcmp(value_ptr, "longest")) {
5278 value = NF_AS_FALLBACK;
5279
5280 if (config.acct_type == ACCT_NF || config.acct_type == ACCT_SF) {
5281 value |= NF_AS_KEEP;
5282 value |= NF_AS_BGP;
5283 }
5284 else value |= NF_AS_BGP; /* NF_AS_KEEP does not apply to ACCT_PM and ACCT_UL;
5285 we set value to NF_AS_BGP since we can't fallback
5286 to any alternative method as of yet */
5287 }
5288 else {
5289 Log(LOG_ERR, "WARN: [%s] Invalid AS aggregation value '%s'\n", filename, value_ptr);
5290 return ERR;
5291 }
5292
5293 for (; list; list = list->next, changes++) list->cfg.nfacctd_as = value;
5294 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key '[nf|pm|sf|u]acctd_as_new'. Globalized.\n", filename);
5295
5296 return changes;
5297 }
5298
cfg_key_nfacctd_net(char * filename,char * name,char * value_ptr)5299 int cfg_key_nfacctd_net(char *filename, char *name, char *value_ptr)
5300 {
5301 struct plugins_list_entry *list = plugins_list;
5302 int value, changes = 0;
5303
5304 lower_string(value_ptr);
5305 if (!strcmp(value_ptr, "sflow") || !strcmp(value_ptr, "netflow")) {
5306 if (config.acct_type == ACCT_NF || config.acct_type == ACCT_SF) value = NF_NET_KEEP;
5307 else {
5308 Log(LOG_ERR, "WARN: [%s] Invalid network aggregation value '%s'\n", filename, value_ptr);
5309 return ERR;
5310 }
5311 }
5312 else if (!strcmp(value_ptr, "file"))
5313 value = NF_NET_NEW;
5314 else if (!strcmp(value_ptr, "mask"))
5315 value = NF_NET_STATIC;
5316 else if (!strcmp(value_ptr, "bgp") || !strcmp(value_ptr, "bmp"))
5317 value = NF_NET_BGP;
5318 else if (!strcmp(value_ptr, "igp"))
5319 value = NF_NET_IGP;
5320 else if (!strcmp(value_ptr, "fallback") || !strcmp(value_ptr, "longest")) {
5321 value = NF_NET_FALLBACK;
5322
5323 if (config.acct_type == ACCT_NF || config.acct_type == ACCT_SF) {
5324 value |= NF_NET_KEEP;
5325 value |= NF_NET_BGP;
5326 value |= NF_NET_IGP;
5327 }
5328 else {
5329 value |= NF_NET_BGP;
5330 value |= NF_NET_IGP;
5331 }
5332 }
5333 else {
5334 Log(LOG_ERR, "WARN: [%s] Invalid network aggregation value '%s'\n", filename, value_ptr);
5335 return ERR;
5336 }
5337
5338 if (!name) for (; list; list = list->next, changes++) list->cfg.nfacctd_net = value;
5339 else {
5340 for (; list; list = list->next) {
5341 if (!strcmp(name, list->name)) {
5342 list->cfg.nfacctd_net = value;
5343 changes++;
5344 break;
5345 }
5346 }
5347 }
5348
5349 return changes;
5350 }
5351
cfg_key_nfacctd_disable_checks(char * filename,char * name,char * value_ptr)5352 int cfg_key_nfacctd_disable_checks(char *filename, char *name, char *value_ptr)
5353 {
5354 struct plugins_list_entry *list = plugins_list;
5355 int value, changes = 0;
5356
5357 value = parse_truefalse_nonzero(value_ptr);
5358 if (value == ERR) return ERR;
5359
5360 for (; list; list = list->next, changes++) list->cfg.nfacctd_disable_checks = value;
5361 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key '[ns]facctd_disable_checks'. Globalized.\n", filename);
5362
5363 return changes;
5364 }
5365
cfg_key_nfacctd_disable_opt_scope_check(char * filename,char * name,char * value_ptr)5366 int cfg_key_nfacctd_disable_opt_scope_check(char *filename, char *name, char *value_ptr)
5367 {
5368 struct plugins_list_entry *list = plugins_list;
5369 int value, changes = 0;
5370
5371 value = parse_truefalse_nonzero(value_ptr);
5372 if (value == ERR) return ERR;
5373
5374 for (; list; list = list->next, changes++) list->cfg.nfacctd_disable_opt_scope_check = value;
5375 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'nfacctd_disable_opt_scope_check'. Globalized.\n", filename);
5376
5377 return changes;
5378 }
5379
cfg_key_classifiers(char * filename,char * name,char * value_ptr)5380 int cfg_key_classifiers(char *filename, char *name, char *value_ptr)
5381 {
5382 struct plugins_list_entry *list = plugins_list;
5383 int changes = 0;
5384
5385 for (; list; list = list->next, changes++) list->cfg.classifiers_path = value_ptr;
5386 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifiers'. Globalized.\n", filename);
5387
5388 return changes;
5389 }
5390
cfg_key_classifier_tentatives(char * filename,char * name,char * value_ptr)5391 int cfg_key_classifier_tentatives(char *filename, char *name, char *value_ptr)
5392 {
5393 struct plugins_list_entry *list = plugins_list;
5394 int value, changes = 0;
5395
5396 value = atoi(value_ptr);
5397 if (value <= 0) {
5398 Log(LOG_INFO, "INFO: [%s] 'classifier_tentatives' has to be >= 1.\n", filename);
5399 return ERR;
5400 }
5401
5402 for (; list; list = list->next, changes++) list->cfg.classifier_tentatives = value;
5403 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifier_tentatives'. Globalized.\n", filename);
5404
5405 return changes;
5406 }
5407
cfg_key_classifier_table_num(char * filename,char * name,char * value_ptr)5408 int cfg_key_classifier_table_num(char *filename, char *name, char *value_ptr)
5409 {
5410 struct plugins_list_entry *list = plugins_list;
5411 int value, changes = 0;
5412
5413 value = atoi(value_ptr);
5414 if (value <= 0) {
5415 Log(LOG_INFO, "INFO: [%s] 'classifier_table_num' has to be >= 1.\n", filename);
5416 return ERR;
5417 }
5418
5419 for (; list; list = list->next, changes++) list->cfg.classifier_table_num = value;
5420 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifier_table_num'. Globalized.\n", filename);
5421
5422 return changes;
5423 }
5424
cfg_key_classifier_ndpi_num_roots(char * filename,char * name,char * value_ptr)5425 int cfg_key_classifier_ndpi_num_roots(char *filename, char *name, char *value_ptr)
5426 {
5427 struct plugins_list_entry *list = plugins_list;
5428 u_int64_t value, changes = 0;
5429 char *endptr;
5430
5431 value = strtoul(value_ptr, &endptr, 10);
5432
5433 for (; list; list = list->next, changes++) list->cfg.ndpi_num_roots = value;
5434 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifier_num_roots'. Globalized.\n", filename);
5435
5436 return changes;
5437 }
5438
cfg_key_classifier_ndpi_max_flows(char * filename,char * name,char * value_ptr)5439 int cfg_key_classifier_ndpi_max_flows(char *filename, char *name, char *value_ptr)
5440 {
5441 struct plugins_list_entry *list = plugins_list;
5442 u_int64_t value, changes = 0;
5443 char *endptr;
5444
5445 value = strtoul(value_ptr, &endptr, 10);
5446
5447 for (; list; list = list->next, changes++) list->cfg.ndpi_max_flows = value;
5448 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifier_max_flows'. Globalized.\n", filename);
5449
5450 return changes;
5451 }
5452
cfg_key_classifier_ndpi_proto_guess(char * filename,char * name,char * value_ptr)5453 int cfg_key_classifier_ndpi_proto_guess(char *filename, char *name, char *value_ptr)
5454 {
5455 struct plugins_list_entry *list = plugins_list;
5456 int value, changes = 0;
5457
5458 value = parse_truefalse(value_ptr);
5459 if (value < 0) return ERR;
5460
5461 for (; list; list = list->next, changes++) list->cfg.ndpi_proto_guess = value;
5462 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifier_proto_guess'. Globalized.\n", filename);
5463
5464 return changes;
5465 }
5466
cfg_key_classifier_ndpi_idle_scan_period(char * filename,char * name,char * value_ptr)5467 int cfg_key_classifier_ndpi_idle_scan_period(char *filename, char *name, char *value_ptr)
5468 {
5469 struct plugins_list_entry *list = plugins_list;
5470 u_int64_t value, changes = 0;
5471 char *endptr;
5472
5473 value = strtoul(value_ptr, &endptr, 10);
5474
5475 for (; list; list = list->next, changes++) list->cfg.ndpi_idle_scan_period = value;
5476 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifier_idle_scan_period'. Globalized.\n", filename);
5477
5478 return changes;
5479 }
5480
cfg_key_classifier_ndpi_idle_max_time(char * filename,char * name,char * value_ptr)5481 int cfg_key_classifier_ndpi_idle_max_time(char *filename, char *name, char *value_ptr)
5482 {
5483 struct plugins_list_entry *list = plugins_list;
5484 u_int64_t value, changes = 0;
5485 char *endptr;
5486
5487 value = strtoul(value_ptr, &endptr, 10);
5488
5489 for (; list; list = list->next, changes++) list->cfg.ndpi_idle_max_time= value;
5490 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifier_idle_max_time'. Globalized.\n", filename);
5491
5492 return changes;
5493 }
5494
cfg_key_classifier_ndpi_idle_scan_budget(char * filename,char * name,char * value_ptr)5495 int cfg_key_classifier_ndpi_idle_scan_budget(char *filename, char *name, char *value_ptr)
5496 {
5497 struct plugins_list_entry *list = plugins_list;
5498 u_int64_t value, changes = 0;
5499 char *endptr;
5500
5501 value = strtoul(value_ptr, &endptr, 10);
5502
5503 for (; list; list = list->next, changes++) list->cfg.ndpi_idle_scan_budget = value;
5504 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifier_idle_scan_budget'. Globalized.\n", filename);
5505
5506 return changes;
5507 }
5508
cfg_key_classifier_ndpi_giveup_proto_tcp(char * filename,char * name,char * value_ptr)5509 int cfg_key_classifier_ndpi_giveup_proto_tcp(char *filename, char *name, char *value_ptr)
5510 {
5511 struct plugins_list_entry *list = plugins_list;
5512 int value, changes = 0;
5513
5514 value = atoi(value_ptr);
5515 if (value <= 0) {
5516 Log(LOG_INFO, "INFO: [%s] 'classifier_giveup_proto_tcp' has to be >= 1.\n", filename);
5517 return ERR;
5518 }
5519
5520 for (; list; list = list->next, changes++) list->cfg.ndpi_giveup_proto_tcp = value;
5521 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifier_giveup_proto_tcp'. Globalized.\n", filename);
5522
5523 return changes;
5524 }
5525
cfg_key_classifier_ndpi_giveup_proto_udp(char * filename,char * name,char * value_ptr)5526 int cfg_key_classifier_ndpi_giveup_proto_udp(char *filename, char *name, char *value_ptr)
5527 {
5528 struct plugins_list_entry *list = plugins_list;
5529 int value, changes = 0;
5530
5531 value = atoi(value_ptr);
5532 if (value <= 0) {
5533 Log(LOG_INFO, "INFO: [%s] 'classifier_giveup_proto_udp' has to be >= 1.\n", filename);
5534 return ERR;
5535 }
5536
5537 for (; list; list = list->next, changes++) list->cfg.ndpi_giveup_proto_udp = value;
5538 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifier_giveup_proto_udp'. Globalized.\n", filename);
5539
5540 return changes;
5541 }
5542
cfg_key_classifier_ndpi_giveup_proto_other(char * filename,char * name,char * value_ptr)5543 int cfg_key_classifier_ndpi_giveup_proto_other(char *filename, char *name, char *value_ptr)
5544 {
5545 struct plugins_list_entry *list = plugins_list;
5546 int value, changes = 0;
5547
5548 value = atoi(value_ptr);
5549 if (value <= 0) {
5550 Log(LOG_INFO, "INFO: [%s] 'classifier_giveup_proto_other' has to be >= 1.\n", filename);
5551 return ERR;
5552 }
5553
5554 for (; list; list = list->next, changes++) list->cfg.ndpi_giveup_proto_other = value;
5555 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'classifier_giveup_proto_other'. Globalized.\n", filename);
5556
5557 return changes;
5558 }
5559
cfg_key_nfprobe_timeouts(char * filename,char * name,char * value_ptr)5560 int cfg_key_nfprobe_timeouts(char *filename, char *name, char *value_ptr)
5561 {
5562 struct plugins_list_entry *list = plugins_list;
5563 int changes = 0;
5564
5565 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_timeouts = value_ptr;
5566 else {
5567 for (; list; list = list->next) {
5568 if (!strcmp(name, list->name)) {
5569 list->cfg.nfprobe_timeouts = value_ptr;
5570 changes++;
5571 break;
5572 }
5573 }
5574 }
5575
5576 return changes;
5577 }
5578
cfg_key_nfprobe_hoplimit(char * filename,char * name,char * value_ptr)5579 int cfg_key_nfprobe_hoplimit(char *filename, char *name, char *value_ptr)
5580 {
5581 struct plugins_list_entry *list = plugins_list;
5582 int value, changes = 0;
5583
5584 value = atoi(value_ptr);
5585 if ((value < 1) || (value > 255)) {
5586 Log(LOG_ERR, "WARN: [%s] 'nfprobe_hoplimit' has to be in the range 1-255.\n", filename);
5587 return ERR;
5588 }
5589
5590 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_hoplimit = value;
5591 else {
5592 for (; list; list = list->next) {
5593 if (!strcmp(name, list->name)) {
5594 list->cfg.nfprobe_hoplimit = value;
5595 changes++;
5596 break;
5597 }
5598 }
5599 }
5600
5601 return changes;
5602 }
5603
cfg_key_nfprobe_maxflows(char * filename,char * name,char * value_ptr)5604 int cfg_key_nfprobe_maxflows(char *filename, char *name, char *value_ptr)
5605 {
5606 struct plugins_list_entry *list = plugins_list;
5607 int value, changes = 0;
5608
5609 value = atoi(value_ptr);
5610 if (value < 1) {
5611 Log(LOG_ERR, "WARN: [%s] 'nfprobe_maxflows' has to be >= 1.\n", filename);
5612 return ERR;
5613 }
5614
5615 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_maxflows = value;
5616 else {
5617 for (; list; list = list->next) {
5618 if (!strcmp(name, list->name)) {
5619 list->cfg.nfprobe_maxflows = value;
5620 changes++;
5621 break;
5622 }
5623 }
5624 }
5625
5626 return changes;
5627 }
5628
cfg_key_nfprobe_receiver(char * filename,char * name,char * value_ptr)5629 int cfg_key_nfprobe_receiver(char *filename, char *name, char *value_ptr)
5630 {
5631 struct plugins_list_entry *list = plugins_list;
5632 int changes = 0;
5633
5634 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_receiver = value_ptr;
5635 else {
5636 for (; list; list = list->next) {
5637 if (!strcmp(name, list->name)) {
5638 list->cfg.nfprobe_receiver = value_ptr;
5639 changes++;
5640 break;
5641 }
5642 }
5643 }
5644
5645 return changes;
5646 }
5647
cfg_key_nfprobe_source_ip(char * filename,char * name,char * value_ptr)5648 int cfg_key_nfprobe_source_ip(char *filename, char *name, char *value_ptr)
5649 {
5650 struct plugins_list_entry *list = plugins_list;
5651 int changes = 0;
5652
5653 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_source_ip = value_ptr;
5654 else {
5655 for (; list; list = list->next) {
5656 if (!strcmp(name, list->name)) {
5657 list->cfg.nfprobe_source_ip = value_ptr;
5658 changes++;
5659 break;
5660 }
5661 }
5662 }
5663
5664 return changes;
5665 }
5666
cfg_key_nfprobe_version(char * filename,char * name,char * value_ptr)5667 int cfg_key_nfprobe_version(char *filename, char *name, char *value_ptr)
5668 {
5669 struct plugins_list_entry *list = plugins_list;
5670 int value, changes = 0;
5671
5672 value = atoi(value_ptr);
5673 if (value != 5 && value != 9 && value != 10) {
5674 Log(LOG_ERR, "WARN: [%s] 'nfprobe_version' has to be one of 5, 9 or 10.\n", filename);
5675 return ERR;
5676 }
5677
5678 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_version = value;
5679 else {
5680 for (; list; list = list->next) {
5681 if (!strcmp(name, list->name)) {
5682 list->cfg.nfprobe_version = value;
5683 changes++;
5684 break;
5685 }
5686 }
5687 }
5688
5689 return changes;
5690 }
5691
cfg_key_nfprobe_engine(char * filename,char * name,char * value_ptr)5692 int cfg_key_nfprobe_engine(char *filename, char *name, char *value_ptr)
5693 {
5694 struct plugins_list_entry *list = plugins_list;
5695 int changes = 0;
5696
5697 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_engine = value_ptr;
5698 else {
5699 for (; list; list = list->next) {
5700 if (!strcmp(name, list->name)) {
5701 list->cfg.nfprobe_engine = value_ptr;
5702 changes++;
5703 break;
5704 }
5705 }
5706 }
5707
5708 return changes;
5709 }
5710
cfg_key_nfprobe_peer_as(char * filename,char * name,char * value_ptr)5711 int cfg_key_nfprobe_peer_as(char *filename, char *name, char *value_ptr)
5712 {
5713 struct plugins_list_entry *list = plugins_list;
5714 int value, changes = 0;
5715
5716 value = parse_truefalse(value_ptr);
5717 if (value < 0) return ERR;
5718
5719 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_peer_as = value;
5720 else {
5721 for (; list; list = list->next) {
5722 if (!strcmp(name, list->name)) {
5723 list->cfg.nfprobe_peer_as = value;
5724 changes++;
5725 break;
5726 }
5727 }
5728 }
5729
5730 return changes;
5731 }
5732
cfg_key_nfprobe_ip_precedence(char * filename,char * name,char * value_ptr)5733 int cfg_key_nfprobe_ip_precedence(char *filename, char *name, char *value_ptr)
5734 {
5735 struct plugins_list_entry *list = plugins_list;
5736 int value, changes = 0;
5737
5738 value = atoi(value_ptr);
5739 if ((value < 0) || (value > 7)) {
5740 Log(LOG_ERR, "WARN: [%s] 'nfprobe_ipprec' and 'sfprobe_ipprec' have to be in the range 0-7.\n", filename);
5741 return ERR;
5742 }
5743
5744 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_ipprec = value;
5745 else {
5746 for (; list; list = list->next) {
5747 if (!strcmp(name, list->name)) {
5748 list->cfg.nfprobe_ipprec = value;
5749 changes++;
5750 break;
5751 }
5752 }
5753 }
5754
5755 return changes;
5756 }
5757
cfg_key_nfprobe_direction(char * filename,char * name,char * value_ptr)5758 int cfg_key_nfprobe_direction(char *filename, char *name, char *value_ptr)
5759 {
5760 struct plugins_list_entry *list = plugins_list;
5761 int value, changes = 0;
5762
5763 lower_string(value_ptr);
5764 if (!strcmp(value_ptr, "tag"))
5765 value = DIRECTION_TAG;
5766 else if (!strcmp(value_ptr, "tag2"))
5767 value = DIRECTION_TAG2;
5768 else if (!strcmp(value_ptr, "in"))
5769 value = DIRECTION_IN;
5770 else if (!strcmp(value_ptr, "out"))
5771 value = DIRECTION_OUT;
5772 else {
5773 Log(LOG_ERR, "WARN: [%s] Invalid nfprobe_direction or sfprobe_direction value '%s'\n", filename, value_ptr);
5774 return ERR;
5775 }
5776
5777 if (!name) {
5778 Log(LOG_ERR, "ERROR: [%s] nfprobe_direction and sfprobe_direction cannot be global. Not loaded.\n", filename);
5779 changes++;
5780 }
5781 else {
5782 for (; list; list = list->next) {
5783 if (!strcmp(name, list->name)) {
5784 list->cfg.nfprobe_direction = value;
5785 changes++;
5786 break;
5787 }
5788 }
5789 }
5790
5791 return changes;
5792 }
5793
cfg_key_nfprobe_ifindex(char * filename,char * name,char * value_ptr)5794 int cfg_key_nfprobe_ifindex(char *filename, char *name, char *value_ptr)
5795 {
5796 struct plugins_list_entry *list = plugins_list;
5797 int changes = 0, value2 = 0;
5798 u_int32_t value = 0;
5799
5800 lower_string(value_ptr);
5801 if (!strcmp(value_ptr, "tag"))
5802 value2 = IFINDEX_TAG;
5803 else if (!strcmp(value_ptr, "tag2"))
5804 value2 = IFINDEX_TAG2;
5805 else if ((value = strtol(value_ptr, NULL, 0)))
5806 value2 = IFINDEX_STATIC;
5807 else {
5808 Log(LOG_ERR, "WARN: [%s] Invalid nfprobe_ifindex or sfprobe_ifindex value '%s'\n", filename, value_ptr);
5809 return ERR;
5810 }
5811
5812 if (!name) {
5813 Log(LOG_ERR, "ERROR: [%s] nfprobe_ifindex and sfprobe_ifindex cannot be global. Not loaded.\n", filename);
5814 changes++;
5815 }
5816 else {
5817 for (; list; list = list->next) {
5818 if (!strcmp(name, list->name)) {
5819 list->cfg.nfprobe_ifindex = value;
5820 list->cfg.nfprobe_ifindex_type = value2;
5821 changes++;
5822 break;
5823 }
5824 }
5825 }
5826
5827 return changes;
5828 }
5829
cfg_key_nfprobe_ifindex_override(char * filename,char * name,char * value_ptr)5830 int cfg_key_nfprobe_ifindex_override(char *filename, char *name, char *value_ptr)
5831 {
5832 struct plugins_list_entry *list = plugins_list;
5833 int value, changes = 0;
5834
5835 value = parse_truefalse(value_ptr);
5836 if (value < 0) return ERR;
5837
5838 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_ifindex_override = value;
5839 else {
5840 for (; list; list = list->next) {
5841 if (!strcmp(name, list->name)) {
5842 list->cfg.nfprobe_ifindex_override = value;
5843 changes++;
5844 break;
5845 }
5846 }
5847 }
5848
5849 return changes;
5850 }
5851
cfg_key_nfprobe_tstamp_usec(char * filename,char * name,char * value_ptr)5852 int cfg_key_nfprobe_tstamp_usec(char *filename, char *name, char *value_ptr)
5853 {
5854 struct plugins_list_entry *list = plugins_list;
5855 int value, changes = 0;
5856
5857 value = parse_truefalse(value_ptr);
5858 if (value < 0) return ERR;
5859
5860 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_tstamp_usec = value;
5861 else {
5862 for (; list; list = list->next) {
5863 if (!strcmp(name, list->name)) {
5864 list->cfg.nfprobe_tstamp_usec = value;
5865 changes++;
5866 break;
5867 }
5868 }
5869 }
5870
5871 return changes;
5872 }
5873
cfg_key_nfprobe_dont_cache(char * filename,char * name,char * value_ptr)5874 int cfg_key_nfprobe_dont_cache(char *filename, char *name, char *value_ptr)
5875 {
5876 struct plugins_list_entry *list = plugins_list;
5877 int value, changes = 0;
5878
5879 value = parse_truefalse(value_ptr);
5880 if (value < 0) return ERR;
5881
5882 if (!name) for (; list; list = list->next, changes++) list->cfg.nfprobe_dont_cache = value;
5883 else {
5884 for (; list; list = list->next) {
5885 if (!strcmp(name, list->name)) {
5886 list->cfg.nfprobe_dont_cache = value;
5887 changes++;
5888 break;
5889 }
5890 }
5891 }
5892
5893 return changes;
5894 }
5895
cfg_key_sfprobe_receiver(char * filename,char * name,char * value_ptr)5896 int cfg_key_sfprobe_receiver(char *filename, char *name, char *value_ptr)
5897 {
5898 struct plugins_list_entry *list = plugins_list;
5899 int changes = 0;
5900
5901 if (!name) for (; list; list = list->next, changes++) list->cfg.sfprobe_receiver = value_ptr;
5902 else {
5903 for (; list; list = list->next) {
5904 if (!strcmp(name, list->name)) {
5905 list->cfg.sfprobe_receiver = value_ptr;
5906 changes++;
5907 break;
5908 }
5909 }
5910 }
5911
5912 return changes;
5913 }
5914
cfg_key_sfprobe_agentip(char * filename,char * name,char * value_ptr)5915 int cfg_key_sfprobe_agentip(char *filename, char *name, char *value_ptr)
5916 {
5917 struct plugins_list_entry *list = plugins_list;
5918 int changes = 0;
5919
5920 if (!name) for (; list; list = list->next, changes++) list->cfg.sfprobe_agentip = value_ptr;
5921 else {
5922 for (; list; list = list->next) {
5923 if (!strcmp(name, list->name)) {
5924 list->cfg.sfprobe_agentip = value_ptr;
5925 changes++;
5926 break;
5927 }
5928 }
5929 }
5930
5931 return changes;
5932 }
5933
cfg_key_sfprobe_agentsubid(char * filename,char * name,char * value_ptr)5934 int cfg_key_sfprobe_agentsubid(char *filename, char *name, char *value_ptr)
5935 {
5936 struct plugins_list_entry *list = plugins_list;
5937 int value, changes = 0;
5938
5939 value = atoi(value_ptr);
5940 if (value < 0) {
5941 Log(LOG_ERR, "WARN: [%s] 'sfprobe_agentsubid' has to be >= 0.\n", filename);
5942 return ERR;
5943 }
5944
5945 if (!name) for (; list; list = list->next, changes++) list->cfg.sfprobe_agentsubid = value;
5946 else {
5947 for (; list; list = list->next) {
5948 if (!strcmp(name, list->name)) {
5949 list->cfg.sfprobe_agentsubid = value;
5950 changes++;
5951 break;
5952 }
5953 }
5954 }
5955
5956 return changes;
5957 }
5958
cfg_key_sfprobe_ifspeed(char * filename,char * name,char * value_ptr)5959 int cfg_key_sfprobe_ifspeed(char *filename, char *name, char *value_ptr)
5960 {
5961 struct plugins_list_entry *list = plugins_list;
5962 int changes = 0;
5963 u_int64_t value;
5964
5965 value = strtoll(value_ptr, NULL, 0);
5966
5967 if (!name) for (; list; list = list->next, changes++) list->cfg.sfprobe_ifspeed = value;
5968 else {
5969 for (; list; list = list->next) {
5970 if (!strcmp(name, list->name)) {
5971 list->cfg.sfprobe_ifspeed = value;
5972 changes++;
5973 break;
5974 }
5975 }
5976 }
5977
5978 return changes;
5979 }
5980
cfg_key_tee_transparent(char * filename,char * name,char * value_ptr)5981 int cfg_key_tee_transparent(char *filename, char *name, char *value_ptr)
5982 {
5983 struct plugins_list_entry *list = plugins_list;
5984 int value, changes = 0;
5985
5986 value = parse_truefalse(value_ptr);
5987 if (value < 0) return ERR;
5988
5989 if (!name) for (; list; list = list->next, changes++) list->cfg.tee_transparent = value;
5990 else {
5991 for (; list; list = list->next) {
5992 if (!strcmp(name, list->name)) {
5993 list->cfg.tee_transparent = value;
5994 changes++;
5995 break;
5996 }
5997 }
5998 }
5999
6000 return changes;
6001 }
6002
cfg_key_tee_max_receivers(char * filename,char * name,char * value_ptr)6003 int cfg_key_tee_max_receivers(char *filename, char *name, char *value_ptr)
6004 {
6005 struct plugins_list_entry *list = plugins_list;
6006 int value, changes = 0;
6007
6008 value = atoi(value_ptr);
6009 if (value < 1) {
6010 Log(LOG_WARNING, "WARN: [%s] invalid 'tee_max_receivers' value). Allowed values are >= 1.\n", filename);
6011 return ERR;
6012 }
6013
6014 if (!name) for (; list; list = list->next, changes++) list->cfg.tee_max_receivers = value;
6015 else {
6016 for (; list; list = list->next) {
6017 if (!strcmp(name, list->name)) {
6018 list->cfg.tee_max_receivers = value;
6019 changes++;
6020 break;
6021 }
6022 }
6023 }
6024
6025 return changes;
6026 }
6027
cfg_key_tee_max_receiver_pools(char * filename,char * name,char * value_ptr)6028 int cfg_key_tee_max_receiver_pools(char *filename, char *name, char *value_ptr)
6029 {
6030 struct plugins_list_entry *list = plugins_list;
6031 int value, changes = 0;
6032
6033 value = atoi(value_ptr);
6034 if (value < 1) {
6035 Log(LOG_WARNING, "WARN: [%s] invalid 'tee_max_receiver_pools' value). Allowed values are >= 1.\n", filename);
6036 return ERR;
6037 }
6038
6039 if (!name) for (; list; list = list->next, changes++) list->cfg.tee_max_receiver_pools = value;
6040 else {
6041 for (; list; list = list->next) {
6042 if (!strcmp(name, list->name)) {
6043 list->cfg.tee_max_receiver_pools = value;
6044 changes++;
6045 break;
6046 }
6047 }
6048 }
6049
6050 return changes;
6051 }
6052
cfg_key_tee_receivers(char * filename,char * name,char * value_ptr)6053 int cfg_key_tee_receivers(char *filename, char *name, char *value_ptr)
6054 {
6055 struct plugins_list_entry *list = plugins_list;
6056 int changes = 0;
6057
6058 if (!name) for (; list; list = list->next, changes++) list->cfg.tee_receivers = value_ptr;
6059 else {
6060 for (; list; list = list->next) {
6061 if (!strcmp(name, list->name)) {
6062 list->cfg.tee_receivers = value_ptr;
6063 changes++;
6064 break;
6065 }
6066 }
6067 }
6068
6069 return changes;
6070 }
6071
cfg_key_tee_pipe_size(char * filename,char * name,char * value_ptr)6072 int cfg_key_tee_pipe_size(char *filename, char *name, char *value_ptr)
6073 {
6074 struct plugins_list_entry *list = plugins_list;
6075 u_int64_t value, changes = 0;
6076 char *endptr;
6077
6078 value = strtoull(value_ptr, &endptr, 10);
6079 if (!value || value > INT_MAX) {
6080 Log(LOG_WARNING, "WARN: [%s] 'tee_pipe_size' has to be > 0 and <= INT_MAX.\n", filename);
6081 return ERR;
6082 }
6083
6084 if (!name) for (; list; list = list->next, changes++) list->cfg.tee_pipe_size = value;
6085 else {
6086 for (; list; list = list->next) {
6087 if (!strcmp(name, list->name)) {
6088 list->cfg.tee_pipe_size = value;
6089 changes++;
6090 break;
6091 }
6092 }
6093 }
6094
6095 return changes;
6096 }
6097
cfg_key_tee_kafka_config_file(char * filename,char * name,char * value_ptr)6098 int cfg_key_tee_kafka_config_file(char *filename, char *name, char *value_ptr)
6099 {
6100 struct plugins_list_entry *list = plugins_list;
6101 int changes = 0;
6102
6103 if (!name) for (; list; list = list->next, changes++) list->cfg.tee_kafka_config_file = value_ptr;
6104 else {
6105 for (; list; list = list->next) {
6106 if (!strcmp(name, list->name)) {
6107 list->cfg.tee_kafka_config_file = value_ptr;
6108 changes++;
6109 break;
6110 }
6111 }
6112 }
6113
6114 return changes;
6115 }
6116
parse_time(char * filename,char * value,int * mu,int * howmany)6117 void parse_time(char *filename, char *value, int *mu, int *howmany)
6118 {
6119 int k, j, len;
6120
6121 *mu = 0;
6122 *howmany = 0;
6123
6124 len = strlen(value);
6125 for (j = 0; j < len; j++) {
6126 if (!isdigit(value[j])) {
6127 if (value[j] == 's') *mu = COUNT_SECONDLY;
6128 else if (value[j] == 'm') *mu = COUNT_MINUTELY;
6129 else if (value[j] == 'h') *mu = COUNT_HOURLY;
6130 else if (value[j] == 'd') *mu = COUNT_DAILY;
6131 else if (value[j] == 'w') *mu = COUNT_WEEKLY;
6132 else if (value[j] == 'M') *mu = COUNT_MONTHLY;
6133 else {
6134 Log(LOG_WARNING, "WARN: [%s] Ignoring unknown time measuring unit: '%c'.\n", filename, value[j]);
6135 *mu = 0;
6136 *howmany = 0;
6137 return;
6138 }
6139 if (*mu) {
6140 value[j] = '\0';
6141 break;
6142 }
6143 }
6144 }
6145
6146 /* if no measurement unit given, assume it's seconds */
6147 if (!(*mu)) *mu = COUNT_SECONDLY;
6148
6149 k = atoi(value);
6150 if (k > 0) {
6151 if (*mu == COUNT_SECONDLY) {
6152 if (k % 60) {
6153 Log(LOG_WARNING, "WARN: [%s] Ignoring invalid time value: %d (residual secs afters conversion in mins)\n", filename, k);
6154 goto exit_lane;
6155 }
6156 else {
6157 k = k / 60;
6158 *mu = COUNT_MINUTELY;
6159 }
6160 }
6161 *howmany = k;
6162 }
6163 else {
6164 Log(LOG_WARNING, "WARN: [%s] Ignoring invalid time value: %d (not greater than zero)\n", filename, k);
6165 goto exit_lane;
6166 }
6167
6168 return;
6169
6170 exit_lane:
6171 *mu = 0;
6172 *howmany = 0;
6173 }
6174
cfg_key_uacctd_group(char * filename,char * name,char * value_ptr)6175 int cfg_key_uacctd_group(char *filename, char *name, char *value_ptr)
6176 {
6177 struct plugins_list_entry *list = plugins_list;
6178 int value, changes = 0;
6179
6180 value = atoi(value_ptr);
6181 if (value < 0 || value > 65535) return ERR;
6182
6183 for (; list; list = list->next, changes++) list->cfg.uacctd_group = value;
6184 return changes;
6185 }
6186
cfg_key_uacctd_nl_size(char * filename,char * name,char * value_ptr)6187 int cfg_key_uacctd_nl_size(char *filename, char *name, char *value_ptr)
6188 {
6189 struct plugins_list_entry *list = plugins_list;
6190 int value, changes = 0;
6191
6192 value = atoi(value_ptr);
6193
6194 for (; list; list = list->next, changes++) list->cfg.uacctd_nl_size = value;
6195 return changes;
6196 }
6197
cfg_key_uacctd_threshold(char * filename,char * name,char * value_ptr)6198 int cfg_key_uacctd_threshold(char *filename, char *name, char *value_ptr)
6199 {
6200 struct plugins_list_entry *list = plugins_list;
6201 int value, changes = 0;
6202
6203 value = atoi(value_ptr);
6204
6205 for (; list; list = list->next, changes++) list->cfg.uacctd_threshold = value;
6206 return changes;
6207 }
6208
cfg_key_tunnel_0(char * filename,char * name,char * value_ptr)6209 int cfg_key_tunnel_0(char *filename, char *name, char *value_ptr)
6210 {
6211 struct plugins_list_entry *list = plugins_list;
6212 int changes = 0;
6213
6214 trim_all_spaces(value_ptr);
6215
6216 for (; list; list = list->next, changes++) list->cfg.tunnel0 = value_ptr;
6217 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'tunnel_0'. Globalized.\n", filename);
6218
6219 return changes;
6220 }
6221
6222 #if defined WITH_GEOIP
cfg_key_geoip_ipv4_file(char * filename,char * name,char * value_ptr)6223 int cfg_key_geoip_ipv4_file(char *filename, char *name, char *value_ptr)
6224 {
6225 struct plugins_list_entry *list = plugins_list;
6226 int changes = 0;
6227
6228 for (; list; list = list->next, changes++) list->cfg.geoip_ipv4_file = value_ptr;
6229 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'geoip_ipv4_file'. Globalized.\n", filename);
6230
6231 return changes;
6232 }
6233
cfg_key_geoip_ipv6_file(char * filename,char * name,char * value_ptr)6234 int cfg_key_geoip_ipv6_file(char *filename, char *name, char *value_ptr)
6235 {
6236 struct plugins_list_entry *list = plugins_list;
6237 int changes = 0;
6238
6239 for (; list; list = list->next, changes++) list->cfg.geoip_ipv6_file = value_ptr;
6240 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'geoip_ipv6_file'. Globalized.\n", filename);
6241
6242 return changes;
6243 }
6244 #endif
6245
6246 #if defined WITH_GEOIPV2
cfg_key_geoipv2_file(char * filename,char * name,char * value_ptr)6247 int cfg_key_geoipv2_file(char *filename, char *name, char *value_ptr)
6248 {
6249 struct plugins_list_entry *list = plugins_list;
6250 int changes = 0;
6251
6252 for (; list; list = list->next, changes++) list->cfg.geoipv2_file = value_ptr;
6253 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'geoipv2_file'. Globalized.\n", filename);
6254
6255 return changes;
6256 }
6257 #endif
6258
cfg_set_aggregate(char * filename,u_int64_t registry[],u_int64_t input,char * token)6259 void cfg_set_aggregate(char *filename, u_int64_t registry[], u_int64_t input, char *token)
6260 {
6261 u_int64_t index = (input >> COUNT_REGISTRY_BITS) & COUNT_INDEX_MASK;
6262 u_int64_t value = (input & COUNT_REGISTRY_MASK);
6263
6264 if (registry[index] & value) {
6265 Log(LOG_ERR, "ERROR: [%s] '%s' repeated in 'aggregate' or invalid 0x%llx bit code.\n", filename, token, (unsigned long long)input);
6266 exit(1);
6267 }
6268 else registry[index] |= value;
6269 }
6270
cfg_key_bgp_daemon_msglog_file(char * filename,char * name,char * value_ptr)6271 int cfg_key_bgp_daemon_msglog_file(char *filename, char *name, char *value_ptr)
6272 {
6273 struct plugins_list_entry *list = plugins_list;
6274 int changes = 0;
6275
6276 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_file = value_ptr;
6277 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_file'. Globalized.\n", filename);
6278
6279 return changes;
6280 }
6281
cfg_key_bgp_daemon_msglog_avro_schema_file(char * filename,char * name,char * value_ptr)6282 int cfg_key_bgp_daemon_msglog_avro_schema_file(char *filename, char *name, char *value_ptr)
6283 {
6284 struct plugins_list_entry *list = plugins_list;
6285 int changes = 0;
6286
6287 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_avro_schema_file = value_ptr;
6288 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_avro_schema_file'. Globalized.\n", filename);
6289
6290 return changes;
6291 }
6292
cfg_key_bgp_daemon_msglog_output(char * filename,char * name,char * value_ptr)6293 int cfg_key_bgp_daemon_msglog_output(char *filename, char *name, char *value_ptr)
6294 {
6295 struct plugins_list_entry *list = plugins_list;
6296 int value, changes = 0;
6297
6298 lower_string(value_ptr);
6299 if (!strcmp(value_ptr, "json")) {
6300 #ifdef WITH_JANSSON
6301 value = PRINT_OUTPUT_JSON;
6302 #else
6303 value = PRINT_OUTPUT_JSON;
6304 Log(LOG_WARNING, "WARN: [%s] bgp_daemon_msglog_output set to json but will produce no output (missing --enable-jansson).\n", filename);
6305 #endif
6306 }
6307 else if (!strcmp(value_ptr, "avro") || !strcmp(value_ptr, "avro_bin")) {
6308 #ifdef WITH_AVRO
6309 value = PRINT_OUTPUT_AVRO_BIN;
6310 #else
6311 value = PRINT_OUTPUT_AVRO_BIN;
6312 Log(LOG_WARNING, "WARN: [%s] bgp_daemon_msglog_output set to avro but will produce no output (missing --enable-avro).\n", filename);
6313 #endif
6314 }
6315 else if (!strcmp(value_ptr, "avro_json")) {
6316 #ifdef WITH_AVRO
6317 value = PRINT_OUTPUT_AVRO_JSON;
6318 #else
6319 value = PRINT_OUTPUT_AVRO_JSON;
6320 Log(LOG_WARNING, "WARN: [%s] bgp_daemon_msglog_output set to avro but will produce no output (missing --enable-avro).\n", filename);
6321 #endif
6322 }
6323 else {
6324 Log(LOG_WARNING, "WARN: [%s] Invalid bgp_daemon_msglog_output value '%s'\n", filename, value_ptr);
6325 return ERR;
6326 }
6327
6328 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_output = value;
6329 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_output'. Globalized.\n", filename);
6330
6331 return changes;
6332 }
6333
cfg_key_bgp_daemon_msglog_amqp_host(char * filename,char * name,char * value_ptr)6334 int cfg_key_bgp_daemon_msglog_amqp_host(char *filename, char *name, char *value_ptr)
6335 {
6336 struct plugins_list_entry *list = plugins_list;
6337 int changes = 0;
6338
6339 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_host = value_ptr;
6340 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_host'. Globalized.\n", filename);
6341
6342 return changes;
6343 }
6344
cfg_key_bgp_daemon_msglog_amqp_vhost(char * filename,char * name,char * value_ptr)6345 int cfg_key_bgp_daemon_msglog_amqp_vhost(char *filename, char *name, char *value_ptr)
6346 {
6347 struct plugins_list_entry *list = plugins_list;
6348 int changes = 0;
6349
6350 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_vhost = value_ptr;
6351 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_vhost'. Globalized.\n", filename);
6352
6353 return changes;
6354 }
6355
cfg_key_bgp_daemon_msglog_amqp_user(char * filename,char * name,char * value_ptr)6356 int cfg_key_bgp_daemon_msglog_amqp_user(char *filename, char *name, char *value_ptr)
6357 {
6358 struct plugins_list_entry *list = plugins_list;
6359 int changes = 0;
6360
6361 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_user = value_ptr;
6362 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_user'. Globalized.\n", filename);
6363
6364 return changes;
6365 }
6366
cfg_key_bgp_daemon_msglog_amqp_passwd(char * filename,char * name,char * value_ptr)6367 int cfg_key_bgp_daemon_msglog_amqp_passwd(char *filename, char *name, char *value_ptr)
6368 {
6369 struct plugins_list_entry *list = plugins_list;
6370 int changes = 0;
6371
6372 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_passwd = value_ptr;
6373 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_passwd'. Globalized.\n", filename);
6374
6375 return changes;
6376 }
6377
cfg_key_bgp_daemon_msglog_amqp_exchange(char * filename,char * name,char * value_ptr)6378 int cfg_key_bgp_daemon_msglog_amqp_exchange(char *filename, char *name, char *value_ptr)
6379 {
6380 struct plugins_list_entry *list = plugins_list;
6381 int changes = 0;
6382
6383 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_exchange = value_ptr;
6384 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_exchange'. Globalized.\n", filename);
6385
6386 return changes;
6387 }
6388
cfg_key_bgp_daemon_msglog_amqp_exchange_type(char * filename,char * name,char * value_ptr)6389 int cfg_key_bgp_daemon_msglog_amqp_exchange_type(char *filename, char *name, char *value_ptr)
6390 {
6391 struct plugins_list_entry *list = plugins_list;
6392 int changes = 0;
6393
6394 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_exchange_type = value_ptr;
6395 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_exchange_type'. Globalized.\n", filename);
6396
6397 return changes;
6398 }
6399
cfg_key_bgp_daemon_msglog_amqp_routing_key(char * filename,char * name,char * value_ptr)6400 int cfg_key_bgp_daemon_msglog_amqp_routing_key(char *filename, char *name, char *value_ptr)
6401 {
6402 struct plugins_list_entry *list = plugins_list;
6403 int changes = 0;
6404
6405 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_routing_key = value_ptr;
6406 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_routing_key'. Globalized.\n", filename);
6407
6408 return changes;
6409 }
6410
cfg_key_bgp_daemon_msglog_amqp_routing_key_rr(char * filename,char * name,char * value_ptr)6411 int cfg_key_bgp_daemon_msglog_amqp_routing_key_rr(char *filename, char *name, char *value_ptr)
6412 {
6413 struct plugins_list_entry *list = plugins_list;
6414 int changes = 0, value = 0;
6415
6416 value = atoi(value_ptr);
6417 if (value < 0) {
6418 Log(LOG_WARNING, "WARN: [%s] 'bgp_daemon_msglog_amqp_routing_key_rr' has to be >= 0.\n", filename);
6419 return ERR;
6420 }
6421
6422 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_routing_key_rr = value;
6423 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_routing_key_rr'. Globalized.\n", filename);
6424
6425 return changes;
6426 }
6427
cfg_key_bgp_daemon_msglog_amqp_persistent_msg(char * filename,char * name,char * value_ptr)6428 int cfg_key_bgp_daemon_msglog_amqp_persistent_msg(char *filename, char *name, char *value_ptr)
6429 {
6430 struct plugins_list_entry *list = plugins_list;
6431 int value, changes = 0;
6432
6433 value = parse_truefalse(value_ptr);
6434 if (value < 0) return ERR;
6435
6436 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_persistent_msg = value;
6437 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_persistent_msg'. Globalized.\n", filename);
6438
6439 return changes;
6440 }
6441
cfg_key_bgp_daemon_msglog_amqp_frame_max(char * filename,char * name,char * value_ptr)6442 int cfg_key_bgp_daemon_msglog_amqp_frame_max(char *filename, char *name, char *value_ptr)
6443 {
6444 struct plugins_list_entry *list = plugins_list;
6445 u_int32_t value, changes = 0;
6446 char *endptr;
6447
6448 value = strtoul(value_ptr, &endptr, 10);
6449 if (value <= 0) {
6450 Log(LOG_WARNING, "WARN: [%s] 'bgp_daemon_msglog_amqp_frame_max' has to be > 0.\n", filename);
6451 return ERR;
6452 }
6453
6454 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_frame_max = value;
6455 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_frame_max'. Globalized.\n", filename);
6456
6457 return changes;
6458 }
6459
cfg_key_bgp_daemon_msglog_amqp_heartbeat_interval(char * filename,char * name,char * value_ptr)6460 int cfg_key_bgp_daemon_msglog_amqp_heartbeat_interval(char *filename, char *name, char *value_ptr)
6461 {
6462 struct plugins_list_entry *list = plugins_list;
6463 u_int32_t value, changes = 0;
6464 char *endptr;
6465
6466 value = strtoul(value_ptr, &endptr, 10);
6467
6468 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_heartbeat_interval = value;
6469 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_heartbeat_interval'. Globalized.\n", filename);
6470
6471 return changes;
6472 }
6473
cfg_key_bgp_daemon_msglog_amqp_retry(char * filename,char * name,char * value_ptr)6474 int cfg_key_bgp_daemon_msglog_amqp_retry(char *filename, char *name, char *value_ptr)
6475 {
6476 struct plugins_list_entry *list = plugins_list;
6477 int value, changes = 0;
6478
6479 value = atoi(value_ptr);
6480 if (value <= 0) {
6481 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_msglog_amqp_retry' has to be > 0.\n", filename);
6482 return ERR;
6483 }
6484
6485 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_amqp_retry = value;
6486 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_amqp_retry'. Globalized.\n", filename);
6487
6488 return changes;
6489 }
6490
cfg_key_bgp_daemon_table_dump_file(char * filename,char * name,char * value_ptr)6491 int cfg_key_bgp_daemon_table_dump_file(char *filename, char *name, char *value_ptr)
6492 {
6493 struct plugins_list_entry *list = plugins_list;
6494 int changes = 0;
6495
6496 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_file = value_ptr;
6497 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_file'. Globalized.\n", filename);
6498
6499 return changes;
6500 }
6501
cfg_key_bgp_daemon_table_dump_latest_file(char * filename,char * name,char * value_ptr)6502 int cfg_key_bgp_daemon_table_dump_latest_file(char *filename, char *name, char *value_ptr)
6503 {
6504 struct plugins_list_entry *list = plugins_list;
6505 int changes = 0;
6506
6507 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_latest_file = value_ptr;
6508 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_latest_file'. Globalized.\n", filename);
6509
6510 return changes;
6511 }
6512
cfg_key_bgp_daemon_table_dump_avro_schema_file(char * filename,char * name,char * value_ptr)6513 int cfg_key_bgp_daemon_table_dump_avro_schema_file(char *filename, char *name, char *value_ptr)
6514 {
6515 struct plugins_list_entry *list = plugins_list;
6516 int changes = 0;
6517
6518 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_avro_schema_file = value_ptr;
6519 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_avro_schema_file'. Globalized.\n", filename);
6520
6521 return changes;
6522 }
6523
cfg_key_bgp_daemon_table_dump_output(char * filename,char * name,char * value_ptr)6524 int cfg_key_bgp_daemon_table_dump_output(char *filename, char *name, char *value_ptr)
6525 {
6526 struct plugins_list_entry *list = plugins_list;
6527 int value, changes = 0;
6528
6529 lower_string(value_ptr);
6530 if (!strcmp(value_ptr, "json")) {
6531 #ifdef WITH_JANSSON
6532 value = PRINT_OUTPUT_JSON;
6533 #else
6534 value = PRINT_OUTPUT_JSON;
6535 Log(LOG_WARNING, "WARN: [%s] bgp_table_dump_output set to json but will produce no output (missing --enable-jansson).\n", filename);
6536 #endif
6537 }
6538 else if (!strcmp(value_ptr, "avro") || !strcmp(value_ptr, "avro_bin")) {
6539 #ifdef WITH_AVRO
6540 value = PRINT_OUTPUT_AVRO_BIN;
6541 #else
6542 value = PRINT_OUTPUT_AVRO_BIN;
6543 Log(LOG_WARNING, "WARN: [%s] bgp_table_dump_output set to avro but will produce no output (missing --enable-avro).\n", filename);
6544 #endif
6545 }
6546 else if (!strcmp(value_ptr, "avro_json")) {
6547 #ifdef WITH_AVRO
6548 value = PRINT_OUTPUT_AVRO_JSON;
6549 #else
6550 value = PRINT_OUTPUT_AVRO_JSON;
6551 Log(LOG_WARNING, "WARN: [%s] bgp_table_dump_output set to avro but will produce no output (missing --enable-avro).\n", filename);
6552 #endif
6553 }
6554 else {
6555 Log(LOG_WARNING, "WARN: [%s] Invalid bgp_table_dump_output value '%s'\n", filename, value_ptr);
6556 return ERR;
6557 }
6558
6559 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_output = value;
6560 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_output'. Globalized.\n", filename);
6561
6562 return changes;
6563 }
6564
cfg_key_bgp_daemon_table_dump_refresh_time(char * filename,char * name,char * value_ptr)6565 int cfg_key_bgp_daemon_table_dump_refresh_time(char *filename, char *name, char *value_ptr)
6566 {
6567 struct plugins_list_entry *list = plugins_list;
6568 int value, changes = 0, i, len = strlen(value_ptr);
6569
6570 for (i = 0; i < len; i++) {
6571 if (!isdigit(value_ptr[i]) && !isspace(value_ptr[i])) {
6572 Log(LOG_ERR, "WARN: [%s] 'bgp_table_dump_refresh_time' is expected in secs but contains non-digit chars: '%c'\n", filename, value_ptr[i]);
6573 return ERR;
6574 }
6575 }
6576
6577 value = atoi(value_ptr);
6578 if (value < 60 || value > 86400) {
6579 Log(LOG_ERR, "WARN: [%s] 'bgp_table_dump_refresh_time' value has to be >= 60 and <= 86400 secs.\n", filename);
6580 return ERR;
6581 }
6582
6583 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_refresh_time = value;
6584 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_refresh_time'. Globalized.\n", filename);
6585
6586 return changes;
6587 }
6588
cfg_key_bgp_daemon_table_dump_amqp_host(char * filename,char * name,char * value_ptr)6589 int cfg_key_bgp_daemon_table_dump_amqp_host(char *filename, char *name, char *value_ptr)
6590 {
6591 struct plugins_list_entry *list = plugins_list;
6592 int changes = 0;
6593
6594 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_amqp_host = value_ptr;
6595 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_amqp_host'. Globalized.\n", filename);
6596
6597 return changes;
6598 }
6599
cfg_key_bgp_daemon_table_dump_amqp_vhost(char * filename,char * name,char * value_ptr)6600 int cfg_key_bgp_daemon_table_dump_amqp_vhost(char *filename, char *name, char *value_ptr)
6601 {
6602 struct plugins_list_entry *list = plugins_list;
6603 int changes = 0;
6604
6605 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_amqp_vhost = value_ptr;
6606 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_amqp_vhost'. Globalized.\n", filename);
6607
6608 return changes;
6609 }
6610
cfg_key_bgp_daemon_table_dump_amqp_user(char * filename,char * name,char * value_ptr)6611 int cfg_key_bgp_daemon_table_dump_amqp_user(char *filename, char *name, char *value_ptr)
6612 {
6613 struct plugins_list_entry *list = plugins_list;
6614 int changes = 0;
6615
6616 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_amqp_user = value_ptr;
6617 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_amqp_user'. Globalized.\n", filename);
6618
6619 return changes;
6620 }
6621
cfg_key_bgp_daemon_table_dump_amqp_passwd(char * filename,char * name,char * value_ptr)6622 int cfg_key_bgp_daemon_table_dump_amqp_passwd(char *filename, char *name, char *value_ptr)
6623 {
6624 struct plugins_list_entry *list = plugins_list;
6625 int changes = 0;
6626
6627 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_amqp_passwd = value_ptr;
6628 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_amqp_passwd'. Globalized.\n", filename);
6629
6630 return changes;
6631 }
6632
cfg_key_bgp_daemon_table_dump_amqp_exchange(char * filename,char * name,char * value_ptr)6633 int cfg_key_bgp_daemon_table_dump_amqp_exchange(char *filename, char *name, char *value_ptr)
6634 {
6635 struct plugins_list_entry *list = plugins_list;
6636 int changes = 0;
6637
6638 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_amqp_exchange = value_ptr;
6639 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_amqp_exchange'. Globalized.\n", filename);
6640
6641 return changes;
6642 }
6643
cfg_key_bgp_daemon_table_dump_amqp_exchange_type(char * filename,char * name,char * value_ptr)6644 int cfg_key_bgp_daemon_table_dump_amqp_exchange_type(char *filename, char *name, char *value_ptr)
6645 {
6646 struct plugins_list_entry *list = plugins_list;
6647 int changes = 0;
6648
6649 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_amqp_exchange_type = value_ptr;
6650 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_amqp_exchange_type'. Globalized.\n", filename);
6651
6652 return changes;
6653 }
6654
cfg_key_bgp_daemon_table_dump_amqp_routing_key(char * filename,char * name,char * value_ptr)6655 int cfg_key_bgp_daemon_table_dump_amqp_routing_key(char *filename, char *name, char *value_ptr)
6656 {
6657 struct plugins_list_entry *list = plugins_list;
6658 int changes = 0;
6659
6660 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_amqp_routing_key = value_ptr;
6661 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_amqp_routing_key'. Globalized.\n", filename);
6662
6663 return changes;
6664 }
6665
cfg_key_bgp_daemon_table_dump_amqp_routing_key_rr(char * filename,char * name,char * value_ptr)6666 int cfg_key_bgp_daemon_table_dump_amqp_routing_key_rr(char *filename, char *name, char *value_ptr)
6667 {
6668 struct plugins_list_entry *list = plugins_list;
6669 int changes = 0, value = 0;
6670
6671 value = atoi(value_ptr);
6672 if (value < 0) {
6673 Log(LOG_WARNING, "WARN: [%s] 'bgp_table_dump_amqp_routing_key_rr' has to be >= 0.\n", filename);
6674 return ERR;
6675 }
6676
6677 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_amqp_routing_key_rr = value;
6678 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_amqp_routing_key_rr'. Globalized.\n", filename);
6679
6680 return changes;
6681 }
6682
cfg_key_bgp_daemon_table_dump_amqp_persistent_msg(char * filename,char * name,char * value_ptr)6683 int cfg_key_bgp_daemon_table_dump_amqp_persistent_msg(char *filename, char *name, char *value_ptr)
6684 {
6685 struct plugins_list_entry *list = plugins_list;
6686 int value, changes = 0;
6687
6688 value = parse_truefalse(value_ptr);
6689 if (value < 0) return ERR;
6690
6691 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_amqp_persistent_msg = value;
6692 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_amqp_persistent_msg'. Globalized.\n", filename);
6693
6694 return changes;
6695 }
6696
cfg_key_bgp_daemon_table_dump_amqp_frame_max(char * filename,char * name,char * value_ptr)6697 int cfg_key_bgp_daemon_table_dump_amqp_frame_max(char *filename, char *name, char *value_ptr)
6698 {
6699 struct plugins_list_entry *list = plugins_list;
6700 u_int32_t value, changes = 0;
6701 char *endptr;
6702
6703 value = strtoul(value_ptr, &endptr, 10);
6704 if (value <= 0) {
6705 Log(LOG_WARNING, "WARN: [%s] 'bgp_table_dump_amqp_frame_max' has to be > 0.\n", filename);
6706 return ERR;
6707 }
6708
6709 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_amqp_frame_max = value;
6710 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_amqp_frame_max'. Globalized.\n", filename);
6711
6712 return changes;
6713 }
6714
cfg_key_bgp_daemon_table_dump_amqp_heartbeat_interval(char * filename,char * name,char * value_ptr)6715 int cfg_key_bgp_daemon_table_dump_amqp_heartbeat_interval(char *filename, char *name, char *value_ptr)
6716 {
6717 struct plugins_list_entry *list = plugins_list;
6718 u_int32_t value, changes = 0;
6719 char *endptr;
6720
6721 value = strtoul(value_ptr, &endptr, 10);
6722
6723 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_amqp_heartbeat_interval = value;
6724 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_amqp_heartbeat_interval'. Globalized.\n", filename);
6725
6726 return changes;
6727 }
6728
cfg_key_bgp_daemon_msglog_kafka_broker_host(char * filename,char * name,char * value_ptr)6729 int cfg_key_bgp_daemon_msglog_kafka_broker_host(char *filename, char *name, char *value_ptr)
6730 {
6731 struct plugins_list_entry *list = plugins_list;
6732 int changes = 0;
6733
6734 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_kafka_broker_host = value_ptr;
6735 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_kafka_broker_host'. Globalized.\n", filename);
6736
6737 return changes;
6738 }
6739
cfg_key_bgp_daemon_msglog_kafka_broker_port(char * filename,char * name,char * value_ptr)6740 int cfg_key_bgp_daemon_msglog_kafka_broker_port(char *filename, char *name, char *value_ptr)
6741 {
6742 struct plugins_list_entry *list = plugins_list;
6743 int value, changes = 0;
6744
6745 value = atoi(value_ptr);
6746 if ((value <= 0) || (value > 65535)) {
6747 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_msglog_kafka_broker_port' has to be in the range 1-65535.\n", filename);
6748 return ERR;
6749 }
6750
6751 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_kafka_broker_port = value;
6752 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_kafka_broker_port'. Globalized.\n", filename);
6753
6754 return changes;
6755 }
6756
cfg_key_bgp_daemon_msglog_kafka_topic(char * filename,char * name,char * value_ptr)6757 int cfg_key_bgp_daemon_msglog_kafka_topic(char *filename, char *name, char *value_ptr)
6758 {
6759 struct plugins_list_entry *list = plugins_list;
6760 int changes = 0;
6761
6762 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_kafka_topic = value_ptr;
6763 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_kafka_topic'. Globalized.\n", filename);
6764
6765 return changes;
6766 }
6767
cfg_key_bgp_daemon_msglog_kafka_topic_rr(char * filename,char * name,char * value_ptr)6768 int cfg_key_bgp_daemon_msglog_kafka_topic_rr(char *filename, char *name, char *value_ptr)
6769 {
6770 struct plugins_list_entry *list = plugins_list;
6771 int changes = 0, value = 0;
6772
6773 value = atoi(value_ptr);
6774 if (value < 0) {
6775 Log(LOG_WARNING, "WARN: [%s] 'bgp_daemon_msglog_kafka_topic_rr' has to be >= 0.\n", filename);
6776 return ERR;
6777 }
6778
6779 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_kafka_topic_rr = value;
6780 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_kafka_topic_rr'. Globalized.\n", filename);
6781
6782 return changes;
6783 }
6784
cfg_key_bgp_daemon_msglog_kafka_partition(char * filename,char * name,char * value_ptr)6785 int cfg_key_bgp_daemon_msglog_kafka_partition(char *filename, char *name, char *value_ptr)
6786 {
6787 struct plugins_list_entry *list = plugins_list;
6788 int value, changes = 0;
6789
6790 value = atoi(value_ptr);
6791 if (value < -1) {
6792 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_msglog_kafka_partition' has to be >= -1.\n", filename);
6793 return ERR;
6794 }
6795
6796 if (!value) value = FALSE_NONZERO;
6797
6798 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_kafka_partition = value;
6799 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_kafka_partition'. Globalized.\n", filename);
6800
6801 return changes;
6802 }
6803
cfg_key_bgp_daemon_msglog_kafka_partition_key(char * filename,char * name,char * value_ptr)6804 int cfg_key_bgp_daemon_msglog_kafka_partition_key(char *filename, char *name, char *value_ptr)
6805 {
6806 struct plugins_list_entry *list = plugins_list;
6807 int value_len, changes = 0;
6808
6809 value_len = strlen(value_ptr);
6810
6811 for (; list; list = list->next, changes++) {
6812 list->cfg.bgp_daemon_msglog_kafka_partition_key = value_ptr;
6813 list->cfg.bgp_daemon_msglog_kafka_partition_keylen = value_len;
6814 }
6815 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_kafka_partition_key'. Globalized.\n", filename);
6816
6817 return changes;
6818 }
6819
cfg_key_bgp_daemon_msglog_kafka_retry(char * filename,char * name,char * value_ptr)6820 int cfg_key_bgp_daemon_msglog_kafka_retry(char *filename, char *name, char *value_ptr)
6821 {
6822 struct plugins_list_entry *list = plugins_list;
6823 int value, changes = 0;
6824
6825 value = atoi(value_ptr);
6826 if (value <= 0) {
6827 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_msglog_kafka_retry' has to be > 0.\n", filename);
6828 return ERR;
6829 }
6830
6831 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_kafka_retry = value;
6832 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_kafka_retry'. Globalized.\n", filename);
6833
6834 return changes;
6835 }
6836
cfg_key_bgp_daemon_msglog_kafka_config_file(char * filename,char * name,char * value_ptr)6837 int cfg_key_bgp_daemon_msglog_kafka_config_file(char *filename, char *name, char *value_ptr)
6838 {
6839 struct plugins_list_entry *list = plugins_list;
6840 int changes = 0;
6841
6842 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_kafka_config_file = value_ptr;
6843 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_kafka_config_file'. Globalized.\n", filename);
6844
6845 return changes;
6846 }
6847
cfg_key_bgp_daemon_msglog_kafka_avro_schema_registry(char * filename,char * name,char * value_ptr)6848 int cfg_key_bgp_daemon_msglog_kafka_avro_schema_registry(char *filename, char *name, char *value_ptr)
6849 {
6850 struct plugins_list_entry *list = plugins_list;
6851 int changes = 0;
6852
6853 for (; list; list = list->next, changes++) list->cfg.bgp_daemon_msglog_kafka_avro_schema_registry = value_ptr;
6854 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_daemon_msglog_kafka_avro_schema_registry'. Globalized.\n", filename);
6855
6856 return changes;
6857 }
6858
cfg_key_bgp_daemon_table_dump_kafka_broker_host(char * filename,char * name,char * value_ptr)6859 int cfg_key_bgp_daemon_table_dump_kafka_broker_host(char *filename, char *name, char *value_ptr)
6860 {
6861 struct plugins_list_entry *list = plugins_list;
6862 int changes = 0;
6863
6864 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_kafka_broker_host = value_ptr;
6865 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_kafka_broker_host'. Globalized.\n", filename);
6866
6867 return changes;
6868 }
6869
cfg_key_bgp_daemon_table_dump_kafka_broker_port(char * filename,char * name,char * value_ptr)6870 int cfg_key_bgp_daemon_table_dump_kafka_broker_port(char *filename, char *name, char *value_ptr)
6871 {
6872 struct plugins_list_entry *list = plugins_list;
6873 int value, changes = 0;
6874
6875 value = atoi(value_ptr);
6876 if ((value <= 0) || (value > 65535)) {
6877 Log(LOG_ERR, "WARN: [%s] 'bgp_daemon_msglog_kafka_broker_port' has to be in the range 1-65535.\n", filename);
6878 return ERR;
6879 }
6880
6881 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_kafka_broker_port = value;
6882 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_kafka_broker_port'. Globalized.\n", filename);
6883
6884 return changes;
6885 }
6886
cfg_key_bgp_daemon_table_dump_kafka_topic(char * filename,char * name,char * value_ptr)6887 int cfg_key_bgp_daemon_table_dump_kafka_topic(char *filename, char *name, char *value_ptr)
6888 {
6889 struct plugins_list_entry *list = plugins_list;
6890 int changes = 0;
6891
6892 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_kafka_topic = value_ptr;
6893 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_kafka_topic'. Globalized.\n", filename);
6894
6895 return changes;
6896 }
6897
cfg_key_bgp_daemon_table_dump_kafka_topic_rr(char * filename,char * name,char * value_ptr)6898 int cfg_key_bgp_daemon_table_dump_kafka_topic_rr(char *filename, char *name, char *value_ptr)
6899 {
6900 struct plugins_list_entry *list = plugins_list;
6901 int changes = 0, value = 0;
6902
6903 value = atoi(value_ptr);
6904 if (value < 0) {
6905 Log(LOG_WARNING, "WARN: [%s] 'bgp_table_dump_kafka_topic_rr' has to be >= 0.\n", filename);
6906 return ERR;
6907 }
6908
6909 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_kafka_topic_rr = value;
6910 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_kafka_topic_rr'. Globalized.\n", filename);
6911
6912 return changes;
6913 }
6914
cfg_key_bgp_daemon_table_dump_kafka_partition(char * filename,char * name,char * value_ptr)6915 int cfg_key_bgp_daemon_table_dump_kafka_partition(char *filename, char *name, char *value_ptr)
6916 {
6917 struct plugins_list_entry *list = plugins_list;
6918 int value, changes = 0;
6919
6920 value = atoi(value_ptr);
6921 if (value < -1) {
6922 Log(LOG_ERR, "WARN: [%s] 'bgp_table_dump_kafka_partition' has to be >= -1.\n", filename);
6923 return ERR;
6924 }
6925
6926 if (!value) value = FALSE_NONZERO;
6927
6928 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_kafka_partition = value;
6929 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_kafka_partition'. Globalized.\n", filename);
6930
6931 return changes;
6932 }
6933
cfg_key_bgp_daemon_table_dump_kafka_partition_key(char * filename,char * name,char * value_ptr)6934 int cfg_key_bgp_daemon_table_dump_kafka_partition_key(char *filename, char *name, char *value_ptr)
6935 {
6936 struct plugins_list_entry *list = plugins_list;
6937 int value_len, changes = 0;
6938
6939 value_len = strlen(value_ptr);
6940
6941 for (; list; list = list->next, changes++) {
6942 list->cfg.bgp_table_dump_kafka_partition_key = value_ptr;
6943 list->cfg.bgp_table_dump_kafka_partition_keylen = value_len;
6944 }
6945 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_kafka_partition_key'. Globalized.\n", filename);
6946
6947 return changes;
6948 }
6949
cfg_key_bgp_daemon_table_dump_kafka_config_file(char * filename,char * name,char * value_ptr)6950 int cfg_key_bgp_daemon_table_dump_kafka_config_file(char *filename, char *name, char *value_ptr)
6951 {
6952 struct plugins_list_entry *list = plugins_list;
6953 int changes = 0;
6954
6955 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_kafka_config_file = value_ptr;
6956 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_kafka_config_file'. Globalized.\n", filename);
6957
6958 return changes;
6959 }
6960
cfg_key_bgp_daemon_table_dump_kafka_avro_schema_registry(char * filename,char * name,char * value_ptr)6961 int cfg_key_bgp_daemon_table_dump_kafka_avro_schema_registry(char *filename, char *name, char *value_ptr)
6962 {
6963 struct plugins_list_entry *list = plugins_list;
6964 int changes = 0;
6965
6966 for (; list; list = list->next, changes++) list->cfg.bgp_table_dump_kafka_avro_schema_registry = value_ptr;
6967 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bgp_table_dump_kafka_avro_schema_registry'. Globalized.\n", filename);
6968
6969 return changes;
6970 }
6971
cfg_key_bmp_daemon_msglog_kafka_broker_host(char * filename,char * name,char * value_ptr)6972 int cfg_key_bmp_daemon_msglog_kafka_broker_host(char *filename, char *name, char *value_ptr)
6973 {
6974 struct plugins_list_entry *list = plugins_list;
6975 int changes = 0;
6976
6977 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_kafka_broker_host = value_ptr;
6978 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_kafka_broker_host'. Globalized.\n", filename);
6979
6980 return changes;
6981 }
6982
cfg_key_bmp_daemon_msglog_kafka_broker_port(char * filename,char * name,char * value_ptr)6983 int cfg_key_bmp_daemon_msglog_kafka_broker_port(char *filename, char *name, char *value_ptr)
6984 {
6985 struct plugins_list_entry *list = plugins_list;
6986 int value, changes = 0;
6987
6988 value = atoi(value_ptr);
6989 if ((value <= 0) || (value > 65535)) {
6990 Log(LOG_ERR, "WARN: [%s] 'bmp_daemon_msglog_kafka_broker_port' has to be in the range 1-65535.\n", filename);
6991 return ERR;
6992 }
6993
6994 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_kafka_broker_port = value;
6995 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_kafka_broker_port'. Globalized.\n", filename);
6996
6997 return changes;
6998 }
6999
cfg_key_bmp_daemon_msglog_kafka_topic(char * filename,char * name,char * value_ptr)7000 int cfg_key_bmp_daemon_msglog_kafka_topic(char *filename, char *name, char *value_ptr)
7001 {
7002 struct plugins_list_entry *list = plugins_list;
7003 int changes = 0;
7004
7005 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_kafka_topic = value_ptr;
7006 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_kafka_topic'. Globalized.\n", filename);
7007
7008 return changes;
7009 }
7010
cfg_key_bmp_daemon_msglog_kafka_topic_rr(char * filename,char * name,char * value_ptr)7011 int cfg_key_bmp_daemon_msglog_kafka_topic_rr(char *filename, char *name, char *value_ptr)
7012 {
7013 struct plugins_list_entry *list = plugins_list;
7014 int changes = 0, value = 0;
7015
7016 value = atoi(value_ptr);
7017 if (value < 0) {
7018 Log(LOG_WARNING, "WARN: [%s] 'bmp_daemon_msglog_kafka_topic_rr' has to be >= 0.\n", filename);
7019 return ERR;
7020 }
7021
7022 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_kafka_topic_rr = value;
7023 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_kafka_topic_rr'. Globalized.\n", filename);
7024
7025 return changes;
7026 }
7027
cfg_key_bmp_daemon_msglog_kafka_partition(char * filename,char * name,char * value_ptr)7028 int cfg_key_bmp_daemon_msglog_kafka_partition(char *filename, char *name, char *value_ptr)
7029 {
7030 struct plugins_list_entry *list = plugins_list;
7031 int value, changes = 0;
7032
7033 value = atoi(value_ptr);
7034 if (value < -1) {
7035 Log(LOG_ERR, "WARN: [%s] 'bmp_daemon_msglog_kafka_partition' has to be >= -1.\n", filename);
7036 return ERR;
7037 }
7038
7039 if (!value) value = FALSE_NONZERO;
7040
7041 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_kafka_partition = value;
7042 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_kafka_partition'. Globalized.\n", filename);
7043
7044 return changes;
7045 }
7046
cfg_key_bmp_daemon_msglog_kafka_partition_key(char * filename,char * name,char * value_ptr)7047 int cfg_key_bmp_daemon_msglog_kafka_partition_key(char *filename, char *name, char *value_ptr)
7048 {
7049 struct plugins_list_entry *list = plugins_list;
7050 int value_len, changes = 0;
7051
7052 value_len = strlen(value_ptr);
7053
7054 for (; list; list = list->next, changes++) {
7055 list->cfg.bmp_daemon_msglog_kafka_partition_key = value_ptr;
7056 list->cfg.bmp_daemon_msglog_kafka_partition_keylen = value_len;
7057 }
7058 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_kafka_partition_key'. Globalized.\n", filename);
7059
7060 return changes;
7061 }
7062
cfg_key_bmp_daemon_msglog_kafka_retry(char * filename,char * name,char * value_ptr)7063 int cfg_key_bmp_daemon_msglog_kafka_retry(char *filename, char *name, char *value_ptr)
7064 {
7065 struct plugins_list_entry *list = plugins_list;
7066 int value, changes = 0;
7067
7068 value = atoi(value_ptr);
7069 if (value <= 0) {
7070 Log(LOG_ERR, "WARN: [%s] 'bmp_daemon_msglog_kafka_retry' has to be > 0.\n", filename);
7071 return ERR;
7072 }
7073
7074 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_kafka_retry = value;
7075 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_kafka_retry'. Globalized.\n", filename);
7076
7077 return changes;
7078 }
7079
cfg_key_bmp_daemon_msglog_kafka_config_file(char * filename,char * name,char * value_ptr)7080 int cfg_key_bmp_daemon_msglog_kafka_config_file(char *filename, char *name, char *value_ptr)
7081 {
7082 struct plugins_list_entry *list = plugins_list;
7083 int changes = 0;
7084
7085 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_kafka_config_file = value_ptr;
7086 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_kafka_config_file'. Globalized.\n", filename);
7087
7088 return changes;
7089 }
7090
cfg_key_bmp_daemon_msglog_kafka_avro_schema_registry(char * filename,char * name,char * value_ptr)7091 int cfg_key_bmp_daemon_msglog_kafka_avro_schema_registry(char *filename, char *name, char *value_ptr)
7092 {
7093 struct plugins_list_entry *list = plugins_list;
7094 int changes = 0;
7095
7096 for (; list; list = list->next, changes++) list->cfg.bmp_daemon_msglog_kafka_avro_schema_registry = value_ptr;
7097 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_daemon_msglog_kafka_avro_schema_registry'. Globalized.\n", filename);
7098
7099 return changes;
7100 }
7101
cfg_key_bmp_daemon_dump_kafka_broker_host(char * filename,char * name,char * value_ptr)7102 int cfg_key_bmp_daemon_dump_kafka_broker_host(char *filename, char *name, char *value_ptr)
7103 {
7104 struct plugins_list_entry *list = plugins_list;
7105 int changes = 0;
7106
7107 for (; list; list = list->next, changes++) list->cfg.bmp_dump_kafka_broker_host = value_ptr;
7108 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_kafka_broker_host'. Globalized.\n", filename);
7109
7110 return changes;
7111 }
7112
cfg_key_bmp_daemon_dump_kafka_broker_port(char * filename,char * name,char * value_ptr)7113 int cfg_key_bmp_daemon_dump_kafka_broker_port(char *filename, char *name, char *value_ptr)
7114 {
7115 struct plugins_list_entry *list = plugins_list;
7116 int value, changes = 0;
7117
7118 value = atoi(value_ptr);
7119 if ((value <= 0) || (value > 65535)) {
7120 Log(LOG_ERR, "WARN: [%s] 'bmp_daemon_msglog_kafka_broker_port' has to be in the range 1-65535.\n", filename);
7121 return ERR;
7122 }
7123
7124 for (; list; list = list->next, changes++) list->cfg.bmp_dump_kafka_broker_port = value;
7125 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_kafka_broker_port'. Globalized.\n", filename);
7126
7127 return changes;
7128 }
7129
cfg_key_bmp_daemon_dump_kafka_topic(char * filename,char * name,char * value_ptr)7130 int cfg_key_bmp_daemon_dump_kafka_topic(char *filename, char *name, char *value_ptr)
7131 {
7132 struct plugins_list_entry *list = plugins_list;
7133 int changes = 0;
7134
7135 for (; list; list = list->next, changes++) list->cfg.bmp_dump_kafka_topic = value_ptr;
7136 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_kafka_topic'. Globalized.\n", filename);
7137
7138 return changes;
7139 }
7140
cfg_key_bmp_daemon_dump_kafka_topic_rr(char * filename,char * name,char * value_ptr)7141 int cfg_key_bmp_daemon_dump_kafka_topic_rr(char *filename, char *name, char *value_ptr)
7142 {
7143 struct plugins_list_entry *list = plugins_list;
7144 int changes = 0, value = 0;
7145
7146 value = atoi(value_ptr);
7147 if (value < 0) {
7148 Log(LOG_WARNING, "WARN: [%s] 'bmp_dump_kafka_topic_rr' has to be >= 0.\n", filename);
7149 return ERR;
7150 }
7151
7152 for (; list; list = list->next, changes++) list->cfg.bmp_dump_kafka_topic_rr = value;
7153 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_kafka_topic_rr'. Globalized.\n", filename);
7154
7155 return changes;
7156 }
7157
cfg_key_bmp_daemon_dump_kafka_partition(char * filename,char * name,char * value_ptr)7158 int cfg_key_bmp_daemon_dump_kafka_partition(char *filename, char *name, char *value_ptr)
7159 {
7160 struct plugins_list_entry *list = plugins_list;
7161 int value, changes = 0;
7162
7163 value = atoi(value_ptr);
7164 if (value < -1) {
7165 Log(LOG_ERR, "WARN: [%s] 'bmp_dump_kafka_partition' has to be >= -1.\n", filename);
7166 return ERR;
7167 }
7168
7169 if (!value) value = FALSE_NONZERO;
7170
7171 for (; list; list = list->next, changes++) list->cfg.bmp_dump_kafka_partition = value;
7172 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_kafka_partition'. Globalized.\n", filename);
7173
7174 return changes;
7175 }
7176
cfg_key_bmp_daemon_dump_kafka_partition_key(char * filename,char * name,char * value_ptr)7177 int cfg_key_bmp_daemon_dump_kafka_partition_key(char *filename, char *name, char *value_ptr)
7178 {
7179 struct plugins_list_entry *list = plugins_list;
7180 int value_len, changes = 0;
7181
7182 value_len = strlen(value_ptr);
7183
7184 for (; list; list = list->next, changes++) {
7185 list->cfg.bmp_dump_kafka_partition_key = value_ptr;
7186 list->cfg.bmp_dump_kafka_partition_keylen = value_len;
7187 }
7188 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_kafka_partition_key'. Globalized.\n", filename);
7189
7190 return changes;
7191 }
7192
cfg_key_bmp_daemon_dump_kafka_config_file(char * filename,char * name,char * value_ptr)7193 int cfg_key_bmp_daemon_dump_kafka_config_file(char *filename, char *name, char *value_ptr)
7194 {
7195 struct plugins_list_entry *list = plugins_list;
7196 int changes = 0;
7197
7198 for (; list; list = list->next, changes++) list->cfg.bmp_dump_kafka_config_file = value_ptr;
7199 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_kafka_config_file'. Globalized.\n", filename);
7200
7201 return changes;
7202 }
7203
cfg_key_bmp_daemon_dump_kafka_avro_schema_registry(char * filename,char * name,char * value_ptr)7204 int cfg_key_bmp_daemon_dump_kafka_avro_schema_registry(char *filename, char *name, char *value_ptr)
7205 {
7206 struct plugins_list_entry *list = plugins_list;
7207 int changes = 0;
7208
7209 for (; list; list = list->next, changes++) list->cfg.bmp_dump_kafka_avro_schema_registry = value_ptr;
7210 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'bmp_dump_kafka_avro_schema_registry'. Globalized.\n", filename);
7211
7212 return changes;
7213 }
7214
cfg_key_tmp_asa_bi_flow(char * filename,char * name,char * value_ptr)7215 int cfg_key_tmp_asa_bi_flow(char *filename, char *name, char *value_ptr)
7216 {
7217 struct plugins_list_entry *list = plugins_list;
7218 int value, changes = 0;
7219
7220 value = parse_truefalse(value_ptr);
7221 if (value < 0) return ERR;
7222
7223 if (!name) for (; list; list = list->next, changes++) list->cfg.tmp_asa_bi_flow = value;
7224 else {
7225 for (; list; list = list->next) {
7226 if (!strcmp(name, list->name)) {
7227 list->cfg.tmp_asa_bi_flow = value;
7228 changes++;
7229 break;
7230 }
7231 }
7232 }
7233
7234 return changes;
7235 }
7236
cfg_key_tmp_bgp_lookup_compare_ports(char * filename,char * name,char * value_ptr)7237 int cfg_key_tmp_bgp_lookup_compare_ports(char *filename, char *name, char *value_ptr)
7238 {
7239 struct plugins_list_entry *list = plugins_list;
7240 int value, changes = 0;
7241
7242 value = parse_truefalse(value_ptr);
7243 if (value < 0) return ERR;
7244
7245 for (; list; list = list->next, changes++) list->cfg.tmp_bgp_lookup_compare_ports = value;
7246 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'tmp_bgp_lookup_compare_ports'. Globalized.\n", filename);
7247
7248 return changes;
7249 }
7250
cfg_key_tmp_bgp_daemon_route_refresh(char * filename,char * name,char * value_ptr)7251 int cfg_key_tmp_bgp_daemon_route_refresh(char *filename, char *name, char *value_ptr)
7252 {
7253 struct plugins_list_entry *list = plugins_list;
7254 int value, changes = 0;
7255
7256 value = parse_truefalse(value_ptr);
7257 if (value < 0) return ERR;
7258
7259 for (; list; list = list->next, changes++) list->cfg.tmp_bgp_daemon_route_refresh = value;
7260 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'tmp_bgp_daemon_route_refresh'. Globalized.\n", filename);
7261
7262 return changes;
7263 }
7264
cfg_key_thread_stack(char * filename,char * name,char * value_ptr)7265 int cfg_key_thread_stack(char *filename, char *name, char *value_ptr)
7266 {
7267 struct plugins_list_entry *list = plugins_list;
7268 int value, changes = 0;
7269
7270 value = atoi(value_ptr);
7271 if (value <= 0) {
7272 Log(LOG_ERR, "WARN: [%s] 'thread_stack' has to be > 0.\n", filename);
7273 return ERR;
7274 }
7275
7276 for (; list; list = list->next, changes++) list->cfg.thread_stack = value;
7277 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'thread_stack'. Globalized.\n", filename);
7278
7279 return changes;
7280 }
7281
cfg_key_telemetry_daemon(char * filename,char * name,char * value_ptr)7282 int cfg_key_telemetry_daemon(char *filename, char *name, char *value_ptr)
7283 {
7284 struct plugins_list_entry *list = plugins_list;
7285 int value, changes = 0;
7286
7287 value = parse_truefalse(value_ptr);
7288 if (value < 0) return ERR;
7289
7290 for (; list; list = list->next, changes++) list->cfg.telemetry_daemon = value;
7291 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon'. Globalized.\n", filename);
7292
7293 return changes;
7294 }
7295
cfg_key_telemetry_port_tcp(char * filename,char * name,char * value_ptr)7296 int cfg_key_telemetry_port_tcp(char *filename, char *name, char *value_ptr)
7297 {
7298 struct plugins_list_entry *list = plugins_list;
7299 int value, changes = 0;
7300
7301 value = atoi(value_ptr);
7302 if ((value <= 0) || (value > 65535)) {
7303 Log(LOG_ERR, "WARN: [%s] 'telemetry_daemon_port_tcp' has to be in the range 1-65535.\n", filename);
7304 return ERR;
7305 }
7306
7307 for (; list; list = list->next, changes++) list->cfg.telemetry_port_tcp = value;
7308 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_port_tcp'. Globalized.\n", filename);
7309
7310 return changes;
7311 }
7312
cfg_key_telemetry_port_udp(char * filename,char * name,char * value_ptr)7313 int cfg_key_telemetry_port_udp(char *filename, char *name, char *value_ptr)
7314 {
7315 struct plugins_list_entry *list = plugins_list;
7316 int value, changes = 0;
7317
7318 value = atoi(value_ptr);
7319 if ((value <= 0) || (value > 65535)) {
7320 Log(LOG_ERR, "WARN: [%s] 'telemetry_daemon_port_udp' has to be in the range 1-65535.\n", filename);
7321 return ERR;
7322 }
7323
7324 for (; list; list = list->next, changes++) list->cfg.telemetry_port_udp = value;
7325 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_port_udp'. Globalized.\n", filename);
7326
7327 return changes;
7328 }
7329
cfg_key_telemetry_ip(char * filename,char * name,char * value_ptr)7330 int cfg_key_telemetry_ip(char *filename, char *name, char *value_ptr)
7331 {
7332 struct plugins_list_entry *list = plugins_list;
7333 int changes = 0;
7334
7335 for (; list; list = list->next, changes++) list->cfg.telemetry_ip = value_ptr;
7336 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_ip'. Globalized.\n", filename);
7337
7338 return changes;
7339 }
7340
cfg_key_telemetry_zmq_address(char * filename,char * name,char * value_ptr)7341 int cfg_key_telemetry_zmq_address(char *filename, char *name, char *value_ptr)
7342 {
7343 struct plugins_list_entry *list = plugins_list;
7344 int changes = 0;
7345
7346 for (; list; list = list->next, changes++) list->cfg.telemetry_zmq_address = value_ptr;
7347 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_zmq_address'. Globalized.\n", filename);
7348
7349 return changes;
7350 }
7351
cfg_key_telemetry_kafka_broker_host(char * filename,char * name,char * value_ptr)7352 int cfg_key_telemetry_kafka_broker_host(char *filename, char *name, char *value_ptr)
7353 {
7354 struct plugins_list_entry *list = plugins_list;
7355 int changes = 0;
7356
7357 for (; list; list = list->next, changes++) list->cfg.telemetry_kafka_broker_host = value_ptr;
7358 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_kafka_broker_host'. Globalized.\n", filename);
7359
7360 return changes;
7361 }
7362
cfg_key_telemetry_kafka_broker_port(char * filename,char * name,char * value_ptr)7363 int cfg_key_telemetry_kafka_broker_port(char *filename, char *name, char *value_ptr)
7364 {
7365 struct plugins_list_entry *list = plugins_list;
7366 int value, changes = 0;
7367
7368 value = atoi(value_ptr);
7369 if ((value <= 0) || (value > 65535)) {
7370 Log(LOG_ERR, "WARN: [%s] 'telemetry_kafka_broker_port' has to be in the range 1-65535.\n", filename);
7371 return ERR;
7372 }
7373
7374 for (; list; list = list->next, changes++) list->cfg.telemetry_kafka_broker_port = value;
7375 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_kafka_broker_port'. Globalized.\n", filename);
7376
7377 return changes;
7378 }
7379
cfg_key_telemetry_kafka_topic(char * filename,char * name,char * value_ptr)7380 int cfg_key_telemetry_kafka_topic(char *filename, char *name, char *value_ptr)
7381 {
7382 struct plugins_list_entry *list = plugins_list;
7383 int changes = 0;
7384
7385 for (; list; list = list->next, changes++) list->cfg.telemetry_kafka_topic = value_ptr;
7386 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_kafka_topic'. Globalized.\n", filename);
7387
7388 return changes;
7389 }
7390
cfg_key_telemetry_kafka_config_file(char * filename,char * name,char * value_ptr)7391 int cfg_key_telemetry_kafka_config_file(char *filename, char *name, char *value_ptr)
7392 {
7393 struct plugins_list_entry *list = plugins_list;
7394 int changes = 0;
7395
7396 for (; list; list = list->next, changes++) list->cfg.telemetry_kafka_config_file = value_ptr;
7397 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_kafka_config_file'. Globalized.\n", filename);
7398
7399 return changes;
7400 }
cfg_key_telemetry_decoder(char * filename,char * name,char * value_ptr)7401 int cfg_key_telemetry_decoder(char *filename, char *name, char *value_ptr)
7402 {
7403 struct plugins_list_entry *list = plugins_list;
7404 int changes = 0;
7405
7406 for (; list; list = list->next, changes++) list->cfg.telemetry_decoder = value_ptr;
7407 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_decoder'. Globalized.\n", filename);
7408
7409 return changes;
7410 }
7411
cfg_key_telemetry_allow_file(char * filename,char * name,char * value_ptr)7412 int cfg_key_telemetry_allow_file(char *filename, char *name, char *value_ptr)
7413 {
7414 struct plugins_list_entry *list = plugins_list;
7415 int changes = 0;
7416
7417 for (; list; list = list->next, changes++) list->cfg.telemetry_allow_file = value_ptr;
7418 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_allow_file'. Globalized.\n", filename);
7419
7420 return changes;
7421 }
7422
cfg_key_telemetry_pipe_size(char * filename,char * name,char * value_ptr)7423 int cfg_key_telemetry_pipe_size(char *filename, char *name, char *value_ptr)
7424 {
7425 struct plugins_list_entry *list = plugins_list;
7426 u_int64_t value, changes = 0;
7427 char *endptr;
7428
7429 value = strtoull(value_ptr, &endptr, 10);
7430 if (!value || value > INT_MAX) {
7431 Log(LOG_WARNING, "WARN: [%s] 'telemetry_daemon_pipe_size' has to be > 0 and <= INT_MAX.\n", filename);
7432 return ERR;
7433 }
7434
7435 for (; list; list = list->next, changes++) list->cfg.telemetry_pipe_size = value;
7436 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_pipe_size'. Globalized.\n", filename);
7437
7438 return changes;
7439 }
7440
cfg_key_telemetry_ip_precedence(char * filename,char * name,char * value_ptr)7441 int cfg_key_telemetry_ip_precedence(char *filename, char *name, char *value_ptr)
7442 {
7443 struct plugins_list_entry *list = plugins_list;
7444 int value, changes = 0;
7445
7446 value = atoi(value_ptr);
7447 if ((value < 0) || (value > 7)) {
7448 Log(LOG_ERR, "WARN: [%s] 'telemetry_daemon_ipprec' has to be in the range 0-7.\n", filename);
7449 return ERR;
7450 }
7451
7452 for (; list; list = list->next, changes++) list->cfg.telemetry_ipprec = value;
7453 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_ipprec'. Globalized.\n", filename);
7454
7455 return changes;
7456 }
7457
cfg_key_telemetry_max_peers(char * filename,char * name,char * value_ptr)7458 int cfg_key_telemetry_max_peers(char *filename, char *name, char *value_ptr)
7459 {
7460 struct plugins_list_entry *list = plugins_list;
7461 int value, changes = 0;
7462
7463 value = atoi(value_ptr);
7464 if (value < 1) {
7465 Log(LOG_ERR, "WARN: [%s] 'telemetry_daemon_max_peers' has to be >= 1.\n", filename);
7466 return ERR;
7467 }
7468
7469 for (; list; list = list->next, changes++) list->cfg.telemetry_max_peers = value;
7470 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_max_peers'. Globalized.\n", filename);
7471
7472 return changes;
7473 }
7474
cfg_key_telemetry_peer_timeout(char * filename,char * name,char * value_ptr)7475 int cfg_key_telemetry_peer_timeout(char *filename, char *name, char *value_ptr)
7476 {
7477 struct plugins_list_entry *list = plugins_list;
7478 int value, changes = 0;
7479
7480 value = atoi(value_ptr);
7481 if (value < 60) {
7482 Log(LOG_ERR, "WARN: [%s] 'telemetry_daemon_peer_timeout' has to be >= 60.\n", filename);
7483 return ERR;
7484 }
7485
7486 for (; list; list = list->next, changes++) list->cfg.telemetry_peer_timeout = value;
7487 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_peer_timeout'. Globalized.\n", filename);
7488
7489 return changes;
7490 }
7491
cfg_key_telemetry_msglog_file(char * filename,char * name,char * value_ptr)7492 int cfg_key_telemetry_msglog_file(char *filename, char *name, char *value_ptr)
7493 {
7494 struct plugins_list_entry *list = plugins_list;
7495 int changes = 0;
7496
7497 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_file = value_ptr;
7498 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_file'. Globalized.\n", filename);
7499
7500 return changes;
7501 }
7502
cfg_key_telemetry_msglog_output(char * filename,char * name,char * value_ptr)7503 int cfg_key_telemetry_msglog_output(char *filename, char *name, char *value_ptr)
7504 {
7505 struct plugins_list_entry *list = plugins_list;
7506 int value, changes = 0;
7507
7508 lower_string(value_ptr);
7509 if (!strcmp(value_ptr, "json")) {
7510 #ifdef WITH_JANSSON
7511 value = PRINT_OUTPUT_JSON;
7512 #else
7513 value = PRINT_OUTPUT_JSON;
7514 Log(LOG_WARNING, "WARN: [%s] telemetry_daemon_msglog_output set to json but will produce no output (missing --enable-jansson).\n", filename);
7515 #endif
7516 }
7517 else {
7518 Log(LOG_WARNING, "WARN: [%s] Invalid telemetry_daemon_msglog_output value '%s'\n", filename, value_ptr);
7519 return ERR;
7520 }
7521
7522 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_output = value;
7523 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_output'. Globalized.\n", filename);
7524
7525 return changes;
7526 }
7527
cfg_key_telemetry_msglog_amqp_host(char * filename,char * name,char * value_ptr)7528 int cfg_key_telemetry_msglog_amqp_host(char *filename, char *name, char *value_ptr)
7529 {
7530 struct plugins_list_entry *list = plugins_list;
7531 int changes = 0;
7532
7533 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_host = value_ptr;
7534 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_host'. Globalized.\n", filename);
7535
7536 return changes;
7537 }
7538
cfg_key_telemetry_msglog_amqp_vhost(char * filename,char * name,char * value_ptr)7539 int cfg_key_telemetry_msglog_amqp_vhost(char *filename, char *name, char *value_ptr)
7540 {
7541 struct plugins_list_entry *list = plugins_list;
7542 int changes = 0;
7543
7544 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_vhost = value_ptr;
7545 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_vhost'. Globalized.\n", filename);
7546
7547 return changes;
7548 }
7549
cfg_key_telemetry_msglog_amqp_user(char * filename,char * name,char * value_ptr)7550 int cfg_key_telemetry_msglog_amqp_user(char *filename, char *name, char *value_ptr)
7551 {
7552 struct plugins_list_entry *list = plugins_list;
7553 int changes = 0;
7554
7555 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_user = value_ptr;
7556 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_user'. Globalized.\n", filename);
7557
7558 return changes;
7559 }
7560
cfg_key_telemetry_msglog_amqp_passwd(char * filename,char * name,char * value_ptr)7561 int cfg_key_telemetry_msglog_amqp_passwd(char *filename, char *name, char *value_ptr)
7562 {
7563 struct plugins_list_entry *list = plugins_list;
7564 int changes = 0;
7565
7566 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_passwd = value_ptr;
7567 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_passwd'. Globalized.\n", filename);
7568
7569 return changes;
7570 }
7571
cfg_key_telemetry_msglog_amqp_exchange(char * filename,char * name,char * value_ptr)7572 int cfg_key_telemetry_msglog_amqp_exchange(char *filename, char *name, char *value_ptr)
7573 {
7574 struct plugins_list_entry *list = plugins_list;
7575 int changes = 0;
7576
7577 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_exchange = value_ptr;
7578 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_exchange'. Globalized.\n", filename);
7579
7580 return changes;
7581 }
7582
cfg_key_telemetry_msglog_amqp_exchange_type(char * filename,char * name,char * value_ptr)7583 int cfg_key_telemetry_msglog_amqp_exchange_type(char *filename, char *name, char *value_ptr)
7584 {
7585 struct plugins_list_entry *list = plugins_list;
7586 int changes = 0;
7587
7588 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_exchange_type = value_ptr;
7589 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_exchange_type'. Globalized.\n", filename);
7590
7591 return changes;
7592 }
7593
cfg_key_telemetry_msglog_amqp_routing_key(char * filename,char * name,char * value_ptr)7594 int cfg_key_telemetry_msglog_amqp_routing_key(char *filename, char *name, char *value_ptr)
7595 {
7596 struct plugins_list_entry *list = plugins_list;
7597 int changes = 0;
7598
7599 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_routing_key = value_ptr;
7600 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_routing_key'. Globalized.\n", filename);
7601
7602 return changes;
7603 }
7604
cfg_key_telemetry_msglog_amqp_routing_key_rr(char * filename,char * name,char * value_ptr)7605 int cfg_key_telemetry_msglog_amqp_routing_key_rr(char *filename, char *name, char *value_ptr)
7606 {
7607 struct plugins_list_entry *list = plugins_list;
7608 int changes = 0, value = 0;
7609
7610 value = atoi(value_ptr);
7611 if (value < 0) {
7612 Log(LOG_WARNING, "WARN: [%s] 'telemetry_daemon_msglog_amqp_routing_key_rr' has to be >= 0.\n", filename);
7613 return ERR;
7614 }
7615
7616 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_routing_key_rr = value;
7617 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_routing_key_rr'. Globalized.\n", filename);
7618
7619 return changes;
7620 }
7621
cfg_key_telemetry_msglog_amqp_persistent_msg(char * filename,char * name,char * value_ptr)7622 int cfg_key_telemetry_msglog_amqp_persistent_msg(char *filename, char *name, char *value_ptr)
7623 {
7624 struct plugins_list_entry *list = plugins_list;
7625 int value, changes = 0;
7626
7627 value = parse_truefalse(value_ptr);
7628 if (value < 0) return ERR;
7629
7630 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_persistent_msg = value;
7631 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_persistent_msg'. Globalized.\n", filename);
7632
7633 return changes;
7634 }
7635
cfg_key_telemetry_msglog_amqp_frame_max(char * filename,char * name,char * value_ptr)7636 int cfg_key_telemetry_msglog_amqp_frame_max(char *filename, char *name, char *value_ptr)
7637 {
7638 struct plugins_list_entry *list = plugins_list;
7639 u_int32_t value, changes = 0;
7640 char *endptr;
7641
7642 value = strtoul(value_ptr, &endptr, 10);
7643 if (value <= 0) {
7644 Log(LOG_WARNING, "WARN: [%s] 'telemetry_daemon_msglog_amqp_frame_max' has to be > 0.\n", filename);
7645 return ERR;
7646 }
7647
7648 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_frame_max = value;
7649 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_frame_max'. Globalized.\n", filename);
7650
7651 return changes;
7652 }
7653
cfg_key_telemetry_msglog_amqp_heartbeat_interval(char * filename,char * name,char * value_ptr)7654 int cfg_key_telemetry_msglog_amqp_heartbeat_interval(char *filename, char *name, char *value_ptr)
7655 {
7656 struct plugins_list_entry *list = plugins_list;
7657 u_int32_t value, changes = 0;
7658 char *endptr;
7659
7660 value = strtoul(value_ptr, &endptr, 10);
7661
7662 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_heartbeat_interval = value;
7663 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_heartbeat_interval'. Globalized.\n", filename);
7664
7665 return changes;
7666 }
7667
cfg_key_telemetry_msglog_amqp_retry(char * filename,char * name,char * value_ptr)7668 int cfg_key_telemetry_msglog_amqp_retry(char *filename, char *name, char *value_ptr)
7669 {
7670 struct plugins_list_entry *list = plugins_list;
7671 int value, changes = 0;
7672
7673 value = atoi(value_ptr);
7674 if (value <= 0) {
7675 Log(LOG_ERR, "WARN: [%s] 'telemetry_daemon_msglog_amqp_retry' has to be > 0.\n", filename);
7676 return ERR;
7677 }
7678
7679 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_amqp_retry = value;
7680 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_amqp_retry'. Globalized.\n", filename);
7681
7682 return changes;
7683 }
7684
cfg_key_telemetry_dump_file(char * filename,char * name,char * value_ptr)7685 int cfg_key_telemetry_dump_file(char *filename, char *name, char *value_ptr)
7686 {
7687 struct plugins_list_entry *list = plugins_list;
7688 int changes = 0;
7689
7690 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_file = value_ptr;
7691 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_file'. Globalized.\n", filename);
7692
7693 return changes;
7694 }
7695
cfg_key_telemetry_dump_latest_file(char * filename,char * name,char * value_ptr)7696 int cfg_key_telemetry_dump_latest_file(char *filename, char *name, char *value_ptr)
7697 {
7698 struct plugins_list_entry *list = plugins_list;
7699 int changes = 0;
7700
7701 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_latest_file = value_ptr;
7702 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_latest_file'. Globalized.\n", filename);
7703
7704 return changes;
7705 }
7706
cfg_key_telemetry_dump_output(char * filename,char * name,char * value_ptr)7707 int cfg_key_telemetry_dump_output(char *filename, char *name, char *value_ptr)
7708 {
7709 struct plugins_list_entry *list = plugins_list;
7710 int value, changes = 0;
7711
7712 lower_string(value_ptr);
7713 if (!strcmp(value_ptr, "json")) {
7714 #ifdef WITH_JANSSON
7715 value = PRINT_OUTPUT_JSON;
7716 #else
7717 value = PRINT_OUTPUT_JSON;
7718 Log(LOG_WARNING, "WARN: [%s] telemetry_dump_output set to json but will produce no output (missing --enable-jansson).\n", filename);
7719 #endif
7720 }
7721 else {
7722 Log(LOG_WARNING, "WARN: [%s] Invalid telemetry_dump_output value '%s'\n", filename, value_ptr);
7723 return ERR;
7724 }
7725
7726 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_output = value;
7727 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_output'. Globalized.\n", filename);
7728
7729 return changes;
7730 }
7731
cfg_key_telemetry_dump_refresh_time(char * filename,char * name,char * value_ptr)7732 int cfg_key_telemetry_dump_refresh_time(char *filename, char *name, char *value_ptr)
7733 {
7734 struct plugins_list_entry *list = plugins_list;
7735 int value, changes = 0, i, len = strlen(value_ptr);
7736
7737 for (i = 0; i < len; i++) {
7738 if (!isdigit(value_ptr[i]) && !isspace(value_ptr[i])) {
7739 Log(LOG_ERR, "WARN: [%s] 'telemetry_dump_refresh_time' is expected in secs but contains non-digit chars: '%c'\n", filename, value_ptr[i]);
7740 return ERR;
7741 }
7742 }
7743
7744 value = atoi(value_ptr);
7745 if (value < 10 || value > 86400) {
7746 Log(LOG_ERR, "WARN: [%s] 'telemetry_dump_refresh_time' value has to be >= 10 and <= 86400 secs.\n", filename);
7747 return ERR;
7748 }
7749
7750 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_refresh_time = value;
7751 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_refresh_time'. Globalized.\n", filename);
7752
7753 return changes;
7754 }
7755
cfg_key_telemetry_dump_amqp_host(char * filename,char * name,char * value_ptr)7756 int cfg_key_telemetry_dump_amqp_host(char *filename, char *name, char *value_ptr)
7757 {
7758 struct plugins_list_entry *list = plugins_list;
7759 int changes = 0;
7760
7761 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_amqp_host = value_ptr;
7762 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_amqp_host'. Globalized.\n", filename);
7763
7764 return changes;
7765 }
7766
cfg_key_telemetry_dump_amqp_vhost(char * filename,char * name,char * value_ptr)7767 int cfg_key_telemetry_dump_amqp_vhost(char *filename, char *name, char *value_ptr)
7768 {
7769 struct plugins_list_entry *list = plugins_list;
7770 int changes = 0;
7771
7772 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_amqp_vhost = value_ptr;
7773 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_amqp_vhost'. Globalized.\n", filename);
7774
7775 return changes;
7776 }
7777
cfg_key_telemetry_dump_amqp_user(char * filename,char * name,char * value_ptr)7778 int cfg_key_telemetry_dump_amqp_user(char *filename, char *name, char *value_ptr)
7779 {
7780 struct plugins_list_entry *list = plugins_list;
7781 int changes = 0;
7782
7783 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_amqp_user = value_ptr;
7784 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_amqp_user'. Globalized.\n", filename);
7785
7786 return changes;
7787 }
7788
cfg_key_telemetry_dump_amqp_passwd(char * filename,char * name,char * value_ptr)7789 int cfg_key_telemetry_dump_amqp_passwd(char *filename, char *name, char *value_ptr)
7790 {
7791 struct plugins_list_entry *list = plugins_list;
7792 int changes = 0;
7793
7794 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_amqp_passwd = value_ptr;
7795 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_amqp_passwd'. Globalized.\n", filename);
7796
7797 return changes;
7798 }
7799
cfg_key_telemetry_dump_amqp_exchange(char * filename,char * name,char * value_ptr)7800 int cfg_key_telemetry_dump_amqp_exchange(char *filename, char *name, char *value_ptr)
7801 {
7802 struct plugins_list_entry *list = plugins_list;
7803 int changes = 0;
7804
7805 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_amqp_exchange = value_ptr;
7806 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_amqp_exchange'. Globalized.\n", filename);
7807
7808 return changes;
7809 }
7810
cfg_key_telemetry_dump_amqp_exchange_type(char * filename,char * name,char * value_ptr)7811 int cfg_key_telemetry_dump_amqp_exchange_type(char *filename, char *name, char *value_ptr)
7812 {
7813 struct plugins_list_entry *list = plugins_list;
7814 int changes = 0;
7815
7816 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_amqp_exchange_type = value_ptr;
7817 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_amqp_exchange_type'. Globalized.\n", filename);
7818
7819 return changes;
7820 }
7821
cfg_key_telemetry_dump_amqp_routing_key(char * filename,char * name,char * value_ptr)7822 int cfg_key_telemetry_dump_amqp_routing_key(char *filename, char *name, char *value_ptr)
7823 {
7824 struct plugins_list_entry *list = plugins_list;
7825 int changes = 0;
7826
7827 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_amqp_routing_key = value_ptr;
7828 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_amqp_routing_key'. Globalized.\n", filename);
7829
7830 return changes;
7831 }
7832
cfg_key_telemetry_dump_amqp_routing_key_rr(char * filename,char * name,char * value_ptr)7833 int cfg_key_telemetry_dump_amqp_routing_key_rr(char *filename, char *name, char *value_ptr)
7834 {
7835 struct plugins_list_entry *list = plugins_list;
7836 int changes = 0, value = 0;
7837
7838 value = atoi(value_ptr);
7839 if (value < 0) {
7840 Log(LOG_WARNING, "WARN: [%s] 'telemetry_dump_amqp_routing_key_rr' has to be >= 0.\n", filename);
7841 return ERR;
7842 }
7843
7844 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_amqp_routing_key_rr = value;
7845 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_amqp_routing_key_rr'. Globalized.\n", filename);
7846
7847 return changes;
7848 }
7849
cfg_key_telemetry_dump_amqp_persistent_msg(char * filename,char * name,char * value_ptr)7850 int cfg_key_telemetry_dump_amqp_persistent_msg(char *filename, char *name, char *value_ptr)
7851 {
7852 struct plugins_list_entry *list = plugins_list;
7853 int value, changes = 0;
7854
7855 value = parse_truefalse(value_ptr);
7856 if (value < 0) return ERR;
7857
7858 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_amqp_persistent_msg = value;
7859 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_amqp_persistent_msg'. Globalized.\n", filename);
7860
7861 return changes;
7862 }
7863
cfg_key_telemetry_dump_amqp_frame_max(char * filename,char * name,char * value_ptr)7864 int cfg_key_telemetry_dump_amqp_frame_max(char *filename, char *name, char *value_ptr)
7865 {
7866 struct plugins_list_entry *list = plugins_list;
7867 u_int32_t value, changes = 0;
7868 char *endptr;
7869
7870 value = strtoul(value_ptr, &endptr, 10);
7871 if (value <= 0) {
7872 Log(LOG_WARNING, "WARN: [%s] 'telemetry_dump_amqp_frame_max' has to be > 0.\n", filename);
7873 return ERR;
7874 }
7875
7876 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_amqp_frame_max = value;
7877 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_amqp_frame_max'. Globalized.\n", filename);
7878
7879 return changes;
7880 }
7881
cfg_key_telemetry_dump_amqp_heartbeat_interval(char * filename,char * name,char * value_ptr)7882 int cfg_key_telemetry_dump_amqp_heartbeat_interval(char *filename, char *name, char *value_ptr)
7883 {
7884 struct plugins_list_entry *list = plugins_list;
7885 u_int32_t value, changes = 0;
7886 char *endptr;
7887
7888 value = strtoul(value_ptr, &endptr, 10);
7889
7890 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_amqp_heartbeat_interval = value;
7891 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_amqp_heartbeat_interval'. Globalized.\n", filename);
7892
7893 return changes;
7894 }
7895
cfg_key_telemetry_msglog_kafka_broker_host(char * filename,char * name,char * value_ptr)7896 int cfg_key_telemetry_msglog_kafka_broker_host(char *filename, char *name, char *value_ptr)
7897 {
7898 struct plugins_list_entry *list = plugins_list;
7899 int changes = 0;
7900
7901 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_kafka_broker_host = value_ptr;
7902 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_kafka_broker_host'. Globalized.\n", filename);
7903
7904 return changes;
7905 }
7906
cfg_key_telemetry_msglog_kafka_broker_port(char * filename,char * name,char * value_ptr)7907 int cfg_key_telemetry_msglog_kafka_broker_port(char *filename, char *name, char *value_ptr)
7908 {
7909 struct plugins_list_entry *list = plugins_list;
7910 int value, changes = 0;
7911
7912 value = atoi(value_ptr);
7913 if ((value <= 0) || (value > 65535)) {
7914 Log(LOG_ERR, "WARN: [%s] 'telemetry_daemon_msglog_kafka_broker_port' has to be in the range 1-65535.\n", filename);
7915 return ERR;
7916 }
7917
7918 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_kafka_broker_port = value;
7919 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_kafka_broker_port'. Globalized.\n", filename);
7920
7921 return changes;
7922 }
7923
cfg_key_telemetry_msglog_kafka_topic(char * filename,char * name,char * value_ptr)7924 int cfg_key_telemetry_msglog_kafka_topic(char *filename, char *name, char *value_ptr)
7925 {
7926 struct plugins_list_entry *list = plugins_list;
7927 int changes = 0;
7928
7929 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_kafka_topic = value_ptr;
7930 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_kafka_topic'. Globalized.\n", filename);
7931
7932 return changes;
7933 }
7934
cfg_key_telemetry_msglog_kafka_topic_rr(char * filename,char * name,char * value_ptr)7935 int cfg_key_telemetry_msglog_kafka_topic_rr(char *filename, char *name, char *value_ptr)
7936 {
7937 struct plugins_list_entry *list = plugins_list;
7938 int changes = 0, value = 0;
7939
7940 value = atoi(value_ptr);
7941 if (value < 0) {
7942 Log(LOG_WARNING, "WARN: [%s] 'telemetry_daemon_msglog_kafka_topic_rr' has to be >= 0.\n", filename);
7943 return ERR;
7944 }
7945
7946 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_kafka_topic_rr = value;
7947 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_kafka_topic_rr'. Globalized.\n", filename);
7948
7949 return changes;
7950 }
7951
cfg_key_telemetry_msglog_kafka_partition(char * filename,char * name,char * value_ptr)7952 int cfg_key_telemetry_msglog_kafka_partition(char *filename, char *name, char *value_ptr)
7953 {
7954 struct plugins_list_entry *list = plugins_list;
7955 int value, changes = 0;
7956
7957 value = atoi(value_ptr);
7958 if (value < -1) {
7959 Log(LOG_ERR, "WARN: [%s] 'telemetry_daemon_msglog_kafka_partition' has to be >= -1.\n", filename);
7960 return ERR;
7961 }
7962
7963 if (!value) value = FALSE_NONZERO;
7964
7965 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_kafka_partition = value;
7966 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_kafka_partition'. Globalized.\n", filename);
7967
7968 return changes;
7969 }
7970
cfg_key_telemetry_msglog_kafka_partition_key(char * filename,char * name,char * value_ptr)7971 int cfg_key_telemetry_msglog_kafka_partition_key(char *filename, char *name, char *value_ptr)
7972 {
7973 struct plugins_list_entry *list = plugins_list;
7974 int value_len, changes = 0;
7975
7976 value_len = strlen(value_ptr);
7977
7978 for (; list; list = list->next, changes++) {
7979 list->cfg.telemetry_msglog_kafka_partition_key = value_ptr;
7980 list->cfg.telemetry_msglog_kafka_partition_keylen = value_len;
7981 }
7982 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_kafka_partition_key'. Globalized.\n", filename);
7983
7984 return changes;
7985 }
7986
cfg_key_telemetry_msglog_kafka_retry(char * filename,char * name,char * value_ptr)7987 int cfg_key_telemetry_msglog_kafka_retry(char *filename, char *name, char *value_ptr)
7988 {
7989 struct plugins_list_entry *list = plugins_list;
7990 int value, changes = 0;
7991
7992 value = atoi(value_ptr);
7993 if (value <= 0) {
7994 Log(LOG_ERR, "WARN: [%s] 'telemetry_daemon_msglog_kafka_retry' has to be > 0.\n", filename);
7995 return ERR;
7996 }
7997
7998 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_kafka_retry = value;
7999 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_kafka_retry'. Globalized.\n", filename);
8000
8001 return changes;
8002 }
8003
cfg_key_telemetry_msglog_kafka_config_file(char * filename,char * name,char * value_ptr)8004 int cfg_key_telemetry_msglog_kafka_config_file(char *filename, char *name, char *value_ptr)
8005 {
8006 struct plugins_list_entry *list = plugins_list;
8007 int changes = 0;
8008
8009 for (; list; list = list->next, changes++) list->cfg.telemetry_msglog_kafka_config_file = value_ptr;
8010 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_daemon_msglog_kafka_config_file'. Globalized.\n", filename);
8011
8012 return changes;
8013 }
8014
cfg_key_telemetry_dump_kafka_broker_host(char * filename,char * name,char * value_ptr)8015 int cfg_key_telemetry_dump_kafka_broker_host(char *filename, char *name, char *value_ptr)
8016 {
8017 struct plugins_list_entry *list = plugins_list;
8018 int changes = 0;
8019
8020 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_kafka_broker_host = value_ptr;
8021 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_kafka_broker_host'. Globalized.\n", filename);
8022
8023 return changes;
8024 }
8025
cfg_key_telemetry_dump_kafka_broker_port(char * filename,char * name,char * value_ptr)8026 int cfg_key_telemetry_dump_kafka_broker_port(char *filename, char *name, char *value_ptr)
8027 {
8028 struct plugins_list_entry *list = plugins_list;
8029 int value, changes = 0;
8030
8031 value = atoi(value_ptr);
8032 if ((value <= 0) || (value > 65535)) {
8033 Log(LOG_ERR, "WARN: [%s] 'telemetry_daemon_msglog_kafka_broker_port' has to be in the range 1-65535.\n", filename);
8034 return ERR;
8035 }
8036
8037 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_kafka_broker_port = value;
8038 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_kafka_broker_port'. Globalized.\n", filename);
8039
8040 return changes;
8041 }
8042
cfg_key_telemetry_dump_kafka_topic(char * filename,char * name,char * value_ptr)8043 int cfg_key_telemetry_dump_kafka_topic(char *filename, char *name, char *value_ptr)
8044 {
8045 struct plugins_list_entry *list = plugins_list;
8046 int changes = 0;
8047
8048 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_kafka_topic = value_ptr;
8049 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_kafka_topic'. Globalized.\n", filename);
8050
8051 return changes;
8052 }
8053
cfg_key_telemetry_dump_kafka_topic_rr(char * filename,char * name,char * value_ptr)8054 int cfg_key_telemetry_dump_kafka_topic_rr(char *filename, char *name, char *value_ptr)
8055 {
8056 struct plugins_list_entry *list = plugins_list;
8057 int changes = 0, value = 0;
8058
8059 value = atoi(value_ptr);
8060 if (value < 0) {
8061 Log(LOG_WARNING, "WARN: [%s] 'telemetry_dump_kafka_topic_rr' has to be >= 0.\n", filename);
8062 return ERR;
8063 }
8064
8065 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_kafka_topic_rr = value;
8066 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_kafka_topic_rr'. Globalized.\n", filename);
8067
8068 return changes;
8069 }
8070
cfg_key_telemetry_dump_kafka_partition(char * filename,char * name,char * value_ptr)8071 int cfg_key_telemetry_dump_kafka_partition(char *filename, char *name, char *value_ptr)
8072 {
8073 struct plugins_list_entry *list = plugins_list;
8074 int value, changes = 0;
8075
8076 value = atoi(value_ptr);
8077 if (value < -1) {
8078 Log(LOG_ERR, "WARN: [%s] 'telemetry_dump_kafka_partition' has to be >= -1.\n", filename);
8079 return ERR;
8080 }
8081
8082 if (!value) value = FALSE_NONZERO;
8083
8084 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_kafka_partition = value;
8085 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_kafka_partition'. Globalized.\n", filename);
8086
8087 return changes;
8088 }
8089
cfg_key_telemetry_dump_kafka_partition_key(char * filename,char * name,char * value_ptr)8090 int cfg_key_telemetry_dump_kafka_partition_key(char *filename, char *name, char *value_ptr)
8091 {
8092 struct plugins_list_entry *list = plugins_list;
8093 int value_len, changes = 0;
8094
8095 value_len = strlen(value_ptr);
8096
8097 for (; list; list = list->next, changes++) {
8098 list->cfg.telemetry_dump_kafka_partition_key = value_ptr;
8099 list->cfg.telemetry_dump_kafka_partition_keylen = value_len;
8100 }
8101 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_kafka_partition_key'. Globalized.\n", filename);
8102
8103 return changes;
8104 }
8105
cfg_key_telemetry_dump_kafka_config_file(char * filename,char * name,char * value_ptr)8106 int cfg_key_telemetry_dump_kafka_config_file(char *filename, char *name, char *value_ptr)
8107 {
8108 struct plugins_list_entry *list = plugins_list;
8109 int changes = 0;
8110
8111 for (; list; list = list->next, changes++) list->cfg.telemetry_dump_kafka_config_file = value_ptr;
8112 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'telemetry_dump_kafka_config_file'. Globalized.\n", filename);
8113
8114 return changes;
8115 }
8116
cfg_key_rpki_roas_file(char * filename,char * name,char * value_ptr)8117 int cfg_key_rpki_roas_file(char *filename, char *name, char *value_ptr)
8118 {
8119 struct plugins_list_entry *list = plugins_list;
8120 int changes = 0;
8121
8122 for (; list; list = list->next, changes++) list->cfg.rpki_roas_file = value_ptr;
8123 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'rpki_roas_file'. Globalized.\n", filename);
8124
8125 return changes;
8126 }
8127
cfg_key_rpki_rtr_cache(char * filename,char * name,char * value_ptr)8128 int cfg_key_rpki_rtr_cache(char *filename, char *name, char *value_ptr)
8129 {
8130 struct plugins_list_entry *list = plugins_list;
8131 int changes = 0;
8132
8133 for (; list; list = list->next, changes++) list->cfg.rpki_rtr_cache = value_ptr;
8134 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'rpki_rtr_cache'. Globalized.\n", filename);
8135
8136 return changes;
8137 }
8138
cfg_key_rpki_rtr_cache_version(char * filename,char * name,char * value_ptr)8139 int cfg_key_rpki_rtr_cache_version(char *filename, char *name, char *value_ptr)
8140 {
8141 struct plugins_list_entry *list = plugins_list;
8142 int value, changes = 0;
8143
8144 value = atoi(value_ptr);
8145
8146 for (; list; list = list->next, changes++) list->cfg.rpki_rtr_cache_version = value;
8147 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'rpki_rtr_cache_version'. Globalized.\n", filename);
8148
8149 return changes;
8150 }
8151
cfg_key_rpki_rtr_cache_pipe_size(char * filename,char * name,char * value_ptr)8152 int cfg_key_rpki_rtr_cache_pipe_size(char *filename, char *name, char *value_ptr)
8153 {
8154 struct plugins_list_entry *list = plugins_list;
8155 u_int64_t value, changes = 0;
8156 char *endptr;
8157
8158 value = strtoull(value_ptr, &endptr, 10);
8159 if (!value || value > INT_MAX) {
8160 Log(LOG_WARNING, "WARN: [%s] 'rpki_rtr_cache_pipe_size' has to be > 0 and <= INT_MAX.\n", filename);
8161 return ERR;
8162 }
8163
8164 for (; list; list = list->next, changes++) list->cfg.rpki_rtr_cache_pipe_size = value;
8165 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'rpki_rtr_cache_pipe_size'. Globalized.\n", filename);
8166
8167 return changes;
8168 }
8169
cfg_key_rpki_rtr_cache_ip_precedence(char * filename,char * name,char * value_ptr)8170 int cfg_key_rpki_rtr_cache_ip_precedence(char *filename, char *name, char *value_ptr)
8171 {
8172 struct plugins_list_entry *list = plugins_list;
8173 int value, changes = 0;
8174
8175 value = atoi(value_ptr);
8176 if ((value < 0) || (value > 7)) {
8177 Log(LOG_ERR, "WARN: [%s] 'rpki_rtr_cache_ipprec' has to be in the range 0-7.\n", filename);
8178 return ERR;
8179 }
8180
8181 for (; list; list = list->next, changes++) list->cfg.rpki_rtr_cache_ipprec = value;
8182 if (name) Log(LOG_WARNING, "WARN: [%s] plugin name not supported for key 'rpki_rtr_cache_ipprec'. Globalized.\n", filename);
8183
8184 return changes;
8185 }
8186
cfg_key_print_output_custom_lib(char * filename,char * name,char * value_ptr)8187 int cfg_key_print_output_custom_lib(char *filename, char *name, char *value_ptr)
8188 {
8189 struct plugins_list_entry *list = plugins_list;
8190 int changes = 0;
8191
8192 if (!name) for (; list; list = list->next, changes++) list->cfg.print_output_custom_lib = value_ptr;
8193 else {
8194 for (; list; list = list->next) {
8195 if (!strcmp(name, list->name)) {
8196 list->cfg.print_output_custom_lib = value_ptr;
8197 changes++;
8198 break;
8199 }
8200 }
8201 }
8202
8203 return changes;
8204 }
8205
cfg_key_print_output_custom_cfg_file(char * filename,char * name,char * value_ptr)8206 int cfg_key_print_output_custom_cfg_file(char *filename, char *name, char *value_ptr)
8207 {
8208 struct plugins_list_entry *list = plugins_list;
8209 int changes = 0;
8210
8211 if (!name) for (; list; list = list->next, changes++) list->cfg.print_output_custom_cfg_file = value_ptr;
8212 else {
8213 for (; list; list = list->next) {
8214 if (!strcmp(name, list->name)) {
8215 list->cfg.print_output_custom_cfg_file = value_ptr;
8216 changes++;
8217 break;
8218 }
8219 }
8220 }
8221
8222 return changes;
8223 }
8224