blob: 61eaad471ffb09ae604a1e96ee6a3270d4237ba8 [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001/*
2 * plugin.c: plugin handling
3 *
4 * Copyright (c) 2011 Cisco and/or its affiliates.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#include <vlib/unix/plugin.h>
Damjan Marion3b46cba2017-01-23 21:13:45 +010019#include <vppinfra/elf.h>
Ed Warnickecb9cada2015-12-08 15:45:58 -070020#include <dlfcn.h>
21#include <dirent.h>
22
23plugin_main_t vlib_plugin_main;
24
Damjan Marion3b46cba2017-01-23 21:13:45 +010025char *vlib_plugin_path __attribute__ ((weak));
26char *vlib_plugin_path = "";
27char *vlib_plugin_app_version __attribute__ ((weak));
28char *vlib_plugin_app_version = "";
Ed Warnickecb9cada2015-12-08 15:45:58 -070029
Damjan Marionf935e332017-01-06 14:33:05 +010030void *
31vlib_get_plugin_symbol (char *plugin_name, char *symbol_name)
32{
33 plugin_main_t *pm = &vlib_plugin_main;
34 uword *p;
35 plugin_info_t *pi;
36
37 if ((p = hash_get_mem (pm->plugin_by_name_hash, plugin_name)) == 0)
38 return 0;
39
40 pi = vec_elt_at_index (pm->plugin_info, p[0]);
41 return dlsym (pi->handle, symbol_name);
42}
43
Damjan Marion3b46cba2017-01-23 21:13:45 +010044static char *
45str_array_to_vec (char *array, int len)
46{
47 char c, *r = 0;
48 int n = 0;
49
50 do
51 {
52 c = array[n];
53 vec_add1 (r, c);
54 }
55 while (c && ++n < len);
56
57 if (c)
58 vec_add1 (r, 0);
59
60 return r;
61}
62
Dave Barach9b8ffd92016-07-08 08:13:45 -040063static int
64load_one_plugin (plugin_main_t * pm, plugin_info_t * pi, int from_early_init)
Ed Warnickecb9cada2015-12-08 15:45:58 -070065{
Damjan Marion3b46cba2017-01-23 21:13:45 +010066 void *handle;
Dave Barach9b8ffd92016-07-08 08:13:45 -040067 clib_error_t *error;
Damjan Marion3b46cba2017-01-23 21:13:45 +010068 elf_main_t em = { 0 };
69 elf_section_t *section;
70 u8 *data;
71 char *version_required;
72 vlib_plugin_registration_t *reg;
73 plugin_config_t *pc = 0;
74 uword *p;
75
76 if (elf_read_file (&em, (char *) pi->filename))
77 return -1;
78
79 error = elf_get_section_by_name (&em, ".vlib_plugin_registration",
80 &section);
81 if (error)
82 {
83 clib_warning ("Not a plugin: %s\n", (char *) pi->name);
84 return -1;
85 }
86
87 data = elf_get_section_contents (&em, section->index, 1);
88 reg = (vlib_plugin_registration_t *) data;
89
90 if (vec_len (data) != sizeof (*reg))
91 {
92 clib_warning ("vlib_plugin_registration size mismatch in plugin %s\n",
93 (char *) pi->name);
94 goto error;
95 }
96
Mohsin Kazmi06bc2602018-03-22 23:45:23 +010097 if (pm->plugins_default_disable)
98 reg->default_disabled = 1;
99
Damjan Marion3b46cba2017-01-23 21:13:45 +0100100 p = hash_get_mem (pm->config_index_by_name, pi->name);
101 if (p)
102 {
103 pc = vec_elt_at_index (pm->configs, p[0]);
104 if (pc->is_disabled)
105 {
106 clib_warning ("Plugin disabled: %s", pi->name);
107 goto error;
108 }
109 if (reg->default_disabled && pc->is_enabled == 0)
110 {
Damjan Marion1bfb0dd2017-03-22 11:08:39 +0100111 clib_warning ("Plugin disabled (default): %s", pi->name);
Damjan Marion3b46cba2017-01-23 21:13:45 +0100112 goto error;
113 }
114 }
115 else if (reg->default_disabled)
116 {
Damjan Marion1bfb0dd2017-03-22 11:08:39 +0100117 clib_warning ("Plugin disabled (default): %s", pi->name);
Damjan Marion3b46cba2017-01-23 21:13:45 +0100118 goto error;
119 }
120
121 version_required = str_array_to_vec ((char *) &reg->version_required,
122 sizeof (reg->version_required));
123
124 if ((strlen (version_required) > 0) &&
125 (strncmp (vlib_plugin_app_version, version_required,
126 strlen (version_required))))
127 {
128 clib_warning ("Plugin %s version mismatch: %s != %s",
129 pi->name, vlib_plugin_app_version, reg->version_required);
130 if (!(pc && pc->skip_version_check == 1))
131 {
132 vec_free (version_required);
133 goto error;
134 }
135 }
136
137 vec_free (version_required);
138 vec_free (data);
139 elf_main_free (&em);
Ed Warnickecb9cada2015-12-08 15:45:58 -0700140
Damjan Marionf935e332017-01-06 14:33:05 +0100141 handle = dlopen ((char *) pi->filename, RTLD_LAZY);
Dave Barach9b8ffd92016-07-08 08:13:45 -0400142
Ed Warnickecb9cada2015-12-08 15:45:58 -0700143 if (handle == 0)
144 {
Dave Barach9b8ffd92016-07-08 08:13:45 -0400145 clib_warning ("%s", dlerror ());
Damjan Marionc9fc77c2017-04-25 21:07:52 +0200146 clib_warning ("Failed to load plugin '%s'", pi->name);
Dave Barach3464c862018-03-12 17:38:31 -0400147 goto error;
Ed Warnickecb9cada2015-12-08 15:45:58 -0700148 }
Dave Barach9b8ffd92016-07-08 08:13:45 -0400149
Ed Warnickecb9cada2015-12-08 15:45:58 -0700150 pi->handle = handle;
151
Damjan Marion3b46cba2017-01-23 21:13:45 +0100152 reg = dlsym (pi->handle, "vlib_plugin_registration");
Ole Troan3b3688f2016-06-15 14:29:08 +0200153
Damjan Marion3b46cba2017-01-23 21:13:45 +0100154 if (reg == 0)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700155 {
Damjan Marion3b46cba2017-01-23 21:13:45 +0100156 /* This should never happen unless somebody chagnes registration macro */
157 clib_warning ("Missing plugin registration in plugin '%s'", pi->name);
Damjan Marion72d2c4f2018-04-05 21:32:29 +0200158 dlclose (pi->handle);
159 goto error;
Ed Warnickecb9cada2015-12-08 15:45:58 -0700160 }
161
Damjan Marion3b46cba2017-01-23 21:13:45 +0100162 pi->reg = reg;
163 pi->version = str_array_to_vec ((char *) &reg->version,
164 sizeof (reg->version));
Ed Warnickecb9cada2015-12-08 15:45:58 -0700165
Ole Troane4ad8cc2017-02-07 11:22:33 +0100166 if (reg->early_init)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700167 {
Damjan Marion3b46cba2017-01-23 21:13:45 +0100168 clib_error_t *(*ei) (vlib_main_t *);
169 void *h;
170
171 h = dlsym (pi->handle, reg->early_init);
172 if (h)
173 {
174 ei = h;
175 error = (*ei) (pm->vlib_main);
176 if (error)
177 {
178 clib_error_report (error);
Damjan Marion72d2c4f2018-04-05 21:32:29 +0200179 dlclose (pi->handle);
180 goto error;
Damjan Marion3b46cba2017-01-23 21:13:45 +0100181 }
182 }
183 else
184 clib_warning ("Plugin %s: early init function %s set but not found",
185 (char *) pi->name, reg->early_init);
Ed Warnickecb9cada2015-12-08 15:45:58 -0700186 }
187
Damjan Marion1bfb0dd2017-03-22 11:08:39 +0100188 if (reg->description)
189 clib_warning ("Loaded plugin: %s (%s)", pi->name, reg->description);
190 else
191 clib_warning ("Loaded plugin: %s", pi->name);
Ed Warnickecb9cada2015-12-08 15:45:58 -0700192
193 return 0;
Damjan Marion3b46cba2017-01-23 21:13:45 +0100194error:
195 vec_free (data);
196 elf_main_free (&em);
197 return -1;
Ed Warnickecb9cada2015-12-08 15:45:58 -0700198}
199
Dave Barach9b8ffd92016-07-08 08:13:45 -0400200static u8 **
201split_plugin_path (plugin_main_t * pm)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700202{
203 int i;
204 u8 **rv = 0;
205 u8 *path = pm->plugin_path;
206 u8 *this = 0;
207
208 for (i = 0; i < vec_len (pm->plugin_path); i++)
209 {
210 if (path[i] != ':')
Dave Barach9b8ffd92016-07-08 08:13:45 -0400211 {
212 vec_add1 (this, path[i]);
213 continue;
214 }
215 vec_add1 (this, 0);
Ed Warnickecb9cada2015-12-08 15:45:58 -0700216 vec_add1 (rv, this);
217 this = 0;
218 }
219 if (this)
220 {
221 vec_add1 (this, 0);
222 vec_add1 (rv, this);
223 }
224 return rv;
225}
226
Dave Baracha83bc302017-02-25 16:38:12 -0500227static int
228plugin_name_sort_cmp (void *a1, void *a2)
229{
230 plugin_info_t *p1 = a1;
231 plugin_info_t *p2 = a2;
232
233 return strcmp ((char *) p1->name, (char *) p2->name);
234}
235
Dave Barach9b8ffd92016-07-08 08:13:45 -0400236int
237vlib_load_new_plugins (plugin_main_t * pm, int from_early_init)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700238{
239 DIR *dp;
240 struct dirent *entry;
241 struct stat statb;
242 uword *p;
243 plugin_info_t *pi;
244 u8 **plugin_path;
Dave Baracha83bc302017-02-25 16:38:12 -0500245 u32 *load_fail_indices = 0;
Ed Warnickecb9cada2015-12-08 15:45:58 -0700246 int i;
247
248 plugin_path = split_plugin_path (pm);
Dave Barach9b8ffd92016-07-08 08:13:45 -0400249
Ed Warnickecb9cada2015-12-08 15:45:58 -0700250 for (i = 0; i < vec_len (plugin_path); i++)
251 {
Dave Barach9b8ffd92016-07-08 08:13:45 -0400252 dp = opendir ((char *) plugin_path[i]);
Ed Warnickecb9cada2015-12-08 15:45:58 -0700253
Dave Barach9b8ffd92016-07-08 08:13:45 -0400254 if (dp == 0)
255 continue;
256
257 while ((entry = readdir (dp)))
258 {
259 u8 *plugin_name;
Damjan Marionf935e332017-01-06 14:33:05 +0100260 u8 *filename;
Dave Barach9b8ffd92016-07-08 08:13:45 -0400261
262 if (pm->plugin_name_filter)
263 {
264 int j;
265 for (j = 0; j < vec_len (pm->plugin_name_filter); j++)
266 if (entry->d_name[j] != pm->plugin_name_filter[j])
267 goto next;
268 }
269
Damjan Marionf935e332017-01-06 14:33:05 +0100270 filename = format (0, "%s/%s%c", plugin_path[i], entry->d_name, 0);
Ole Troan3b3688f2016-06-15 14:29:08 +0200271
272 /* Only accept .so */
Damjan Marionf935e332017-01-06 14:33:05 +0100273 char *ext = strrchr ((const char *) filename, '.');
Dave Barach9b8ffd92016-07-08 08:13:45 -0400274 /* unreadable */
275 if (!ext || (strcmp (ext, ".so") != 0) ||
Damjan Marionf935e332017-01-06 14:33:05 +0100276 stat ((char *) filename, &statb) < 0)
Dave Barach9b8ffd92016-07-08 08:13:45 -0400277 {
278 ignore:
Damjan Marionf935e332017-01-06 14:33:05 +0100279 vec_free (filename);
Dave Barach9b8ffd92016-07-08 08:13:45 -0400280 continue;
281 }
282
283 /* a dir or other things which aren't plugins */
284 if (!S_ISREG (statb.st_mode))
285 goto ignore;
286
Damjan Marionf935e332017-01-06 14:33:05 +0100287 plugin_name = format (0, "%s%c", entry->d_name, 0);
Dave Baracha83bc302017-02-25 16:38:12 -0500288 /* Have we seen this plugin already? */
Dave Barach9b8ffd92016-07-08 08:13:45 -0400289 p = hash_get_mem (pm->plugin_by_name_hash, plugin_name);
290 if (p == 0)
291 {
Dave Baracha83bc302017-02-25 16:38:12 -0500292 /* No, add it to the plugin vector */
Dave Barach9b8ffd92016-07-08 08:13:45 -0400293 vec_add2 (pm->plugin_info, pi, 1);
294 pi->name = plugin_name;
Damjan Marionf935e332017-01-06 14:33:05 +0100295 pi->filename = filename;
Dave Barach9b8ffd92016-07-08 08:13:45 -0400296 pi->file_info = statb;
Dave Barach9b8ffd92016-07-08 08:13:45 -0400297 hash_set_mem (pm->plugin_by_name_hash, plugin_name,
298 pi - pm->plugin_info);
299 }
300 next:
301 ;
302 }
Ed Warnickecb9cada2015-12-08 15:45:58 -0700303 closedir (dp);
304 vec_free (plugin_path[i]);
305 }
306 vec_free (plugin_path);
Dave Baracha83bc302017-02-25 16:38:12 -0500307
308
309 /*
310 * Sort the plugins by name. This is important.
311 * API traces contain absolute message numbers.
312 * Loading plugins in directory (vs. alphabetical) order
313 * makes trace replay incredibly fragile.
314 */
315 vec_sort_with_function (pm->plugin_info, plugin_name_sort_cmp);
316
317 /*
318 * Attempt to load the plugins
319 */
320 for (i = 0; i < vec_len (pm->plugin_info); i++)
321 {
322 pi = vec_elt_at_index (pm->plugin_info, i);
323
324 if (load_one_plugin (pm, pi, from_early_init))
325 {
326 /* Make a note of any which fail to load */
327 vec_add1 (load_fail_indices, i);
328 hash_unset_mem (pm->plugin_by_name_hash, pi->name);
329 vec_free (pi->name);
330 vec_free (pi->filename);
331 }
332 }
333
334 /* Remove plugin info vector elements corresponding to load failures */
335 if (vec_len (load_fail_indices) > 0)
336 {
337 for (i = vec_len (load_fail_indices) - 1; i >= 0; i--)
338 vec_delete (pm->plugin_info, 1, load_fail_indices[i]);
339 vec_free (load_fail_indices);
340 }
341
342 /* Recreate the plugin name hash */
343 for (i = 0; i < vec_len (pm->plugin_info); i++)
344 {
345 pi = vec_elt_at_index (pm->plugin_info, i);
346 hash_unset_mem (pm->plugin_by_name_hash, pi->name);
347 hash_set_mem (pm->plugin_by_name_hash, pi->name, pi - pm->plugin_info);
348 }
349
Ed Warnickecb9cada2015-12-08 15:45:58 -0700350 return 0;
351}
Dave Barach9b8ffd92016-07-08 08:13:45 -0400352
Dave Barach9b8ffd92016-07-08 08:13:45 -0400353int
354vlib_plugin_early_init (vlib_main_t * vm)
Ed Warnickecb9cada2015-12-08 15:45:58 -0700355{
356 plugin_main_t *pm = &vlib_plugin_main;
357
Damjan Marion3b46cba2017-01-23 21:13:45 +0100358 if (pm->plugin_path == 0)
359 pm->plugin_path = format (0, "%s%c", vlib_plugin_path, 0);
Ed Warnickecb9cada2015-12-08 15:45:58 -0700360
361 clib_warning ("plugin path %s", pm->plugin_path);
362
Ed Warnickecb9cada2015-12-08 15:45:58 -0700363 pm->plugin_by_name_hash = hash_create_string (0, sizeof (uword));
364 pm->vlib_main = vm;
Dave Barach9b8ffd92016-07-08 08:13:45 -0400365
366 return vlib_load_new_plugins (pm, 1 /* from_early_init */ );
Ed Warnickecb9cada2015-12-08 15:45:58 -0700367}
Dave Barach9b8ffd92016-07-08 08:13:45 -0400368
Dave Barach0a32b602017-11-28 18:55:09 -0500369u8 *
370vlib_get_vat_plugin_path (void)
371{
372 plugin_main_t *pm = &vlib_plugin_main;
373 return (pm->vat_plugin_path);
374}
375
376u8 *
377vlib_get_vat_plugin_name_filter (void)
378{
379 plugin_main_t *pm = &vlib_plugin_main;
380 return (pm->vat_plugin_name_filter);
381}
382
Shwetha Bhandarif24e5d72016-07-11 23:08:54 +0100383static clib_error_t *
384vlib_plugins_show_cmd_fn (vlib_main_t * vm,
Ed Warnicke853e7202016-08-12 11:42:26 -0700385 unformat_input_t * input, vlib_cli_command_t * cmd)
Shwetha Bhandarif24e5d72016-07-11 23:08:54 +0100386{
387 plugin_main_t *pm = &vlib_plugin_main;
388 u8 *s = 0;
389 u8 *key = 0;
Damjan Marion3b46cba2017-01-23 21:13:45 +0100390 uword value = 0;
Shwetha Bhandarif24e5d72016-07-11 23:08:54 +0100391 int index = 1;
Damjan Marion3b46cba2017-01-23 21:13:45 +0100392 plugin_info_t *pi;
Shwetha Bhandarif24e5d72016-07-11 23:08:54 +0100393
Damjan Marion3b46cba2017-01-23 21:13:45 +0100394 s = format (s, " Plugin path is: %s\n\n", pm->plugin_path);
Damjan Marion1bfb0dd2017-03-22 11:08:39 +0100395 s = format (s, " %-41s%-33s%s\n", "Plugin", "Version", "Description");
Shwetha Bhandarif24e5d72016-07-11 23:08:54 +0100396
Damjan Marion3b46cba2017-01-23 21:13:45 +0100397 /* *INDENT-OFF* */
Ed Warnicke853e7202016-08-12 11:42:26 -0700398 hash_foreach_mem (key, value, pm->plugin_by_name_hash,
Damjan Marion3b46cba2017-01-23 21:13:45 +0100399 {
400 if (key != 0)
401 {
402 pi = vec_elt_at_index (pm->plugin_info, value);
Damjan Marion1bfb0dd2017-03-22 11:08:39 +0100403 s = format (s, "%3d. %-40s %-32s %s\n", index, key, pi->version,
404 pi->reg->description ? pi->reg->description : "");
Damjan Marion3b46cba2017-01-23 21:13:45 +0100405 index++;
406 }
407 });
408 /* *INDENT-ON* */
Shwetha Bhandarif24e5d72016-07-11 23:08:54 +0100409
Ed Warnicke853e7202016-08-12 11:42:26 -0700410 vlib_cli_output (vm, "%v", s);
411 vec_free (s);
Shwetha Bhandarif24e5d72016-07-11 23:08:54 +0100412 return 0;
413}
414
Dave Barachfe6bdfd2017-01-20 19:50:09 -0500415/* *INDENT-OFF* */
Ed Warnicke853e7202016-08-12 11:42:26 -0700416VLIB_CLI_COMMAND (plugins_show_cmd, static) =
417{
Dave Barachfe6bdfd2017-01-20 19:50:09 -0500418 .path = "show plugins",
419 .short_help = "show loaded plugins",
420 .function = vlib_plugins_show_cmd_fn,
421};
422/* *INDENT-ON* */
423
Damjan Marion3b46cba2017-01-23 21:13:45 +0100424static clib_error_t *
425config_one_plugin (vlib_main_t * vm, char *name, unformat_input_t * input)
426{
427 plugin_main_t *pm = &vlib_plugin_main;
428 plugin_config_t *pc;
429 clib_error_t *error = 0;
430 uword *p;
431 int is_enable = 0;
432 int is_disable = 0;
433 int skip_version_check = 0;
434
435 if (pm->config_index_by_name == 0)
436 pm->config_index_by_name = hash_create_string (0, sizeof (uword));
437
438 p = hash_get_mem (pm->config_index_by_name, name);
439
440 if (p)
441 {
442 error = clib_error_return (0, "plugin '%s' already configured", name);
443 goto done;
444 }
445
446 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
447 {
448 if (unformat (input, "enable"))
449 is_enable = 1;
450 else if (unformat (input, "disable"))
451 is_disable = 1;
452 else if (unformat (input, "skip-version-check"))
453 skip_version_check = 1;
454 else
455 {
456 error = clib_error_return (0, "unknown input '%U'",
457 format_unformat_error, input);
458 goto done;
459 }
460 }
461
462 if (is_enable && is_disable)
463 {
464 error = clib_error_return (0, "please specify either enable or disable"
465 " for plugin '%s'", name);
466 goto done;
467 }
468
469 vec_add2 (pm->configs, pc, 1);
470 hash_set_mem (pm->config_index_by_name, name, pc - pm->configs);
471 pc->is_enabled = is_enable;
472 pc->is_disabled = is_disable;
473 pc->skip_version_check = skip_version_check;
474 pc->name = name;
475
476done:
477 return error;
478}
479
480clib_error_t *
481vlib_plugin_config (vlib_main_t * vm, unformat_input_t * input)
482{
483 plugin_main_t *pm = &vlib_plugin_main;
484 clib_error_t *error = 0;
485 unformat_input_t in;
486
487 unformat_init (&in, 0, 0);
488
489 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
490 {
491 u8 *s, *v;
492 if (unformat (input, "%s %v", &s, &v))
493 {
494 if (strncmp ((const char *) s, "plugins", 8) == 0)
495 {
496 if (vec_len (in.buffer) > 0)
497 vec_add1 (in.buffer, ' ');
498 vec_add (in.buffer, v, vec_len (v));
499 }
500 }
501 else
502 {
503 error = clib_error_return (0, "unknown input '%U'",
504 format_unformat_error, input);
505 goto done;
506 }
507
508 vec_free (v);
509 vec_free (s);
510 }
511done:
512 input = &in;
513 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
514 {
515 unformat_input_t sub_input;
516 u8 *s = 0;
517 if (unformat (input, "path %s", &s))
518 pm->plugin_path = s;
Dave Barach0a32b602017-11-28 18:55:09 -0500519 else if (unformat (input, "name-filter %s", &s))
520 pm->plugin_name_filter = s;
521 else if (unformat (input, "vat-path %s", &s))
522 pm->vat_plugin_path = s;
523 else if (unformat (input, "vat-name-filter %s", &s))
524 pm->vat_plugin_name_filter = s;
Mohsin Kazmi06bc2602018-03-22 23:45:23 +0100525 else if (unformat (input, "plugin default %U",
526 unformat_vlib_cli_sub_input, &sub_input))
527 {
528 pm->plugins_default_disable =
529 unformat (&sub_input, "disable") ? 1 : 0;
530 unformat_free (&sub_input);
531 }
Damjan Marion3b46cba2017-01-23 21:13:45 +0100532 else if (unformat (input, "plugin %s %U", &s,
533 unformat_vlib_cli_sub_input, &sub_input))
534 {
535 error = config_one_plugin (vm, (char *) s, &sub_input);
536 unformat_free (&sub_input);
537 if (error)
538 goto done2;
539 }
540 else
541 {
542 error = clib_error_return (0, "unknown input '%U'",
543 format_unformat_error, input);
544 {
545 vec_free (s);
546 goto done2;
547 }
548 }
549 }
550
551done2:
552 unformat_free (&in);
553 return error;
554}
555
556/* discard whole 'plugins' section, as it is already consumed prior to
557 plugin load */
558static clib_error_t *
559plugins_config (vlib_main_t * vm, unformat_input_t * input)
560{
561 u8 *junk;
562
563 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
564 {
565 if (unformat (input, "%s", &junk))
566 {
567 vec_free (junk);
568 return 0;
569 }
570 else
571 return clib_error_return (0, "unknown input '%U'",
572 format_unformat_error, input);
573 }
574 return 0;
575}
576
577VLIB_CONFIG_FUNCTION (plugins_config, "plugins");
578
Dave Barach9b8ffd92016-07-08 08:13:45 -0400579/*
580 * fd.io coding-style-patch-verification: ON
581 *
582 * Local Variables:
583 * eval: (c-set-style "gnu")
584 * End:
585 */