FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
adj_glean.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @brief Glean Adjacency
18  *
19  * A gleean adjacency represent the need to discover new peers on an
20  * attached link. Packets that hit a glean adjacency will generate an
21  * ARP/ND packet addessesed to the packet's destination address.
22  * Note this is different to an incomplete neighbour adjacency, which
23  * does not send ARP/ND requests to the packet's destination address,
24  * but instead to the next-hop address of the adjacency itself.
25  */
26 
27 #ifndef __ADJ_GLEAN_H__
28 #define __ADJ_GLEAN_H__
29 
30 #include <vnet/adj/adj_types.h>
31 
32 /**
33  * @brief
34  * Add (and lock) a new or lock an existing glean adjacency
35  *
36  * @param proto
37  * The protocol for the neighbours that we wish to glean
38  *
39  * @param sw_if_index
40  * The interface on which to glean
41  *
42  * @param nh_addr
43  * the address applied to the interface on which to glean. This
44  * as the source address in packets when the ARP/ND packet is sent
45  */
47  vnet_link_t linkt,
49  const fib_prefix_t *conn);
50 
51 /**
52  * @brief Get an existing glean
53  *
54  * @return INVALID if it does not exist
55  */
58  const ip46_address_t *nh_addr);
59 
60 /**
61  * adj_glean_update_rewrite
62  *
63  * Called by an adjacency provider (an interface type) to configure
64  * a glean adj (i.e. and adjacency linked to a connected prefix) to
65  * its default behaviour.
66  * Other interface types (i.e. 6RD tunnels) can can choose not to use
67  * glean behaviour on an adjacency liked to a connected prefix.
68  */
69 extern void adj_glean_update_rewrite(adj_index_t adj_index);
71 
72 /**
73  * Return the source address from the glean
74  */
75 const ip46_address_t *adj_glean_get_src(fib_protocol_t proto,
77  const ip46_address_t *nh_addr);
78 
79 /**
80  * @brief Format/display a glean adjacency.
81  */
82 extern u8* format_adj_glean(u8* s, va_list *ap);
83 
84 /**
85  * Walk all the gleans on an interface
86  */
87 extern void adj_glean_walk (u32 sw_if_index,
89  void *);
90 
91 /**
92  * @brief
93  * Module initialisation
94  */
95 extern void adj_glean_module_init(void);
96 
97 /**
98  * @brief
99  * Return the size of the adjacency database. for testing purposes
100  */
101 extern u32 adj_glean_db_size(void);
102 
103 #endif
adj_types.h
adj_glean_get
adj_index_t adj_glean_get(fib_protocol_t proto, u32 sw_if_index, const ip46_address_t *nh_addr)
Get an existing glean.
Definition: adj_glean.c:231
adj_glean_walk
void adj_glean_walk(u32 sw_if_index, adj_walk_cb_t, void *)
Walk all the gleans on an interface.
Definition: adj_glean.c:196
adj_glean_db_size
u32 adj_glean_db_size(void)
Return the size of the adjacency database.
Definition: adj_glean.c:445
adj_glean_module_init
void adj_glean_module_init(void)
Module initialisation.
Definition: adj_glean.c:509
adj_glean_update_rewrite
void adj_glean_update_rewrite(adj_index_t adj_index)
adj_glean_update_rewrite
Definition: adj_glean.c:163
adj_glean_update_rewrite_itf
void adj_glean_update_rewrite_itf(u32 sw_if_index)
Definition: adj_glean.c:190
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u32
unsigned int u32
Definition: types.h:88
nh_addr
vl_api_address_t nh_addr
Definition: lisp_gpe.api:222
adj_glean_add_or_lock
adj_index_t adj_glean_add_or_lock(fib_protocol_t proto, vnet_link_t linkt, u32 sw_if_index, const fib_prefix_t *conn)
Glean Adjacency.
Definition: adj_glean.c:112
adj_index_t
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
vnet_link_t
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
u8
unsigned char u8
Definition: types.h:56
format_adj_glean
u8 * format_adj_glean(u8 *s, va_list *ap)
Format/display a glean adjacency.
Definition: adj_glean.c:429
adj_glean_get_src
const ip46_address_t * adj_glean_get_src(fib_protocol_t proto, u32 sw_if_index, const ip46_address_t *nh_addr)
Return the source address from the glean.
Definition: adj_glean.c:257
adj_walk_cb_t
adj_walk_rc_t(* adj_walk_cb_t)(adj_index_t ai, void *ctx)
Call back function when walking adjacencies.
Definition: adj_types.h:50
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202