|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
19 #include <sys/ioctl.h>
29 #include <vpp/app/version.h>
48 s =
format (s,
"[%d] sw-if-index %d client-ip %U session-id %d ",
53 s =
format (s,
"encap-if-index %d decap-fib-index %d\n",
56 s =
format (s,
" local-mac %U client-mac %U",
66 u32 dev_instance = va_arg (*args,
u32);
67 return format (s,
"pppoe_session%d", dev_instance);
91 u32 dev_instance = va_arg (*args,
u32);
92 s =
format (s,
"unimplemented dev %u", dev_instance);
125 eth_hdr->
type = clib_host_to_net_u16 (ETHERNET_TYPE_PPPOE_SESSION);
132 eth_hdr->
type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
135 vlan->
type = clib_host_to_net_u16 (ETHERNET_TYPE_PPPOE_SESSION);
156 pppoe->
ppp_proto = clib_host_to_net_u16 (PPP_PROTOCOL_ip4);
159 pppoe->
ppp_proto = clib_host_to_net_u16 (PPP_PROTOCOL_ip6);
270 #define foreach_copy_field \
284 return decap_fib_index <
r->n_next_nodes;
293 u32 hw_if_index = ~0;
306 cached_result.
raw = ~0;
311 pfx.
fp_addr.ip4.as_u32 =
a->client_ip.ip4.as_u32;
317 pfx.
fp_addr.ip6.as_u64[0] =
a->client_ip.ip6.as_u64[0];
318 pfx.
fp_addr.ip6.as_u64[1] =
a->client_ip.ip6.as_u64[1];
325 a->client_mac, 0, &
key, &bucket, &result);
326 a->encap_if_index = result.
fields.sw_if_index;
328 if (
a->encap_if_index == ~0)
329 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
336 a->client_mac, clib_host_to_net_u16 (
a->session_id),
337 &
key, &bucket, &result);
341 &
key, &cached_key, &bucket, &result);
346 if (result.
fields.session_index != ~0)
347 return VNET_API_ERROR_TUNNEL_EXIST;
351 return VNET_API_ERROR_INVALID_DECAP_NEXT;
359 #define _(x) t->x = a->x;
368 a->client_mac, clib_host_to_net_u16 (
a->session_id),
369 &
key, &bucket, &result);
381 hi->hw_instance =
hi->dev_instance;
400 (vnm, pppoe_device_class.index, t - pem->
sessions,
401 pppoe_hw_class.index, t - pem->
sessions);
428 if (result.
fields.session_index == ~0)
429 return VNET_API_ERROR_NO_SUCH_ENTRY;
443 result.
fields.session_index = ~0;
445 a->client_mac, clib_host_to_net_u16 (
a->session_id),
446 &
key, &bucket, &result);
473 ip46_address_t client_ip;
475 u8 client_ip_set = 0;
478 u32 encap_if_index = 0;
479 u32 decap_fib_index = 0;
480 u8 client_mac[6] = { 0 };
481 u8 client_mac_set = 0;
485 u32 session_sw_if_index;
503 else if (
unformat (line_input,
"client-ip %U",
509 else if (
unformat (line_input,
"client-ip %U",
515 else if (
unformat (line_input,
"decap-vrf-id %d", &
tmp))
522 if (decap_fib_index == ~0)
542 if (client_ip_set == 0)
549 if (ipv4_set && ipv6_set)
555 if (client_mac_set == 0)
564 a->is_ip6 = ipv6_set;
566 #define _(x) a->x = x;
582 case VNET_API_ERROR_TUNNEL_EXIST:
586 case VNET_API_ERROR_NO_SUCH_ENTRY:
592 (0,
"vnet_pppoe_add_del_session returned %d",
rv);
615 .path =
"create pppoe session",
617 "create pppoe session client-ip <client-ip> session-id <nn>"
618 " client-mac <client-mac> [decap-vrf-id <nn>] [del]",
656 .path =
"show pppoe session",
657 .short_help =
"show pppoe session",
676 if (
ctx->first_entry)
678 ctx->first_entry = 0;
680 "%=19s%=12s%=13s%=14s",
681 "Mac-Address",
"session_id",
"sw_if_index",
686 result.
raw = kvp->value;
689 "%=19U%=12d%=13d%=14d",
691 clib_net_to_host_u16 (
key.fields.session_id),
692 result.
fields.sw_if_index == ~0
693 ? -1 : result.
fields.sw_if_index,
694 result.
fields.session_index == ~0
695 ? -1 : result.
fields.session_index);
696 ctx->total_entries++;
698 return (BIHASH_WALK_CONTINUE);
715 if (
ctx.total_entries == 0)
739 .path =
"show pppoe fib",
740 .short_help =
"show pppoe fib",
777 .version = VPP_BUILD_VER,
778 .description =
"PPP over Ethernet (PPPoE)",
u32 decap_fib_index
FIB indices - inner IP packet lookup here.
fib_node_index_t fib_table_entry_path_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Add one path to an entry (aka route) in the FIB.
vnet_interface_main_t * im
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
struct vnet_sub_interface_t::@374 eth
void interface_tx_dpo_add_or_lock(dpo_proto_t proto, u32 sw_if_index, dpo_id_t *dpo)
The data-path object representing transmitting the packet on a n interface.
@ IP_LOOKUP_NEXT_ARP
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
VNET_DEVICE_CLASS(pppoe_device_class, static)
vnet_sw_interface_type_t type
struct vnet_sub_interface_t::@374::@375::@377 flags
static fib_source_t pppoe_fib_src
#define clib_memcpy(d, s, n)
static u8 * pppoe_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
@ VNET_INTERFACE_COUNTER_TX
static clib_error_t * pppoe_add_del_session_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
int vnet_pppoe_add_del_session(vnet_pppoe_add_del_session_args_t *a, u32 *sw_if_indexp)
u8 * format_ethernet_address(u8 *s, va_list *args)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
static vlib_cli_command_t create_pppoe_session_command
(constructor) VLIB_CLI_COMMAND (create_pppoe_session_command)
@ IP_LOOKUP_NEXT_GLEAN
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
static void pppoe_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
@ VNET_SW_INTERFACE_TYPE_SUB
#define clib_error_return(e, args...)
static vlib_cli_command_t show_pppoe_session_command
(constructor) VLIB_CLI_COMMAND (show_pppoe_session_command)
@ IP_LOOKUP_NEXT_LOCAL
This packet is for one of our own IP addresses.
VNET_HW_INTERFACE_CLASS(pppoe_hw_class)
u16 fp_len
The mask length.
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define pool_put(P, E)
Free an object E in pool P.
@ IP_LOOKUP_NEXT_MIDCHAIN
This packets follow a mid-chain adjacency.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
@ VNET_HW_INTERFACE_FLAG_LINK_UP
vlib_simple_counter_main_t * sw_if_counters
void adj_mcast_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite, u8 offset, u32 mask)
adj_mcast_midchain_update_rewrite
u8 * format_pppoe_session(u8 *s, va_list *args)
static_always_inline void pppoe_learn_process(BVT(clib_bihash) *table, u32 sw_if_index0, pppoe_entry_key_t *key0, pppoe_entry_key_t *cached_key, u32 *bucket0, pppoe_entry_result_t *result0)
Perform learning on one packet based on the mac table lookup result.
static u8 * format_pppoe_name(u8 *s, va_list *args)
vnet_link_t ia_link
link/ether-type 1 bytes
vnet_hw_if_output_node_runtime_t * r
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static void pppoe_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
Fixup the adj rewrite post encap.
vlib_node_registration_t pppoe_input_node
(constructor) VLIB_REGISTER_NODE (pppoe_input_node)
static int pppoe_show_walk_cb(BVT(clib_bihash_kv) *kvp, void *arg)
vnet_sw_interface_flags_t flags
dpo_proto_t vnet_link_to_dpo_proto(vnet_link_t linkt)
static u8 * format_pppoe_header_with_length(u8 *s, va_list *args)
@ IP_LOOKUP_NEXT_MCAST_MIDCHAIN
Multicast Midchain Adjacency.
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
@ IP_LOOKUP_NEXT_DROP
Adjacency to drop this packet.
clib_error_t * pppoe_init(vlib_main_t *vm)
void clib_bihash_init(clib_bihash *h, char *name, u32 nbuckets, uword memory_size)
initialize a bounded index extensible hash table
#define PPPOE_NUM_BUCKETS
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
void fib_table_entry_path_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_route_path_flags_t path_flags)
remove one path to an entry (aka route) in the FIB.
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
@ IP_LOOKUP_NEXT_REWRITE
This packet is to be rewritten and forwarded to the next processing node.
BVT(clib_bihash)
The table of adjacencies indexed by the rewrite string.
@ IP_LOOKUP_NEXT_PUNT
Adjacency to punt this packet.
#define VLIB_CLI_COMMAND(x,...)
@ IP_LOOKUP_NEXT_BCAST
Broadcast Adjacency.
@ VNET_INTERFACE_COUNTER_RX
#define CLIB_CACHE_LINE_BYTES
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
vlib_combined_counter_main_t * combined_sw_if_counters
fib_source_t fib_source_allocate(const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh)
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
static bool pppoe_decap_next_is_valid(pppoe_main_t *pem, u32 is_ip6, u32 decap_fib_index)
static_always_inline void pppoe_lookup_1(BVT(clib_bihash) *table, pppoe_entry_key_t *cached_key, pppoe_entry_result_t *cached_result, u8 *mac0, u16 session_id0, pppoe_entry_key_t *key0, u32 *bucket0, pppoe_entry_result_t *result0)
@ FIB_SOURCE_BH_API
add paths with [mpls] path extensions
#define FIB_SOURCE_PRIORITY_HI
Some priority values that plugins might use when they are not to concerned where in the list they'll ...
@ IP_LOOKUP_NEXT_ICMP_ERROR
This packets needs to go to ICMP error.
static_always_inline void pppoe_update_1(BVT(clib_bihash) *table, u8 *mac0, u16 session_id0, pppoe_entry_key_t *key0, u32 *bucket0, pppoe_entry_result_t *result0)
void adj_nbr_midchain_stack(adj_index_t adj_index, const dpo_id_t *next)
adj_nbr_midchain_stack
vlib_node_registration_t ip6_input_node
(constructor) VLIB_REGISTER_NODE (ip6_input_node)
static void vnet_interface_counter_unlock(vnet_interface_main_t *im)
void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite)
adj_nbr_midchain_update_rewrite
format_function_t format_vnet_sw_if_index_name
description fragment has unexpected format
struct pppoe_entry_result_t::@776::@778 fields
static void vlib_zero_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
Clear a simple counter Clears the set of per-thread u16 counters, and the u64 counter.
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
format_function_t format_ip46_address
@ FIB_ROUTE_PATH_FLAG_NONE
u32 * session_index_by_sw_if_index
#define VLIB_INIT_FUNCTION(x)
static vlib_cli_command_t show_pppoe_fib_command
(constructor) VLIB_CLI_COMMAND (show_pppoe_fib_command)
static uword pool_elts(void *v)
Number of active elements in a pool.
static clib_error_t * pppoe_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
fib_protocol_t fp_proto
protocol type
#define PPPOE_MEMORY_SIZE
u32 adj_index_t
An index for adjacencies.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
@ VNET_SW_INTERFACE_FLAG_HIDDEN
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
static clib_error_t * show_pppoe_session_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void clib_bihash_foreach_key_value_pair(clib_bihash *h, clib_bihash_foreach_key_value_pair_cb *callback, void *arg)
Visit active (key,value) pairs in a bi-hash table.
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
vlib_node_registration_t ip4_input_node
Global ip4 input node.
@ IP_LOOKUP_NEXT_MCAST
Multicast Adjacency.
u32 * free_pppoe_session_hw_if_indices
static clib_error_t * show_pppoe_fib_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Display the contents of the PPPoE Fib.
@ VNET_HW_INTERFACE_CLASS_FLAG_P2P
a point 2 point interface
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
enum fib_source_t_ fib_source_t
The different sources that can create a route.
pppoe_session_t * sessions
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
vl_api_interface_index_t sw_if_index
struct pppoe_show_walk_ctx_t_ pppoe_show_walk_ctx_t
vlib_node_registration_t pppoe_cp_dispatch_node
(constructor) VLIB_REGISTER_NODE (pppoe_cp_dispatch_node)
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
static void vnet_interface_counter_lock(vnet_interface_main_t *im)
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
Aggregate type for a prefix.
void ethernet_register_input_type(vlib_main_t *vm, ethernet_type_t type, u32 node_index)
@ VNET_INTERFACE_COUNTER_DROP
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
vnet_interface_main_t interface_main
#define foreach_copy_field
VLIB buffer representation.
vl_api_wireguard_peer_flags_t flags