summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2017-01-13 14:13:09 +0100
committerFlorin Coras <florin.coras@gmail.com>2017-01-13 15:52:36 +0000
commitc3af7bf104919be668d696fc1ac05893712dae06 (patch)
treecdf40ecc1960e833ef5e06eac8298ab128f0516d /src
parent67e7fcb181c2eeeb14f3bd9f88a3c5ee4dc51a17 (diff)
LISP: Fix gpe API
Change-Id: Iba076fc13e3f870c49fc5ca971dc7b8799188a27 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vat/api_format.c185
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe.api54
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe.c45
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_api.c113
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c2
-rw-r--r--src/vpp/api/custom_dump.c4
6 files changed, 113 insertions, 290 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 7514820721e..176fe836c45 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -2452,103 +2452,6 @@ static void
vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
}
-static u8 *
-format_decap_next (u8 * s, va_list * args)
-{
- u32 next_index = va_arg (*args, u32);
-
- switch (next_index)
- {
- case LISP_GPE_INPUT_NEXT_DROP:
- return format (s, "drop");
- case LISP_GPE_INPUT_NEXT_IP4_INPUT:
- return format (s, "ip4");
- case LISP_GPE_INPUT_NEXT_IP6_INPUT:
- return format (s, "ip6");
- default:
- return format (s, "unknown %d", next_index);
- }
- return s;
-}
-
-static void
-vl_api_lisp_gpe_tunnel_details_t_handler (vl_api_lisp_gpe_tunnel_details_t *
- mp)
-{
- vat_main_t *vam = &vat_main;
- u8 *iid_str;
- u8 *flag_str = NULL;
-
- iid_str = format (0, "%d (0x%x)", ntohl (mp->iid), ntohl (mp->iid));
-
-#define _(n,v) if (mp->flags & v) flag_str = format (flag_str, "%s-bit ", #n);
- foreach_lisp_gpe_flag_bit;
-#undef _
-
- print (vam->ofp, "%=20d%=30U%=16U%=16d%=16d%=16U"
- "%=16d%=16d%=16sd=16d%=16s%=16s",
- mp->tunnels,
- mp->is_ipv6 ? format_ip6_address : format_ip4_address,
- mp->source_ip,
- mp->is_ipv6 ? format_ip6_address : format_ip4_address,
- mp->destination_ip,
- ntohl (mp->encap_fib_id),
- ntohl (mp->decap_fib_id),
- format_decap_next, ntohl (mp->dcap_next),
- mp->ver_res >> 6,
- flag_str, mp->next_protocol, mp->ver_res, mp->res, iid_str);
-
- vec_free (iid_str);
-}
-
-static void
- vl_api_lisp_gpe_tunnel_details_t_handler_json
- (vl_api_lisp_gpe_tunnel_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t *node = NULL;
- struct in6_addr ip6;
- struct in_addr ip4;
- u8 *next_decap_str;
-
- next_decap_str = format (0, "%U", format_decap_next, htonl (mp->dcap_next));
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- vat_json_object_add_uint (node, "tunel", mp->tunnels);
- if (mp->is_ipv6)
- {
- clib_memcpy (&ip6, mp->source_ip, sizeof (ip6));
- vat_json_object_add_ip6 (node, "source address", ip6);
- clib_memcpy (&ip6, mp->destination_ip, sizeof (ip6));
- vat_json_object_add_ip6 (node, "destination address", ip6);
- }
- else
- {
- clib_memcpy (&ip4, mp->source_ip, sizeof (ip4));
- vat_json_object_add_ip4 (node, "source address", ip4);
- clib_memcpy (&ip4, mp->destination_ip, sizeof (ip4));
- vat_json_object_add_ip4 (node, "destination address", ip4);
- }
- vat_json_object_add_uint (node, "fib encap", ntohl (mp->encap_fib_id));
- vat_json_object_add_uint (node, "fib decap", ntohl (mp->decap_fib_id));
- vat_json_object_add_string_copy (node, "decap next", next_decap_str);
- vat_json_object_add_uint (node, "lisp version", mp->ver_res >> 6);
- vat_json_object_add_uint (node, "flags", mp->flags);
- vat_json_object_add_uint (node, "next protocol", mp->next_protocol);
- vat_json_object_add_uint (node, "ver_res", mp->ver_res);
- vat_json_object_add_uint (node, "res", mp->res);
- vat_json_object_add_uint (node, "iid", ntohl (mp->iid));
-
- vec_free (next_decap_str);
-}
-
static void
vl_api_show_lisp_map_register_state_reply_t_handler
(vl_api_show_lisp_map_register_state_reply_t * mp)
@@ -3895,7 +3798,6 @@ _(LISP_LOCATOR_DETAILS, lisp_locator_details) \
_(LISP_EID_TABLE_DETAILS, lisp_eid_table_details) \
_(LISP_EID_TABLE_MAP_DETAILS, lisp_eid_table_map_details) \
_(LISP_EID_TABLE_VNI_DETAILS, lisp_eid_table_vni_details) \
-_(LISP_GPE_TUNNEL_DETAILS, lisp_gpe_tunnel_details) \
_(LISP_MAP_RESOLVER_DETAILS, lisp_map_resolver_details) \
_(LISP_MAP_SERVER_DETAILS, lisp_map_server_details) \
_(LISP_ADJACENCIES_GET_REPLY, lisp_adjacencies_get_reply) \
@@ -13265,6 +13167,7 @@ typedef CLIB_PACKED(struct
static int
api_lisp_gpe_add_del_fwd_entry (vat_main_t * vam)
{
+ u32 dp_table = 0, vni = 0;;
unformat_input_t *input = vam->input;
vl_api_lisp_gpe_add_del_fwd_entry_t *mp;
f64 timeout = ~0;
@@ -13272,10 +13175,11 @@ api_lisp_gpe_add_del_fwd_entry (vat_main_t * vam)
lisp_eid_vat_t _rmt_eid, *rmt_eid = &_rmt_eid;
lisp_eid_vat_t _lcl_eid, *lcl_eid = &_lcl_eid;
u8 rmt_eid_set = 0, lcl_eid_set = 0;
- u32 action = ~0, p, w;
+ u32 action = ~0, w;
ip4_address_t rmt_rloc4, lcl_rloc4;
ip6_address_t rmt_rloc6, lcl_rloc6;
- rloc_t *rmt_locs = 0, *lcl_locs = 0, rloc, *curr_rloc = 0;
+ vl_api_lisp_gpe_locator_t *rmt_locs = 0, *lcl_locs = 0, rloc, *curr_rloc =
+ 0;
memset (&rloc, 0, sizeof (rloc));
@@ -13283,25 +13187,30 @@ api_lisp_gpe_add_del_fwd_entry (vat_main_t * vam)
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "del"))
- {
- is_add = 0;
- }
- else if (unformat (input, "rmt_eid %U", unformat_lisp_eid_vat, rmt_eid))
+ is_add = 0;
+ else if (unformat (input, "add"))
+ is_add = 1;
+ else if (unformat (input, "reid %U", unformat_lisp_eid_vat, rmt_eid))
{
rmt_eid_set = 1;
}
- else if (unformat (input, "lcl_eid %U", unformat_lisp_eid_vat, lcl_eid))
+ else if (unformat (input, "leid %U", unformat_lisp_eid_vat, lcl_eid))
{
lcl_eid_set = 1;
}
- else if (unformat (input, "p %d w %d", &p, &w))
+ else if (unformat (input, "vrf %d", &dp_table))
+ ;
+ else if (unformat (input, "bd %d", &dp_table))
+ ;
+ else if (unformat (input, "vni %d", &vni))
+ ;
+ else if (unformat (input, "w %d", &w))
{
if (!curr_rloc)
{
errmsg ("No RLOC configured for setting priority/weight!");
return -99;
}
- curr_rloc->priority = p;
curr_rloc->weight = w;
}
else if (unformat (input, "loc-pair %U %U", unformat_ip4_address,
@@ -13310,12 +13219,12 @@ api_lisp_gpe_add_del_fwd_entry (vat_main_t * vam)
rloc.is_ip4 = 1;
clib_memcpy (&rloc.addr, &lcl_rloc4, sizeof (lcl_rloc4));
- rloc.priority = rloc.weight = 0;
+ rloc.weight = 0;
vec_add1 (lcl_locs, rloc);
clib_memcpy (&rloc.addr, &rmt_rloc4, sizeof (rmt_rloc4));
vec_add1 (rmt_locs, rloc);
- /* priority and weight saved in rmt loc */
+ /* weight saved in rmt loc */
curr_rloc = &rmt_locs[vec_len (rmt_locs) - 1];
}
else if (unformat (input, "loc-pair %U %U", unformat_ip6_address,
@@ -13323,12 +13232,12 @@ api_lisp_gpe_add_del_fwd_entry (vat_main_t * vam)
{
rloc.is_ip4 = 0;
clib_memcpy (&rloc.addr, &lcl_rloc6, sizeof (lcl_rloc6));
- rloc.priority = rloc.weight = 0;
+ rloc.weight = 0;
vec_add1 (lcl_locs, rloc);
clib_memcpy (&rloc.addr, &rmt_rloc6, sizeof (rmt_rloc6));
vec_add1 (rmt_locs, rloc);
- /* priority and weight saved in rmt loc */
+ /* weight saved in rmt loc */
curr_rloc = &rmt_locs[vec_len (rmt_locs) - 1];
}
else if (unformat (input, "action %d", &action))
@@ -13361,23 +13270,28 @@ api_lisp_gpe_add_del_fwd_entry (vat_main_t * vam)
}
/* Construct the API message */
- M (LISP_GPE_ADD_DEL_FWD_ENTRY, lisp_gpe_add_del_fwd_entry);
+ M2 (LISP_GPE_ADD_DEL_FWD_ENTRY, lisp_gpe_add_del_fwd_entry,
+ sizeof (vl_api_lisp_gpe_locator_t) * vec_len (rmt_locs) * 2);
mp->is_add = is_add;
lisp_eid_put_vat (mp->rmt_eid, rmt_eid->addr, rmt_eid->type);
lisp_eid_put_vat (mp->lcl_eid, lcl_eid->addr, lcl_eid->type);
mp->eid_type = rmt_eid->type;
+ mp->dp_table = clib_host_to_net_u32 (dp_table);
+ mp->vni = clib_host_to_net_u32 (vni);
mp->rmt_len = rmt_eid->len;
mp->lcl_len = lcl_eid->len;
mp->action = action;
if (0 != rmt_locs && 0 != lcl_locs)
{
- mp->loc_num = vec_len (rmt_locs);
- clib_memcpy (mp->lcl_locs, lcl_locs,
- (sizeof (rloc_t) * vec_len (lcl_locs)));
- clib_memcpy (mp->rmt_locs, rmt_locs,
- (sizeof (rloc_t) * vec_len (rmt_locs)));
+ mp->loc_num = clib_host_to_net_u32 (vec_len (rmt_locs) * 2);
+ clib_memcpy (mp->locs, lcl_locs,
+ (sizeof (vl_api_lisp_gpe_locator_t) * vec_len (lcl_locs)));
+
+ u32 offset = sizeof (vl_api_lisp_gpe_locator_t) * vec_len (lcl_locs);
+ clib_memcpy (((u8 *) mp->locs) + offset, rmt_locs,
+ (sizeof (vl_api_lisp_gpe_locator_t) * vec_len (rmt_locs)));
}
vec_free (lcl_locs);
vec_free (rmt_locs);
@@ -14667,38 +14581,6 @@ api_lisp_eid_table_dump (vat_main_t * vam)
}
static int
-api_lisp_gpe_tunnel_dump (vat_main_t * vam)
-{
- vl_api_lisp_gpe_tunnel_dump_t *mp;
- f64 timeout = ~0;
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%=20s%=30s%=16s%=16s%=16s%=16s"
- "%=16s%=16s%=16s%=16s%=16s",
- "Tunel", "Source", "Destination", "Fib encap", "Fib decap",
- "Decap next", "Lisp version", "Flags", "Next protocol",
- "ver_res", "res", "iid");
- }
-
- M (LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump);
- /* send it... */
- S;
-
- /* Use a control ping for synchronization */
- {
- vl_api_control_ping_t *mp;
- M (CONTROL_PING, control_ping);
- S;
- }
- /* Wait for a reply... */
- W;
-
- /* NOTREACHED */
- return 0;
-}
-
-static int
api_lisp_adjacencies_get (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
@@ -17676,8 +17558,8 @@ _(lisp_add_del_local_eid,"vni <vni> eid " \
"<ipv4|ipv6>/<prefix> | <L2 address> " \
"locator-set <locator_name> [del]" \
"[key-id sha1|sha256 secret-key <secret-key>]") \
-_(lisp_gpe_add_del_fwd_entry, "rmt_eid <eid> [lcl_eid <eid>] vni <vni>" \
- "dp_table <table> loc-pair <lcl_loc> <rmt_loc> ... [del]") \
+_(lisp_gpe_add_del_fwd_entry, "reid <eid> [leid <eid>] vni <vni>" \
+ "vrf/bd <dp_table> loc-pair <lcl_loc> <rmt_loc> w <weight>... [del]") \
_(lisp_add_del_map_resolver, "<ip4|6-addr> [del]") \
_(lisp_add_del_map_server, "<ip4|6-addr> [del]") \
_(lisp_gpe_enable_disable, "enable|disable") \
@@ -17702,7 +17584,6 @@ _(lisp_eid_table_dump, "[eid <ipv4|ipv6>/<prefix> | <mac>] [vni] " \
"[local] | [remote]") \
_(lisp_eid_table_vni_dump, "") \
_(lisp_eid_table_map_dump, "l2|l3") \
-_(lisp_gpe_tunnel_dump, "") \
_(lisp_map_resolver_dump, "") \
_(lisp_map_server_dump, "") \
_(lisp_adjacencies_get, "vni <vni>") \
diff --git a/src/vnet/lisp-gpe/lisp_gpe.api b/src/vnet/lisp-gpe/lisp_gpe.api
index 3956b97d6a1..2a79becee48 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.api
+++ b/src/vnet/lisp-gpe/lisp_gpe.api
@@ -13,6 +13,18 @@
* limitations under the License.
*/
+/** \brief LISP locator structure
+ @param is_ip4 - whether addr is IPv4 or v6
+ @param weight - locator weight
+ @param addr - IPv4/6 address
+*/
+typeonly manual_print manual_endian define lisp_gpe_locator
+{
+ u8 is_ip4;
+ u8 weight;
+ u8 addr[16];
+};
+
/** \brief add or delete lisp gpe tunnel
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -27,12 +39,11 @@
@param lcl_len - local prefix len
@param vni - virtual network identifier
@param dp_table - vrf/bridge domain id
- @param loc_num - number of locators
- @param lcl_locs - array of local locators
- @param rmt_locs - array of remote locators
@param action - negative action when 0 locators configured
+ @param loc_num - number of locators
+ @param locs - array of remote locators
*/
-define lisp_gpe_add_del_fwd_entry
+manual_print manual_endian define lisp_gpe_add_del_fwd_entry
{
u32 client_index;
u32 context;
@@ -44,10 +55,9 @@ define lisp_gpe_add_del_fwd_entry
u8 lcl_len;
u32 vni;
u32 dp_table;
- u32 loc_num;
- u8 lcl_locs[loc_num];
- u8 rmt_locs[loc_num];
u8 action;
+ u32 loc_num;
+ vl_api_lisp_gpe_locator_t locs[loc_num];
};
/** \brief Reply for gpe_fwd_entry add/del
@@ -107,37 +117,9 @@ define lisp_gpe_add_del_iface_reply
i32 retval;
};
-define lisp_gpe_tunnel_details
-{
- u32 context;
- u32 tunnels;
- u8 is_ipv6;
- u8 source_ip[16];
- u8 destination_ip[16];
- u32 encap_fib_id;
- u32 decap_fib_id;
- u32 dcap_next;
- u8 lisp_ver;
- u8 next_protocol;
- u8 flags;
- u8 ver_res;
- u8 res;
- u32 iid;
-};
-
-/** \brief Request for gpe tunnel summary status
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- */
-define lisp_gpe_tunnel_dump
-{
- u32 client_index;
- u32 context;
-};
-
/*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/
- \ No newline at end of file
+
diff --git a/src/vnet/lisp-gpe/lisp_gpe.c b/src/vnet/lisp-gpe/lisp_gpe.c
index fbda8687c3b..3fd78c6a1cd 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.c
+++ b/src/vnet/lisp-gpe/lisp_gpe.c
@@ -38,11 +38,15 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm,
ip_address_t lloc, rloc;
clib_error_t *error = 0;
gid_address_t _reid, *reid = &_reid, _leid, *leid = &_leid;
- u8 reid_set = 0, leid_set = 0, is_negative = 0, vrf_set = 0, vni_set = 0;
- u32 vni, vrf, action = ~0, p, w;
+ u8 reid_set = 0, leid_set = 0, is_negative = 0, dp_table_set = 0,
+ vni_set = 0;
+ u32 vni = 0, dp_table = 0, action = ~0, w;
locator_pair_t pair, *pairs = 0;
int rv;
+ memset (leid, 0, sizeof (*leid));
+ memset (reid, 0, sizeof (*reid));
+
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
@@ -67,46 +71,46 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm,
gid_address_vni (reid) = vni;
vni_set = 1;
}
- else if (unformat (line_input, "vrf %u", &vrf))
+ else if (unformat (line_input, "vrf %u", &dp_table))
{
- vrf_set = 1;
+ dp_table_set = 1;
}
- else if (unformat (line_input, "bd %u", &vrf))
+ else if (unformat (line_input, "bd %u", &dp_table))
{
- vrf_set = 1;
+ dp_table_set = 1;
}
else if (unformat (line_input, "negative action %U",
unformat_negative_mapping_action, &action))
{
is_negative = 1;
}
- else if (unformat (line_input, "loc-pair %U %U p %d w %d",
+ else if (unformat (line_input, "loc-pair %U %U w %d",
unformat_ip_address, &lloc,
- unformat_ip_address, &rloc, &p, &w))
+ unformat_ip_address, &rloc, &w))
{
pair.lcl_loc = lloc;
pair.rmt_loc = rloc;
- pair.priority = p;
pair.weight = w;
vec_add1 (pairs, pair);
}
else
{
error = unformat_parse_error (line_input);
+ vlib_cli_output (vm, "parse error: '%U'",
+ format_unformat_error, line_input);
goto done;
}
}
- unformat_free (line_input);
- if (!vni_set || !vrf_set)
+ if (!vni_set || !dp_table_set)
{
- error = clib_error_return (0, "vni and vrf must be set!");
+ vlib_cli_output (vm, "vni and vrf/bd must be set!");
goto done;
}
if (!reid_set)
{
- error = clib_error_return (0, "remote eid must be set!");
+ vlib_cli_output (vm, "remote eid must be set!");
goto done;
}
@@ -114,7 +118,7 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm,
{
if (~0 == action)
{
- error = clib_error_return (0, "no action set for negative tunnel!");
+ vlib_cli_output (vm, "no action set for negative tunnel!");
goto done;
}
}
@@ -122,7 +126,7 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm,
{
if (vec_len (pairs) == 0)
{
- error = clib_error_return (0, "expected ip4/ip6 locators.");
+ vlib_cli_output (vm, "expected ip4/ip6 locators");
goto done;
}
}
@@ -142,7 +146,7 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm,
a->is_add = is_add;
a->is_negative = is_negative;
a->vni = vni;
- a->table_id = vrf;
+ a->table_id = dp_table;
gid_address_copy (&a->lcl_eid, leid);
gid_address_copy (&a->rmt_eid, reid);
a->locator_pairs = pairs;
@@ -150,11 +154,12 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm,
rv = vnet_lisp_gpe_add_del_fwd_entry (a, 0);
if (0 != rv)
{
- error = clib_error_return (0, "failed to %s gpe tunnel!",
- is_add ? "add" : "delete");
+ vlib_cli_output (vm, "failed to %s gpe tunnel!",
+ is_add ? "add" : "delete");
}
done:
+ unformat_free (line_input);
vec_free (pairs);
return error;
}
@@ -162,8 +167,8 @@ done:
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (lisp_gpe_add_del_fwd_entry_command, static) = {
.path = "lisp gpe entry",
- .short_help = "lisp gpe entry add/del vni <vni> vrf <vrf> [leid <leid>]"
- "reid <reid> [loc-pair <lloc> <rloc> p <priority> w <weight>] "
+ .short_help = "lisp gpe entry add/del vni <vni> vrf/bd <id> [leid <leid>]"
+ "reid <reid> [loc-pair <lloc> <rloc> w <weight>] "
"[negative action <action>]",
.function = lisp_gpe_add_del_fwd_entry_command_fn,
};
diff --git a/src/vnet/lisp-gpe/lisp_gpe_api.c b/src/vnet/lisp-gpe/lisp_gpe_api.c
index 176ded501cd..93b6053203e 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_api.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_api.c
@@ -28,6 +28,11 @@
#include <vnet/vnet_msg_enum.h>
+#define vl_api_lisp_gpe_locator_pair_t_endian vl_noop_handler
+#define vl_api_lisp_gpe_locator_pair_t_print vl_noop_handler
+#define vl_api_lisp_gpe_add_del_fwd_entry_t_endian vl_noop_handler
+#define vl_api_lisp_gpe_add_del_fwd_entry_t_print vl_noop_handler
+
#define vl_typedefs /* define message structures */
#include <vnet/vnet_all_api_h.h>
#undef vl_typedefs
@@ -47,43 +52,33 @@
#define foreach_vpe_api_msg \
_(LISP_GPE_ADD_DEL_FWD_ENTRY, lisp_gpe_add_del_fwd_entry) \
_(LISP_GPE_ENABLE_DISABLE, lisp_gpe_enable_disable) \
-_(LISP_GPE_ADD_DEL_IFACE, lisp_gpe_add_del_iface) \
-_(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump)
-
-/** Used for transferring locators via VPP API */
-/* *INDENT-OFF* */
-typedef CLIB_PACKED (struct {
- u8 is_ip4; /**< is locator an IPv4 address */
- u8 priority; /**< locator priority */
- u8 weight; /**< locator weight */
- u8 addr[16]; /**< IPv4/IPv6 address */
-}) rloc_t;
-/* *INDENT-ON* */
+_(LISP_GPE_ADD_DEL_IFACE, lisp_gpe_add_del_iface)
static locator_pair_t *
-unformat_lisp_loc_pairs (void *lcl_locs, void *rmt_locs, u32 rloc_num)
+unformat_lisp_loc_pairs (void *locs, u32 rloc_num)
{
u32 i;
- locator_pair_t *pairs = 0, pair;
- rloc_t *r;
+ locator_pair_t *pairs = 0, pair, *p;
+ vl_api_lisp_gpe_locator_t *r;
for (i = 0; i < rloc_num; i++)
{
/* local locator */
- r = &((rloc_t *) lcl_locs)[i];
- memset (&pair.lcl_loc, 0, sizeof (pair.lcl_loc));
+ r = &((vl_api_lisp_gpe_locator_t *) locs)[i];
+ memset (&pair, 0, sizeof (pair));
ip_address_set (&pair.lcl_loc, &r->addr, r->is_ip4 ? IP4 : IP6);
- /* remote locators */
- r = &((rloc_t *) rmt_locs)[i];
- memset (&pair.rmt_loc, 0, sizeof (pair.rmt_loc));
- ip_address_set (&pair.rmt_loc, &r->addr, r->is_ip4 ? IP4 : IP6);
-
- pair.priority = r->priority;
pair.weight = r->weight;
-
vec_add1 (pairs, pair);
}
+
+ for (i = rloc_num; i < rloc_num * 2; i++)
+ {
+ /* remote locators */
+ r = &((vl_api_lisp_gpe_locator_t *) locs)[i];
+ p = &pairs[i - rloc_num];
+ ip_address_set (&p->rmt_loc, &r->addr, r->is_ip4 ? IP4 : IP6);
+ }
return pairs;
}
@@ -120,6 +115,15 @@ unformat_lisp_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
}
static void
+ lisp_gpe_add_del_fwd_entry_t_net_to_host
+ (vl_api_lisp_gpe_add_del_fwd_entry_t * mp)
+{
+ mp->vni = clib_net_to_host_u32 (mp->vni);
+ mp->dp_table = clib_net_to_host_u32 (mp->dp_table);
+ mp->loc_num = clib_net_to_host_u32 (mp->loc_num);
+}
+
+static void
vl_api_lisp_gpe_add_del_fwd_entry_t_handler
(vl_api_lisp_gpe_add_del_fwd_entry_t * mp)
{
@@ -128,6 +132,7 @@ static void
locator_pair_t *pairs = 0;
int rv = 0;
+ lisp_gpe_add_del_fwd_entry_t_net_to_host (mp);
memset (a, 0, sizeof (a[0]));
rv = unformat_lisp_eid_api (&a->rmt_eid, mp->vni, mp->eid_type,
@@ -135,7 +140,12 @@ static void
rv |= unformat_lisp_eid_api (&a->lcl_eid, mp->vni, mp->eid_type,
mp->lcl_eid, mp->lcl_len);
- pairs = unformat_lisp_loc_pairs (mp->lcl_locs, mp->rmt_locs, mp->loc_num);
+ if (mp->loc_num % 2 != 0)
+ {
+ rv = -1;
+ goto send_reply;
+ }
+ pairs = unformat_lisp_loc_pairs (mp->locs, mp->loc_num / 2);
if (rv || 0 == pairs)
goto send_reply;
@@ -198,59 +208,6 @@ vl_api_lisp_gpe_add_del_iface_t_handler (vl_api_lisp_gpe_add_del_iface_t * mp)
REPLY_MACRO (VL_API_LISP_GPE_ADD_DEL_IFACE_REPLY);
}
-static void
-send_lisp_gpe_fwd_entry_details (lisp_gpe_fwd_entry_t * lfe,
- unix_shared_memory_queue_t * q, u32 context)
-{
- vl_api_lisp_gpe_tunnel_details_t *rmp;
- lisp_gpe_main_t *lgm = &lisp_gpe_main;
-
- rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_GPE_TUNNEL_DETAILS);
-
- rmp->tunnels = lfe - lgm->lisp_fwd_entry_pool;
-
- rmp->is_ipv6 = ip_prefix_version (&(lfe->key->rmt.ippref)) == IP6 ? 1 : 0;
- ip_address_copy_addr (rmp->source_ip,
- &ip_prefix_addr (&(lfe->key->rmt.ippref)));
- ip_address_copy_addr (rmp->destination_ip,
- &ip_prefix_addr (&(lfe->key->rmt.ippref)));
-
- rmp->encap_fib_id = htonl (0);
- rmp->decap_fib_id = htonl (lfe->eid_fib_index);
- rmp->iid = htonl (lfe->key->vni);
- rmp->context = context;
-
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
-}
-
-static void
-vl_api_lisp_gpe_tunnel_dump_t_handler (vl_api_lisp_gpe_tunnel_dump_t * mp)
-{
- unix_shared_memory_queue_t *q = NULL;
- lisp_gpe_main_t *lgm = &lisp_gpe_main;
- lisp_gpe_fwd_entry_t *lfe = NULL;
-
- if (pool_elts (lgm->lisp_fwd_entry_pool) == 0)
- {
- return;
- }
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
-
- /* *INDENT-OFF* */
- pool_foreach(lfe, lgm->lisp_fwd_entry_pool,
- ({
- send_lisp_gpe_fwd_entry_details(lfe, q, mp->context);
- }));
- /* *INDENT-ON* */
-}
-
/*
* lisp_gpe_api_hookup
* Add vpe's API message handlers to the table.
diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
index 26a93a87b9d..e05f0e01bee 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
@@ -913,7 +913,7 @@ format_lisp_fwd_path (u8 * s, va_list ap)
{
lisp_fwd_path_t *lfp = va_arg (ap, lisp_fwd_path_t *);
- s = format (s, "priority:%d weight:%d ", lfp->priority, lfp->weight);
+ s = format (s, "weight:%d ", lfp->weight);
s = format (s, "adj:[%U]\n",
format_lisp_gpe_adjacency,
lisp_gpe_adjacency_get (lfp->lisp_adj),
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index f14a031dae6..4cbb70825cc 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -2948,8 +2948,7 @@ _(lisp_map_resolver_dump) \
_(lisp_map_server_dump) \
_(show_lisp_rloc_probe_state) \
_(show_lisp_map_register_state) \
-_(show_lisp_map_request_mode) \
-_(lisp_gpe_tunnel_dump)
+_(show_lisp_map_request_mode)
#define _(f) \
static void * vl_api_ ## f ## _t_print \
@@ -3094,7 +3093,6 @@ _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
_(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
_(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
_(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
-_(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump) \
_(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
_(LISP_MAP_SERVER_DUMP, lisp_map_server_dump) \
_(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \