diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2016-05-10 16:58:29 +0200 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2016-05-11 00:16:44 +0000 |
commit | 215104e67f3574e9a54684c1ed628b4690f47979 (patch) | |
tree | cc43abf407c827e68c5c64230212835509fa7f18 /vnet | |
parent | 93dcd1d743db3c0a131ecb0eddfe9c6cb1a7e441 (diff) |
ONE-6: dp is not programmed when re-enabling LISP
Change-Id: I4c0c5d44168da811a713943275430a378ff46929
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/lisp-cp/control.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/vnet/vnet/lisp-cp/control.c b/vnet/vnet/lisp-cp/control.c index 7799227a20a..f63a430c3f2 100644 --- a/vnet/vnet/lisp-cp/control.c +++ b/vnet/vnet/lisp-cp/control.c @@ -18,6 +18,9 @@ #include <vnet/lisp-cp/lisp_msg_serdes.h> #include <vnet/lisp-gpe/lisp_gpe.h> +static void +add_fwd_entry (lisp_cp_main_t* lcm, u32 src_map_index, u32 dst_map_index); + /* Stores mapping in map-cache. It does NOT program data plane forwarding for * remote/learned mappings. */ int @@ -713,6 +716,8 @@ vnet_lisp_enable_disable (u8 is_enabled) { /* clear refcount table */ hash_free (lcm->dp_if_refcount_by_vni); + hash_free (lcm->fwd_entry_by_mapping_index); + pool_free (lcm->fwd_entry_pool); } /* update global flag */ @@ -1285,7 +1290,7 @@ static uword lisp_cp_lookup (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * from_frame) { - u32 * from, * to_next_drop; + u32 * from, * to_next_drop, di, si; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main(); u32 pkts_mapped = 0; uword n_left_from, n_left_to_next_drop; @@ -1327,10 +1332,23 @@ lisp_cp_lookup (vlib_main_t * vm, vlib_node_runtime_t * node, ip_prefix_len(spref) = ip_address_max_len (ip_prefix_version(spref)); ip_prefix_len(dpref) = ip_address_max_len (ip_prefix_version(dpref)); - /* send map-request */ - send_encapsulated_map_request (vm, lcm, &src, &dst, 0); - - pkts_mapped++; + /* if we have remote mapping for destination already in map-chache + add forwarding tunnel directly. If not send a map-request */ + di = gid_dictionary_lookup (&lcm->mapping_index_by_gid, &dst); + if (~0 != di) + { + si = gid_dictionary_lookup (&lcm->mapping_index_by_gid, &src); + if (~0 != si) + { + add_fwd_entry (lcm, si, di); + } + } + else + { + /* send map-request */ + send_encapsulated_map_request (vm, lcm, &src, &dst, 0); + pkts_mapped++; + } if (PREDICT_FALSE(p0->flags & VLIB_BUFFER_IS_TRACED)) { @@ -1466,7 +1484,7 @@ del_fwd_entry (lisp_cp_main_t * lcm, u32 src_map_index, pool_put(lcm->fwd_entry_pool, fe); } -void +static void add_fwd_entry (lisp_cp_main_t* lcm, u32 src_map_index, u32 dst_map_index) { mapping_t * src_map, * dst_map; |