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