2 *------------------------------------------------------------------
3 * Copyright (c) 2017 Intel and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *------------------------------------------------------------------
18 #include <pppoe/pppoe.h>
19 #include <vnet/unix/tapcli.h>
22 pppoe_add_del_tap_command_fn (vlib_main_t * vm,
23 unformat_input_t * input,
24 vlib_cli_command_t * cmd)
26 unformat_input_t _line_input, *line_input = &_line_input;
27 pppoe_main_t *pem = &pppoe_main;
29 u8 tap_if_index_set = 0;
31 clib_error_t *error = NULL;
33 /* Get a line of input. */
34 if (!unformat_user (input, unformat_line_input, line_input))
37 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
39 if (unformat (line_input, "del"))
43 else if (unformat (line_input, "tap-if-index %d", &tap_if_index))
47 error = clib_error_return (0, "parse error: '%U'",
48 format_unformat_error, line_input);
53 if (tap_if_index_set == 0)
55 error = clib_error_return (0, "tap if index not specified");
61 pem->tap_if_index = tap_if_index;
65 pem->tap_if_index = ~0;
69 unformat_free (line_input);
75 VLIB_CLI_COMMAND (create_pppoe_tap_cmd, static) =
77 .path = "create pppoe tap",
78 .short_help = "create pppoe tap if-name <intfc> [del]",
79 .function = pppoe_add_del_tap_command_fn,
84 * fd.io coding-style-patch-verification: ON
87 * eval: (c-set-style "gnu")