aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2016-05-06 14:22:40 +0200
committerDave Barach <openvpp@barachs.net>2016-05-09 11:35:52 +0000
commited09a050b7981b631dda6ee9de7bcc5b1279868e (patch)
treee814ed3354c3205b7c473f35332226d9d91def54
parent30d41fff9b649b6bc4c24af8c4059da7ad121de4 (diff)
ONE-5: Remove unused vnet_lisp_gpe_add_del_tunnel API
Change-Id: Ib22ec807d2b74b7c3cb37f66052cd07bc4d896db Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r--vnet/vnet/lisp-gpe/lisp_gpe.c32
-rw-r--r--vnet/vnet/lisp-gpe/lisp_gpe.h37
-rw-r--r--vpp-api-test/vat/api_format.c172
-rw-r--r--vpp/api/api.c63
-rw-r--r--vpp/api/custom_dump.c44
-rw-r--r--vpp/api/vpe.api23
6 files changed, 23 insertions, 348 deletions
diff --git a/vnet/vnet/lisp-gpe/lisp_gpe.c b/vnet/vnet/lisp-gpe/lisp_gpe.c
index 4c39bf97cae..76d51b1d1c8 100644
--- a/vnet/vnet/lisp-gpe/lisp_gpe.c
+++ b/vnet/vnet/lisp-gpe/lisp_gpe.c
@@ -91,27 +91,15 @@ lisp_gpe_rewrite (lisp_gpe_tunnel_t * t)
return 0;
}
-/* TODO remove */
-int
-vnet_lisp_gpe_add_del_tunnel (vnet_lisp_gpe_add_del_tunnel_args_t *a,
- u32 * sw_if_indexp)
-{
- clib_warning ("UNSUPPORTED! Use vnet_lisp_gpe_add_del_fwd_entry");
- return 0;
-}
-
#define foreach_copy_field \
_(encap_fib_index) \
_(decap_fib_index) \
_(decap_next_index) \
-_(flags) \
-_(next_protocol) \
-_(ver_res) \
-_(res) \
_(vni)
static u32
-add_del_tunnel (vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 * tun_index_res)
+add_del_ip_tunnel (vnet_lisp_gpe_add_del_fwd_entry_args_t *a,
+ u32 * tun_index_res)
{
lisp_gpe_main_t * lgm = &lisp_gpe_main;
lisp_gpe_tunnel_t *t = 0;
@@ -119,6 +107,7 @@ add_del_tunnel (vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 * tun_index_res)
int rv;
lisp_gpe_tunnel_key_t key;
+ /* prepare tunnel key */
memset(&key, 0, sizeof(key));
ip_prefix_copy(&key.eid, &gid_address_ippref(&a->deid));
ip_address_copy(&key.dst_loc, &a->dlocator);
@@ -146,6 +135,10 @@ add_del_tunnel (vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 * tun_index_res)
ip_address_copy(&t->src, &a->slocator);
ip_address_copy(&t->dst, &a->dlocator);
+ t->flags |= LISP_GPE_FLAGS_P;
+ t->next_protocol = ip_prefix_version(&key.eid) == IP4 ?
+ LISP_GPE_NEXT_PROTO_IP4 : LISP_GPE_NEXT_PROTO_IP6;
+
rv = lisp_gpe_rewrite (t);
if (rv)
@@ -236,12 +229,8 @@ vnet_lisp_gpe_add_del_fwd_entry (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
spref = &gid_address_ippref(&a->seid);
ip_ver = ip_prefix_version(dpref);
- a->next_protocol = ip_ver == IP4 ?
- LISP_GPE_NEXT_PROTO_IP4 : LISP_GPE_NEXT_PROTO_IP6;
- a->flags |= LISP_GPE_FLAGS_P;
-
/* add/del tunnel to tunnels pool and prepares rewrite */
- rv = add_del_tunnel (a, &tun_index);
+ rv = add_del_ip_tunnel (a, &tun_index);
if (rv)
return rv;
@@ -355,9 +344,6 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm,
a.deid = eids[i];
a.slocator = slocators[i];
a.dlocator = dlocators[i];
- prefp = &gid_address_ippref(&a.deid);
- a.decap_next_index = (ip_prefix_version(prefp) == IP4) ?
- LISP_GPE_INPUT_NEXT_IP4_INPUT : LISP_GPE_INPUT_NEXT_IP6_INPUT;
vnet_lisp_gpe_add_del_fwd_entry (&a, 0);
}
@@ -367,7 +353,7 @@ lisp_gpe_add_del_fwd_entry_command_fn (vlib_main_t * vm,
return error;
}
-VLIB_CLI_COMMAND (add_del_lisp_gpe_mapping_tunnel_command, static) = {
+VLIB_CLI_COMMAND (lisp_gpe_add_del_fwd_entry_command, static) = {
.path = "lisp gpe maptunnel",
.short_help = "lisp gpe maptunnel eid <eid> sloc <src-locator> "
"dloc <dst-locator> [del]",
diff --git a/vnet/vnet/lisp-gpe/lisp_gpe.h b/vnet/vnet/lisp-gpe/lisp_gpe.h
index cba779525a8..bc0af79720e 100644
--- a/vnet/vnet/lisp-gpe/lisp_gpe.h
+++ b/vnet/vnet/lisp-gpe/lisp_gpe.h
@@ -174,24 +174,6 @@ format_lisp_gpe_header_with_length (u8 * s, va_list * args);
typedef struct
{
u8 is_add;
- ip4_address_t src, dst;
- u32 encap_fib_index;
- u32 decap_fib_index;
- u32 decap_next_index;
- u8 flags;
- u8 ver_res;
- u8 res;
- u8 next_protocol;
- u32 vni; /* host byte order */
-} vnet_lisp_gpe_add_del_tunnel_args_t;
-
-int
-vnet_lisp_gpe_add_del_tunnel (vnet_lisp_gpe_add_del_tunnel_args_t *a,
- u32 * sw_if_indexp);
-
-typedef struct
-{
- u8 is_add;
u32 table_id; /* vrf */
u32 vni; /* host byte order */
} vnet_lisp_gpe_add_del_iface_args_t;
@@ -221,20 +203,29 @@ typedef enum
typedef struct
{
u8 is_add;
+
+ /* type of mapping */
u8 is_negative;
negative_fwd_actions_e action;
+
+ /* local and remote eids */
gid_address_t seid; /* TODO convert to ip4, ip6, mac ? */
gid_address_t deid;
+
+ /* local and remote locators (underlay attachment points) */
ip_address_t slocator;
ip_address_t dlocator;
+
+ /* FIB indices to lookup remote locator at encap and inner IP at decap */
u32 encap_fib_index;
u32 decap_fib_index;
+
u32 decap_next_index; /* TODO is this really needed? */
- u8 flags;
- u8 ver_res;
- u8 res;
- u8 next_protocol;
- u32 vni; /* host byte order */
+
+ /* VNI/tenant id in HOST byte order */
+ u32 vni;
+
+ /* vrf where fwd entry should be inserted */
u32 table_id;
} vnet_lisp_gpe_add_del_fwd_entry_args_t;
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c
index 37af449f371..6f1db386250 100644
--- a/vpp-api-test/vat/api_format.c
+++ b/vpp-api-test/vat/api_format.c
@@ -909,37 +909,6 @@ static void vl_api_nsh_vxlan_gpe_add_del_tunnel_reply_t_handler_json
vam->result_ready = 1;
}
-static void vl_api_lisp_gpe_add_del_tunnel_reply_t_handler
-(vl_api_lisp_gpe_add_del_tunnel_reply_t * mp)
-{
- vat_main_t * vam = &vat_main;
- i32 retval = ntohl(mp->retval);
- u32 sw_if_index = ntohl(mp->sw_if_index);
-
- if (retval >= 0 && sw_if_index != (u32)~0) {
- errmsg ("sw_if_index %d\n", ntohl(mp->sw_if_index));
- }
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void vl_api_lisp_gpe_add_del_tunnel_reply_t_handler_json
-(vl_api_lisp_gpe_add_del_tunnel_reply_t * mp)
-{
- vat_main_t * vam = &vat_main;
- vat_json_node_t node;
-
- vat_json_init_object(&node);
- vat_json_object_add_int(&node, "retval", ntohl(mp->retval));
- vat_json_object_add_uint(&node, "sw_if_index", ntohl(mp->sw_if_index));
-
- vat_json_print(vam->ofp, &node);
- vat_json_free(&node);
-
- vam->retval = ntohl(mp->retval);
- vam->result_ready = 1;
-}
-
static void vl_api_show_version_reply_t_handler
(vl_api_show_version_reply_t * mp)
{
@@ -2361,7 +2330,6 @@ _(SHOW_VERSION_REPLY, show_version_reply) \
_(NSH_GRE_ADD_DEL_TUNNEL_REPLY, nsh_gre_add_del_tunnel_reply) \
_(L2_FIB_TABLE_ENTRY, l2_fib_table_entry) \
_(NSH_VXLAN_GPE_ADD_DEL_TUNNEL_REPLY, nsh_vxlan_gpe_add_del_tunnel_reply) \
-_(LISP_GPE_ADD_DEL_TUNNEL_REPLY, lisp_gpe_add_del_tunnel_reply) \
_(INTERFACE_NAME_RENUMBER_REPLY, interface_name_renumber_reply) \
_(WANT_IP4_ARP_EVENTS_REPLY, want_ip4_arp_events_reply) \
_(IP4_ARP_EVENT, ip4_arp_event) \
@@ -8237,140 +8205,6 @@ static int api_nsh_vxlan_gpe_add_del_tunnel (vat_main_t * vam)
return 0;
}
-static uword unformat_lisp_gpe_decap_next (unformat_input_t * input,
- va_list * args)
-{
- u32 * result = va_arg (*args, u32 *);
- u32 tmp;
-
- if (unformat (input, "drop"))
- *result = LISP_GPE_INPUT_NEXT_DROP;
- else if (unformat (input, "ip4"))
- *result = LISP_GPE_INPUT_NEXT_IP4_INPUT;
- else if (unformat (input, "ip6"))
- *result = LISP_GPE_INPUT_NEXT_IP6_INPUT;
- else if (unformat (input, "ethernet"))
- *result = LISP_GPE_INPUT_NEXT_IP6_INPUT;
- else if (unformat (input, "%d", &tmp))
- *result = tmp;
- else
- return 0;
- return 1;
-}
-
-static int
-api_lisp_gpe_add_del_tunnel (vat_main_t * vam)
-{
- unformat_input_t * line_input = vam->input;
- vl_api_lisp_gpe_add_del_tunnel_t *mp;
- f64 timeout;
- ip4_address_t src, dst;
- u8 is_add = 1;
- u8 src_set = 0;
- u8 dst_set = 0;
- u32 encap_vrf_id = 0;
- u32 decap_vrf_id = 0;
- u8 next_protocol = LISP_GPE_NEXT_PROTOCOL_IP4;
- u32 decap_next_index = LISP_GPE_INPUT_NEXT_IP4_INPUT;
- u8 flags = LISP_GPE_FLAGS_P;
- u8 ver_res = 0;
- u8 res = 0;
- u32 iid = 0;
- u8 iid_set = 0;
- u32 tmp;
-
- while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) {
- if (unformat (line_input, "del"))
- is_add = 0;
- else if (unformat (line_input, "src %U",
- unformat_ip4_address, &src))
- src_set = 1;
- else if (unformat (line_input, "dst %U",
- unformat_ip4_address, &dst))
- dst_set = 1;
- else if (unformat (line_input, "encap-vrf-id %d", &encap_vrf_id))
- ;
- else if (unformat (line_input, "decap-vrf-id %d", &decap_vrf_id))
- ;
- else if (unformat (line_input, "decap-next %U",
- unformat_lisp_gpe_decap_next,
- &decap_next_index))
- ;
- else if (unformat(line_input, "next-ip4"))
- next_protocol = 1;
- else if (unformat(line_input, "next-ip6"))
- next_protocol = 2;
- else if (unformat(line_input, "next-ethernet"))
- next_protocol = 3;
- else if (unformat(line_input, "next-nsh"))
- next_protocol = 4;
- /* Allow the user to specify anything they want in the LISP hdr */
- else if (unformat (line_input, "ver_res %x", &tmp))
- ver_res = tmp;
- else if (unformat (line_input, "res %x", &tmp))
- res = tmp;
- else if (unformat (line_input, "flags %x", &tmp))
- flags = tmp;
- else if (unformat (line_input, "n-bit"))
- flags |= LISP_GPE_FLAGS_N;
- else if (unformat (line_input, "l-bit"))
- flags |= LISP_GPE_FLAGS_L;
- else if (unformat (line_input, "e-bit"))
- flags |= LISP_GPE_FLAGS_E;
- else if (unformat (line_input, "v-bit"))
- flags |= LISP_GPE_FLAGS_V;
- else if (unformat (line_input, "i-bit"))
- flags |= LISP_GPE_FLAGS_V;
- else if (unformat (line_input, "not-p-bit"))
- flags &= !LISP_GPE_FLAGS_P;
- else if (unformat (line_input, "p-bit"))
- flags |= LISP_GPE_FLAGS_P;
- else if (unformat (line_input, "o-bit"))
- flags |= LISP_GPE_FLAGS_O;
- else if (unformat (line_input, "iidx %x", &iid))
- iid_set = 1;
- else if (unformat (line_input, "iid %d", &iid))
- iid_set = 1;
- else {
- errmsg ("parse error '%U'\n", format_unformat_error, line_input);
- return -99;
- }
- }
-
- if (src_set == 0) {
- errmsg ("tunnel src address not specified\n");
- return -99;
- }
- if (dst_set == 0) {
- errmsg ("tunnel dst address not specified\n");
- return -99;
- }
- if (iid_set == 0) {
- errmsg ("iid not specified\n");
- return -99;
- }
-
- M(LISP_GPE_ADD_DEL_TUNNEL, lisp_gpe_add_del_tunnel);
-
- mp->src = src.as_u32;
- mp->dst = dst.as_u32;
- mp->encap_vrf_id = ntohl(encap_vrf_id);
- mp->decap_vrf_id = ntohl(decap_vrf_id);
- mp->decap_next_index = ntohl(decap_next_index);
- mp->is_add = is_add;
- mp->flags = flags;
- mp->ver_res = ver_res;
- mp->res = res;
- mp->next_protocol = next_protocol;
- mp->iid = ntohl(iid);
-
- S; W;
-
- /* NOTREACHED */
- return 0;
-}
-
-
u8 * format_l2_fib_mac_address (u8 * s, va_list * args)
{
u8 * a = va_arg (*args, u8 *);
@@ -10786,12 +10620,6 @@ _(nsh_vxlan_gpe_add_del_tunnel, \
"[c-bit <1|0>] [md-type <nn>][next-ip4][next-ip6][next-ethernet]\n" \
"[tlv <xx>][del]") \
_(l2_fib_table_dump, "bd_id <bridge-domain-id>") \
-_(lisp_gpe_add_del_tunnel, \
- "src <ip4-addr> dst <ip4-addr> iid <nn>|iidx <0xnn>\n" \
- "[encap-vrf-id <nn>] [decap-vrf-id <nn>]\n" \
- "[n-bit][l-bit][e-bit][v-bit][i-bit][p-bit][not-p-bit][o-bit]\n" \
- "[next-ip4][next-ip6][next-ethernet][next-nsh]\n" \
- "[decap-next [ip4|ip6|ethernet|nsh-encap|<nn>]][del]") \
_(interface_name_renumber, \
"<intfc> | sw_if_index <nn> new_show_dev_instance <nn>") \
_(input_acl_set_interface, \
diff --git a/vpp/api/api.c b/vpp/api/api.c
index c672d4a309a..5e808795417 100644
--- a/vpp/api/api.c
+++ b/vpp/api/api.c
@@ -291,7 +291,6 @@ _(NSH_GRE_ADD_DEL_TUNNEL, nsh_gre_add_del_tunnel) \
_(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
_(L2_FIB_TABLE_ENTRY, l2_fib_table_entry) \
_(NSH_VXLAN_GPE_ADD_DEL_TUNNEL, nsh_vxlan_gpe_add_del_tunnel) \
-_(LISP_GPE_ADD_DEL_TUNNEL, lisp_gpe_add_del_tunnel) \
_(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
_(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
_(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
@@ -4664,64 +4663,6 @@ out:
}
static void
-vl_api_lisp_gpe_add_del_tunnel_t_handler
-(vl_api_lisp_gpe_add_del_tunnel_t * mp)
-{
- vl_api_lisp_gpe_add_del_tunnel_reply_t * rmp;
- int rv = 0;
- vnet_lisp_gpe_add_del_tunnel_args_t _a, *a = &_a;
- u32 encap_fib_index, decap_fib_index;
- u32 decap_next_index;
- uword * p;
- ip4_main_t * im = &ip4_main;
- u32 sw_if_index = ~0;
-
- p = hash_get (im->fib_index_by_table_id, ntohl(mp->encap_vrf_id));
- if (! p) {
- rv = VNET_API_ERROR_NO_SUCH_FIB;
- goto out;
- }
- encap_fib_index = p[0];
-
- decap_next_index = ntohl(mp->decap_next_index);
-
- /* Interpret decap_vrf_id as an opaque if sending to other-than-ip4-input */
- if (decap_next_index == NSH_GRE_INPUT_NEXT_IP4_INPUT) {
- p = hash_get (im->fib_index_by_table_id, ntohl(mp->decap_vrf_id));
- if (! p) {
- rv = VNET_API_ERROR_NO_SUCH_INNER_FIB;
- goto out;
- }
- decap_fib_index = p[0];
- } else {
- decap_fib_index = ntohl(mp->decap_vrf_id);
- }
-
- memset (a, 0, sizeof (*a));
-
- a->is_add = mp->is_add;
- /* ip addresses sent in network byte order */
- a->src.as_u32 = mp->src;
- a->dst.as_u32 = mp->dst;
- a->encap_fib_index = encap_fib_index;
- a->decap_fib_index = decap_fib_index;
- a->decap_next_index = decap_next_index;
- a->flags = mp->flags;
- a->ver_res = mp->ver_res;
- a->res = mp->res;
- a->next_protocol = mp->next_protocol;
- a->vni = clib_net_to_host_u32 (mp->iid);
-
- rv = vnet_lisp_gpe_add_del_tunnel (a, &sw_if_index);
-
-out:
- REPLY_MACRO2(VL_API_LISP_GPE_ADD_DEL_TUNNEL_REPLY,
- ({
- rmp->sw_if_index = ntohl (sw_if_index);
- }));
-}
-
-static void
vl_api_lisp_add_del_locator_set_t_handler(vl_api_lisp_add_del_locator_set_t *mp)
{
vl_api_lisp_add_del_locator_set_reply_t *rmp;
@@ -4881,7 +4822,6 @@ vl_api_lisp_gpe_add_del_fwd_entry_t_handler(
vl_api_lisp_gpe_add_del_fwd_entry_reply_t *rmp;
int rv = 0;
ip_address_t slocator, dlocator;
- ip_prefix_t * prefp = NULL;
gid_address_t eid;
vnet_lisp_gpe_add_del_fwd_entry_args_t a;
@@ -4893,9 +4833,6 @@ vl_api_lisp_gpe_add_del_fwd_entry_t_handler(
a.deid = eid;
a.slocator = slocator;
a.dlocator = dlocator;
- prefp = &gid_address_ippref(&a.deid);
- a.decap_next_index = (ip_prefix_version(prefp) == IP4) ?
- LISP_GPE_INPUT_NEXT_IP4_INPUT : LISP_GPE_INPUT_NEXT_IP6_INPUT;
rv = vnet_lisp_gpe_add_del_fwd_entry (&a, 0);
REPLY_MACRO(VL_API_LISP_GPE_ADD_DEL_FWD_ENTRY_REPLY);
diff --git a/vpp/api/custom_dump.c b/vpp/api/custom_dump.c
index 574e102fc46..d0d77f6877e 100644
--- a/vpp/api/custom_dump.c
+++ b/vpp/api/custom_dump.c
@@ -1684,49 +1684,6 @@ static void *vl_api_nsh_vxlan_gpe_add_del_tunnel_t_print
FINISH;
}
-static void *vl_api_lisp_gpe_add_del_tunnel_t_print
-(vl_api_lisp_gpe_add_del_tunnel_t * mp, void *handle)
-{
- u8 * s;
-
- s = format (0, "SCRIPT: lisp_gpe_add_del_tunnel ");
-
- s = format (s, "src %U dst %U ", format_ip4_address, &mp->src,
- format_ip4_address, &mp->dst);
-
- if (mp->encap_vrf_id)
- s = format (s, "encap-vrf-id %d ", ntohl(mp->encap_vrf_id));
-
- if (mp->decap_vrf_id)
- s = format (s, "decap-vrf-id %d ", ntohl(mp->decap_vrf_id));
-
- s = format (s, "decap-next %d ", ntohl(mp->decap_next_index));
-
- s = format (s, "flags %x ", (u32)(mp->flags));
-
- if (mp->ver_res)
- s = format (s, "ver_res %x ", (u32)(mp->ver_res));
-
- if (mp->res)
- s = format (s, "res %x ", (u32)(mp->res));
-
- s = format (s, "iid %d ", ntohl (mp->iid));
-
- if (mp->is_add == 0)
- s = format (s, "del ");
-
- if (mp->next_protocol == 1)
- s = format (s, "next-ip4 ");
- else if (mp->next_protocol == 2)
- s = format (s, "next-ip6 ");
- else if (mp->next_protocol == 3)
- s = format (s, "next-ethernet ");
- else if (mp->next_protocol == 4)
- s = format (s, "next-nsh ");
-
- FINISH;
-}
-
static void *vl_api_interface_name_renumber_t_print
(vl_api_interface_name_renumber_t * mp, void * handle)
{
@@ -1918,7 +1875,6 @@ _(SHOW_VERSION, show_version) \
_(NSH_GRE_ADD_DEL_TUNNEL, nsh_gre_add_del_tunnel) \
_(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
_(NSH_VXLAN_GPE_ADD_DEL_TUNNEL, nsh_vxlan_gpe_add_del_tunnel) \
-_(LISP_GPE_ADD_DEL_TUNNEL, lisp_gpe_add_del_tunnel) \
_(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
_(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
_(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api
index 6ecb15fb710..10c62bb3d7a 100644
--- a/vpp/api/vpe.api
+++ b/vpp/api/vpe.api
@@ -2169,29 +2169,6 @@ define nsh_vxlan_gpe_add_del_tunnel_reply {
u32 sw_if_index;
};
-define lisp_gpe_add_del_tunnel {
- u32 client_index;
- u32 context;
- u32 src;
- u32 dst;
- u32 encap_vrf_id;
- u32 decap_vrf_id;
- u32 decap_next_index;
- u8 is_add;
- u8 flags;
- u8 ver_res;
- u8 res;
- u8 next_protocol;
- /* in network byte order */
- u32 iid;
-};
-
-define lisp_gpe_add_del_tunnel_reply {
- u32 context;
- i32 retval;
- u32 sw_if_index;
-};
-
/** \brief add or delete locator_set
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request