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>
21 pppoe_add_del_cp (u32 cp_if_index, u8 is_add)
23 pppoe_main_t *pem = &pppoe_main;
30 vnet_feature_enable_disable ("device-input", "pppoe-input",
31 cp_if_index, is_add, 0, 0);
35 pem->cp_if_index = cp_if_index;
39 pem->cp_if_index = ~0;
45 pppoe_add_del_cp_command_fn (vlib_main_t * vm,
46 unformat_input_t * input,
47 vlib_cli_command_t * cmd)
49 unformat_input_t _line_input, *line_input = &_line_input;
50 pppoe_main_t *pem = &pppoe_main;
52 u8 cp_if_index_set = 0;
54 clib_error_t *error = NULL;
56 /* Get a line of input. */
57 if (!unformat_user (input, unformat_line_input, line_input))
60 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
62 if (unformat (line_input, "del"))
66 else if (unformat (line_input, "cp-if-index %d", &cp_if_index))
70 error = clib_error_return (0, "parse error: '%U'",
71 format_unformat_error, line_input);
76 if (cp_if_index_set == 0)
78 error = clib_error_return (0, "cp if index not specified");
82 vnet_feature_enable_disable ("device-input", "pppoe-input",
83 cp_if_index, is_add, 0, 0);
87 pem->cp_if_index = cp_if_index;
91 pem->cp_if_index = ~0;
95 unformat_free (line_input);
101 VLIB_CLI_COMMAND (create_pppoe_cp_cmd, static) =
103 .path = "create pppoe cp",
104 .short_help = "create pppoe cp-if-index <intfc> [del]",
105 .function = pppoe_add_del_cp_command_fn,
110 * fd.io coding-style-patch-verification: ON
113 * eval: (c-set-style "gnu")