Line data Source code
1 : /*
2 : * Copyright (c) 2018-2019 Cisco and/or its affiliates.
3 : * Licensed under the Apache License, Version 2.0 (the "License");
4 : * you may not use this
5 : * You may obtain a copy of the License at:
6 : *
7 : * http://www.apache.org/licenses/LICENSE-2.0
8 : *
9 : * Unless required by applicable law or agreed to in writing, software
10 : * distributed under the License is distributed on an "AS IS" BASIS,
11 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : * See the License for the specific language governing permissions and
13 : * limitations under the License.
14 : */
15 :
16 : #include <vcl/vcl_private.h>
17 :
18 : /* NOTE: _vppcom_main is only used until the heap is allocated.
19 : * Do not access it directly -- use vcm which will point to
20 : * the heap allocated copy after init.
21 : */
22 : vppcom_main_t _vppcom_main = {
23 : .debug = VPPCOM_DEBUG_INIT,
24 : .is_init = 0,
25 : .app_index = ~0,
26 : };
27 :
28 : vppcom_main_t *vcm = &_vppcom_main;
29 :
30 : void
31 37 : vppcom_cfg_init (vppcom_cfg_t * vcl_cfg)
32 : {
33 37 : ASSERT (vcl_cfg);
34 :
35 37 : vcl_cfg->heapsize = (256ULL << 20);
36 37 : vcl_cfg->max_workers = 16;
37 37 : vcl_cfg->segment_size = (256 << 20);
38 37 : vcl_cfg->add_segment_size = (128 << 20);
39 37 : vcl_cfg->preallocated_fifo_pairs = 8;
40 37 : vcl_cfg->rx_fifo_size = (1 << 20);
41 37 : vcl_cfg->tx_fifo_size = (1 << 20);
42 37 : vcl_cfg->event_queue_size = 2048;
43 37 : vcl_cfg->app_timeout = 10 * 60.0;
44 37 : vcl_cfg->session_timeout = 10 * 60.0;
45 37 : vcl_cfg->event_log_path = "/dev/shm";
46 37 : }
47 :
48 : #define VCFG_DBG(_lvl, _fmt, _args...) \
49 : { \
50 : if (vcm->debug > _lvl) \
51 : fprintf (stderr, _fmt "\n", ##_args); \
52 : }
53 : void
54 37 : vppcom_cfg_heapsize (char *conf_fname)
55 : {
56 37 : vppcom_cfg_t *vcl_cfg = &vcm->cfg;
57 : FILE *fp;
58 : char inbuf[4096];
59 37 : int argc = 1;
60 37 : char **argv = NULL;
61 37 : char *arg = NULL;
62 : char *p;
63 : int i;
64 : u8 *sizep;
65 : u32 size;
66 : void *vcl_mem;
67 : void *heap;
68 :
69 37 : fp = fopen (conf_fname, "r");
70 37 : if (fp == NULL)
71 : {
72 37 : VCFG_DBG (0, "VCL<%d>: using default heapsize %lu (0x%lx)",
73 : getpid (), (unsigned long) vcl_cfg->heapsize,
74 : (unsigned long) vcl_cfg->heapsize);
75 37 : goto defaulted;
76 : }
77 :
78 0 : argv = calloc (1, sizeof (char *));
79 0 : if (argv == NULL)
80 : {
81 0 : VCFG_DBG (0, "VCL<%d>: calloc failed, using default heapsize %lu"
82 : " (0x%lx)", getpid (), (unsigned long) vcl_cfg->heapsize,
83 : (unsigned long) vcl_cfg->heapsize);
84 0 : goto defaulted;
85 : }
86 :
87 : while (1)
88 : {
89 0 : if (fgets (inbuf, 4096, fp) == 0)
90 0 : break;
91 0 : p = strtok (inbuf, " \t\n");
92 0 : while (p != NULL)
93 : {
94 0 : if (*p == '#')
95 0 : break;
96 0 : argc++;
97 0 : char **tmp = realloc (argv, argc * sizeof (char *));
98 0 : if (tmp == NULL)
99 : {
100 0 : VCFG_DBG (0, "VCL<%d>: realloc failed, using default "
101 : "heapsize %lu (0x%lx)", getpid (),
102 : (unsigned long) vcl_cfg->heapsize,
103 : (unsigned long) vcl_cfg->heapsize);
104 0 : goto defaulted;
105 : }
106 0 : argv = tmp;
107 0 : arg = strndup (p, 1024);
108 0 : if (arg == NULL)
109 : {
110 0 : VCFG_DBG (0, "VCL<%d>: strndup failed, using default "
111 : "heapsize %lu (0x%lx)", getpid (),
112 : (unsigned long) vcl_cfg->heapsize,
113 : (unsigned long) vcl_cfg->heapsize);
114 0 : goto defaulted;
115 : }
116 0 : argv[argc - 1] = arg;
117 0 : p = strtok (NULL, " \t\n");
118 : }
119 : }
120 :
121 0 : fclose (fp);
122 0 : fp = NULL;
123 :
124 0 : char **tmp = realloc (argv, (argc + 1) * sizeof (char *));
125 0 : if (tmp == NULL)
126 : {
127 0 : VCFG_DBG (0, "VCL<%d>: realloc failed, using default heapsize %lu "
128 : "(0x%lx)", getpid (), (unsigned long) vcl_cfg->heapsize,
129 : (unsigned long) vcl_cfg->heapsize);
130 0 : goto defaulted;
131 : }
132 0 : argv = tmp;
133 0 : argv[argc] = NULL;
134 :
135 : /*
136 : * Look for and parse the "heapsize" config parameter.
137 : * Manual since none of the clib infra has been bootstrapped yet.
138 : *
139 : * Format: heapsize <nn>[mM][gG]
140 : */
141 :
142 0 : for (i = 1; i < (argc - 1); i++)
143 : {
144 0 : if (!strncmp (argv[i], "heapsize", 8))
145 : {
146 0 : sizep = (u8 *) argv[i + 1];
147 0 : size = 0;
148 0 : while (*sizep >= '0' && *sizep <= '9')
149 : {
150 0 : size *= 10;
151 0 : size += *sizep++ - '0';
152 : }
153 0 : if (size == 0)
154 : {
155 0 : VCFG_DBG (0, "VCL<%d>: parse error '%s %s', using default "
156 : "heapsize %lu (0x%lx)", getpid (), argv[i],
157 : argv[i + 1], (unsigned long) vcl_cfg->heapsize,
158 : (unsigned long) vcl_cfg->heapsize);
159 0 : goto defaulted;
160 : }
161 :
162 0 : if (*sizep == 'g' || *sizep == 'G')
163 0 : vcl_cfg->heapsize = size << 30;
164 0 : else if (*sizep == 'm' || *sizep == 'M')
165 0 : vcl_cfg->heapsize = size << 20;
166 : else
167 : {
168 0 : VCFG_DBG (0, "VCL<%d>: parse error '%s %s', using default "
169 : "heapsize %lu (0x%lx)", getpid (), argv[i],
170 : argv[i + 1], (unsigned long) vcl_cfg->heapsize,
171 : (unsigned long) vcl_cfg->heapsize);
172 0 : goto defaulted;
173 : }
174 : }
175 0 : free (argv[i]);
176 : }
177 :
178 0 : defaulted:
179 37 : if (fp != NULL)
180 0 : fclose (fp);
181 37 : if (argv != NULL)
182 0 : free (argv);
183 :
184 37 : vcl_mem = mmap (0, vcl_cfg->heapsize, PROT_READ | PROT_WRITE,
185 : MAP_SHARED | MAP_ANONYMOUS, -1, 0);
186 37 : if (vcl_mem == MAP_FAILED)
187 : {
188 0 : VCFG_DBG (0, "VCL<%d>: ERROR: mmap(0, %lu == 0x%lx, "
189 : "PROT_READ | PROT_WRITE,MAP_SHARED | MAP_ANONYMOUS, "
190 : "-1, 0) failed!", getpid (),
191 : (unsigned long) vcl_cfg->heapsize,
192 : (unsigned long) vcl_cfg->heapsize);
193 0 : ASSERT (vcl_mem != MAP_FAILED);
194 0 : return;
195 : }
196 37 : heap = clib_mem_init_thread_safe (vcl_mem, vcl_cfg->heapsize);
197 37 : if (!heap)
198 : {
199 0 : fprintf (stderr, "VCL<%d>: ERROR: clib_mem_init() failed!", getpid ());
200 0 : ASSERT (heap);
201 0 : return;
202 : }
203 37 : vcl_mem = clib_mem_alloc (sizeof (_vppcom_main));
204 37 : if (!vcl_mem)
205 : {
206 0 : clib_warning ("VCL<%d>: ERROR: clib_mem_alloc() failed!", getpid ());
207 0 : ASSERT (vcl_mem);
208 0 : return;
209 : }
210 :
211 37 : clib_memcpy (vcl_mem, &_vppcom_main, sizeof (_vppcom_main));
212 37 : vcm = vcl_mem;
213 :
214 37 : VCFG_DBG (0, "VCL<%d>: allocated VCL heap = %p, size %lu (0x%lx)",
215 : getpid (), heap, (unsigned long) vcl_cfg->heapsize,
216 : (unsigned long) vcl_cfg->heapsize);
217 : }
218 :
219 : void
220 37 : vppcom_cfg_read_file (char *conf_fname)
221 : {
222 37 : vppcom_cfg_t *vcl_cfg = &vcm->cfg;
223 : int fd;
224 37 : unformat_input_t _input, *input = &_input;
225 37 : unformat_input_t _line_input, *line_input = &_line_input;
226 37 : u8 vc_cfg_input = 0;
227 : struct stat s;
228 : u32 uid, gid;
229 :
230 37 : fd = open (conf_fname, O_RDONLY);
231 37 : if (fd < 0)
232 : {
233 37 : VCFG_DBG (0, "VCL<%d>: using default configuration.", getpid ());
234 37 : goto file_done;
235 : }
236 :
237 0 : if (fstat (fd, &s) < 0)
238 : {
239 0 : VCFG_DBG (0, "VCL<%d>: failed to stat `%s' using default configuration",
240 : getpid (), conf_fname);
241 0 : goto file_done;
242 : }
243 :
244 0 : if (!(S_ISREG (s.st_mode) || S_ISLNK (s.st_mode)))
245 : {
246 0 : VCFG_DBG (0, "VCL<%d>: not a regular file `%s', using default "
247 : "configuration", getpid (), conf_fname);
248 0 : goto file_done;
249 : }
250 :
251 0 : unformat_init_clib_file (input, fd);
252 :
253 0 : while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
254 : {
255 : /* skip empty newlines as they confuse unformat_line_input */
256 0 : unformat_skip_white_space (input);
257 0 : (void) unformat_user (input, unformat_line_input, line_input);
258 0 : unformat_skip_white_space (line_input);
259 :
260 0 : if (unformat (line_input, "vcl {"))
261 : {
262 0 : vc_cfg_input = 1;
263 0 : unformat_free (line_input);
264 0 : continue;
265 : }
266 :
267 0 : if (vc_cfg_input)
268 : {
269 0 : if (unformat (line_input, "heapsize %U", unformat_memory_size,
270 : &vcl_cfg->heapsize))
271 : {
272 0 : VCFG_DBG (0, "VCL<%d>: configured heapsize %lu", getpid (),
273 : (unsigned long) vcl_cfg->heapsize);
274 : }
275 : else
276 0 : if (unformat
277 : (line_input, "max-workers %u", &vcl_cfg->max_workers))
278 : {
279 0 : VCFG_DBG (0, "VCL<%d>: configured max-workers %u", getpid (),
280 : vcl_cfg->max_workers);
281 : }
282 0 : else if (unformat (line_input, "api-socket-name %s",
283 : &vcl_cfg->vpp_bapi_socket_name))
284 : {
285 0 : vec_terminate_c_string (vcl_cfg->vpp_bapi_socket_name);
286 0 : VCFG_DBG (0, "VCL<%d>: configured api-socket-name (%s)",
287 : getpid (), vcl_cfg->vpp_bapi_socket_name);
288 : }
289 0 : else if (unformat (line_input, "app-socket-api %s",
290 : &vcl_cfg->vpp_app_socket_api))
291 : {
292 0 : vec_terminate_c_string (vcl_cfg->vpp_app_socket_api);
293 0 : VCFG_DBG (0, "VCL<%d>: configured app-socket-api (%s)",
294 : getpid (), vcl_cfg->vpp_app_socket_api);
295 : }
296 0 : else if (unformat (line_input, "uid %d", &uid))
297 : {
298 0 : vl_set_memory_uid (uid);
299 0 : VCFG_DBG (0, "VCL<%d>: configured uid %d", getpid (), uid);
300 : }
301 0 : else if (unformat (line_input, "gid %d", &gid))
302 : {
303 0 : vl_set_memory_gid (gid);
304 0 : VCFG_DBG (0, "VCL<%d>: configured gid %d", getpid (), gid);
305 : }
306 0 : else if (unformat (line_input, "segment-size 0x%lx",
307 : &vcl_cfg->segment_size))
308 : {
309 0 : VCFG_DBG (0, "VCL<%d>: configured segment_size 0x%lx (%lu)",
310 : getpid (), vcl_cfg->segment_size,
311 : vcl_cfg->segment_size);
312 : }
313 0 : else if (unformat (line_input, "segment-size %lu",
314 : &vcl_cfg->segment_size))
315 : {
316 0 : VCFG_DBG (0, "VCL<%d>: configured segment_size %lu (0x%lx)",
317 : getpid (), vcl_cfg->segment_size,
318 : vcl_cfg->segment_size);
319 : }
320 0 : else if (unformat (line_input, "add-segment-size 0x%lx",
321 : &vcl_cfg->add_segment_size))
322 : {
323 0 : VCFG_DBG (0, "VCL<%d>: configured add_segment_size 0x%lx (%lu)",
324 : getpid (), vcl_cfg->add_segment_size,
325 : vcl_cfg->add_segment_size);
326 : }
327 0 : else if (unformat (line_input, "add-segment-size %lu",
328 : &vcl_cfg->add_segment_size))
329 : {
330 0 : VCFG_DBG (0, "VCL<%d>: configured add_segment_size %lu (0x%lx)",
331 : getpid (), vcl_cfg->add_segment_size,
332 : vcl_cfg->add_segment_size);
333 : }
334 0 : else if (unformat (line_input, "preallocated-fifo-pairs %u",
335 : &vcl_cfg->preallocated_fifo_pairs))
336 : {
337 0 : VCFG_DBG (0, "VCL<%d>: configured preallocated_fifo_pairs %u "
338 : "(0x%x)", getpid (), vcl_cfg->preallocated_fifo_pairs,
339 : vcl_cfg->preallocated_fifo_pairs);
340 : }
341 0 : else if (unformat (line_input, "rx-fifo-size 0x%x",
342 : &vcl_cfg->rx_fifo_size))
343 : {
344 0 : VCFG_DBG (0, "VCL<%d>: configured rx_fifo_size 0x%x (%u)",
345 : getpid (), vcl_cfg->rx_fifo_size,
346 : vcl_cfg->rx_fifo_size);
347 : }
348 0 : else if (unformat (line_input, "rx-fifo-size %u",
349 : &vcl_cfg->rx_fifo_size))
350 : {
351 0 : VCFG_DBG (0, "VCL<%d>: configured rx_fifo_size %u (0x%x)",
352 : getpid (), vcl_cfg->rx_fifo_size,
353 : vcl_cfg->rx_fifo_size);
354 : }
355 0 : else if (unformat (line_input, "tx-fifo-size 0x%x",
356 : &vcl_cfg->tx_fifo_size))
357 : {
358 0 : VCFG_DBG (0, "VCL<%d>: configured tx_fifo_size 0x%x (%u)",
359 : getpid (), vcl_cfg->tx_fifo_size,
360 : vcl_cfg->tx_fifo_size);
361 : }
362 0 : else if (unformat (line_input, "tx-fifo-size %u",
363 : &vcl_cfg->tx_fifo_size))
364 : {
365 0 : VCFG_DBG (0, "VCL<%d>: configured tx_fifo_size %u (0x%x)",
366 : getpid (), vcl_cfg->tx_fifo_size,
367 : vcl_cfg->tx_fifo_size);
368 : }
369 0 : else if (unformat (line_input, "event-queue-size 0x%x",
370 : &vcl_cfg->event_queue_size))
371 : {
372 0 : VCFG_DBG (0, "VCL<%d>: configured event_queue_size 0x%x (%u)",
373 : getpid (), vcl_cfg->event_queue_size,
374 : vcl_cfg->event_queue_size);
375 : }
376 0 : else if (unformat (line_input, "event-queue-size %u",
377 : &vcl_cfg->event_queue_size))
378 : {
379 0 : VCFG_DBG (0, "VCL<%d>: configured event_queue_size %u (0x%x)",
380 : getpid (), vcl_cfg->event_queue_size,
381 : vcl_cfg->event_queue_size);
382 : }
383 0 : else if (unformat (line_input, "app-timeout %f",
384 : &vcl_cfg->app_timeout))
385 : {
386 0 : VCFG_DBG (0, "VCL<%d>: configured app_timeout %f",
387 : getpid (), vcl_cfg->app_timeout);
388 : }
389 0 : else if (unformat (line_input, "session-timeout %f",
390 : &vcl_cfg->session_timeout))
391 : {
392 0 : VCFG_DBG (0, "VCL<%d>: configured session_timeout %f",
393 : getpid (), vcl_cfg->session_timeout);
394 : }
395 0 : else if (unformat (line_input, "app-proxy-transport-tcp"))
396 : {
397 0 : vcl_cfg->app_proxy_transport_tcp = 1;
398 0 : VCFG_DBG (0, "VCL<%d>: configured app_proxy_transport_tcp (%d)",
399 : getpid (), vcl_cfg->app_proxy_transport_tcp);
400 : }
401 0 : else if (unformat (line_input, "app-proxy-transport-udp"))
402 : {
403 0 : vcl_cfg->app_proxy_transport_udp = 1;
404 0 : VCFG_DBG (0, "VCL<%d>: configured app_proxy_transport_udp (%d)",
405 : getpid (), vcl_cfg->app_proxy_transport_udp);
406 : }
407 0 : else if (unformat (line_input, "app-scope-local"))
408 : {
409 0 : vcl_cfg->app_scope_local = 1;
410 0 : VCFG_DBG (0, "VCL<%d>: configured app_scope_local (%d)",
411 : getpid (), vcl_cfg->app_scope_local);
412 : }
413 0 : else if (unformat (line_input, "app-scope-global"))
414 : {
415 0 : vcl_cfg->app_scope_global = 1;
416 0 : VCFG_DBG (0, "VCL<%d>: configured app_scope_global (%d)",
417 : getpid (), vcl_cfg->app_scope_global);
418 : }
419 0 : else if (unformat (line_input, "huge_page"))
420 : {
421 0 : vcl_cfg->huge_page = 1;
422 0 : VCFG_DBG (0, "VCL<%d>: configured huge_page (%d)", getpid (),
423 : vcl_cfg->huge_page);
424 : }
425 0 : else if (unformat (line_input, "namespace-secret %lu",
426 : &vcl_cfg->namespace_secret))
427 : {
428 0 : VCFG_DBG (0, "VCL<%d>: configured namespace_secret %llu "
429 : "(0x%llx)", getpid (),
430 : (unsigned long long) vcl_cfg->namespace_secret,
431 : (unsigned long long) vcl_cfg->namespace_secret);
432 : }
433 0 : else if (unformat (line_input, "namespace-id %v",
434 : &vcl_cfg->namespace_id))
435 : {
436 0 : u32 max_nsid_vec_len = vcl_bapi_max_nsid_len ();
437 0 : u32 nsid_vec_len = vec_len (vcl_cfg->namespace_id);
438 0 : if (nsid_vec_len > max_nsid_vec_len)
439 : {
440 0 : vec_set_len (vcl_cfg->namespace_id, max_nsid_vec_len);
441 0 : VCFG_DBG (0, "VCL<%d>: configured namespace_id is too long,"
442 : " truncated to %d characters!",
443 : getpid (), max_nsid_vec_len);
444 : }
445 :
446 0 : VCFG_DBG (0, "VCL<%d>: configured namespace_id %s",
447 : getpid (), (char *) vcl_cfg->namespace_id);
448 : }
449 0 : else if (unformat (line_input, "use-mq-eventfd"))
450 : {
451 0 : vcl_cfg->use_mq_eventfd = 1;
452 0 : VCFG_DBG (0, "VCL<%d>: configured with mq with eventfd",
453 : getpid ());
454 : }
455 0 : else if (unformat (line_input, "tls-engine %u",
456 : &vcl_cfg->tls_engine))
457 : {
458 0 : VCFG_DBG (0, "VCL<%d>: configured tls-engine %u (0x%x)",
459 : getpid (), vcl_cfg->tls_engine, vcl_cfg->tls_engine);
460 : }
461 0 : else if (unformat (line_input, "multi-thread-workers"))
462 : {
463 0 : vcl_cfg->mt_wrk_supported = 1;
464 0 : VCFG_DBG (0, "VCL<%d>: configured with multithread workers",
465 : getpid ());
466 : }
467 0 : else if (unformat (line_input, "}"))
468 : {
469 0 : vc_cfg_input = 0;
470 0 : VCFG_DBG (0, "VCL<%d>: completed parsing vppcom config!",
471 : getpid ());
472 0 : unformat_free (line_input);
473 0 : goto input_done;
474 : }
475 : else
476 : {
477 0 : if (line_input->buffer[line_input->index] != '#')
478 : {
479 0 : clib_warning ("VCL<%d>: Unknown vppcom config option: '%s'",
480 : getpid (), (char *)
481 : &line_input->buffer[line_input->index]);
482 : }
483 : }
484 0 : unformat_free (line_input);
485 : }
486 : }
487 :
488 0 : input_done:
489 0 : unformat_free (input);
490 :
491 37 : file_done:
492 37 : if (fd >= 0)
493 0 : close (fd);
494 37 : }
495 :
496 : void
497 37 : vppcom_cfg (vppcom_cfg_t * vcl_cfg)
498 : {
499 : char *conf_fname, *env_var_str;
500 :
501 37 : vppcom_cfg_init (vcl_cfg);
502 37 : env_var_str = getenv (VPPCOM_ENV_DEBUG);
503 37 : if (env_var_str)
504 : {
505 : u32 tmp;
506 0 : if (sscanf (env_var_str, "%u", &tmp) != 1)
507 : {
508 0 : VCFG_DBG (0, "VCL<%d>: WARNING: Invalid debug level specified "
509 : "in the environment variable " VPPCOM_ENV_DEBUG
510 : " (%s)!\n", getpid (), env_var_str);
511 : }
512 : else
513 : {
514 0 : vcm->debug = tmp;
515 0 : VCFG_DBG (0, "VCL<%d>: configured VCL debug level (%u) from "
516 : VPPCOM_ENV_DEBUG "!", getpid (), vcm->debug);
517 : }
518 : }
519 37 : conf_fname = getenv (VPPCOM_ENV_CONF);
520 37 : if (!conf_fname)
521 37 : conf_fname = VPPCOM_CONF_DEFAULT;
522 37 : vppcom_cfg_heapsize (conf_fname);
523 37 : vppcom_cfg_read_file (conf_fname);
524 :
525 : /* Regrab cfg after heap initialization */
526 37 : vcl_cfg = &vcm->cfg;
527 37 : env_var_str = getenv (VPPCOM_ENV_APP_NAMESPACE_ID);
528 37 : if (env_var_str)
529 : {
530 25 : u32 ns_id_vec_len = strlen (env_var_str);
531 :
532 25 : vec_reset_length (vcm->cfg.namespace_id);
533 25 : vec_validate (vcm->cfg.namespace_id, ns_id_vec_len - 1);
534 25 : clib_memcpy (vcm->cfg.namespace_id, env_var_str, ns_id_vec_len);
535 :
536 25 : VCFG_DBG (0, "VCL<%d>: configured namespace_id (%s) from "
537 : VPPCOM_ENV_APP_NAMESPACE_ID "!", getpid (), env_var_str);
538 : }
539 37 : env_var_str = getenv (VPPCOM_ENV_APP_NAMESPACE_SECRET);
540 37 : if (env_var_str)
541 : {
542 : u64 tmp;
543 25 : if (sscanf (env_var_str, "%llu", (unsigned long long *) &tmp) != 1)
544 : {
545 0 : VCFG_DBG (0, "VCL<%d>: WARNING: Invalid namespace secret specified"
546 : " in the environment variable "
547 : VPPCOM_ENV_APP_NAMESPACE_SECRET " (%s)!\n", getpid (),
548 : env_var_str);
549 : }
550 : else
551 : {
552 25 : vcm->cfg.namespace_secret = tmp;
553 25 : VCFG_DBG (0, "VCL<%d>: configured namespace secret (%llu) from "
554 : VPPCOM_ENV_APP_NAMESPACE_SECRET "!", getpid (),
555 : (unsigned long long) vcm->cfg.namespace_secret);
556 : }
557 : }
558 37 : if (getenv (VPPCOM_ENV_APP_PROXY_TRANSPORT_TCP))
559 : {
560 0 : vcm->cfg.app_proxy_transport_tcp = 1;
561 0 : VCFG_DBG (0, "VCL<%d>: configured app_proxy_transport_tcp (%u) from "
562 : VPPCOM_ENV_APP_PROXY_TRANSPORT_TCP "!", getpid (),
563 : vcm->cfg.app_proxy_transport_tcp);
564 : }
565 37 : if (getenv (VPPCOM_ENV_APP_PROXY_TRANSPORT_UDP))
566 : {
567 0 : vcm->cfg.app_proxy_transport_udp = 1;
568 0 : VCFG_DBG (0, "VCL<%d>: configured app_proxy_transport_udp (%u) from "
569 : VPPCOM_ENV_APP_PROXY_TRANSPORT_UDP "!", getpid (),
570 : vcm->cfg.app_proxy_transport_udp);
571 : }
572 37 : if (getenv (VPPCOM_ENV_APP_SCOPE_LOCAL))
573 : {
574 12 : vcm->cfg.app_scope_local = 1;
575 12 : VCFG_DBG (0, "VCL<%d>: configured app_scope_local (%u) from "
576 : VPPCOM_ENV_APP_SCOPE_LOCAL "!", getpid (),
577 : vcm->cfg.app_scope_local);
578 : }
579 37 : if (getenv (VPPCOM_ENV_APP_SCOPE_GLOBAL))
580 : {
581 25 : vcm->cfg.app_scope_global = 1;
582 25 : VCFG_DBG (0, "VCL<%d>: configured app_scope_global (%u) from "
583 : VPPCOM_ENV_APP_SCOPE_GLOBAL "!", getpid (),
584 : vcm->cfg.app_scope_global);
585 : }
586 37 : env_var_str = getenv (VPPCOM_ENV_VPP_API_SOCKET);
587 37 : if (env_var_str)
588 : {
589 29 : vcm->cfg.vpp_bapi_socket_name = format (0, "%s%c", env_var_str, 0);
590 29 : VCFG_DBG (0, "VCL<%d>: configured api-socket-name (%s)", getpid (),
591 : vcl_cfg->vpp_bapi_socket_name);
592 : }
593 37 : env_var_str = getenv (VPPCOM_ENV_VPP_SAPI_SOCKET);
594 37 : if (env_var_str)
595 : {
596 8 : vcm->cfg.vpp_app_socket_api = format (0, "%s%c", env_var_str, 0);
597 8 : VCFG_DBG (0, "VCL<%d>: configured app-socket-api (%s)", getpid (),
598 : vcl_cfg->vpp_app_socket_api);
599 : }
600 37 : env_var_str = getenv (VPPCOM_ENV_APP_USE_MQ_EVENTFD);
601 37 : if (env_var_str)
602 : {
603 0 : vcm->cfg.use_mq_eventfd = 1;
604 0 : VCFG_DBG (0, "VCL<%d>: configured " VPPCOM_ENV_APP_USE_MQ_EVENTFD,
605 : getpid ());
606 : }
607 37 : }
608 :
609 : /*
610 : * fd.io coding-style-patch-verification: ON
611 : *
612 : * Local Variables:
613 : * eval: (c-set-style "gnu")
614 : * End:
615 : */
|