diff options
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/lisp-gpe/lisp_gpe.c | 32 | ||||
-rw-r--r-- | vnet/vnet/lisp-gpe/lisp_gpe.h | 37 |
2 files changed, 23 insertions, 46 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; |