summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnet/vnet/lisp-gpe/decap.c17
-rw-r--r--vnet/vnet/lisp-gpe/lisp_gpe.c15
2 files changed, 20 insertions, 12 deletions
diff --git a/vnet/vnet/lisp-gpe/decap.c b/vnet/vnet/lisp-gpe/decap.c
index fc5f72f4b3b..a583666fcf4 100644
--- a/vnet/vnet/lisp-gpe/decap.c
+++ b/vnet/vnet/lisp-gpe/decap.c
@@ -58,8 +58,12 @@ next_proto_to_next_index[LISP_GPE_NEXT_PROTOS] = {
static u32
next_protocol_to_next_index (lisp_gpe_header_t * lgh, u8 * next_header)
{
+ /* lisp-gpe router */
+ if (PREDICT_TRUE((lgh->flags & LISP_GPE_FLAGS_P)
+ && lgh->next_protocol < LISP_GPE_NEXT_PROTOS))
+ return next_proto_to_next_index[lgh->next_protocol];
/* legay lisp router */
- if (PREDICT_FALSE((lgh->flags & LISP_GPE_FLAGS_P) == 0))
+ else if ((lgh->flags & LISP_GPE_FLAGS_P) == 0)
{
ip4_header_t * iph = (ip4_header_t *) next_header;
if ((iph->ip_version_and_header_length & 0xF0) == 0x40)
@@ -69,10 +73,6 @@ next_protocol_to_next_index (lisp_gpe_header_t * lgh, u8 * next_header)
else
return LISP_GPE_INPUT_NEXT_DROP;
}
- /* lisp-gpe router */
- else if ((lgh->flags & LISP_GPE_FLAGS_P)
- && lgh->next_protocol < LISP_GPE_NEXT_PROTOS)
- return next_proto_to_next_index[lgh->next_protocol];
else
return LISP_GPE_INPUT_NEXT_DROP;
}
@@ -199,7 +199,7 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
{
vnet_buffer(b1)->sw_if_index[VLIB_RX] = si1[0];
pkts_decapsulated++;
- error0 = 0;
+ error1 = 0;
}
else
{
@@ -253,7 +253,10 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
b0 = vlib_get_buffer (vm, bi0);
- /* udp leaves current_data pointing at the lisp header */
+ /* udp leaves current_data pointing at the lisp header
+ * TODO: there's no difference in processing between v4 and v6
+ * encapsulated packets so the code should be simplified if ip header
+ * info is not going to be used for dp smrs/dpsec */
if (is_v4)
{
vlib_buffer_advance (
diff --git a/vnet/vnet/lisp-gpe/lisp_gpe.c b/vnet/vnet/lisp-gpe/lisp_gpe.c
index 76a7fa25e9f..6ccc5f0d32e 100644
--- a/vnet/vnet/lisp-gpe/lisp_gpe.c
+++ b/vnet/vnet/lisp-gpe/lisp_gpe.c
@@ -227,19 +227,24 @@ vnet_lisp_gpe_add_del_fwd_entry (vnet_lisp_gpe_add_del_fwd_entry_args_t * a,
ip_prefix_t * dpref, * spref;
uword * lookup_next_index, * lgpe_sw_if_index, * lnip;
u8 ip_ver;
+
/* treat negative fwd entries separately */
if (a->is_negative)
return add_del_negative_fwd_entry (lgm, a);
+ dpref = &gid_address_ippref(&a->deid);
+ 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);
if (rv)
return rv;
- dpref = &gid_address_ippref(&a->deid);
- spref = &gid_address_ippref(&a->seid);
- ip_ver = ip_prefix_version(dpref);
-
/* setup adjacency for eid */
memset (&adj, 0, sizeof(adj));
adj.n_adj = 1;
@@ -570,7 +575,7 @@ lisp_gpe_init (vlib_main_t *vm)
udp_register_dst_port (vm, UDP_DST_PORT_lisp_gpe,
lisp_gpe_ip4_input_node.index, 1 /* is_ip4 */);
udp_register_dst_port (vm, UDP_DST_PORT_lisp_gpe6,
- lisp_gpe_ip4_input_node.index, 0 /* is_ip4 */);
+ lisp_gpe_ip6_input_node.index, 0 /* is_ip4 */);
return 0;
}