summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-02-03 10:55:09 +0000
committerDamjan Marion <dmarion@me.com>2020-02-04 09:44:58 +0000
commit03ce46219cd0fabfd4918822c5b9fed9ef880de8 (patch)
treef33c291dba25bcbe856602e6c63ce9d8ef4cc96c /src/vnet
parent0860b2e19365c092f10dd1ce639caaded0e87ded (diff)
teib: Rename NHRP to TEIB
Type: refactor The Tunnel Endpoint Informatiob Base (TEIB) is a better description of what it is (a mapping between tunnel endpoint address, in the overlay, and next-hop address, in the underlay) whereas NHRP is one instanc eof a control protocol that might add such endpoints. Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: Idcb2ad0b6543d3e5d9f6e96f9d14dafb5ce2aa85
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/CMakeLists.txt12
-rw-r--r--src/vnet/gre/gre.c8
-rw-r--r--src/vnet/gre/gre.h4
-rw-r--r--src/vnet/gre/interface.c52
-rw-r--r--src/vnet/ipip/ipip.c60
-rw-r--r--src/vnet/nhrp/nhrp.c244
-rw-r--r--src/vnet/nhrp/nhrp.h81
-rw-r--r--src/vnet/teib/teib.api (renamed from src/vnet/nhrp/nhrp.api)14
-rw-r--r--src/vnet/teib/teib.c244
-rw-r--r--src/vnet/teib/teib.h85
-rw-r--r--src/vnet/teib/teib_api.c (renamed from src/vnet/nhrp/nhrp_api.c)62
-rw-r--r--src/vnet/teib/teib_cli.c (renamed from src/vnet/nhrp/nhrp_cli.c)42
12 files changed, 456 insertions, 452 deletions
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 6f9f6bcc974..5a9ae4c1a7f 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -1517,20 +1517,20 @@ list(APPEND VNET_HEADERS
list(APPEND VNET_API_FILES pci/pci_types.api)
##############################################################################
-# NHRP
+# Tunnel Endpoint Information Base
##############################################################################
list (APPEND VNET_SOURCES
- nhrp/nhrp_api.c
- nhrp/nhrp_cli.c
- nhrp/nhrp.c
+ teib/teib_api.c
+ teib/teib_cli.c
+ teib/teib.c
)
list(APPEND VNET_HEADERS
- nhrp/nhrp.h
+ teib/teib.h
)
-list(APPEND VNET_API_FILES nhrp/nhrp.api)
+list(APPEND VNET_API_FILES teib/teib.api)
##############################################################################
# ARP/ND
diff --git a/src/vnet/gre/gre.c b/src/vnet/gre/gre.c
index f1bc6946416..a4f38880a39 100644
--- a/src/vnet/gre/gre.c
+++ b/src/vnet/gre/gre.c
@@ -438,9 +438,9 @@ mgre_mk_complete_walk (adj_index_t ai, void *data)
gre_build_rewrite (vnet_get_main (),
ctx->t->sw_if_index,
adj_get_link_type (ai),
- &nhrp_entry_get_nh (ctx->ne)->fp_addr));
+ &teib_entry_get_nh (ctx->ne)->fp_addr));
- nhrp_entry_adj_stack (ctx->ne, ai);
+ teib_entry_adj_stack (ctx->ne, ai);
return (ADJ_WALK_RC_CONTINUE);
}
@@ -464,7 +464,7 @@ mgre_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
{
gre_main_t *gm = &gre_main;
ip_adjacency_t *adj;
- nhrp_entry_t *ne;
+ teib_entry_t *ne;
gre_tunnel_t *t;
u32 ti;
@@ -472,7 +472,7 @@ mgre_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
ti = gm->tunnel_index_by_sw_if_index[sw_if_index];
t = pool_elt_at_index (gm->tunnels, ti);
- ne = nhrp_entry_find (sw_if_index, &adj->sub_type.nbr.next_hop);
+ ne = teib_entry_find (sw_if_index, &adj->sub_type.nbr.next_hop);
if (NULL == ne)
// no NHRP entry to provide the next-hop
diff --git a/src/vnet/gre/gre.h b/src/vnet/gre/gre.h
index 0cc60b87eeb..14798d85842 100644
--- a/src/vnet/gre/gre.h
+++ b/src/vnet/gre/gre.h
@@ -25,7 +25,7 @@
#include <vnet/ip/format.h>
#include <vnet/adj/adj_types.h>
#include <vnet/tunnel/tunnel.h>
-#include <vnet/nhrp/nhrp.h>
+#include <vnet/teib/teib.h>
extern vnet_hw_interface_class_t gre_hw_interface_class;
extern vnet_hw_interface_class_t mgre_hw_interface_class;
@@ -328,7 +328,7 @@ extern void gre_update_adj (vnet_main_t * vnm,
typedef struct mgre_walk_ctx_t_
{
const gre_tunnel_t *t;
- const nhrp_entry_t *ne;
+ const teib_entry_t *ne;
} mgre_walk_ctx_t;
adj_walk_rc_t mgre_mk_complete_walk (adj_index_t ai, void *data);
diff --git a/src/vnet/gre/interface.c b/src/vnet/gre/interface.c
index 553c89aeb51..6efa3da13b8 100644
--- a/src/vnet/gre/interface.c
+++ b/src/vnet/gre/interface.c
@@ -25,7 +25,7 @@
#include <vnet/adj/adj_nbr.h>
#include <vnet/mpls/mpls.h>
#include <vnet/l2/l2_input.h>
-#include <vnet/nhrp/nhrp.h>
+#include <vnet/teib/teib.h>
u8 *
format_gre_tunnel_type (u8 * s, va_list * args)
@@ -183,23 +183,23 @@ gre_tunnel_restack (gre_tunnel_t * gt)
}
static void
-gre_nhrp_mk_key (const gre_tunnel_t * t,
- const nhrp_entry_t * ne, gre_tunnel_key_t * key)
+gre_teib_mk_key (const gre_tunnel_t * t,
+ const teib_entry_t * ne, gre_tunnel_key_t * key)
{
const fib_prefix_t *nh;
- nh = nhrp_entry_get_nh (ne);
+ nh = teib_entry_get_nh (ne);
/* construct the key using mode P2P so it can be found in the DP */
if (FIB_PROTOCOL_IP4 == nh->fp_proto)
gre_mk_key4 (t->tunnel_src.ip4,
nh->fp_addr.ip4,
- nhrp_entry_get_fib_index (ne),
+ teib_entry_get_fib_index (ne),
t->type, TUNNEL_MODE_P2P, 0, &key->gtk_v4);
else
gre_mk_key6 (&t->tunnel_src.ip6,
&nh->fp_addr.ip6,
- nhrp_entry_get_fib_index (ne),
+ teib_entry_get_fib_index (ne),
t->type, TUNNEL_MODE_P2P, 0, &key->gtk_v6);
}
@@ -207,7 +207,7 @@ gre_nhrp_mk_key (const gre_tunnel_t * t,
* An NHRP entry has been added
*/
static void
-gre_nhrp_entry_added (const nhrp_entry_t * ne)
+gre_teib_entry_added (const teib_entry_t * ne)
{
gre_main_t *gm = &gre_main;
const ip46_address_t *nh;
@@ -216,7 +216,7 @@ gre_nhrp_entry_added (const nhrp_entry_t * ne)
u32 sw_if_index;
u32 t_idx;
- sw_if_index = nhrp_entry_get_sw_if_index (ne);
+ sw_if_index = teib_entry_get_sw_if_index (ne);
if (vec_len (gm->tunnel_index_by_sw_if_index) < sw_if_index)
return;
@@ -233,7 +233,7 @@ gre_nhrp_entry_added (const nhrp_entry_t * ne)
/* the next-hop (underlay) of the NHRP entry will form part of the key for
* ingress lookup to match packets to this interface */
- gre_nhrp_mk_key (t, ne, &key);
+ gre_teib_mk_key (t, ne, &key);
gre_tunnel_db_add (t, &key);
/* update the rewrites for each of the adjacencies for this peer (overlay)
@@ -242,15 +242,15 @@ gre_nhrp_entry_added (const nhrp_entry_t * ne)
.t = t,
.ne = ne
};
- nh = nhrp_entry_get_peer (ne);
- adj_nbr_walk_nh (nhrp_entry_get_sw_if_index (ne),
+ nh = teib_entry_get_peer (ne);
+ adj_nbr_walk_nh (teib_entry_get_sw_if_index (ne),
(ip46_address_is_ip4 (nh) ?
FIB_PROTOCOL_IP4 :
FIB_PROTOCOL_IP6), nh, mgre_mk_complete_walk, &ctx);
}
static void
-gre_nhrp_entry_deleted (const nhrp_entry_t * ne)
+gre_teib_entry_deleted (const teib_entry_t * ne)
{
gre_main_t *gm = &gre_main;
const ip46_address_t *nh;
@@ -259,7 +259,7 @@ gre_nhrp_entry_deleted (const nhrp_entry_t * ne)
u32 sw_if_index;
u32 t_idx;
- sw_if_index = nhrp_entry_get_sw_if_index (ne);
+ sw_if_index = teib_entry_get_sw_if_index (ne);
if (vec_len (gm->tunnel_index_by_sw_if_index) < sw_if_index)
return;
@@ -271,37 +271,37 @@ gre_nhrp_entry_deleted (const nhrp_entry_t * ne)
t = pool_elt_at_index (gm->tunnels, t_idx);
/* remove the next-hop as an ingress lookup key */
- gre_nhrp_mk_key (t, ne, &key);
+ gre_teib_mk_key (t, ne, &key);
gre_tunnel_db_remove (t, &key);
- nh = nhrp_entry_get_peer (ne);
+ nh = teib_entry_get_peer (ne);
/* make all the adjacencies incomplete */
- adj_nbr_walk_nh (nhrp_entry_get_sw_if_index (ne),
+ adj_nbr_walk_nh (teib_entry_get_sw_if_index (ne),
(ip46_address_is_ip4 (nh) ?
FIB_PROTOCOL_IP4 :
FIB_PROTOCOL_IP6), nh, mgre_mk_incomplete_walk, t);
}
static walk_rc_t
-gre_tunnel_delete_nhrp_walk (index_t nei, void *ctx)
+gre_tunnel_delete_teib_walk (index_t nei, void *ctx)
{
gre_tunnel_t *t = ctx;
gre_tunnel_key_t key;
- gre_nhrp_mk_key (t, nhrp_entry_get (nei), &key);
+ gre_teib_mk_key (t, teib_entry_get (nei), &key);
gre_tunnel_db_remove (t, &key);
return (WALK_CONTINUE);
}
static walk_rc_t
-gre_tunnel_add_nhrp_walk (index_t nei, void *ctx)
+gre_tunnel_add_teib_walk (index_t nei, void *ctx)
{
gre_tunnel_t *t = ctx;
gre_tunnel_key_t key;
- gre_nhrp_mk_key (t, nhrp_entry_get (nei), &key);
+ gre_teib_mk_key (t, teib_entry_get (nei), &key);
gre_tunnel_db_add (t, &key);
return (WALK_CONTINUE);
@@ -421,7 +421,7 @@ vnet_gre_tunnel_add (vnet_gre_tunnel_add_del_args_t * a,
gre_tunnel_db_add (t, &key);
if (t->mode == TUNNEL_MODE_MP)
- nhrp_walk_itf (t->sw_if_index, gre_tunnel_add_nhrp_walk, t);
+ teib_walk_itf (t->sw_if_index, gre_tunnel_add_teib_walk, t);
if (t->type == GRE_TUNNEL_TYPE_ERSPAN)
{
@@ -477,7 +477,7 @@ vnet_gre_tunnel_delete (vnet_gre_tunnel_add_del_args_t * a,
return VNET_API_ERROR_NO_SUCH_ENTRY;
if (t->mode == TUNNEL_MODE_MP)
- nhrp_walk_itf (t->sw_if_index, gre_tunnel_delete_nhrp_walk, t);
+ teib_walk_itf (t->sw_if_index, gre_tunnel_delete_teib_walk, t);
sw_if_index = t->sw_if_index;
vnet_sw_interface_set_flags (vnm, sw_if_index, 0 /* down */ );
@@ -753,16 +753,16 @@ VLIB_CLI_COMMAND (show_gre_tunnel_command, static) = {
};
/* *INDENT-ON* */
-const static nhrp_vft_t gre_nhrp_vft = {
- .nv_added = gre_nhrp_entry_added,
- .nv_deleted = gre_nhrp_entry_deleted,
+const static teib_vft_t gre_teib_vft = {
+ .nv_added = gre_teib_entry_added,
+ .nv_deleted = gre_teib_entry_deleted,
};
/* force inclusion from application's main.c */
clib_error_t *
gre_interface_init (vlib_main_t * vm)
{
- nhrp_register (&gre_nhrp_vft);
+ teib_register (&gre_teib_vft);
return (NULL);
}
diff --git a/src/vnet/ipip/ipip.c b/src/vnet/ipip/ipip.c
index c94e91d1727..047a2df811e 100644
--- a/src/vnet/ipip/ipip.c
+++ b/src/vnet/ipip/ipip.c
@@ -25,7 +25,7 @@
#include <vnet/fib/ip6_fib.h>
#include <vnet/ip/format.h>
#include <vnet/ipip/ipip.h>
-#include <vnet/nhrp/nhrp.h>
+#include <vnet/teib/teib.h>
#include <vnet/tunnel/tunnel_dp.h>
ipip_main_t ipip_main;
@@ -299,7 +299,7 @@ ipip_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
typedef struct mipip_walk_ctx_t_
{
const ipip_tunnel_t *t;
- const nhrp_entry_t *ne;
+ const teib_entry_t *ne;
} mipip_walk_ctx_t;
static adj_walk_rc_t
@@ -313,10 +313,10 @@ mipip_mk_complete_walk (adj_index_t ai, void *data)
ADJ_FLAG_MIDCHAIN_IP_STACK, ipip_build_rewrite (vnet_get_main (),
ctx->t->sw_if_index,
adj_get_link_type (ai),
- &nhrp_entry_get_nh
+ &teib_entry_get_nh
(ctx->ne)->fp_addr));
- nhrp_entry_adj_stack (ctx->ne, ai);
+ teib_entry_adj_stack (ctx->ne, ai);
return (ADJ_WALK_RC_CONTINUE);
}
@@ -340,7 +340,7 @@ mipip_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
{
ipip_main_t *gm = &ipip_main;
ip_adjacency_t *adj;
- nhrp_entry_t *ne;
+ teib_entry_t *ne;
ipip_tunnel_t *t;
u32 ti;
@@ -348,7 +348,7 @@ mipip_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
ti = gm->tunnel_index_by_sw_if_index[sw_if_index];
t = pool_elt_at_index (gm->tunnels, ti);
- ne = nhrp_entry_find (sw_if_index, &adj->sub_type.nbr.next_hop);
+ ne = teib_entry_find (sw_if_index, &adj->sub_type.nbr.next_hop);
if (NULL == ne)
{
@@ -527,21 +527,21 @@ ipip_mk_key (const ipip_tunnel_t * t, ipip_tunnel_key_t * key)
}
static void
-ipip_nhrp_mk_key (const ipip_tunnel_t * t,
- const nhrp_entry_t * ne, ipip_tunnel_key_t * key)
+ipip_teib_mk_key (const ipip_tunnel_t * t,
+ const teib_entry_t * ne, ipip_tunnel_key_t * key)
{
const fib_prefix_t *nh;
- nh = nhrp_entry_get_nh (ne);
+ nh = teib_entry_get_nh (ne);
/* construct the key using mode P2P so it can be found in the DP */
ipip_mk_key_i (t->transport, IPIP_MODE_P2P,
&t->tunnel_src, &nh->fp_addr,
- nhrp_entry_get_fib_index (ne), key);
+ teib_entry_get_fib_index (ne), key);
}
static void
-ipip_nhrp_entry_added (const nhrp_entry_t * ne)
+ipip_teib_entry_added (const teib_entry_t * ne)
{
ipip_main_t *gm = &ipip_main;
const ip46_address_t *nh;
@@ -550,7 +550,7 @@ ipip_nhrp_entry_added (const nhrp_entry_t * ne)
u32 sw_if_index;
u32 t_idx;
- sw_if_index = nhrp_entry_get_sw_if_index (ne);
+ sw_if_index = teib_entry_get_sw_if_index (ne);
if (vec_len (gm->tunnel_index_by_sw_if_index) < sw_if_index)
return;
@@ -561,7 +561,7 @@ ipip_nhrp_entry_added (const nhrp_entry_t * ne)
t = pool_elt_at_index (gm->tunnels, t_idx);
- ipip_nhrp_mk_key (t, ne, &key);
+ ipip_teib_mk_key (t, ne, &key);
ipip_tunnel_db_add (t, &key);
// update the rewrites for each of the adjacencies for this next-hop
@@ -569,15 +569,15 @@ ipip_nhrp_entry_added (const nhrp_entry_t * ne)
.t = t,
.ne = ne
};
- nh = nhrp_entry_get_peer (ne);
- adj_nbr_walk_nh (nhrp_entry_get_sw_if_index (ne),
+ nh = teib_entry_get_peer (ne);
+ adj_nbr_walk_nh (teib_entry_get_sw_if_index (ne),
(ip46_address_is_ip4 (nh) ?
FIB_PROTOCOL_IP4 :
FIB_PROTOCOL_IP6), nh, mipip_mk_complete_walk, &ctx);
}
static void
-ipip_nhrp_entry_deleted (const nhrp_entry_t * ne)
+ipip_teib_entry_deleted (const teib_entry_t * ne)
{
ipip_main_t *gm = &ipip_main;
const ip46_address_t *nh;
@@ -586,7 +586,7 @@ ipip_nhrp_entry_deleted (const nhrp_entry_t * ne)
u32 sw_if_index;
u32 t_idx;
- sw_if_index = nhrp_entry_get_sw_if_index (ne);
+ sw_if_index = teib_entry_get_sw_if_index (ne);
if (vec_len (gm->tunnel_index_by_sw_if_index) < sw_if_index)
return;
@@ -597,37 +597,37 @@ ipip_nhrp_entry_deleted (const nhrp_entry_t * ne)
t = pool_elt_at_index (gm->tunnels, t_idx);
- ipip_nhrp_mk_key (t, ne, &key);
+ ipip_teib_mk_key (t, ne, &key);
ipip_tunnel_db_remove (t, &key);
- nh = nhrp_entry_get_peer (ne);
+ nh = teib_entry_get_peer (ne);
/* make all the adjacencies incomplete */
- adj_nbr_walk_nh (nhrp_entry_get_sw_if_index (ne),
+ adj_nbr_walk_nh (teib_entry_get_sw_if_index (ne),
(ip46_address_is_ip4 (nh) ?
FIB_PROTOCOL_IP4 :
FIB_PROTOCOL_IP6), nh, mipip_mk_incomplete_walk, t);
}
static walk_rc_t
-ipip_tunnel_delete_nhrp_walk (index_t nei, void *ctx)
+ipip_tunnel_delete_teib_walk (index_t nei, void *ctx)
{
ipip_tunnel_t *t = ctx;
ipip_tunnel_key_t key;
- ipip_nhrp_mk_key (t, nhrp_entry_get (nei), &key);
+ ipip_teib_mk_key (t, teib_entry_get (nei), &key);
ipip_tunnel_db_remove (t, &key);
return (WALK_CONTINUE);
}
static walk_rc_t
-ipip_tunnel_add_nhrp_walk (index_t nei, void *ctx)
+ipip_tunnel_add_teib_walk (index_t nei, void *ctx)
{
ipip_tunnel_t *t = ctx;
ipip_tunnel_key_t key;
- ipip_nhrp_mk_key (t, nhrp_entry_get (nei), &key);
+ ipip_teib_mk_key (t, teib_entry_get (nei), &key);
ipip_tunnel_db_add (t, &key);
return (WALK_CONTINUE);
@@ -721,7 +721,7 @@ ipip_add_tunnel (ipip_transport_t transport,
ipip_tunnel_db_add (t, &key);
if (t->mode == IPIP_MODE_P2MP)
- nhrp_walk_itf (t->sw_if_index, ipip_tunnel_add_nhrp_walk, t);
+ teib_walk_itf (t->sw_if_index, ipip_tunnel_add_teib_walk, t);
if (sw_if_indexp)
*sw_if_indexp = sw_if_index;
@@ -754,7 +754,7 @@ ipip_del_tunnel (u32 sw_if_index)
return VNET_API_ERROR_NO_SUCH_ENTRY;
if (t->mode == IPIP_MODE_P2MP)
- nhrp_walk_itf (t->sw_if_index, ipip_tunnel_delete_nhrp_walk, t);
+ teib_walk_itf (t->sw_if_index, ipip_tunnel_delete_teib_walk, t);
vnet_sw_interface_set_flags (vnm, sw_if_index, 0 /* down */ );
gm->tunnel_index_by_sw_if_index[sw_if_index] = ~0;
@@ -768,9 +768,9 @@ ipip_del_tunnel (u32 sw_if_index)
return 0;
}
-const static nhrp_vft_t ipip_nhrp_vft = {
- .nv_added = ipip_nhrp_entry_added,
- .nv_deleted = ipip_nhrp_entry_deleted,
+const static teib_vft_t ipip_teib_vft = {
+ .nv_added = ipip_teib_entry_added,
+ .nv_deleted = ipip_teib_entry_deleted,
};
static clib_error_t *
@@ -784,7 +784,7 @@ ipip_init (vlib_main_t * vm)
gm->tunnel_by_key =
hash_create_mem (0, sizeof (ipip_tunnel_key_t), sizeof (uword));
- nhrp_register (&ipip_nhrp_vft);
+ teib_register (&ipip_teib_vft);
return 0;
}
diff --git a/src/vnet/nhrp/nhrp.c b/src/vnet/nhrp/nhrp.c
deleted file mode 100644
index 11d2c2be027..00000000000
--- a/src/vnet/nhrp/nhrp.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * nhrp.h: next-hop resolution
- *
- * Copyright (c) 2016 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <vnet/nhrp/nhrp.h>
-#include <vnet/fib/fib_table.h>
-#include <vnet/adj/adj_midchain.h>
-
-typedef struct nhrp_key_t_
-{
- ip46_address_t nk_peer;
- u32 nk_sw_if_index;
-} nhrp_key_t;
-
-struct nhrp_entry_t_
-{
- nhrp_key_t *ne_key;
- fib_prefix_t ne_nh;
- u32 ne_fib_index;
-};
-
-static uword *nhrp_db;
-static nhrp_entry_t *nhrp_pool;
-static nhrp_vft_t *nhrp_vfts;
-
-#define NHRP_NOTIFY(_ne, _fn) { \
- nhrp_vft_t *_vft; \
- vec_foreach(_vft, nhrp_vfts) { \
- if (_vft->_fn) { \
- _vft->_fn(_ne); \
- } \
- } \
-}
-
-u32
-nhrp_entry_get_sw_if_index (const nhrp_entry_t * ne)
-{
- return (ne->ne_key->nk_sw_if_index);
-}
-
-u32
-nhrp_entry_get_fib_index (const nhrp_entry_t * ne)
-{
- return (ne->ne_fib_index);
-}
-
-const ip46_address_t *
-nhrp_entry_get_peer (const nhrp_entry_t * ne)
-{
- return (&ne->ne_key->nk_peer);
-}
-
-const fib_prefix_t *
-nhrp_entry_get_nh (const nhrp_entry_t * ne)
-{
- return (&ne->ne_nh);
-}
-
-void
-nhrp_entry_adj_stack (const nhrp_entry_t * ne, adj_index_t ai)
-{
- adj_midchain_delegate_stack (ai, ne->ne_fib_index, &ne->ne_nh);
-}
-
-nhrp_entry_t *
-nhrp_entry_get (index_t nei)
-{
- return pool_elt_at_index (nhrp_pool, nei);
-}
-
-nhrp_entry_t *
-nhrp_entry_find (u32 sw_if_index, const ip46_address_t * peer)
-{
- nhrp_key_t nk = {
- .nk_peer = *peer,
- .nk_sw_if_index = sw_if_index,
- };
- uword *p;
-
- p = hash_get_mem (nhrp_db, &nk);
-
- if (NULL != p)
- return nhrp_entry_get (p[0]);
-
- return (NULL);
-}
-
-int
-nhrp_entry_add (u32 sw_if_index,
- const ip46_address_t * peer,
- u32 nh_table_id, const ip46_address_t * nh)
-{
- fib_protocol_t fproto;
- nhrp_entry_t *ne;
- u32 fib_index;
- index_t nei;
-
- fproto = (ip46_address_is_ip4 (nh) ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
-
- fib_index = fib_table_find (fproto, nh_table_id);
-
- if (~0 == fib_index)
- {
- return (VNET_API_ERROR_NO_SUCH_FIB);
- }
-
- ne = nhrp_entry_find (sw_if_index, peer);
-
- if (NULL == ne)
- {
- nhrp_key_t nk = {
- .nk_peer = *peer,
- .nk_sw_if_index = sw_if_index,
- };
- nhrp_entry_t *ne;
-
- pool_get_zero (nhrp_pool, ne);
-
- nei = ne - nhrp_pool;
- ne->ne_key = clib_mem_alloc (sizeof (*ne->ne_key));
- clib_memcpy (ne->ne_key, &nk, sizeof (*ne->ne_key));
-
- ip46_address_copy (&ne->ne_nh.fp_addr, nh);
- ne->ne_nh.fp_proto = fproto;
- ne->ne_nh.fp_len = (ne->ne_nh.fp_proto == FIB_PROTOCOL_IP4 ? 32 : 128);
- ne->ne_fib_index = fib_index;
-
- hash_set_mem (nhrp_db, ne->ne_key, nei);
-
- NHRP_NOTIFY (ne, nv_added);
- }
- else
- return (VNET_API_ERROR_ENTRY_ALREADY_EXISTS);
-
- return 0;
-}
-
-int
-nhrp_entry_del (u32 sw_if_index, const ip46_address_t * peer)
-{
- nhrp_entry_t *ne;
-
- ne = nhrp_entry_find (sw_if_index, peer);
-
- if (ne != NULL)
- {
- hash_unset_mem (nhrp_db, ne->ne_key);
-
- NHRP_NOTIFY (ne, nv_deleted);
-
- clib_mem_free (ne->ne_key);
- pool_put (nhrp_pool, ne);
- }
- else
- return (VNET_API_ERROR_ENTRY_ALREADY_EXISTS);
-
- return 0;
-}
-
-u8 *
-format_nhrp_entry (u8 * s, va_list * args)
-{
- index_t nei = va_arg (*args, index_t);
- vnet_main_t *vnm = vnet_get_main ();
- nhrp_entry_t *ne;
-
- ne = nhrp_entry_get (nei);
-
- s = format (s, "[%d] ", nei);
- s = format (s, "%U:", format_vnet_sw_if_index_name,
- vnm, ne->ne_key->nk_sw_if_index);
- s = format (s, " %U", format_ip46_address,
- &ne->ne_key->nk_peer, IP46_TYPE_ANY);
- s = format (s, " via [%d]:%U",
- fib_table_get_table_id (ne->ne_fib_index, ne->ne_nh.fp_proto),
- format_fib_prefix, &ne->ne_nh);
-
- return (s);
-}
-
-void
-nhrp_walk (nhrp_walk_cb_t fn, void *ctx)
-{
- index_t nei;
-
- /* *INDENT-OFF* */
- pool_foreach_index(nei, nhrp_pool,
- ({
- fn(nei, ctx);
- }));
- /* *INDENT-ON* */
-}
-
-void
-nhrp_walk_itf (u32 sw_if_index, nhrp_walk_cb_t fn, void *ctx)
-{
- index_t nei;
-
- /* *INDENT-OFF* */
- pool_foreach_index(nei, nhrp_pool,
- ({
- if (sw_if_index == nhrp_entry_get_sw_if_index(nhrp_entry_get(nei)))
- fn(nei, ctx);
- }));
- /* *INDENT-ON* */
-}
-
-void
-nhrp_register (const nhrp_vft_t * vft)
-{
- vec_add1 (nhrp_vfts, *vft);
-}
-
-static clib_error_t *
-nhrp_init (vlib_main_t * vm)
-{
- nhrp_db = hash_create_mem (0, sizeof (nhrp_key_t), sizeof (u32));
-
- return (NULL);
-}
-
-VLIB_INIT_FUNCTION (nhrp_init);
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/vnet/nhrp/nhrp.h b/src/vnet/nhrp/nhrp.h
deleted file mode 100644
index 5b46b0d8a92..00000000000
--- a/src/vnet/nhrp/nhrp.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * nhrp.h: next-hop resolution
- *
- * Copyright (c) 2016 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __NHRP_H__
-#define __NHRP_H__
-
-#include <vnet/ip/ip.h>
-
-/**
- * An NHRP entry represents the mapping between a peer on an interface in the overlay
- * and a next-hop address in the underlay.
- * i.e. there's a multipoint tunnel providing the overlay (henace a peer on
- * that tunnel) which is reachable via 'tunnel destination' address in the
- * underlay.
- */
-typedef struct nhrp_entry_t_ nhrp_entry_t;
-
-/** accessors for the opaque struct */
-extern u32 nhrp_entry_get_sw_if_index (const nhrp_entry_t * ne);
-extern u32 nhrp_entry_get_fib_index (const nhrp_entry_t * ne);
-extern const ip46_address_t *nhrp_entry_get_peer (const nhrp_entry_t * ne);
-extern const fib_prefix_t *nhrp_entry_get_nh (const nhrp_entry_t * ne);
-extern u8 *format_nhrp_entry (u8 * s, va_list * args);
-
-/**
- * Create a new NHRP entry
- */
-extern int nhrp_entry_add (u32 sw_if_index,
- const ip46_address_t * peer,
- u32 nh_table_id, const ip46_address_t * nh);
-
-extern int nhrp_entry_del (u32 sw_if_index, const ip46_address_t * peer);
-
-extern nhrp_entry_t *nhrp_entry_find (u32 sw_if_index,
- const ip46_address_t * peer);
-extern nhrp_entry_t *nhrp_entry_get (index_t nei);
-
-extern void nhrp_entry_adj_stack (const nhrp_entry_t * ne, adj_index_t ai);
-
-typedef walk_rc_t (*nhrp_walk_cb_t) (index_t nei, void *ctx);
-
-extern void nhrp_walk (nhrp_walk_cb_t fn, void *ctx);
-extern void nhrp_walk_itf (u32 sw_if_index, nhrp_walk_cb_t fn, void *ctx);
-
-/**
- * Notifications for the creation and deletion of NHRP entries
- */
-typedef void (*nhrp_entry_added_t) (const nhrp_entry_t * ne);
-typedef void (*nhrp_entry_deleted_t) (const nhrp_entry_t * ne);
-
-typedef struct nhrp_vft_t_
-{
- nhrp_entry_added_t nv_added;
- nhrp_entry_deleted_t nv_deleted;
-} nhrp_vft_t;
-
-extern void nhrp_register (const nhrp_vft_t * vft);
-
-#endif
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/vnet/nhrp/nhrp.api b/src/vnet/teib/teib.api
index de0630c9c88..8e7320837b1 100644
--- a/src/vnet/nhrp/nhrp.api
+++ b/src/vnet/teib/teib.api
@@ -19,10 +19,10 @@ option version = "1.0.0";
import "vnet/ip/ip_types.api";
import "vnet/interface_types.api";
-/** \brief NHRP Entry
+/** \brief TEIB Entry
@param sw_if_index
*/
-typedef nhrp_entry
+typedef teib_entry
{
vl_api_interface_index_t sw_if_index;
vl_api_address_t peer;
@@ -30,24 +30,24 @@ typedef nhrp_entry
u32 nh_table_id;
};
-autoreply define nhrp_entry_add_del
+autoreply define teib_entry_add_del
{
u32 client_index;
u32 context;
u8 is_add;
- vl_api_nhrp_entry_t entry;
+ vl_api_teib_entry_t entry;
};
-define nhrp_dump
+define teib_dump
{
u32 client_index;
u32 context;
};
-define nhrp_details
+define teib_details
{
u32 context;
- vl_api_nhrp_entry_t entry;
+ vl_api_teib_entry_t entry;
};
/*
diff --git a/src/vnet/teib/teib.c b/src/vnet/teib/teib.c
new file mode 100644
index 00000000000..e392b49e86b
--- /dev/null
+++ b/src/vnet/teib/teib.c
@@ -0,0 +1,244 @@
+/*
+ * teib.h: next-hop resolution
+ *
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <vnet/teib/teib.h>
+#include <vnet/fib/fib_table.h>
+#include <vnet/adj/adj_midchain.h>
+
+typedef struct teib_key_t_
+{
+ ip46_address_t tk_peer;
+ u32 tk_sw_if_index;
+} teib_key_t;
+
+struct teib_entry_t_
+{
+ teib_key_t *te_key;
+ fib_prefix_t te_nh;
+ u32 te_fib_index;
+};
+
+static uword *teib_db;
+static teib_entry_t *teib_pool;
+static teib_vft_t *teib_vfts;
+
+#define TEIB_NOTIFY(_te, _fn) { \
+ teib_vft_t *_vft; \
+ vec_foreach(_vft, teib_vfts) { \
+ if (_vft->_fn) { \
+ _vft->_fn(_te); \
+ } \
+ } \
+}
+
+u32
+teib_entry_get_sw_if_index (const teib_entry_t * te)
+{
+ return (te->te_key->tk_sw_if_index);
+}
+
+u32
+teib_entry_get_fib_index (const teib_entry_t * te)
+{
+ return (te->te_fib_index);
+}
+
+const ip46_address_t *
+teib_entry_get_peer (const teib_entry_t * te)
+{
+ return (&te->te_key->tk_peer);
+}
+
+const fib_prefix_t *
+teib_entry_get_nh (const teib_entry_t * te)
+{
+ return (&te->te_nh);
+}
+
+void
+teib_entry_adj_stack (const teib_entry_t * te, adj_index_t ai)
+{
+ adj_midchain_delegate_stack (ai, te->te_fib_index, &te->te_nh);
+}
+
+teib_entry_t *
+teib_entry_get (index_t tei)
+{
+ return pool_elt_at_index (teib_pool, tei);
+}
+
+teib_entry_t *
+teib_entry_find (u32 sw_if_index, const ip46_address_t * peer)
+{
+ teib_key_t nk = {
+ .tk_peer = *peer,
+ .tk_sw_if_index = sw_if_index,
+ };
+ uword *p;
+
+ p = hash_get_mem (teib_db, &nk);
+
+ if (NULL != p)
+ return teib_entry_get (p[0]);
+
+ return (NULL);
+}
+
+int
+teib_entry_add (u32 sw_if_index,
+ const ip46_address_t * peer,
+ u32 nh_table_id, const ip46_address_t * nh)
+{
+ fib_protocol_t fproto;
+ teib_entry_t *te;
+ u32 fib_index;
+ index_t tei;
+
+ fproto = (ip46_address_is_ip4 (nh) ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
+
+ fib_index = fib_table_find (fproto, nh_table_id);
+
+ if (~0 == fib_index)
+ {
+ return (VNET_API_ERROR_NO_SUCH_FIB);
+ }
+
+ te = teib_entry_find (sw_if_index, peer);
+
+ if (NULL == te)
+ {
+ teib_key_t nk = {
+ .tk_peer = *peer,
+ .tk_sw_if_index = sw_if_index,
+ };
+ teib_entry_t *te;
+
+ pool_get_zero (teib_pool, te);
+
+ tei = te - teib_pool;
+ te->te_key = clib_mem_alloc (sizeof (*te->te_key));
+ clib_memcpy (te->te_key, &nk, sizeof (*te->te_key));
+
+ ip46_address_copy (&te->te_nh.fp_addr, nh);
+ te->te_nh.fp_proto = fproto;
+ te->te_nh.fp_len = (te->te_nh.fp_proto == FIB_PROTOCOL_IP4 ? 32 : 128);
+ te->te_fib_index = fib_index;
+
+ hash_set_mem (teib_db, te->te_key, tei);
+
+ TEIB_NOTIFY (te, nv_added);
+ }
+ else
+ return (VNET_API_ERROR_ENTRY_ALREADY_EXISTS);
+
+ return 0;
+}
+
+int
+teib_entry_del (u32 sw_if_index, const ip46_address_t * peer)
+{
+ teib_entry_t *te;
+
+ te = teib_entry_find (sw_if_index, peer);
+
+ if (te != NULL)
+ {
+ hash_unset_mem (teib_db, te->te_key);
+
+ TEIB_NOTIFY (te, nv_deleted);
+
+ clib_mem_free (te->te_key);
+ pool_put (teib_pool, te);
+ }
+ else
+ return (VNET_API_ERROR_ENTRY_ALREADY_EXISTS);
+
+ return 0;
+}
+
+u8 *
+format_teib_entry (u8 * s, va_list * args)
+{
+ index_t tei = va_arg (*args, index_t);
+ vnet_main_t *vnm = vnet_get_main ();
+ teib_entry_t *te;
+
+ te = teib_entry_get (tei);
+
+ s = format (s, "[%d] ", tei);
+ s = format (s, "%U:", format_vnet_sw_if_index_name,
+ vnm, te->te_key->tk_sw_if_index);
+ s = format (s, " %U", format_ip46_address,
+ &te->te_key->tk_peer, IP46_TYPE_ANY);
+ s = format (s, " via [%d]:%U",
+ fib_table_get_table_id (te->te_fib_index, te->te_nh.fp_proto),
+ format_fib_prefix, &te->te_nh);
+
+ return (s);
+}
+
+void
+teib_walk (teib_walk_cb_t fn, void *ctx)
+{
+ index_t tei;
+
+ /* *INDENT-OFF* */
+ pool_foreach_index(tei, teib_pool,
+ ({
+ fn(tei, ctx);
+ }));
+ /* *INDENT-ON* */
+}
+
+void
+teib_walk_itf (u32 sw_if_index, teib_walk_cb_t fn, void *ctx)
+{
+ index_t tei;
+
+ /* *INDENT-OFF* */
+ pool_foreach_index(tei, teib_pool,
+ ({
+ if (sw_if_index == teib_entry_get_sw_if_index(teib_entry_get(tei)))
+ fn(tei, ctx);
+ }));
+ /* *INDENT-ON* */
+}
+
+void
+teib_register (const teib_vft_t * vft)
+{
+ vec_add1 (teib_vfts, *vft);
+}
+
+static clib_error_t *
+teib_init (vlib_main_t * vm)
+{
+ teib_db = hash_create_mem (0, sizeof (teib_key_t), sizeof (u32));
+
+ return (NULL);
+}
+
+VLIB_INIT_FUNCTION (teib_init);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/teib/teib.h b/src/vnet/teib/teib.h
new file mode 100644
index 00000000000..4a03eee844f
--- /dev/null
+++ b/src/vnet/teib/teib.h
@@ -0,0 +1,85 @@
+/*
+ * teib.h: next-hop resolution
+ *
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TEIB_H__
+#define __TEIB_H__
+
+#include <vnet/ip/ip.h>
+
+/**
+ * Tunnel Endpoint Information Base.
+ *
+ * A TEIB entry represents the mapping between a peer on an interface in the overlay
+ * and a next-hop address in the underlay.
+ * i.e. there's a multipoint tunnel providing the overlay (henace a peer on
+ * that tunnel) which is reachable via 'tunnel destination' address in the
+ * underlay.
+ *
+ * Such overlay to underlay mappings might be providied by a protocol like NHRP
+ */
+typedef struct teib_entry_t_ teib_entry_t;
+
+/** accessors for the opaque struct */
+extern u32 teib_entry_get_sw_if_index (const teib_entry_t * ne);
+extern u32 teib_entry_get_fib_index (const teib_entry_t * ne);
+extern const ip46_address_t *teib_entry_get_peer (const teib_entry_t * ne);
+extern const fib_prefix_t *teib_entry_get_nh (const teib_entry_t * ne);
+extern u8 *format_teib_entry (u8 * s, va_list * args);
+
+/**
+ * Create a new TEIB entry
+ */
+extern int teib_entry_add (u32 sw_if_index,
+ const ip46_address_t * peer,
+ u32 nh_table_id, const ip46_address_t * nh);
+
+extern int teib_entry_del (u32 sw_if_index, const ip46_address_t * peer);
+
+extern teib_entry_t *teib_entry_find (u32 sw_if_index,
+ const ip46_address_t * peer);
+extern teib_entry_t *teib_entry_get (index_t nei);
+
+extern void teib_entry_adj_stack (const teib_entry_t * ne, adj_index_t ai);
+
+typedef walk_rc_t (*teib_walk_cb_t) (index_t nei, void *ctx);
+
+extern void teib_walk (teib_walk_cb_t fn, void *ctx);
+extern void teib_walk_itf (u32 sw_if_index, teib_walk_cb_t fn, void *ctx);
+
+/**
+ * Notifications for the creation and deletion of TEIB entries
+ */
+typedef void (*teib_entry_added_t) (const teib_entry_t * ne);
+typedef void (*teib_entry_deleted_t) (const teib_entry_t * ne);
+
+typedef struct teib_vft_t_
+{
+ teib_entry_added_t nv_added;
+ teib_entry_deleted_t nv_deleted;
+} teib_vft_t;
+
+extern void teib_register (const teib_vft_t * vft);
+
+#endif
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/nhrp/nhrp_api.c b/src/vnet/teib/teib_api.c
index d36adf99e14..a51dd6d0f7f 100644
--- a/src/vnet/nhrp/nhrp_api.c
+++ b/src/vnet/teib/teib_api.c
@@ -1,6 +1,6 @@
/*
*------------------------------------------------------------------
- * nhrp_api.c - nhrp api
+ * teib_api.c - teib api
*
* Copyright (c) 2016 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,24 +21,24 @@
#include <vlibmemory/api.h>
#include <vnet/api_errno.h>
-#include <vnet/nhrp/nhrp.h>
+#include <vnet/teib/teib.h>
#include <vnet/ip/ip_types_api.h>
#include <vnet/fib/fib_table.h>
/* define message IDs */
#include <vnet/format_fns.h>
-#include <vnet/nhrp/nhrp.api_enum.h>
-#include <vnet/nhrp/nhrp.api_types.h>
+#include <vnet/teib/teib.api_enum.h>
+#include <vnet/teib/teib.api_types.h>
-static u32 nhrp_base_msg_id;
-#define REPLY_MSG_ID_BASE nhrp_base_msg_id
+static u32 teib_base_msg_id;
+#define REPLY_MSG_ID_BASE teib_base_msg_id
#include <vlibapi/api_helper_macros.h>
static void
-vl_api_nhrp_entry_add_del_t_handler (vl_api_nhrp_entry_add_del_t * mp)
+vl_api_teib_entry_add_del_t_handler (vl_api_teib_entry_add_del_t * mp)
{
- vl_api_nhrp_entry_add_del_reply_t *rmp;
+ vl_api_teib_entry_add_del_reply_t *rmp;
ip46_address_t peer, nh;
int rv;
@@ -48,45 +48,45 @@ vl_api_nhrp_entry_add_del_t_handler (vl_api_nhrp_entry_add_del_t * mp)
ip_address_decode (&mp->entry.nh, &nh);
if (mp->is_add)
- rv = nhrp_entry_add (ntohl (mp->entry.sw_if_index), &peer,
+ rv = teib_entry_add (ntohl (mp->entry.sw_if_index), &peer,
ntohl (mp->entry.nh_table_id), &nh);
else
- rv = nhrp_entry_del (ntohl (mp->entry.sw_if_index), &peer);
+ rv = teib_entry_del (ntohl (mp->entry.sw_if_index), &peer);
BAD_SW_IF_INDEX_LABEL;
- REPLY_MACRO (VL_API_NHRP_ENTRY_ADD_DEL_REPLY);
+ REPLY_MACRO (VL_API_TEIB_ENTRY_ADD_DEL_REPLY);
}
-typedef struct vl_api_nhrp_send_t_
+typedef struct vl_api_teib_send_t_
{
vl_api_registration_t *reg;
u32 context;
-} vl_api_nhrp_send_t;
+} vl_api_teib_send_t;
static walk_rc_t
-vl_api_nhrp_send_one (index_t nei, void *arg)
+vl_api_teib_send_one (index_t nei, void *arg)
{
- vl_api_nhrp_details_t *mp;
- vl_api_nhrp_send_t *ctx = arg;
- const nhrp_entry_t *ne;
+ vl_api_teib_details_t *mp;
+ vl_api_teib_send_t *ctx = arg;
+ const teib_entry_t *ne;
const fib_prefix_t *pfx;
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_NHRP_DETAILS + REPLY_MSG_ID_BASE);
+ mp->_vl_msg_id = ntohs (VL_API_TEIB_DETAILS + REPLY_MSG_ID_BASE);
mp->context = ctx->context;
- ne = nhrp_entry_get (nei);
- pfx = nhrp_entry_get_nh (ne);
+ ne = teib_entry_get (nei);
+ pfx = teib_entry_get_nh (ne);
- ip_address_encode (nhrp_entry_get_peer (ne), IP46_TYPE_ANY,
+ ip_address_encode (teib_entry_get_peer (ne), IP46_TYPE_ANY,
&mp->entry.peer);
ip_address_encode (&pfx->fp_addr, IP46_TYPE_ANY, &mp->entry.nh);
mp->entry.nh_table_id =
htonl (fib_table_get_table_id
- (nhrp_entry_get_fib_index (ne), pfx->fp_proto));
- mp->entry.sw_if_index = htonl (nhrp_entry_get_sw_if_index (ne));
+ (teib_entry_get_fib_index (ne), pfx->fp_proto));
+ mp->entry.sw_if_index = htonl (teib_entry_get_sw_if_index (ne));
vl_api_send_msg (ctx->reg, (u8 *) mp);
@@ -94,7 +94,7 @@ vl_api_nhrp_send_one (index_t nei, void *arg)
}
static void
-vl_api_nhrp_dump_t_handler (vl_api_nhrp_dump_t * mp)
+vl_api_teib_dump_t_handler (vl_api_teib_dump_t * mp)
{
vl_api_registration_t *reg;
@@ -102,32 +102,32 @@ vl_api_nhrp_dump_t_handler (vl_api_nhrp_dump_t * mp)
if (!reg)
return;
- vl_api_nhrp_send_t ctx = {
+ vl_api_teib_send_t ctx = {
.reg = reg,
.context = mp->context,
};
- nhrp_walk (vl_api_nhrp_send_one, &ctx);
+ teib_walk (vl_api_teib_send_one, &ctx);
}
/*
- * nhrp_api_hookup
+ * teib_api_hookup
* Add vpe's API message handlers to the table.
* vlib has already mapped shared memory and
* added the client registration handlers.
* See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
*/
-#include <vnet/nhrp/nhrp.api.c>
+#include <vnet/teib/teib.api.c>
static clib_error_t *
-nhrp_api_hookup (vlib_main_t * vm)
+teib_api_hookup (vlib_main_t * vm)
{
- nhrp_base_msg_id = setup_message_id_table ();
+ teib_base_msg_id = setup_message_id_table ();
return (NULL);
}
-VLIB_API_INIT_FUNCTION (nhrp_api_hookup);
+VLIB_API_INIT_FUNCTION (teib_api_hookup);
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/nhrp/nhrp_cli.c b/src/vnet/teib/teib_cli.c
index 654c750197e..faf0d828963 100644
--- a/src/vnet/nhrp/nhrp_cli.c
+++ b/src/vnet/teib/teib_cli.c
@@ -13,10 +13,10 @@
* limitations under the License.
*/
-#include <vnet/nhrp/nhrp.h>
+#include <vnet/teib/teib.h>
static clib_error_t *
-nhrp_add (vlib_main_t * vm,
+teib_add (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
@@ -71,7 +71,7 @@ nhrp_add (vlib_main_t * vm,
goto done;
}
- rv = nhrp_entry_add (sw_if_index, &peer, nh_table_id, &nh);
+ rv = teib_entry_add (sw_if_index, &peer, nh_table_id, &nh);
if (rv)
{
@@ -87,15 +87,15 @@ done:
}
/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (nhrp_create_command, static) = {
- .path = "create nhrp",
- .short_help = "create nhrp <interface> peer <addr> nh <addr> [nh-table-id <ID>]",
- .function = nhrp_add,
+VLIB_CLI_COMMAND (teib_create_command, static) = {
+ .path = "create teib",
+ .short_help = "create teib <interface> peer <addr> nh <addr> [nh-table-id <ID>]",
+ .function = teib_add,
};
/* *INDENT-ON* */
static clib_error_t *
-nhrp_del (vlib_main_t * vm,
+teib_del (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
@@ -137,7 +137,7 @@ nhrp_del (vlib_main_t * vm,
goto done;
}
- rv = nhrp_entry_del (sw_if_index, &peer);
+ rv = teib_entry_del (sw_if_index, &peer);
if (rv)
{
@@ -153,35 +153,35 @@ done:
}
/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (nhrp_delete_command, static) = {
- .path = "delete nhrp",
- .short_help = "delete nhrp <interface> peer <addr>",
- .function = nhrp_del,
+VLIB_CLI_COMMAND (teib_delete_command, static) = {
+ .path = "delete teib",
+ .short_help = "delete teib <interface> peer <addr>",
+ .function = teib_del,
};
/* *INDENT-ON* */
static walk_rc_t
-nhrp_show_one (index_t nei, void *ctx)
+teib_show_one (index_t nei, void *ctx)
{
- vlib_cli_output (ctx, "%U", format_nhrp_entry, nei);
+ vlib_cli_output (ctx, "%U", format_teib_entry, nei);
return (WALK_CONTINUE);
}
static clib_error_t *
-nhrp_show (vlib_main_t * vm,
+teib_show (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
{
- nhrp_walk (nhrp_show_one, vm);
+ teib_walk (teib_show_one, vm);
return (NULL);
}
/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (nhrp_show_command, static) = {
- .path = "show nhrp",
- .short_help = "show nhrp",
- .function = nhrp_show,
+VLIB_CLI_COMMAND (teib_show_command, static) = {
+ .path = "show teib",
+ .short_help = "show teib",
+ .function = teib_show,
};
/* *INDENT-ON* */