diff options
Diffstat (limited to 'src/plugins/pppoe')
-rw-r--r-- | src/plugins/pppoe/pppoe.c | 29 | ||||
-rw-r--r-- | src/plugins/pppoe/pppoe.h | 4 | ||||
-rw-r--r-- | src/plugins/pppoe/pppoe_api.c | 6 | ||||
-rw-r--r-- | src/plugins/pppoe/pppoe_cp.c | 2 | ||||
-rw-r--r-- | src/plugins/pppoe/pppoe_decap.c | 23 |
5 files changed, 24 insertions, 40 deletions
diff --git a/src/plugins/pppoe/pppoe.c b/src/plugins/pppoe/pppoe.c index 1589725eddd..0d5f9c1aeac 100644 --- a/src/plugins/pppoe/pppoe.c +++ b/src/plugins/pppoe/pppoe.c @@ -77,13 +77,11 @@ pppoe_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags) return /* no error */ 0; } -/* *INDENT-OFF* */ VNET_DEVICE_CLASS (pppoe_device_class,static) = { .name = "PPPoE", .format_device_name = format_pppoe_name, .admin_up_down_function = pppoe_interface_admin_up_down, }; -/* *INDENT-ON* */ static u8 * format_pppoe_header_with_length (u8 * s, va_list * args) @@ -256,7 +254,6 @@ pppoe_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai) dpo_reset (&dpo); } -/* *INDENT-OFF* */ VNET_HW_INTERFACE_CLASS (pppoe_hw_class) = { .name = "PPPoE", @@ -265,7 +262,6 @@ VNET_HW_INTERFACE_CLASS (pppoe_hw_class) = .update_adjacency = pppoe_update_adj, .flags = VNET_HW_INTERFACE_CLASS_FLAG_P2P, }; -/* *INDENT-ON* */ #define foreach_copy_field \ _(session_id) \ @@ -353,7 +349,7 @@ int vnet_pppoe_add_del_session pool_get_aligned (pem->sessions, t, CLIB_CACHE_LINE_BYTES); clib_memset (t, 0, sizeof (*t)); - clib_memcpy (t->local_mac, hi->hw_address, 6); + clib_memcpy (t->local_mac, hi->hw_address, vec_len (hi->hw_address)); /* copy from arg structure */ #define _(x) t->x = a->x; @@ -374,7 +370,7 @@ int vnet_pppoe_add_del_session vnet_interface_main_t *im = &vnm->interface_main; hw_if_index = pem->free_pppoe_session_hw_if_indices [vec_len (pem->free_pppoe_session_hw_if_indices) - 1]; - _vec_len (pem->free_pppoe_session_hw_if_indices) -= 1; + vec_dec_len (pem->free_pppoe_session_hw_if_indices, 1); hi = vnet_get_hw_interface (vnm, hw_if_index); hi->dev_instance = t - pem->sessions; @@ -413,6 +409,8 @@ int vnet_pppoe_add_del_session si->flags &= ~VNET_SW_INTERFACE_FLAG_HIDDEN; vnet_sw_interface_set_flags (vnm, sw_if_index, VNET_SW_INTERFACE_FLAG_ADMIN_UP); + vnet_set_interface_l3_output_node (vnm->vlib_main, sw_if_index, + (u8 *) "tunnel-output"); /* add reverse route for client ip */ fib_table_entry_path_add (a->decap_fib_index, &pfx, @@ -431,6 +429,7 @@ int vnet_pppoe_add_del_session t = pool_elt_at_index (pem->sessions, result.fields.session_index); sw_if_index = t->sw_if_index; + vnet_reset_interface_l3_output_node (vnm->vlib_main, sw_if_index); vnet_sw_interface_set_flags (vnm, t->sw_if_index, 0 /* down */ ); vnet_sw_interface_t *si = vnet_get_sw_interface (vnm, t->sw_if_index); si->flags |= VNET_SW_INTERFACE_FLAG_HIDDEN; @@ -610,7 +609,6 @@ done: * @cliexcmd{create pppoe session client-ip 10.0.3.1 session-id 13 * client-mac 00:01:02:03:04:05 del } ?*/ -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (create_pppoe_session_command, static) = { .path = "create pppoe session", .short_help = @@ -618,9 +616,7 @@ VLIB_CLI_COMMAND (create_pppoe_session_command, static) = { " client-mac <client-mac> [decap-vrf-id <nn>] [del]", .function = pppoe_add_del_session_command_fn, }; -/* *INDENT-ON* */ -/* *INDENT-OFF* */ static clib_error_t * show_pppoe_session_command_fn (vlib_main_t * vm, unformat_input_t * input, @@ -639,7 +635,6 @@ show_pppoe_session_command_fn (vlib_main_t * vm, return 0; } -/* *INDENT-ON* */ /*? * Display all the PPPoE Session entries. @@ -651,13 +646,11 @@ show_pppoe_session_command_fn (vlib_main_t * vm, * local-mac a0:b0:c0:d0:e0:f0 client-mac 00:01:02:03:04:05 * @cliexend ?*/ -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (show_pppoe_session_command, static) = { .path = "show pppoe session", .short_help = "show pppoe session", .function = show_pppoe_session_command_fn, }; -/* *INDENT-ON* */ typedef struct pppoe_show_walk_ctx_t_ { @@ -721,7 +714,7 @@ show_pppoe_fib_command_fn (vlib_main_t * vm, } /*? - * This command dispays the MAC Address entries of the PPPoE FIB table. + * This command displays the MAC Address entries of the PPPoE FIB table. * Output can be filtered to just get the number of MAC Addresses or display * each MAC Address. * @@ -729,18 +722,16 @@ show_pppoe_fib_command_fn (vlib_main_t * vm, * Example of how to display the number of MAC Address entries in the PPPoE * FIB table: * @cliexstart{show pppoe fib} - * Mac Address session_id Interface sw_if_index session_index - * 52:54:00:53:18:33 1 GigabitEthernet0/8/0 2 0 - * 52:54:00:53:18:55 2 GigabitEthernet0/8/1 3 1 + * Mac Address session_id Interface sw_if_index session_index + * 52:54:00:53:18:33 1 GigabitEthernet0/8/0 2 0 + * 52:54:00:53:18:55 2 GigabitEthernet0/8/1 3 1 * @cliexend ?*/ -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (show_pppoe_fib_command, static) = { .path = "show pppoe fib", .short_help = "show pppoe fib", .function = show_pppoe_fib_command_fn, }; -/* *INDENT-ON* */ clib_error_t * pppoe_init (vlib_main_t * vm) @@ -772,12 +763,10 @@ pppoe_init (vlib_main_t * vm) VLIB_INIT_FUNCTION (pppoe_init); -/* *INDENT-OFF* */ VLIB_PLUGIN_REGISTER () = { .version = VPP_BUILD_VER, .description = "PPP over Ethernet (PPPoE)", }; -/* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON diff --git a/src/plugins/pppoe/pppoe.h b/src/plugins/pppoe/pppoe.h index a72b7349328..444de42f4a5 100644 --- a/src/plugins/pppoe/pppoe.h +++ b/src/plugins/pppoe/pppoe.h @@ -106,7 +106,6 @@ extern char *pppoe_error_strings[]; #define PPPOE_NUM_BUCKETS (64 * 1024) #define PPPOE_MEMORY_SIZE (8<<20) -/* *INDENT-OFF* */ /* * The PPPoE key is the mac address and session ID */ @@ -127,9 +126,7 @@ typedef struct u64 raw; }; } pppoe_entry_key_t; -/* *INDENT-ON* */ -/* *INDENT-OFF* */ /* * The PPPoE entry results */ @@ -147,7 +144,6 @@ typedef struct u64 raw; }; } pppoe_entry_result_t; -/* *INDENT-ON* */ typedef struct { diff --git a/src/plugins/pppoe/pppoe_api.c b/src/plugins/pppoe/pppoe_api.c index 6705fb6acea..c7099a3491f 100644 --- a/src/plugins/pppoe/pppoe_api.c +++ b/src/plugins/pppoe/pppoe_api.c @@ -64,12 +64,10 @@ static void vl_api_pppoe_add_del_session_t_handler rv = vnet_pppoe_add_del_session (&a, &sw_if_index); out: - /* *INDENT-OFF* */ REPLY_MACRO2(VL_API_PPPOE_ADD_DEL_SESSION_REPLY, ({ rmp->sw_if_index = ntohl (sw_if_index); })); - /* *INDENT-ON* */ } static void send_pppoe_session_details @@ -120,12 +118,10 @@ vl_api_pppoe_session_dump_t_handler (vl_api_pppoe_session_dump_t * mp) if (~0 == sw_if_index) { - /* *INDENT-OFF* */ pool_foreach (t, pem->sessions) { send_pppoe_session_details(t, reg, mp->context); } - /* *INDENT-ON* */ } else { @@ -148,9 +144,7 @@ vl_api_pppoe_add_del_cp_t_handler (vl_api_pppoe_add_del_cp_t * mp) rv = pppoe_add_del_cp (ntohl (mp->sw_if_index), mp->is_add); - /* *INDENT-OFF* */ REPLY_MACRO(VL_API_PPPOE_ADD_DEL_CP_REPLY); - /* *INDENT-ON* */ } #include <pppoe/pppoe.api.c> diff --git a/src/plugins/pppoe/pppoe_cp.c b/src/plugins/pppoe/pppoe_cp.c index 6c6ba249fcc..82891d5b654 100644 --- a/src/plugins/pppoe/pppoe_cp.c +++ b/src/plugins/pppoe/pppoe_cp.c @@ -97,14 +97,12 @@ done: return error; } -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (create_pppoe_cp_cmd, static) = { .path = "create pppoe cp", .short_help = "create pppoe cp-if-index <intfc> [del]", .function = pppoe_add_del_cp_command_fn, }; -/* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON diff --git a/src/plugins/pppoe/pppoe_decap.c b/src/plugins/pppoe/pppoe_decap.c index 71b9874081e..7c456a7a9cc 100644 --- a/src/plugins/pppoe/pppoe_decap.c +++ b/src/plugins/pppoe/pppoe_decap.c @@ -133,8 +133,10 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm, pppoe0 = (pppoe_header_t*)(vlan0+1); if( type0 != ETHERNET_TYPE_PPPOE_DISCOVERY && type0 != ETHERNET_TYPE_PPPOE_SESSION ) { error0 = PPPOE_ERROR_BAD_VER_TYPE; - next0 = PPPOE_INPUT_NEXT_DROP; - goto trace0; + result0.fields.session_index = + ~0; // avoid tracing random data + next0 = PPPOE_INPUT_NEXT_DROP; + goto trace0; } } else { pppoe0 = (pppoe_header_t*)(h0+1); @@ -152,6 +154,7 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm, vlib_buffer_advance(b0, sizeof(*h0)+sizeof(*vlan0)); error0 = PPPOE_ERROR_CONTROL_PLANE; next0 = PPPOE_INPUT_NEXT_CP_INPUT; + result0.fields.session_index = ~0; goto trace0; } @@ -228,8 +231,10 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm, pppoe1 = (pppoe_header_t*)(vlan1+1); if( type1 != ETHERNET_TYPE_PPPOE_DISCOVERY && type1 != ETHERNET_TYPE_PPPOE_SESSION ) { error1 = PPPOE_ERROR_BAD_VER_TYPE; - next1 = PPPOE_INPUT_NEXT_DROP; - goto trace1; + result1.fields.session_index = + ~0; // avoid tracing random data + next1 = PPPOE_INPUT_NEXT_DROP; + goto trace1; } } else { pppoe1 = (pppoe_header_t*)(h1+1); @@ -247,6 +252,7 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm, vlib_buffer_advance(b1, sizeof(*h1)+sizeof(*vlan1)); error1 = PPPOE_ERROR_CONTROL_PLANE; next1 = PPPOE_INPUT_NEXT_CP_INPUT; + result1.fields.session_index = ~0; goto trace1; } @@ -354,8 +360,10 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm, pppoe0 = (pppoe_header_t*)(vlan0+1); if( type0 != ETHERNET_TYPE_PPPOE_DISCOVERY && type0 != ETHERNET_TYPE_PPPOE_SESSION ) { error0 = PPPOE_ERROR_BAD_VER_TYPE; - next0 = PPPOE_INPUT_NEXT_DROP; - goto trace00; + result0.fields.session_index = + ~0; // avoid tracing random data + next0 = PPPOE_INPUT_NEXT_DROP; + goto trace00; } } else { pppoe0 = (pppoe_header_t*)(h0+1); @@ -372,6 +380,7 @@ VLIB_NODE_FN (pppoe_input_node) (vlib_main_t * vm, vlib_buffer_advance(b0, sizeof(*h0)+sizeof(*vlan0)); error0 = PPPOE_ERROR_CONTROL_PLANE; next0 = PPPOE_INPUT_NEXT_CP_INPUT; + result0.fields.session_index = ~0; goto trace00; } @@ -485,11 +494,9 @@ VLIB_REGISTER_NODE (pppoe_input_node) = { .format_trace = format_pppoe_rx_trace, }; -/* *INDENT-OFF* */ VNET_FEATURE_INIT (pppoe_input_node, static) = { .arc_name = "device-input", .node_name = "pppoe-input", .runs_before = VNET_FEATURES ("ethernet-input"), }; -/* *INDENT-ON */ |