From af8c8e5d9596b4bb1dc6edc5c3675de5304f6456 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Thu, 17 Aug 2017 15:57:20 -0700 Subject: gpe: fix sub-interface hash lookup Change-Id: Ice6b3818ee24c7c248bf61e4d6c1ef2a85cb8fb1 Signed-off-by: Florin Coras --- src/vnet/lisp-gpe/lisp_gpe.c | 4 ++-- src/vnet/lisp-gpe/lisp_gpe_sub_interface.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/vnet') diff --git a/src/vnet/lisp-gpe/lisp_gpe.c b/src/vnet/lisp-gpe/lisp_gpe.c index 018895ad911..8ee2a72d381 100644 --- a/src/vnet/lisp-gpe/lisp_gpe.c +++ b/src/vnet/lisp-gpe/lisp_gpe.c @@ -91,8 +91,8 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm, unformat_ip_address, &lloc, unformat_ip_address, &rloc, &w)) { - pair.lcl_loc = lloc; - pair.rmt_loc = rloc; + ip_address_copy (&pair.lcl_loc, &lloc); + ip_address_copy (&pair.rmt_loc, &rloc); pair.weight = w; pair.priority = 0; vec_add1 (pairs, pair); diff --git a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c index 0dfbc40d8e7..7146b38044a 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c +++ b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c @@ -53,7 +53,7 @@ lisp_gpe_sub_interface_db_find (const ip_address_t * lrloc, u32 vni) memset (&key, 0, sizeof (key)); ip_address_copy (&key.local_rloc, lrloc); - key.vni = clib_host_to_net_u32 (vni); + key.vni = vni; p = hash_get_mem (lisp_gpe_sub_interfaces, &key); if (NULL == p) @@ -119,7 +119,7 @@ lisp_gpe_sub_interface_find_or_create_and_lock (const ip_address_t * lrloc, lisp_gpe_sub_interface_t *l3s; index_t l3si; - l3si = lisp_gpe_sub_interface_db_find (lrloc, clib_host_to_net_u32 (vni)); + l3si = lisp_gpe_sub_interface_db_find (lrloc, vni); if (INDEX_INVALID == l3si) { @@ -148,8 +148,8 @@ lisp_gpe_sub_interface_find_or_create_and_lock (const ip_address_t * lrloc, l3s->key = clib_mem_alloc (sizeof (*l3s->key)); memset (l3s->key, 0, sizeof (*l3s->key)); - l3s->key->local_rloc = *lrloc; - l3s->key->vni = clib_host_to_net_u32 (vni); + ip_address_copy (&l3s->key->local_rloc, lrloc); + l3s->key->vni = vni; l3s->main_sw_if_index = main_sw_if_index; l3s->sw_if_index = sub_sw_if_index; l3s->eid_table_id = overlay_table_id; @@ -215,11 +215,11 @@ format_lisp_gpe_sub_interface (u8 * s, va_list ap) lisp_gpe_sub_interface_t *l3s = va_arg (ap, lisp_gpe_sub_interface_t *); vnet_main_t *vnm = vnet_get_main (); - s = format (s, "%=16U", + s = format (s, "%-16U", format_vnet_sw_interface_name, vnm, vnet_get_sw_interface (vnm, l3s->sw_if_index)); - s = format (s, "%=10d", clib_net_to_host_u32 (l3s->key->vni)); - s = format (s, "%=12d", l3s->sw_if_index); + s = format (s, "%=8d", l3s->key->vni); + s = format (s, "%=15d", l3s->sw_if_index); s = format (s, "%U", format_ip_address, &l3s->key->local_rloc); return (s); @@ -233,7 +233,7 @@ lisp_gpe_sub_interface_show (vlib_main_t * vm, { lisp_gpe_sub_interface_t *l3s; - vlib_cli_output (vm, "%=16s%=10s%=12s%s", "Name", "VNI", "SW IF Index", + vlib_cli_output (vm, "%-16s%=8s%=15s%s", "Name", "VNI", "sw_if_index", "local RLOC"); /* *INDENT-OFF* */ -- cgit 1.2.3-korg