diff options
author | 2016-10-26 14:31:24 +0200 | |
---|---|---|
committer | 2016-12-06 09:30:43 +0000 | |
commit | 397fd7d39f023887e428de37a1929c366a99b8d5 (patch) | |
tree | 3a90215e1eab0fab2f3c6765c471591d64852b08 /vpp | |
parent | b09167f33d3c79e7ccc27e0fc484cc5fbcdb9943 (diff) |
Implement LISP control plane messages
* Map-register
* Map-notify
* RLOC probing
Change-Id: I7f6295376b21cd67805446dfd1c1033acead2d4b
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'vpp')
-rw-r--r-- | vpp/vpp-api/api.c | 138 | ||||
-rw-r--r-- | vpp/vpp-api/custom_dump.c | 43 | ||||
-rw-r--r-- | vpp/vpp-api/vpe.api | 149 |
3 files changed, 327 insertions, 3 deletions
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c index d663bd87..004dcb70 100644 --- a/vpp/vpp-api/api.c +++ b/vpp/vpp-api/api.c @@ -254,8 +254,11 @@ _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \ _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \ _(LISP_GPE_ADD_DEL_FWD_ENTRY, lisp_gpe_add_del_fwd_entry) \ _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \ +_(LISP_ADD_DEL_MAP_SERVER, lisp_add_del_map_server) \ _(LISP_GPE_ENABLE_DISABLE, lisp_gpe_enable_disable) \ _(LISP_ENABLE_DISABLE, lisp_enable_disable) \ +_(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \ +_(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \ _(LISP_GPE_ADD_DEL_IFACE, lisp_gpe_add_del_iface) \ _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \ _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \ @@ -267,9 +270,12 @@ _(LISP_LOCATOR_DUMP, lisp_locator_dump) \ _(LISP_EID_TABLE_DUMP, lisp_eid_table_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_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \ _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \ _(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \ +_(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \ +_(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \ _(SHOW_LISP_STATUS, show_lisp_status) \ _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \ lisp_add_del_map_request_itr_rlocs) \ @@ -4473,7 +4479,7 @@ vl_api_lisp_add_del_local_eid_t_handler (vl_api_lisp_add_del_local_eid_t * mp) uword *p = NULL; u32 locator_set_index = ~0, map_index = ~0; vnet_lisp_add_del_mapping_args_t _a, *a = &_a; - u8 *name = NULL; + u8 *name = NULL, *key = NULL; memset (a, 0, sizeof (a[0])); memset (eid, 0, sizeof (eid[0])); @@ -4491,15 +4497,22 @@ vl_api_lisp_add_del_local_eid_t_handler (vl_api_lisp_add_del_local_eid_t * mp) } locator_set_index = p[0]; + if (*mp->key) + key = format (0, "%s", mp->key); + /* XXX treat batch configuration */ a->is_add = mp->is_add; gid_address_copy (&a->eid, eid); a->locator_set_index = locator_set_index; a->local = 1; + a->key = key; + a->key_id = clib_net_to_host_u16 (mp->key_id); + rv = vnet_lisp_add_del_local_mapping (a, &map_index); out: vec_free (name); + vec_free (key); gid_address_free (&a->eid); REPLY_MACRO (VL_API_LISP_ADD_DEL_LOCAL_EID_REPLY); @@ -4609,6 +4622,22 @@ send_reply: } static void +vl_api_lisp_add_del_map_server_t_handler (vl_api_lisp_add_del_map_server_t + * mp) +{ + vl_api_lisp_add_del_map_server_reply_t *rmp; + int rv = 0; + ip_address_t addr; + + memset (&addr, 0, sizeof (addr)); + + ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4); + rv = vnet_lisp_add_del_map_server (&addr, mp->is_add); + + REPLY_MACRO (VL_API_LISP_ADD_DEL_MAP_SERVER_REPLY); +} + +static void vl_api_lisp_add_del_map_resolver_t_handler (vl_api_lisp_add_del_map_resolver_t * mp) { @@ -4641,6 +4670,28 @@ vl_api_lisp_gpe_enable_disable_t_handler (vl_api_lisp_gpe_enable_disable_t * } static void + vl_api_lisp_map_register_enable_disable_t_handler + (vl_api_lisp_map_register_enable_disable_t * mp) +{ + vl_api_lisp_map_register_enable_disable_reply_t *rmp; + int rv = 0; + + vnet_lisp_map_register_enable_disable (mp->is_enabled); + REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY); +} + +static void + vl_api_lisp_rloc_probe_enable_disable_t_handler + (vl_api_lisp_rloc_probe_enable_disable_t * mp) +{ + vl_api_lisp_rloc_probe_enable_disable_reply_t *rmp; + int rv = 0; + + vnet_lisp_rloc_probe_enable_disable (mp->is_enabled); + REPLY_MACRO (VL_API_LISP_ENABLE_DISABLE_REPLY); +} + +static void vl_api_lisp_enable_disable_t_handler (vl_api_lisp_enable_disable_t * mp) { vl_api_lisp_enable_disable_reply_t *rmp; @@ -5080,6 +5131,8 @@ send_lisp_eid_table_details (mapping_t * mapit, } rmp->context = context; rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid)); + rmp->key_id = clib_host_to_net_u16 (mapit->key_id); + memcpy (rmp->key, mapit->key, vec_len (mapit->key)); vl_msg_api_send_shmem (q, (u8 *) & rmp); } @@ -5179,6 +5232,57 @@ vl_api_lisp_gpe_tunnel_dump_t_handler (vl_api_lisp_gpe_tunnel_dump_t * mp) } static void +send_lisp_map_server_details (ip_address_t * ip, + unix_shared_memory_queue_t * q, u32 context) +{ + vl_api_lisp_map_server_details_t *rmp = NULL; + + rmp = vl_msg_api_alloc (sizeof (*rmp)); + memset (rmp, 0, sizeof (*rmp)); + rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_SERVER_DETAILS); + + switch (ip_addr_version (ip)) + { + case IP4: + rmp->is_ipv6 = 0; + clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip), + sizeof (ip_addr_v4 (ip))); + break; + + case IP6: + rmp->is_ipv6 = 1; + clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip), + sizeof (ip_addr_v6 (ip))); + break; + + default: + ASSERT (0); + } + rmp->context = context; + + vl_msg_api_send_shmem (q, (u8 *) & rmp); +} + +static void +vl_api_lisp_map_server_dump_t_handler (vl_api_lisp_map_server_dump_t * mp) +{ + unix_shared_memory_queue_t *q = NULL; + lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); + lisp_msmr_t *mr; + + q = vl_api_client_index_to_input_queue (mp->client_index); + if (q == 0) + { + return; + } + + vec_foreach (mr, lcm->map_servers) + { + send_lisp_map_server_details (&mr->address, q, mp->context); + } +} + +static void send_lisp_map_resolver_details (ip_address_t * ip, unix_shared_memory_queue_t * q, u32 context) { @@ -5215,7 +5319,7 @@ vl_api_lisp_map_resolver_dump_t_handler (vl_api_lisp_map_resolver_dump_t * mp) { unix_shared_memory_queue_t *q = NULL; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); - map_resolver_t *mr; + lisp_msmr_t *mr; q = vl_api_client_index_to_input_queue (mp->client_index); if (q == 0) @@ -5333,6 +5437,36 @@ lisp_adjacency_copy (vl_api_lisp_adjacency_t * dst, lisp_adjacency_t * adjs) } static void + vl_api_show_lisp_rloc_probe_state_t_handler + (vl_api_show_lisp_rloc_probe_state_t * mp) +{ + vl_api_show_lisp_rloc_probe_state_reply_t *rmp = 0; + int rv = 0; + + /* *INDENT-OFF* */ + REPLY_MACRO2 (VL_API_SHOW_LISP_RLOC_PROBE_STATE_REPLY, + { + rmp->is_enabled = vnet_lisp_rloc_probe_state_get (); + }); + /* *INDENT-ON* */ +} + +static void + vl_api_show_lisp_map_register_state_t_handler + (vl_api_show_lisp_map_register_state_t * mp) +{ + vl_api_show_lisp_map_register_state_reply_t *rmp = 0; + int rv = 0; + + /* *INDENT-OFF* */ + REPLY_MACRO2 (VL_API_SHOW_LISP_MAP_REGISTER_STATE_REPLY, + { + rmp->is_enabled = vnet_lisp_map_register_state_get (); + }); + /* *INDENT-ON* */ +} + +static void vl_api_lisp_adjacencies_get_t_handler (vl_api_lisp_adjacencies_get_t * mp) { vl_api_lisp_adjacencies_get_reply_t *rmp = 0; diff --git a/vpp/vpp-api/custom_dump.c b/vpp/vpp-api/custom_dump.c index fdea9416..d0a8ecae 100644 --- a/vpp/vpp-api/custom_dump.c +++ b/vpp/vpp-api/custom_dump.c @@ -35,6 +35,7 @@ #include <vlib/unix/unix.h> #include <vlibapi/api.h> #include <vlibmemory/api.h> +#include <vnet/lisp-cp/lisp_types.h> #include <stats/stats.h> #include <oam/oam.h> @@ -2482,6 +2483,12 @@ static void *vl_api_lisp_add_del_local_eid_t_print s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid, mp->prefix_len); s = format (s, "locator-set %s ", mp->locator_set_name); + if (*mp->key) + { + u32 key_id = mp->key_id; + s = format (s, "key-id %U", format_hmac_key_id, key_id); + s = format (s, "secret-key %s", mp->key); + } FINISH; } @@ -2659,6 +2666,34 @@ static void *vl_api_lisp_eid_table_dump_t_print FINISH; } +static void *vl_api_lisp_rloc_probe_enable_disable_t_print + (vl_api_lisp_rloc_probe_enable_disable_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: lisp_rloc_probe_enable_disable "); + if (mp->is_enabled) + s = format (s, "enable"); + else + s = format (s, "disable"); + + FINISH; +} + +static void *vl_api_lisp_map_register_enable_disable_t_print + (vl_api_lisp_map_register_enable_disable_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: lisp_map_register_enable_disable "); + if (mp->is_enabled) + s = format (s, "enable"); + else + s = format (s, "disable"); + + FINISH; +} + static void *vl_api_lisp_adjacencies_get_t_print (vl_api_lisp_adjacencies_get_t * mp, void *handle) { @@ -2894,6 +2929,9 @@ static void *vl_api_sw_interface_set_mtu_t_print #define foreach_custom_print_no_arg_function \ _(lisp_eid_table_vni_dump) \ _(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) @@ -3045,9 +3083,14 @@ _(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) \ _(LISP_LOCATOR_DUMP, lisp_locator_dump) \ _(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \ +_(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \ +_(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \ +_(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \ +_(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \ _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel) \ _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump) \ _(DELETE_SUBIF, delete_subif) \ diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api index 7ace8a24..66108acf 100644 --- a/vpp/vpp-api/vpe.api +++ b/vpp/vpp-api/vpe.api @@ -2369,6 +2369,11 @@ define lisp_add_del_locator_reply @param prefix_len - prefix len @param locator_set_name - name of locator_set to add/del eid-table @param vni - virtual network instance + @param key_id + HMAC_NO_KEY 0 + HMAC_SHA_1_96 1 + HMAC_SHA_256_128 2 + @param key - secret key */ define lisp_add_del_local_eid { @@ -2380,6 +2385,8 @@ define lisp_add_del_local_eid u8 prefix_len; u8 locator_set_name[64]; u32 vni; + u16 key_id; + u8 key[64]; }; /** \brief Reply for local_eid add/del @@ -2439,6 +2446,32 @@ define lisp_gpe_add_del_fwd_entry_reply i32 retval; }; +/** \brief Add/delete map server + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request + @param is_add - add address if non-zero; delete otherwise + @param is_ipv6 - if non-zero the address is ipv6, else ipv4 + @param ip_address - map server IP address +*/ +define lisp_add_del_map_server +{ + u32 client_index; + u32 context; + u8 is_add; + u8 is_ipv6; + u8 ip_address[16]; +}; + +/** \brief Reply for lisp_add_del_map_server + @param context - returned sender context, to match reply w/ request + @param retval - return code +*/ +define lisp_add_del_map_server_reply +{ + u32 context; + i32 retval; +}; + /** \brief add or delete map-resolver @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @@ -2558,6 +2591,93 @@ define lisp_pitr_set_locator_set_reply i32 retval; }; +/** \brief Get state of LISP RLOC probing + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request +*/ +define show_lisp_rloc_probe_state +{ + u32 client_index; + u32 context; +}; + +/** \brief Reply for show_lisp_rloc_probe_state + @param context - returned sender context, to match reply w/ request + @param retval - return code + @param is_enabled - state of RLOC probing +*/ +define show_lisp_rloc_probe_state_reply +{ + u32 context; + i32 retval; + u8 is_enabled; +}; + +/** \brief enable/disable LISP RLOC probing + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request + @param is_enable - enable if non-zero; disable otherwise +*/ +define lisp_rloc_probe_enable_disable +{ + u32 client_index; + u32 context; + u8 is_enabled; +}; + +/** \brief Reply for lisp_rloc_probe_enable_disable + @param context - returned sender context, to match reply w/ request + @param retval - return code +*/ +define lisp_rloc_probe_enable_disable_reply +{ + u32 context; + i32 retval; +}; + +/** \brief enable/disable LISP map-register + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request + @param is_enable - enable if non-zero; disable otherwise +*/ +define lisp_map_register_enable_disable +{ + u32 client_index; + u32 context; + u8 is_enabled; +}; + +/** \brief Reply for lisp_map_register_enable_disable + @param context - returned sender context, to match reply w/ request + @param retval - return code +*/ +define lisp_map_register_enable_disable_reply +{ + u32 context; + i32 retval; +}; + +/** \brief Get state of LISP map-register + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request +*/ +define show_lisp_map_register_state +{ + u32 client_index; + u32 context; +}; + +/** \brief Reply for show_lisp_map_register_state + @param context - returned sender context, to match reply w/ request + @param retval - return code +*/ +define show_lisp_map_register_state_reply +{ + u32 context; + i32 retval; + u8 is_enabled; +}; + /** \brief set LISP map-request mode. Based on configuration VPP will send src/dest or just normal destination map requests. @param client_index - opaque cookie to identify the sender @@ -2826,6 +2946,11 @@ define lisp_locator_set_dump @param vni - virtual network instance @param ttl - time to live @param authoritative - authoritative + @param key_id + HMAC_NO_KEY 0 + HMAC_SHA_1_96 1 + HMAC_SHA_256_128 2 + @param key - secret key */ define lisp_eid_table_details @@ -2843,6 +2968,8 @@ define lisp_eid_table_details u8 seid_prefix_len; u32 ttl; u8 authoritative; + u16 key_id; + u8 key[64]; }; /** \brief Request for eid table summary status @@ -2993,7 +3120,6 @@ define lisp_gpe_tunnel_dump }; /** \brief LISP map resolver status - @param locator_set_name - name of the locator_set @param is_ipv6 - if non-zero the address is ipv6, else ipv4 @param ip_address - array of address bytes */ @@ -3014,6 +3140,27 @@ define lisp_map_resolver_dump u32 context; }; +/** \brief LISP map server details + @param is_ipv6 - if non-zero the address is ipv6, else ipv4 + @param ip_address - array of address bytes + */ +define lisp_map_server_details +{ + u32 context; + u8 is_ipv6; + u8 ip_address[16]; +}; + +/** \brief Request for map server summary status + @param client_index - opaque cookie to identify the sender + @param context - sender context, to match reply w/ request + */ +define lisp_map_server_dump +{ + u32 client_index; + u32 context; +}; + /** \brief Request for lisp-gpe protocol status @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request |