X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fpppoe%2Fpppoe.c;h=46faa1f33eb599d932eb16e643c9252725bd0efb;hb=29c6132108be68feb11c8d9bfaaf674cba86ee33;hp=d73a71857c65fafd592df713f650038ff42ff68f;hpb=346ed07526326f0b1c48ac356d5d786ff9ae0013;p=vpp.git diff --git a/src/plugins/pppoe/pppoe.c b/src/plugins/pppoe/pppoe.c index d73a71857c6..46faa1f33eb 100644 --- a/src/plugins/pppoe/pppoe.c +++ b/src/plugins/pppoe/pppoe.c @@ -37,6 +37,8 @@ pppoe_main_t pppoe_main; +static fib_source_t pppoe_fib_src; + u8 * format_pppoe_session (u8 * s, va_list * args) { @@ -65,14 +67,6 @@ format_pppoe_name (u8 * s, va_list * args) return format (s, "pppoe_session%d", dev_instance); } -static uword -dummy_interface_tx (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) -{ - clib_warning ("you shouldn't be here, leaking buffers..."); - return frame->n_vectors; -} - static clib_error_t * pppoe_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags) { @@ -87,7 +81,6 @@ pppoe_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags) VNET_DEVICE_CLASS (pppoe_device_class,static) = { .name = "PPPoE", .format_device_name = format_pppoe_name, - .tx_function = dummy_interface_tx, .admin_up_down_function = pppoe_interface_admin_up_down, }; /* *INDENT-ON* */ @@ -147,7 +140,7 @@ pppoe_build_rewrite (vnet_main_t * vnm, */ static void pppoe_fixup (vlib_main_t * vm, - ip_adjacency_t * adj, vlib_buffer_t * b0, const void *data) + const ip_adjacency_t * adj, vlib_buffer_t * b0, const void *data) { const pppoe_session_t *t; pppoe_header_t *pppoe0; @@ -273,7 +266,7 @@ int vnet_pppoe_add_del_session cached_key.raw = ~0; cached_result.raw = ~0; /* warning be gone */ - memset (&pfx, 0, sizeof (pfx)); + clib_memset (&pfx, 0, sizeof (pfx)); if (!is_ip6) { @@ -320,7 +313,7 @@ int vnet_pppoe_add_del_session return VNET_API_ERROR_INVALID_DECAP_NEXT; pool_get_aligned (pem->sessions, t, CLIB_CACHE_LINE_BYTES); - memset (t, 0, sizeof (*t)); + clib_memset (t, 0, sizeof (*t)); clib_memcpy (t->local_mac, hi->hw_address, 6); @@ -385,7 +378,7 @@ int vnet_pppoe_add_del_session /* add reverse route for client ip */ fib_table_entry_path_add (a->decap_fib_index, &pfx, - FIB_SOURCE_PLUGIN_HI, FIB_ENTRY_FLAG_NONE, + pppoe_fib_src, FIB_ENTRY_FLAG_NONE, fib_proto_to_dpo (pfx.fp_proto), &pfx.fp_addr, sw_if_index, ~0, 1, NULL, FIB_ROUTE_PATH_FLAG_NONE); @@ -417,7 +410,7 @@ int vnet_pppoe_add_del_session /* delete reverse route for client ip */ fib_table_entry_path_remove (a->decap_fib_index, &pfx, - FIB_SOURCE_PLUGIN_HI, + pppoe_fib_src, fib_proto_to_dpo (pfx.fp_proto), &pfx.fp_addr, sw_if_index, ~0, 1, @@ -455,7 +448,7 @@ pppoe_add_del_session_command_fn (vlib_main_t * vm, clib_error_t *error = NULL; /* Cant "universally zero init" (={0}) due to GCC bug 53119 */ - memset (&client_ip, 0, sizeof client_ip); + clib_memset (&client_ip, 0, sizeof client_ip); /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) @@ -527,7 +520,7 @@ pppoe_add_del_session_command_fn (vlib_main_t * vm, goto done; } - memset (a, 0, sizeof (*a)); + clib_memset (a, 0, sizeof (*a)); a->is_add = is_add; a->is_ip6 = ipv6_set; @@ -635,7 +628,7 @@ typedef struct pppoe_show_walk_ctx_t_ u32 total_entries; } pppoe_show_walk_ctx_t; -static void +static int pppoe_show_walk_cb (BVT (clib_bihash_kv) * kvp, void *arg) { pppoe_show_walk_ctx_t *ctx = arg; @@ -663,6 +656,8 @@ pppoe_show_walk_cb (BVT (clib_bihash_kv) * kvp, void *arg) result.fields.session_index == ~0 ? -1 : result.fields.session_index); ctx->total_entries++; + + return (BIHASH_WALK_CONTINUE); } /** Display the contents of the PPPoE Fib. */ @@ -730,6 +725,10 @@ pppoe_init (vlib_main_t * vm) ethernet_register_input_type (vm, ETHERNET_TYPE_PPPOE_DISCOVERY, pppoe_cp_dispatch_node.index); + pppoe_fib_src = fib_source_allocate ("pppoe", + FIB_SOURCE_PRIORITY_HI, + FIB_SOURCE_BH_API); + return 0; } @@ -738,7 +737,7 @@ VLIB_INIT_FUNCTION (pppoe_init); /* *INDENT-OFF* */ VLIB_PLUGIN_REGISTER () = { .version = VPP_BUILD_VER, - .description = "PPPoE", + .description = "PPP over Ethernet (PPPoE)", }; /* *INDENT-ON* */