summaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/faces
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/faces')
-rw-r--r--hicn-plugin/src/faces/app/face_prod_node.c150
-rw-r--r--hicn-plugin/src/faces/face.c6
-rw-r--r--hicn-plugin/src/faces/face.h69
-rw-r--r--hicn-plugin/src/faces/face_flags.h39
-rw-r--r--hicn-plugin/src/faces/face_node.c290
-rw-r--r--hicn-plugin/src/faces/iface_node.c316
6 files changed, 495 insertions, 375 deletions
diff --git a/hicn-plugin/src/faces/app/face_prod_node.c b/hicn-plugin/src/faces/app/face_prod_node.c
index 5d2b54040..e3241e477 100644
--- a/hicn-plugin/src/faces/app/face_prod_node.c
+++ b/hicn-plugin/src/faces/app/face_prod_node.c
@@ -42,12 +42,12 @@ typedef struct
{
u32 next_index;
u32 sw_if_index;
+ hicn_error_t error;
} hicn_face_prod_input_trace_t;
typedef enum
{
- HICN_FACE_PROD_NEXT_DATA_IP4,
- HICN_FACE_PROD_NEXT_DATA_IP6,
+ HICN_FACE_PROD_NEXT_PCS,
HICN_FACE_PROD_NEXT_ERROR_DROP,
HICN_FACE_PROD_N_NEXT,
} hicn_face_prod_next_t;
@@ -65,11 +65,14 @@ format_face_prod_input_trace (u8 *s, va_list *args)
s = format (s, "prod-face: sw_if_index %d next-index %d", t->sw_if_index,
t->next_index);
+
+ if (t->error != HICN_ERROR_NONE)
+ s = format (s, " error %s", get_error_string (t->error));
return s;
}
static_always_inline int
-match_ip4_name (u32 *name, fib_prefix_t *prefix)
+match_ip4_name (u32 *name, const fib_prefix_t *prefix)
{
u32 xor = 0;
@@ -79,7 +82,7 @@ match_ip4_name (u32 *name, fib_prefix_t *prefix)
}
static_always_inline int
-match_ip6_name (u8 *name, fib_prefix_t *prefix)
+match_ip6_name (u8 *name, const fib_prefix_t *prefix)
{
union
{
@@ -96,24 +99,42 @@ match_ip6_name (u8 *name, fib_prefix_t *prefix)
}
static_always_inline u32
-hicn_face_prod_next_from_data_hdr (vlib_node_runtime_t *node, vlib_buffer_t *b,
- fib_prefix_t *prefix)
+hicn_face_prod_next_from_data_hdr (vlib_buffer_t *b)
{
- u8 *ptr = vlib_buffer_get_current (b);
- u8 v = *ptr & 0xf0;
+ u8 is_v6;
int match_res = 1;
+ int ret = 0;
+ hicn_name_t *name;
+ hicn_face_prod_state_t *prod_face = NULL;
+
+ // 1 - ensure the packet is hicn and its format is correct
+ ret = hicn_data_parse_pkt (b);
+ if (PREDICT_FALSE (ret))
+ {
+ return HICN_FACE_PROD_NEXT_ERROR_DROP;
+ }
- if (PREDICT_TRUE (v == 0x40 && ip46_address_is_ip4 (&prefix->fp_addr)))
+ // 2 - make sure the packet refers to a valid producer app state and
+ // retrieve app state information
+ prod_face = &face_state_vec[vnet_buffer (b)->sw_if_index[VLIB_RX]];
+ vnet_buffer (b)->ip.adj_index[VLIB_RX] = prod_face->adj_index;
+
+ // 3 - make sure the address in the packet belongs to the producer prefix
+ // of this face
+ const fib_prefix_t *prefix = &prod_face->prefix;
+ is_v6 = hicn_buffer_is_v6 (b);
+ name = &hicn_get_buffer (b)->name;
+ if (PREDICT_TRUE (!is_v6 && ip46_address_is_ip4 (&prefix->fp_addr)))
{
- match_res = match_ip4_name ((u32 *) &(ptr[12]), prefix);
+ match_res = match_ip4_name (&name->prefix.ip4.as_u32, prefix);
}
- else if (PREDICT_TRUE (v == 0x60 && !ip46_address_is_ip4 (&prefix->fp_addr)))
+ else if (PREDICT_TRUE (is_v6 && !ip46_address_is_ip4 (&prefix->fp_addr)))
{
- match_res = match_ip6_name (&(ptr[8]), prefix);
+ match_res = match_ip6_name (name->prefix.ip6.as_u8, prefix);
}
- return match_res ? HICN_FACE_PROD_NEXT_DATA_IP4 + (v == 0x60) :
- HICN_FACE_PROD_NEXT_ERROR_DROP;
+ // 4 - if match found, forward data to next hicn node
+ return match_res ? HICN_FACE_PROD_NEXT_PCS : HICN_FACE_PROD_NEXT_ERROR_DROP;
}
static_always_inline void
@@ -137,6 +158,7 @@ hicn_face_prod_input_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
u32 n_left_from, *from, *to_next;
hicn_face_prod_next_t next_index;
vl_api_hicn_api_node_stats_get_reply_t stats = { 0 };
+ u32 thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -152,22 +174,28 @@ hicn_face_prod_input_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
vlib_buffer_t *b0, *b1, *b2, *b3;
hicn_buffer_t *hicnb0, *hicnb1, *hicnb2, *hicnb3;
u32 bi0, bi1, bi2, bi3;
- hicn_face_prod_state_t *prod_face0 = NULL;
- hicn_face_prod_state_t *prod_face1 = NULL;
- hicn_face_prod_state_t *prod_face2 = NULL;
- hicn_face_prod_state_t *prod_face3 = NULL;
u32 next0, next1, next2, next3;
+ // Prefetch next iteration
{
vlib_buffer_t *b4, *b5, *b6, *b7;
b4 = vlib_get_buffer (vm, from[4]);
b5 = vlib_get_buffer (vm, from[5]);
b6 = vlib_get_buffer (vm, from[6]);
b7 = vlib_get_buffer (vm, from[7]);
- CLIB_PREFETCH (b4, CLIB_CACHE_LINE_BYTES, STORE);
- CLIB_PREFETCH (b5, CLIB_CACHE_LINE_BYTES, STORE);
- CLIB_PREFETCH (b6, CLIB_CACHE_LINE_BYTES, STORE);
- CLIB_PREFETCH (b7, CLIB_CACHE_LINE_BYTES, STORE);
+ CLIB_PREFETCH (b4, 2 * CLIB_CACHE_LINE_BYTES, WRITE);
+ CLIB_PREFETCH (b5, 2 * CLIB_CACHE_LINE_BYTES, WRITE);
+ CLIB_PREFETCH (b6, 2 * CLIB_CACHE_LINE_BYTES, WRITE);
+ CLIB_PREFETCH (b7, 2 * CLIB_CACHE_LINE_BYTES, WRITE);
+
+ CLIB_PREFETCH (vlib_buffer_get_current (b4),
+ 2 * CLIB_CACHE_LINE_BYTES, WRITE);
+ CLIB_PREFETCH (vlib_buffer_get_current (b5),
+ 2 * CLIB_CACHE_LINE_BYTES, WRITE);
+ CLIB_PREFETCH (vlib_buffer_get_current (b6),
+ 2 * CLIB_CACHE_LINE_BYTES, WRITE);
+ CLIB_PREFETCH (vlib_buffer_get_current (b7),
+ 2 * CLIB_CACHE_LINE_BYTES, WRITE);
}
bi0 = from[0];
@@ -200,31 +228,39 @@ hicn_face_prod_input_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
hicnb2->flags = HICN_FACE_FLAGS_DEFAULT;
hicnb3->flags = HICN_FACE_FLAGS_DEFAULT;
- prod_face0 = &face_state_vec[vnet_buffer (b0)->sw_if_index[VLIB_RX]];
- prod_face1 = &face_state_vec[vnet_buffer (b1)->sw_if_index[VLIB_RX]];
- prod_face2 = &face_state_vec[vnet_buffer (b2)->sw_if_index[VLIB_RX]];
- prod_face3 = &face_state_vec[vnet_buffer (b3)->sw_if_index[VLIB_RX]];
-
- vnet_buffer (b0)->ip.adj_index[VLIB_RX] =
- face_state_vec[vnet_buffer (b0)->sw_if_index[VLIB_RX]].adj_index;
- vnet_buffer (b1)->ip.adj_index[VLIB_RX] =
- face_state_vec[vnet_buffer (b1)->sw_if_index[VLIB_RX]].adj_index;
- vnet_buffer (b2)->ip.adj_index[VLIB_RX] =
- face_state_vec[vnet_buffer (b2)->sw_if_index[VLIB_RX]].adj_index;
- vnet_buffer (b3)->ip.adj_index[VLIB_RX] =
- face_state_vec[vnet_buffer (b3)->sw_if_index[VLIB_RX]].adj_index;
-
- next0 =
- hicn_face_prod_next_from_data_hdr (node, b0, &prod_face0->prefix);
- next1 =
- hicn_face_prod_next_from_data_hdr (node, b1, &prod_face1->prefix);
- next2 =
- hicn_face_prod_next_from_data_hdr (node, b2, &prod_face2->prefix);
- next3 =
- hicn_face_prod_next_from_data_hdr (node, b3, &prod_face3->prefix);
+ // parse packets and get next node
+ next0 = hicn_face_prod_next_from_data_hdr (b0);
+ next1 = hicn_face_prod_next_from_data_hdr (b1);
+ next2 = hicn_face_prod_next_from_data_hdr (b2);
+ next3 = hicn_face_prod_next_from_data_hdr (b3);
stats.pkts_data_count += 4;
- /* trace */
+ // counters
+ vlib_increment_combined_counter (
+ &counters[hicnb0->face_id * HICN_N_COUNTER], thread_index,
+ HICN_FACE_COUNTERS_DATA_RX, 1,
+ vlib_buffer_length_in_chain (vm, b0));
+ stats.pkts_data_count += 1;
+
+ vlib_increment_combined_counter (
+ &counters[hicnb1->face_id * HICN_N_COUNTER], thread_index,
+ HICN_FACE_COUNTERS_DATA_RX, 1,
+ vlib_buffer_length_in_chain (vm, b0));
+ stats.pkts_data_count += 1;
+
+ vlib_increment_combined_counter (
+ &counters[hicnb2->face_id * HICN_N_COUNTER], thread_index,
+ HICN_FACE_COUNTERS_DATA_RX, 1,
+ vlib_buffer_length_in_chain (vm, b0));
+ stats.pkts_data_count += 1;
+
+ vlib_increment_combined_counter (
+ &counters[hicnb3->face_id * HICN_N_COUNTER], thread_index,
+ HICN_FACE_COUNTERS_DATA_RX, 1,
+ vlib_buffer_length_in_chain (vm, b0));
+ stats.pkts_data_count += 1;
+
+ // trace
hicn_face_prod_trace_buffer (
vm, node, vnet_buffer (b0)->sw_if_index[VLIB_RX], b0, next0);
hicn_face_prod_trace_buffer (
@@ -234,7 +270,7 @@ hicn_face_prod_input_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
hicn_face_prod_trace_buffer (
vm, node, vnet_buffer (b3)->sw_if_index[VLIB_RX], b3, next3);
- /* enqueue */
+ // enqueue
vlib_validate_buffer_enqueue_x4 (vm, node, next_index, to_next,
n_left_to_next, bi0, bi1, bi2, bi3,
next0, next1, next2, next3);
@@ -246,8 +282,7 @@ hicn_face_prod_input_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
{
vlib_buffer_t *b0;
hicn_buffer_t *hicnb0;
- u32 bi0, swif;
- hicn_face_prod_state_t *prod_face = NULL;
+ u32 bi0;
u32 next0;
if (n_left_from > 1)
@@ -267,15 +302,17 @@ hicn_face_prod_input_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node,
b0 = vlib_get_buffer (vm, bi0);
hicnb0 = hicn_get_buffer (b0);
hicnb0->flags = HICN_FACE_FLAGS_DEFAULT;
- swif = vnet_buffer (b0)->sw_if_index[VLIB_RX];
- prod_face = &face_state_vec[swif];
- next0 =
- hicn_face_prod_next_from_data_hdr (node, b0, &prod_face->prefix);
- vnet_buffer (b0)->ip.adj_index[VLIB_RX] =
- face_state_vec[swif].adj_index;
+ next0 = hicn_face_prod_next_from_data_hdr (b0);
stats.pkts_data_count++;
+ // counters
+ vlib_increment_combined_counter (
+ &counters[hicnb0->face_id * HICN_N_COUNTER], thread_index,
+ HICN_FACE_COUNTERS_DATA_RX, 1,
+ vlib_buffer_length_in_chain (vm, b0));
+ stats.pkts_data_count += 1;
+
/* trace */
hicn_face_prod_trace_buffer (
vm, node, vnet_buffer (b0)->sw_if_index[VLIB_RX], b0, next0);
@@ -310,8 +347,7 @@ VLIB_REGISTER_NODE(hicn_face_prod_input_node) =
.n_next_nodes = HICN_FACE_PROD_N_NEXT,
.next_nodes =
{
- [HICN_FACE_PROD_NEXT_DATA_IP4] = "hicn4-face-input",
- [HICN_FACE_PROD_NEXT_DATA_IP6] = "hicn6-face-input",
+ [HICN_FACE_PROD_NEXT_PCS] = "hicn-data-pcslookup",
[HICN_FACE_PROD_NEXT_ERROR_DROP] = "error-drop",
},
};
@@ -320,4 +356,4 @@ VLIB_REGISTER_NODE(hicn_face_prod_input_node) =
* fd.io coding-style-patch-verification: ON
*
* Local Variables: eval: (c-set-style "gnu") End:
- */
+ */ \ No newline at end of file
diff --git a/hicn-plugin/src/faces/face.c b/hicn-plugin/src/faces/face.c
index 854fd81d3..4ee1c283f 100644
--- a/hicn-plugin/src/faces/face.c
+++ b/hicn-plugin/src/faces/face.c
@@ -62,16 +62,12 @@ mhash_t hicn_face_hashtb;
const static char *const hicn_face6_nodes[] = {
"hicn6-face-output", // this is the name you give your node in
// VLIB_REGISTER_NODE
- "hicn6-iface-output", // this is the name you give your node in
- // VLIB_REGISTER_NODE
NULL,
};
const static char *const hicn_face4_nodes[] = {
"hicn4-face-output", // this is the name you give your node in
// VLIB_REGISTER_NODE
- "hicn4-iface-output", // this is the name you give your node in
- // VLIB_REGISTER_NODE
NULL,
};
@@ -304,7 +300,7 @@ hicn_iface_to_face (hicn_face_t *face, const dpo_id_t *dpo)
*/
int
hicn_face_add (const dpo_id_t *dpo_nh, ip46_address_t *nat_address, int sw_if,
- hicn_face_id_t *pfaceid, u8 is_app_prod)
+ hicn_face_id_t *pfaceid)
{
hicn_face_flags_t flags = (hicn_face_flags_t) 0;
diff --git a/hicn-plugin/src/faces/face.h b/hicn-plugin/src/faces/face.h
index 39505c942..e4b759bec 100644
--- a/hicn-plugin/src/faces/face.h
+++ b/hicn-plugin/src/faces/face.h
@@ -27,6 +27,8 @@
#include <vpp_plugins/hicn/error.h>
+#include "face_flags.h"
+#include "../hicn_buffer_flags.h"
#include "../udp_tunnels/udp_tunnel.h"
#include "../hicn_logging.h"
@@ -117,40 +119,8 @@ typedef struct __attribute__ ((packed)) hicn_face_s
/* Pool of faces */
extern hicn_face_t *hicn_dpoi_face_pool;
-/* Flags */
-/* A face is complete and it stores all the information. A iface lacks of the
- adj index, therefore sending a packet through a iface require a lookup in
- the FIB. */
-#define HICN_FACE_FLAGS_DEFAULT 0x00
-#define HICN_FACE_FLAGS_FACE 0x01
-#define HICN_FACE_FLAGS_IFACE 0x02
-#define HICN_FACE_FLAGS_APPFACE_PROD \
- 0x04 /* Currently only IP face can be appface */
-#define HICN_FACE_FLAGS_APPFACE_CONS \
- 0x08 /* Currently only IP face can be appface */
-#define HICN_FACE_FLAGS_DELETED 0x10
-#define HICN_FACE_FLAGS_UDP 0x20
-
#define HICN_FACE_NULL (hicn_face_id_t) ~0
-#define HICN_FACE_FLAGS_APPFACE_PROD_BIT 2
-#define HICN_FACE_FLAGS_APPFACE_CONS_BIT 3
-
-#define HICN_BUFFER_FLAGS_DEFAULT 0x00
-#define HICN_BUFFER_FLAGS_NEW_FACE 0x02
-#define HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL 0x04
-#define HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL 0x08
-
-STATIC_ASSERT ((1 << HICN_FACE_FLAGS_APPFACE_PROD_BIT) ==
- HICN_FACE_FLAGS_APPFACE_PROD,
- "HICN_FACE_FLAGS_APPFACE_PROD_BIT and "
- "HICN_FACE_FLAGS_APPFACE_PROD must correspond");
-
-STATIC_ASSERT ((1 << HICN_FACE_FLAGS_APPFACE_CONS_BIT) ==
- HICN_FACE_FLAGS_APPFACE_CONS,
- "HICN_FACE_FLAGS_APPFACE_CONS_BIT and "
- "HICN_FACE_FLAGS_APPFACE_CONS must correspond");
-
/**
* @brief Definition of the virtual functin table for an hICN FACE DPO.
*/
@@ -484,7 +454,7 @@ hicn_face_get_with_dpo (const ip46_address_t *addr, u32 sw_if,
* reachable ip address, otherwise HICN_ERROR_NONE
*/
int hicn_face_add (const dpo_id_t *dpo_nh, ip46_address_t *nat_address,
- int sw_if, hicn_face_id_t *pfaceid, u8 is_app_prod);
+ int sw_if, hicn_face_id_t *pfaceid);
/**
* @brief Create a new incomplete face ip. (Meant to be used by the data plane)
@@ -497,7 +467,7 @@ int hicn_face_add (const dpo_id_t *dpo_nh, ip46_address_t *nat_address,
* reachable ip address, otherwise HICN_ERROR_NONE
*/
always_inline void
-hicn_iface_add (ip46_address_t *nat_address, int sw_if,
+hicn_iface_add (const ip46_address_t *nat_address, int sw_if,
hicn_face_id_t *pfaceid, u32 adj_index, u8 flags)
{
hicn_face_t *face;
@@ -615,7 +585,6 @@ hicn_face_ip4_add_and_lock (hicn_face_id_t *index, u8 *hicnb_flags,
*hicnb_flags |= HICN_BUFFER_FLAGS_NEW_FACE;
*index = idx;
- return ret;
}
else
{
@@ -623,15 +592,10 @@ hicn_face_ip4_add_and_lock (hicn_face_id_t *index, u8 *hicnb_flags,
hicn_face_id_t face_id = hicn_dpoi_get_index (face);
hicn_face_unlock_with_id (face_id);
ret = HICN_ERROR_FACE_ALREADY_CREATED;
+ *index = hicn_dpoi_get_index (face);
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
}
- /* Code replicated on purpose */
- *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
- *hicnb_flags |= (face->flags & HICN_FACE_FLAGS_APPFACE_PROD) >>
- HICN_FACE_FLAGS_APPFACE_PROD_BIT;
-
- *index = hicn_dpoi_get_index (face);
-
return ret;
}
@@ -676,7 +640,7 @@ hicn_face_ip6_add_and_lock (hicn_face_id_t *index, u8 *hicnb_flags,
/*All (complete) faces are indexed by remote addess as well */
/* if the face exists, it adds a lock */
- hicn_face_t *face = hicn_face_get ((ip46_address_t *) nat_addr, sw_if,
+ hicn_face_t *face = hicn_face_get ((const ip46_address_t *) nat_addr, sw_if,
&hicn_face_hashtb, adj_index);
if (face == NULL)
@@ -684,8 +648,8 @@ hicn_face_ip6_add_and_lock (hicn_face_id_t *index, u8 *hicnb_flags,
hicn_face_id_t idx;
u8 face_flags = 0;
- hicn_iface_add ((ip46_address_t *) nat_addr, sw_if, &idx, adj_index,
- face_flags);
+ hicn_iface_add ((const ip46_address_t *) nat_addr, sw_if, &idx,
+ adj_index, face_flags);
face = hicn_dpoi_get_from_idx (idx);
@@ -712,12 +676,8 @@ hicn_face_ip6_add_and_lock (hicn_face_id_t *index, u8 *hicnb_flags,
adj_nbr_walk (face->sw_if, FIB_PROTOCOL_IP6, hicn6_iface_adj_walk_cb,
face);
- *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
- *hicnb_flags |= HICN_BUFFER_FLAGS_NEW_FACE;
-
+ *hicnb_flags = HICN_BUFFER_FLAGS_NEW_FACE;
*index = idx;
-
- return ret;
}
else
{
@@ -725,15 +685,10 @@ hicn_face_ip6_add_and_lock (hicn_face_id_t *index, u8 *hicnb_flags,
hicn_face_id_t face_id = hicn_dpoi_get_index (face);
hicn_face_unlock_with_id (face_id);
ret = HICN_ERROR_FACE_ALREADY_CREATED;
+ *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
+ *index = hicn_dpoi_get_index (face);
}
- /* Code replicated on purpose */
- *hicnb_flags = HICN_BUFFER_FLAGS_DEFAULT;
- *hicnb_flags |= (face->flags & HICN_FACE_FLAGS_APPFACE_PROD) >>
- HICN_FACE_FLAGS_APPFACE_PROD_BIT;
-
- *index = hicn_dpoi_get_index (face);
-
return ret;
}
diff --git a/hicn-plugin/src/faces/face_flags.h b/hicn-plugin/src/faces/face_flags.h
new file mode 100644
index 000000000..61dee5465
--- /dev/null
+++ b/hicn-plugin/src/faces/face_flags.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __HICN_FACE_FLAGS_H__
+#define __HICN_FACE_FLAGS_H__
+
+/* Flags */
+/* A face is complete and it stores all the information. A iface lacks of the
+ adj index, therefore sending a packet through a iface require a lookup in
+ the FIB. */
+#define foreach_face_flag \
+ _ (0, FACE, "face") \
+ _ (1, IFACE, "iface") \
+ _ (2, APPFACE_PROD, "face is consumer face") \
+ _ (3, APPFACE_CONS, "face is consumer face") \
+ _ (4, DELETED, "face is deleted") \
+ _ (5, UDP, "face is udp")
+
+enum
+{
+ HICN_FACE_FLAGS_DEFAULT = 0,
+#define _(a, b, c) HICN_FACE_FLAGS_##b = (1 << a),
+ foreach_face_flag
+#undef _
+};
+
+#endif /* __HICN_FACE_FLAGS_H__ */ \ No newline at end of file
diff --git a/hicn-plugin/src/faces/face_node.c b/hicn-plugin/src/faces/face_node.c
index dc9bfffd0..6dedbe1c4 100644
--- a/hicn-plugin/src/faces/face_node.c
+++ b/hicn-plugin/src/faces/face_node.c
@@ -56,6 +56,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
+ hicn_error_t error;
u8 packet_data[60];
} hicn4_face_input_trace_t;
@@ -73,6 +74,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
+ hicn_error_t error;
u8 packet_data[60];
} hicn6_face_input_trace_t;
@@ -86,8 +88,9 @@ typedef enum
#define NEXT_MAPME_IP4 HICN4_FACE_INPUT_NEXT_MAPME
#define NEXT_MAPME_IP6 HICN6_FACE_INPUT_NEXT_MAPME
-#define NEXT_DATA_IP4 HICN4_FACE_INPUT_NEXT_DATA
-#define NEXT_DATA_IP6 HICN6_FACE_INPUT_NEXT_DATA
+
+#define NEXT_DATA_IP4 HICN4_FACE_INPUT_NEXT_DATA
+#define NEXT_DATA_IP6 HICN6_FACE_INPUT_NEXT_DATA
#define NEXT_ERROR_DROP_IP4 HICN4_FACE_INPUT_NEXT_ERROR_DROP
#define NEXT_ERROR_DROP_IP6 HICN6_FACE_INPUT_NEXT_ERROR_DROP
@@ -110,10 +113,11 @@ typedef enum
vlib_buffer_t *b0; \
u32 bi0, sw_if0; \
u32 next0 = NEXT_ERROR_DROP_IP##ipv; \
+ u8 is_icmp0; \
IP_HEADER_##ipv *ip_hdr = NULL; \
hicn_buffer_t *hicnb0; \
int from_tunnel0; \
- int ret0; \
+ int ret0 = HICN_ERROR_NONE; \
/* Prefetch for next iteration. */ \
if (n_left_from > 1) \
{ \
@@ -134,23 +138,35 @@ typedef enum
hicnb0 = hicn_get_buffer (b0); \
ip_hdr = (IP_HEADER_##ipv *) vlib_buffer_get_current (b0); \
\
- u8 is_icmp = ip_hdr->protocol == IPPROTO_ICMPV##ipv; \
- \
- from_tunnel0 = \
- (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL || \
- hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL) > 0; \
- sw_if0 = (from_tunnel0) * ~0 + \
- (1 - from_tunnel0) * vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
- \
- ret0 = hicn_face_ip##ipv##_add_and_lock ( \
- &hicnb0->face_id, &hicnb0->flags, &ip_hdr->dst_address, sw_if0, \
- vnet_buffer (b0)->ip.adj_index[VLIB_RX], \
- /* Should not be used */ ~0); \
- /* Make sure the face is not created here */ \
- ASSERT (ret0 == HICN_ERROR_FACE_ALREADY_CREATED); \
+ /* Parse packet and cache useful info in opaque2 */ \
+ ret0 = hicn_data_parse_pkt (b0); \
+ is_icmp0 = ret0 == HICN_ERROR_PARSER_MAPME_PACKET; \
+ ret0 = (ret0 == HICN_ERROR_NONE) || \
+ (ret0 == HICN_ERROR_PARSER_MAPME_PACKET); \
\
- next0 = \
- is_icmp * NEXT_MAPME_IP##ipv + (1 - is_icmp) * NEXT_DATA_IP##ipv; \
+ /* If parsing is ok, send packet to next node */ \
+ if (PREDICT_FALSE (!ret0)) \
+ { \
+ next0 = HICN##ipv##_FACE_INPUT_NEXT_ERROR_DROP; \
+ } \
+ else \
+ { \
+ next0 = is_icmp0 * NEXT_MAPME_IP##ipv + \
+ (1 - is_icmp0) * NEXT_DATA_IP##ipv; \
+ from_tunnel0 = \
+ (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL || \
+ hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL) > 0; \
+ sw_if0 = \
+ (from_tunnel0) * ~0 + \
+ (1 - from_tunnel0) * vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
+ \
+ ret0 = hicn_face_ip##ipv##_add_and_lock ( \
+ &hicnb0->face_id, &hicnb0->flags, &ip_hdr->dst_address, sw_if0, \
+ vnet_buffer (b0)->ip.adj_index[VLIB_RX], \
+ /* Should not be used */ ~0); \
+ /* Make sure the face is not created here */ \
+ ASSERT (ret0 == HICN_ERROR_FACE_ALREADY_CREATED); \
+ } \
\
vlib_increment_combined_counter ( \
&counters[hicnb0->face_id * HICN_N_COUNTER], thread_index, \
@@ -162,8 +178,9 @@ typedef enum
{ \
TRACE_INPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b0, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
+ t->error = ret0; \
t->next_index = next0; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b0), \
sizeof (t->packet_data)); \
@@ -182,6 +199,7 @@ typedef enum
u32 bi0, bi1, sw_if0, sw_if1; \
u32 next0 = NEXT_ERROR_DROP_IP##ipv; \
u32 next1 = NEXT_ERROR_DROP_IP##ipv; \
+ u8 is_icmp0, is_icmp1; \
IP_HEADER_##ipv *ip_hdr0 = NULL; \
IP_HEADER_##ipv *ip_hdr1 = NULL; \
hicn_buffer_t *hicnb0; \
@@ -215,40 +233,95 @@ typedef enum
ip_hdr0 = (IP_HEADER_##ipv *) vlib_buffer_get_current (b0); \
ip_hdr1 = (IP_HEADER_##ipv *) vlib_buffer_get_current (b1); \
\
- u8 is_icmp0 = ip_hdr0->protocol == IPPROTO_ICMPV##ipv; \
- u8 is_icmp1 = ip_hdr1->protocol == IPPROTO_ICMPV##ipv; \
- \
- from_tunnel0 = \
- (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL || \
- hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL) > 0; \
- sw_if0 = (from_tunnel0) * ~0 + \
- (1 - from_tunnel0) * vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
- \
- ret0 = hicn_face_ip##ipv##_add_and_lock ( \
- &hicnb0->face_id, &hicnb0->flags, &ip_hdr0->dst_address, sw_if0, \
- vnet_buffer (b0)->ip.adj_index[VLIB_RX], \
- /* Should not be used */ ~0); \
- /* Make sure the face is not created here */ \
- ASSERT (ret0 == HICN_ERROR_FACE_ALREADY_CREATED); \
- \
- from_tunnel1 = \
- (hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL || \
- hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL) > 0; \
- sw_if1 = (from_tunnel1) * ~0 + \
- (1 - from_tunnel1) * vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
- \
- ret1 = hicn_face_ip##ipv##_add_and_lock ( \
- &hicnb1->face_id, &hicnb1->flags, &ip_hdr1->dst_address, sw_if1, \
- vnet_buffer (b1)->ip.adj_index[VLIB_RX], \
- /* Should not be used */ ~0); \
- /* Make sure the face is not created here */ \
- ASSERT (ret1 == HICN_ERROR_FACE_ALREADY_CREATED); \
- \
- next0 = \
- is_icmp0 * NEXT_MAPME_IP##ipv + (1 - is_icmp0) * NEXT_DATA_IP##ipv; \
- \
- next1 = \
- is_icmp1 * NEXT_MAPME_IP##ipv + (1 - is_icmp1) * NEXT_DATA_IP##ipv; \
+ /* Parse packet and cache useful info in opaque2 */ \
+ /* Parse packet and cache useful info in opaque2 */ \
+ ret0 = hicn_data_parse_pkt (b0); \
+ ret1 = hicn_data_parse_pkt (b1); \
+ is_icmp0 = ret0 == HICN_ERROR_PARSER_MAPME_PACKET; \
+ is_icmp1 = ret1 == HICN_ERROR_PARSER_MAPME_PACKET; \
+ ret0 = (ret0 == HICN_ERROR_NONE) || \
+ (ret0 == HICN_ERROR_PARSER_MAPME_PACKET); \
+ ret1 = (ret1 == HICN_ERROR_NONE) || \
+ (ret1 == HICN_ERROR_PARSER_MAPME_PACKET); \
+ if (PREDICT_TRUE (ret0 && ret1)) \
+ { \
+ next0 = is_icmp0 * NEXT_MAPME_IP##ipv + \
+ (1 - is_icmp0) * NEXT_DATA_IP##ipv; \
+ \
+ next1 = is_icmp1 * NEXT_MAPME_IP##ipv + \
+ (1 - is_icmp1) * NEXT_DATA_IP##ipv; \
+ \
+ from_tunnel0 = \
+ (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL || \
+ hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL) > 0; \
+ sw_if0 = \
+ (from_tunnel0) * ~0 + \
+ (1 - from_tunnel0) * vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
+ \
+ ret0 = hicn_face_ip##ipv##_add_and_lock ( \
+ &hicnb0->face_id, &hicnb0->flags, &ip_hdr0->dst_address, sw_if0, \
+ vnet_buffer (b0)->ip.adj_index[VLIB_RX], \
+ /* Should not be used */ ~0); \
+ /* Make sure the face is not created here */ \
+ ASSERT (ret0 == HICN_ERROR_FACE_ALREADY_CREATED); \
+ \
+ from_tunnel1 = \
+ (hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL || \
+ hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL) > 0; \
+ sw_if1 = \
+ (from_tunnel1) * ~0 + \
+ (1 - from_tunnel1) * vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
+ \
+ ret1 = hicn_face_ip##ipv##_add_and_lock ( \
+ &hicnb1->face_id, &hicnb1->flags, &ip_hdr1->dst_address, sw_if1, \
+ vnet_buffer (b1)->ip.adj_index[VLIB_RX], \
+ /* Should not be used */ ~0); \
+ /* Make sure the face is not created here */ \
+ ASSERT (ret1 == HICN_ERROR_FACE_ALREADY_CREATED); \
+ } \
+ else if (ret0 && !ret1) \
+ { \
+ next1 = HICN##ipv##_FACE_INPUT_NEXT_ERROR_DROP; \
+ from_tunnel0 = \
+ (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL || \
+ hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL) > 0; \
+ sw_if0 = \
+ (from_tunnel0) * ~0 + \
+ (1 - from_tunnel0) * vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
+ \
+ ret0 = hicn_face_ip##ipv##_add_and_lock ( \
+ &hicnb0->face_id, &hicnb0->flags, &ip_hdr0->dst_address, sw_if0, \
+ vnet_buffer (b0)->ip.adj_index[VLIB_RX], \
+ /* Should not be used */ ~0); \
+ /* Make sure the face is not created here */ \
+ ASSERT (ret0 == HICN_ERROR_FACE_ALREADY_CREATED); \
+ next0 = is_icmp0 * NEXT_MAPME_IP##ipv + \
+ (1 - is_icmp0) * NEXT_DATA_IP##ipv; \
+ } \
+ else if (!ret0 && ret1) \
+ { \
+ next0 = HICN##ipv##_FACE_INPUT_NEXT_ERROR_DROP; \
+ from_tunnel1 = \
+ (hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL || \
+ hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL) > 0; \
+ sw_if1 = \
+ (from_tunnel1) * ~0 + \
+ (1 - from_tunnel1) * vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
+ \
+ ret1 = hicn_face_ip##ipv##_add_and_lock ( \
+ &hicnb1->face_id, &hicnb1->flags, &ip_hdr1->dst_address, sw_if1, \
+ vnet_buffer (b1)->ip.adj_index[VLIB_RX], \
+ /* Should not be used */ ~0); \
+ /* Make sure the face is not created here */ \
+ ASSERT (ret1 == HICN_ERROR_FACE_ALREADY_CREATED); \
+ next1 = is_icmp1 * NEXT_MAPME_IP##ipv + \
+ (1 - is_icmp1) * NEXT_DATA_IP##ipv; \
+ } \
+ else \
+ { \
+ next0 = HICN##ipv##_FACE_INPUT_NEXT_ERROR_DROP; \
+ next1 = HICN##ipv##_FACE_INPUT_NEXT_ERROR_DROP; \
+ } \
\
vlib_increment_combined_counter ( \
&counters[hicnb0->face_id * HICN_N_COUNTER], thread_index, \
@@ -265,8 +338,9 @@ typedef enum
{ \
TRACE_INPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b0, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
+ t->error = ret0; \
t->next_index = next0; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b0), \
sizeof (t->packet_data)); \
@@ -277,8 +351,9 @@ typedef enum
{ \
TRACE_INPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b1, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
+ t->error = ret1; \
t->next_index = next1; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b1), \
sizeof (t->packet_data)); \
@@ -461,80 +536,6 @@ typedef enum
HICN6_FACE_OUTPUT_N_NEXT,
} hicn6_face_output_next_t;
-/* static_always_inline void */
-/* hicn_reply_probe_v4 (vlib_buffer_t * b, hicn_face_t * face) */
-/* { */
-/* hicn_header_t *h0 = vlib_buffer_get_current (b); */
-/* hicn_face_ip_t * face_ip = (hicn_face_ip_t *)(&face->data); */
-/* h0->v4.ip.saddr = h0->v4.ip.daddr; */
-/* h0->v4.ip.daddr = face_ip->local_addr.ip4; */
-/* vnet_buffer (b)->sw_if_index[VLIB_RX] = face->shared.sw_if; */
-
-/* u16 * dst_port_ptr = (u16 *)(((u8*)h0) + sizeof(ip4_header_t) +
- * sizeof(u16)); */
-/* u16 dst_port = *dst_port_ptr; */
-/* u16 * src_port_ptr = (u16 *)(((u8*)h0) + sizeof(ip4_header_t)); */
-
-/* *dst_port_ptr = *src_port_ptr; */
-/* *src_port_ptr = dst_port; */
-
-/* hicn_type_t type = hicn_get_buffer (b)->type; */
-/* hicn_ops_vft[type.l1]->set_lifetime (type, &h0->protocol, 0); */
-/* } */
-
-/* static_always_inline void */
-/* hicn_reply_probe_v6 (vlib_buffer_t * b, hicn_face_t * face) */
-/* { */
-/* hicn_header_t *h0 = vlib_buffer_get_current (b); */
-/* hicn_face_ip_t * face_ip = (hicn_face_ip_t *)(&face->data); */
-/* h0->v6.ip.saddr = h0->v6.ip.daddr; */
-/* h0->v6.ip.daddr = face_ip->local_addr.ip6; */
-/* vnet_buffer (b)->sw_if_index[VLIB_RX] = face->shared.sw_if; */
-
-/* u16 * dst_port_ptr = (u16 *)(((u8*)h0) + sizeof(ip6_header_t) +
- * sizeof(u16)); */
-/* u16 dst_port = *dst_port_ptr; */
-/* u16 * src_port_ptr = (u16 *)(((u8*)h0) + sizeof(ip6_header_t)); */
-
-/* *dst_port_ptr = *src_port_ptr; */
-/* *src_port_ptr = dst_port; */
-
-/* hicn_type_t type = hicn_get_buffer (b)->type; */
-/* hicn_ops_vft[type.l1]->set_lifetime (type, &h0->protocol, 0); */
-
-/* } */
-
-/* static_always_inline u32 */
-/* hicn_face_match_probe (vlib_buffer_t * b, hicn_face_t * face, u32 * next) */
-/* { */
-
-/* u8 *ptr = vlib_buffer_get_current (b); */
-/* u8 v = *ptr & 0xf0; */
-/* u8 res = 0; */
-
-/* if ( v == 0x40 ) */
-/* { */
-/* u16 * dst_port = (u16 *)(ptr + sizeof(ip4_header_t) + sizeof(u16)); */
-/* if (*dst_port == clib_net_to_host_u16(DEFAULT_PROBING_PORT)) */
-/* { */
-/* hicn_reply_probe_v6(b, face); */
-/* *next = HICN4_FACE_NEXT_ECHO_REPLY; */
-/* res = 1; */
-/* } */
-/* } */
-/* else if ( v == 0x60 ) */
-/* { */
-/* u16 * dst_port = (u16 *)(ptr + sizeof(ip6_header_t) + sizeof(u16)); */
-/* if (*dst_port == clib_net_to_host_u16(DEFAULT_PROBING_PORT)) */
-/* { */
-/* hicn_reply_probe_v6(b, face); */
-/* *next = HICN6_FACE_NEXT_ECHO_REPLY; */
-/* res = 1; */
-/* } */
-/* } */
-/* return res; */
-/* } */
-
static inline void
hicn_face_rewrite_interest (vlib_main_t *vm, vlib_buffer_t *b0,
hicn_face_t *face, u32 *next)
@@ -546,6 +547,9 @@ hicn_face_rewrite_interest (vlib_main_t *vm, vlib_buffer_t *b0,
hicn_header_t *hicn = vlib_buffer_get_current (b0);
+ u8 is_v4 = ip46_address_is_ip4 (&face->nat_addr) &&
+ !ip6_address_is_loopback (&face->nat_addr.ip6);
+
// hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
ip46_address_t temp_addr;
@@ -553,11 +557,8 @@ hicn_face_rewrite_interest (vlib_main_t *vm, vlib_buffer_t *b0,
hicn_type_t type = hicn_get_buffer (b0)->type;
int ret = hicn_ops_vft[type.l1]->rewrite_interest (
type, &hicn->protocol, &face->nat_addr, &temp_addr);
-
if (ret == HICN_LIB_ERROR_REWRITE_CKSUM_REQUIRED)
{
- u8 is_v4 = ip46_address_is_ip4 (&face->nat_addr) &&
- !ip6_address_is_loopback (&face->nat_addr.ip6);
ensure_offload_flags (b0, is_v4);
}
@@ -645,7 +646,7 @@ typedef struct
{ \
TRACE_OUTPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b0, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b0), \
@@ -724,7 +725,7 @@ typedef struct
{ \
TRACE_OUTPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b0, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b0), \
@@ -736,7 +737,7 @@ typedef struct
{ \
TRACE_OUTPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b1, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
t->next_index = next1; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b1), \
@@ -812,12 +813,7 @@ VLIB_REGISTER_NODE (hicn4_face_output_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = ARRAY_LEN (hicn4_face_output_error_strings),
.error_strings = hicn4_face_output_error_strings,
- .n_next_nodes = HICN4_FACE_OUTPUT_N_NEXT,
- /* Reusing the list of nodes from lookup to be compatible with arp */
- .next_nodes = { [HICN4_FACE_OUTPUT_NEXT_ERROR_DROP] = "error-drop",
- [HICN4_FACE_OUTPUT_NEXT_ECHO_REPLY] = "hicn4-face-input",
- [HICN4_FACE_OUTPUT_NEXT_UDP4_ENCAP] = "udp4-encap",
- [HICN4_FACE_OUTPUT_NEXT_UDP6_ENCAP] = "udp6-encap" }
+ .sibling_of = "ip4-lookup",
};
static uword
@@ -882,13 +878,7 @@ VLIB_REGISTER_NODE (hicn6_face_output_node) = {
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = ARRAY_LEN (hicn6_face_output_error_strings),
.error_strings = hicn6_face_output_error_strings,
- .n_next_nodes = HICN6_FACE_OUTPUT_N_NEXT,
- /* Reusing the list of nodes from lookup to be compatible with neighbour
- discovery */
- .next_nodes = { [HICN6_FACE_OUTPUT_NEXT_ERROR_DROP] = "error-drop",
- [HICN6_FACE_OUTPUT_NEXT_ECHO_REPLY] = "hicn6-face-input",
- [HICN6_FACE_OUTPUT_NEXT_UDP4_ENCAP] = "udp4-encap",
- [HICN6_FACE_OUTPUT_NEXT_UDP6_ENCAP] = "udp6-encap" }
+ .sibling_of = "ip6-lookup",
};
/*
@@ -897,4 +887,4 @@ VLIB_REGISTER_NODE (hicn6_face_output_node) = {
* Local Variables:
* eval: (c-set-style "gnu")
* End:
- */
+ */ \ No newline at end of file
diff --git a/hicn-plugin/src/faces/iface_node.c b/hicn-plugin/src/faces/iface_node.c
index 84205af9b..3b6634d77 100644
--- a/hicn-plugin/src/faces/iface_node.c
+++ b/hicn-plugin/src/faces/iface_node.c
@@ -52,6 +52,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
+ hicn_error_t error;
u8 packet_data[60];
} hicn4_iface_input_trace_t;
@@ -69,6 +70,7 @@ typedef struct
u32 next_index;
u32 sw_if_index;
u8 pkt_type;
+ hicn_error_t error;
u8 packet_data[60];
} hicn6_iface_input_trace_t;
@@ -86,33 +88,9 @@ typedef enum
#define NEXT_INTEREST_IP4 HICN4_IFACE_INPUT_NEXT_INTEREST
#define NEXT_INTEREST_IP6 HICN6_IFACE_INPUT_NEXT_INTEREST
-#define ADDRESS_IP4 \
- ip_interface_address_t *ia = 0; \
- ip4_address_t *local_address = \
- ip4_interface_first_address (&ip4_main, swif, &ia)
-#define ADDRESS_IP6 \
- ip6_address_t *local_address = ip6_interface_first_address (&ip6_main, swif)
-
-#define ADDRESSX2_IP4 \
- ip_interface_address_t *ia0, *ia1; \
- ia0 = ia1 = 0; \
- ip4_address_t *local_address0 = \
- ip4_interface_first_address (&ip4_main, swif0, &ia0); \
- ip4_address_t *local_address1 = \
- ip4_interface_first_address (&ip4_main, swif1, &ia1);
-
-#define ADDRESSX2_IP6 \
- ip6_address_t *local_address0 = \
- ip6_interface_first_address (&ip6_main, swif0); \
- ip6_address_t *local_address1 = \
- ip6_interface_first_address (&ip6_main, swif1);
-
#define DPO_ADD_LOCK_FACE_IP4 hicn_face_ip4_add_and_lock
#define DPO_ADD_LOCK_FACE_IP6 hicn_face_ip6_add_and_lock
-//#define VLIB_EDGE_IP4 data_fwd_iface_ip4_vlib_edge
-//#define VLIB_EDGE_IP6 data_fwd_iface_ip6_vlib_edge
-
#define IP_HEADER_4 ip4_header_t
#define IP_HEADER_6 ip6_header_t
@@ -148,6 +126,7 @@ typedef enum
HICN4_IFACE_OUTPUT_NEXT_LOOKUP,
HICN4_IFACE_OUTPUT_NEXT_UDP4_ENCAP,
HICN4_IFACE_OUTPUT_NEXT_UDP6_ENCAP,
+ HICN4_IFACE_OUTPUT_NEXT_PG,
HICN4_IFACE_OUTPUT_N_NEXT,
} hicn4_iface_output_next_t;
@@ -166,6 +145,7 @@ typedef enum
HICN6_IFACE_OUTPUT_NEXT_LOOKUP,
HICN6_IFACE_OUTPUT_NEXT_UDP4_ENCAP,
HICN6_IFACE_OUTPUT_NEXT_UDP6_ENCAP,
+ HICN6_IFACE_OUTPUT_NEXT_PG,
HICN6_IFACE_OUTPUT_N_NEXT,
} hicn6_iface_output_next_t;
@@ -178,6 +158,9 @@ typedef enum
#define NEXT_UDP_ENCAP_IP4 HICN4_IFACE_OUTPUT_NEXT_UDP4_ENCAP
#define NEXT_UDP_ENCAP_IP6 HICN6_IFACE_OUTPUT_NEXT_UDP6_ENCAP
+#define NEXT_PG4 HICN4_IFACE_OUTPUT_NEXT_PG
+#define NEXT_PG6 HICN6_IFACE_OUTPUT_NEXT_PG
+
#define HICN_REWRITE_DATA_IP4 hicn_rewrite_iface_data4
#define HICN_REWRITE_DATA_IP6 hicn_rewrite_iface_data6
@@ -190,9 +173,11 @@ typedef enum
do \
{ \
vlib_buffer_t *b0; \
- u32 bi0, next0, next_iface0, sw_if0; \
+ u32 bi0, next0, next_iface0, sw_if0 = ~0; \
IP_HEADER_##ipv *ip_hdr = NULL; \
hicn_buffer_t *hicnb0; \
+ int ret0 = HICN_ERROR_NONE; \
+ u8 is_icmp0; \
/* Prefetch for next iteration. */ \
if (n_left_from > 1) \
{ \
@@ -213,41 +198,55 @@ typedef enum
hicnb0 = hicn_get_buffer (b0); \
ip_hdr = (IP_HEADER_##ipv *) vlib_buffer_get_current (b0); \
\
- stats.pkts_interest_count += 1; \
- \
- u8 is_icmp = ip_hdr->protocol == IPPROTO_ICMPV##ipv; \
- \
- next0 = \
- is_icmp * NEXT_MAPME_IP##ipv + (1 - is_icmp) * NEXT_INTEREST_IP##ipv; \
- \
- next_iface0 = NEXT_DATA_LOOKUP_IP##ipv; \
- sw_if0 = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
- \
- if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL && \
- vnet_buffer (b0)->ip.adj_index[VLIB_RX] != ADJ_INDEX_INVALID) \
+ /* Parse packet and cache useful info in opaque2 */ \
+ ret0 = hicn_interest_parse_pkt (b0); \
+ is_icmp0 = (ret0 == HICN_ERROR_PARSER_MAPME_PACKET); \
+ ret0 = (ret0 == HICN_ERROR_NONE) || \
+ (ret0 == HICN_ERROR_PARSER_MAPME_PACKET); \
+ if (PREDICT_FALSE (!ret0)) \
{ \
- next_iface0 = NEXT_UDP_ENCAP_IP4; \
- sw_if0 = ~0; \
+ next0 = HICN##ipv##_IFACE_INPUT_NEXT_ERROR_DROP; \
} \
- else if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL && \
- vnet_buffer (b0)->ip.adj_index[VLIB_RX] != ADJ_INDEX_INVALID) \
+ else \
{ \
- next_iface0 = NEXT_UDP_ENCAP_IP6; \
- sw_if0 = ~0; \
+ next0 = is_icmp0 * NEXT_MAPME_IP##ipv + \
+ (1 - is_icmp0) * NEXT_INTEREST_IP##ipv; \
+ \
+ next_iface0 = NEXT_DATA_LOOKUP_IP##ipv; \
+ sw_if0 = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
+ \
+ if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL && \
+ vnet_buffer (b0)->ip.adj_index[VLIB_RX] != ADJ_INDEX_INVALID) \
+ { \
+ next_iface0 = NEXT_UDP_ENCAP_IP4; \
+ sw_if0 = ~0; \
+ } \
+ else if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL && \
+ vnet_buffer (b0)->ip.adj_index[VLIB_RX] != \
+ ADJ_INDEX_INVALID) \
+ { \
+ next_iface0 = NEXT_UDP_ENCAP_IP6; \
+ sw_if0 = ~0; \
+ } \
+ else if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_PG) \
+ { \
+ next_iface0 = NEXT_PG##ipv; \
+ } \
+ \
+ DPO_ADD_LOCK_FACE_IP##ipv ( \
+ &(hicnb0->face_id), &hicnb0->flags, &(ip_hdr->src_address), \
+ sw_if0, vnet_buffer (b0)->ip.adj_index[VLIB_RX], next_iface0); \
} \
\
- DPO_ADD_LOCK_FACE_IP##ipv ( \
- &(hicnb0->face_id), &hicnb0->flags, &(ip_hdr->src_address), sw_if0, \
- vnet_buffer (b0)->ip.adj_index[VLIB_RX], next_iface0); \
- \
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \
(b0->flags & VLIB_BUFFER_IS_TRACED))) \
{ \
TRACE_INPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b0, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = sw_if0; \
t->next_index = next0; \
+ t->error = ret0; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b0), \
sizeof (t->packet_data)); \
} \
@@ -267,9 +266,12 @@ typedef enum
do \
{ \
vlib_buffer_t *b0, *b1; \
- u32 bi0, bi1, next0, next1, next_iface0, next_iface1, sw_if0, sw_if1; \
+ u32 bi0, bi1, next0, next1; \
+ u32 next_iface0, next_iface1, sw_if0 = ~0, sw_if1 = ~0; \
+ u8 is_icmp0, is_icmp1; \
IP_HEADER_##ipv *ip_hdr0 = NULL; \
IP_HEADER_##ipv *ip_hdr1 = NULL; \
+ int ret0 = HICN_ERROR_NONE, ret1 = HICN_ERROR_NONE; \
hicn_buffer_t *hicnb0, *hicnb1; \
\
/* Prefetch for next iteration. */ \
@@ -300,63 +302,149 @@ typedef enum
\
stats.pkts_interest_count += 2; \
\
- u8 is_icmp0 = ip_hdr0->protocol == IPPROTO_ICMPV##ipv; \
- u8 is_icmp1 = ip_hdr1->protocol == IPPROTO_ICMPV##ipv; \
- \
- next0 = is_icmp0 * NEXT_MAPME_IP##ipv + \
- (1 - is_icmp0) * NEXT_INTEREST_IP##ipv; \
- \
- next1 = is_icmp1 * NEXT_MAPME_IP##ipv + \
- (1 - is_icmp1) * NEXT_INTEREST_IP##ipv; \
- \
- next_iface0 = NEXT_DATA_LOOKUP_IP##ipv; \
- sw_if0 = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
- \
- if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL && \
- vnet_buffer (b0)->ip.adj_index[VLIB_RX] != ADJ_INDEX_INVALID) \
+ /* Parse packet and cache useful info in opaque2 */ \
+ ret0 = hicn_interest_parse_pkt (b0); \
+ ret1 = hicn_interest_parse_pkt (b1); \
+ is_icmp0 = ret0 == HICN_ERROR_PARSER_MAPME_PACKET; \
+ is_icmp1 = ret1 == HICN_ERROR_PARSER_MAPME_PACKET; \
+ ret0 = (ret0 == HICN_ERROR_NONE) || \
+ (ret0 == HICN_ERROR_PARSER_MAPME_PACKET); \
+ ret1 = (ret1 == HICN_ERROR_NONE) || \
+ (ret1 == HICN_ERROR_PARSER_MAPME_PACKET); \
+ \
+ if (PREDICT_TRUE (ret0 && ret1)) \
{ \
- next_iface0 = NEXT_UDP_ENCAP_IP4; \
- sw_if0 = ~0; \
+ next0 = is_icmp0 * NEXT_MAPME_IP##ipv + \
+ (1 - is_icmp0) * NEXT_INTEREST_IP##ipv; \
+ \
+ next1 = is_icmp1 * NEXT_MAPME_IP##ipv + \
+ (1 - is_icmp1) * NEXT_INTEREST_IP##ipv; \
+ \
+ next_iface0 = NEXT_DATA_LOOKUP_IP##ipv; \
+ sw_if0 = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
+ \
+ if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL && \
+ vnet_buffer (b0)->ip.adj_index[VLIB_RX] != ADJ_INDEX_INVALID) \
+ { \
+ next_iface0 = NEXT_UDP_ENCAP_IP4; \
+ sw_if0 = ~0; \
+ } \
+ else if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL && \
+ vnet_buffer (b0)->ip.adj_index[VLIB_RX] != \
+ ADJ_INDEX_INVALID) \
+ { \
+ next_iface0 = NEXT_UDP_ENCAP_IP6; \
+ sw_if0 = ~0; \
+ } \
+ else if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_PG) \
+ { \
+ next_iface0 = NEXT_PG##ipv; \
+ } \
+ \
+ next_iface1 = NEXT_DATA_LOOKUP_IP##ipv; \
+ sw_if1 = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
+ \
+ if (hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL && \
+ vnet_buffer (b1)->ip.adj_index[VLIB_RX] != ADJ_INDEX_INVALID) \
+ { \
+ next_iface1 = NEXT_UDP_ENCAP_IP4; \
+ sw_if1 = ~0; \
+ } \
+ else if (hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL && \
+ vnet_buffer (b1)->ip.adj_index[VLIB_RX] != \
+ ADJ_INDEX_INVALID) \
+ { \
+ next_iface1 = NEXT_UDP_ENCAP_IP6; \
+ sw_if1 = ~0; \
+ } \
+ else if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_PG) \
+ { \
+ next_iface1 = NEXT_PG##ipv; \
+ } \
+ \
+ DPO_ADD_LOCK_FACE_IP##ipv ( \
+ &(hicnb0->face_id), &hicnb0->flags, &(ip_hdr0->src_address), \
+ sw_if0, vnet_buffer (b0)->ip.adj_index[VLIB_RX], next_iface0); \
+ \
+ DPO_ADD_LOCK_FACE_IP##ipv ( \
+ &(hicnb1->face_id), &hicnb1->flags, &(ip_hdr1->src_address), \
+ sw_if1, vnet_buffer (b1)->ip.adj_index[VLIB_RX], next_iface1); \
} \
- else if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL && \
- vnet_buffer (b0)->ip.adj_index[VLIB_RX] != ADJ_INDEX_INVALID) \
+ else if (ret0 && !ret1) \
{ \
- next_iface0 = NEXT_UDP_ENCAP_IP6; \
- sw_if0 = ~0; \
+ next1 = HICN##ipv##_IFACE_INPUT_NEXT_ERROR_DROP; \
+ next0 = is_icmp0 * NEXT_MAPME_IP##ipv + \
+ (1 - is_icmp0) * NEXT_INTEREST_IP##ipv; \
+ next_iface0 = NEXT_DATA_LOOKUP_IP##ipv; \
+ sw_if0 = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
+ \
+ if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL && \
+ vnet_buffer (b0)->ip.adj_index[VLIB_RX] != ADJ_INDEX_INVALID) \
+ { \
+ next_iface0 = NEXT_UDP_ENCAP_IP4; \
+ sw_if0 = ~0; \
+ } \
+ else if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL && \
+ vnet_buffer (b0)->ip.adj_index[VLIB_RX] != \
+ ADJ_INDEX_INVALID) \
+ { \
+ next_iface0 = NEXT_UDP_ENCAP_IP6; \
+ sw_if0 = ~0; \
+ } \
+ else if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_PG) \
+ { \
+ next_iface0 = NEXT_PG##ipv; \
+ } \
+ \
+ DPO_ADD_LOCK_FACE_IP##ipv ( \
+ &(hicnb0->face_id), &hicnb0->flags, &(ip_hdr0->src_address), \
+ sw_if0, vnet_buffer (b0)->ip.adj_index[VLIB_RX], next_iface0); \
} \
- \
- next_iface1 = NEXT_DATA_LOOKUP_IP##ipv; \
- sw_if1 = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
- \
- if (hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL && \
- vnet_buffer (b1)->ip.adj_index[VLIB_RX] != ADJ_INDEX_INVALID) \
+ else if (!ret0 && ret1) \
{ \
- next_iface1 = NEXT_UDP_ENCAP_IP4; \
- sw_if1 = ~0; \
+ next0 = HICN##ipv##_IFACE_INPUT_NEXT_ERROR_DROP; \
+ next_iface1 = NEXT_DATA_LOOKUP_IP##ipv; \
+ sw_if1 = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
+ next1 = is_icmp1 * NEXT_MAPME_IP##ipv + \
+ (1 - is_icmp1) * NEXT_INTEREST_IP##ipv; \
+ \
+ if (hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP4_TUNNEL && \
+ vnet_buffer (b1)->ip.adj_index[VLIB_RX] != ADJ_INDEX_INVALID) \
+ { \
+ next_iface1 = NEXT_UDP_ENCAP_IP4; \
+ sw_if1 = ~0; \
+ } \
+ else if (hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL && \
+ vnet_buffer (b1)->ip.adj_index[VLIB_RX] != \
+ ADJ_INDEX_INVALID) \
+ { \
+ next_iface1 = NEXT_UDP_ENCAP_IP6; \
+ sw_if1 = ~0; \
+ } \
+ else if (hicnb0->flags & HICN_BUFFER_FLAGS_FROM_PG) \
+ { \
+ next_iface1 = NEXT_PG##ipv; \
+ } \
+ \
+ DPO_ADD_LOCK_FACE_IP##ipv ( \
+ &(hicnb1->face_id), &hicnb1->flags, &(ip_hdr1->src_address), \
+ sw_if1, vnet_buffer (b1)->ip.adj_index[VLIB_RX], next_iface1); \
} \
- else if (hicnb1->flags & HICN_BUFFER_FLAGS_FROM_UDP6_TUNNEL && \
- vnet_buffer (b1)->ip.adj_index[VLIB_RX] != ADJ_INDEX_INVALID) \
+ else \
{ \
- next_iface1 = NEXT_UDP_ENCAP_IP6; \
- sw_if1 = ~0; \
+ next0 = HICN##ipv##_IFACE_INPUT_NEXT_ERROR_DROP; \
+ next1 = HICN##ipv##_IFACE_INPUT_NEXT_ERROR_DROP; \
} \
\
- DPO_ADD_LOCK_FACE_IP##ipv ( \
- &(hicnb0->face_id), &hicnb0->flags, &(ip_hdr0->src_address), sw_if0, \
- vnet_buffer (b0)->ip.adj_index[VLIB_RX], next_iface0); \
- \
- DPO_ADD_LOCK_FACE_IP##ipv ( \
- &(hicnb1->face_id), &hicnb1->flags, &(ip_hdr1->src_address), sw_if1, \
- vnet_buffer (b1)->ip.adj_index[VLIB_RX], next_iface1); \
- \
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && \
(b0->flags & VLIB_BUFFER_IS_TRACED))) \
{ \
TRACE_INPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b0, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = sw_if0; \
t->next_index = next0; \
+ t->error = ret0; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b0), \
sizeof (t->packet_data)); \
} \
@@ -366,9 +454,10 @@ typedef enum
{ \
TRACE_INPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b1, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = sw_if1; \
t->next_index = next1; \
+ t->error = ret1; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b1), \
sizeof (t->packet_data)); \
} \
@@ -435,9 +524,17 @@ hicn4_iface_input_format_trace (u8 *s, va_list *args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
hicn4_iface_input_trace_t *t = va_arg (*args, hicn4_iface_input_trace_t *);
- s = format (s, "IFACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d\n%U",
- (int) t->pkt_type, t->sw_if_index, t->next_index,
- format_ip4_header, t->packet_data, sizeof (t->packet_data));
+ s = format (s, "IFACE_IP4_INPUT: pkt: %d, sw_if_index %d, next index %d",
+ (int) t->pkt_type, t->sw_if_index, t->next_index);
+
+ if (t->error)
+ {
+ s = format (s, " drop reason: %s", get_error_string (t->error));
+ }
+
+ s = format (s, "\n%U", format_ip4_header, t->packet_data,
+ sizeof (t->packet_data));
+
return (s);
}
@@ -544,6 +641,7 @@ hicn_rewrite_iface_data4 (vlib_main_t *vm, vlib_buffer_t *b0,
const hicn_face_t *iface, u32 *next)
{
ip4_header_t *ip0;
+ int ret = HICN_ERROR_NONE;
/* Get the pointer to the old ip and tcp header */
ip0 = vlib_buffer_get_current (b0);
@@ -563,9 +661,11 @@ hicn_rewrite_iface_data4 (vlib_main_t *vm, vlib_buffer_t *b0,
hicn_type_t type = hicn_get_buffer (b0)->type;
u8 flags = hicn_get_buffer (b0)->flags;
u8 reset_pl = flags & HICN_BUFFER_FLAGS_FROM_CS;
- int ret = hicn_ops_vft[type.l1]->rewrite_data (
- type, &hicn->protocol, &(iface->nat_addr), &(temp_addr), iface->pl_id,
- reset_pl);
+
+ ret = hicn_ops_vft[type.l1]->rewrite_data (type, &hicn->protocol,
+ &(iface->nat_addr), &(temp_addr),
+ iface->pl_id, reset_pl);
+
if (ret == HICN_LIB_ERROR_REWRITE_CKSUM_REQUIRED)
{
ensure_offload_flags (b0, 1 /* is_v4 */);
@@ -577,6 +677,7 @@ hicn_rewrite_iface_data6 (vlib_main_t *vm, vlib_buffer_t *b0,
const hicn_face_t *iface, u32 *next)
{
ip6_header_t *ip0;
+ int ret = HICN_ERROR_NONE;
/* Get the pointer to the old ip and tcp header */
/* Copy the previous ip and tcp header to the new portion of memory */
@@ -598,9 +699,10 @@ hicn_rewrite_iface_data6 (vlib_main_t *vm, vlib_buffer_t *b0,
hicn_type_t type = hicn_get_buffer (b0)->type;
u8 flags = hicn_get_buffer (b0)->flags;
u8 reset_pl = flags & HICN_BUFFER_FLAGS_FROM_CS;
- int ret = hicn_ops_vft[type.l1]->rewrite_data (
- type, &hicn->protocol, &(iface->nat_addr), &(temp_addr), iface->pl_id,
- reset_pl);
+
+ ret = hicn_ops_vft[type.l1]->rewrite_data (type, &hicn->protocol,
+ &(iface->nat_addr), &(temp_addr),
+ iface->pl_id, reset_pl);
if (ret == HICN_LIB_ERROR_REWRITE_CKSUM_REQUIRED)
{
@@ -653,7 +755,7 @@ hicn_rewrite_iface_data6 (vlib_main_t *vm, vlib_buffer_t *b0,
{ \
TRACE_OUTPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b0, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b0), \
@@ -731,7 +833,7 @@ hicn_rewrite_iface_data6 (vlib_main_t *vm, vlib_buffer_t *b0,
{ \
TRACE_OUTPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b0, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_RX]; \
t->next_index = next0; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b0), \
@@ -743,7 +845,7 @@ hicn_rewrite_iface_data6 (vlib_main_t *vm, vlib_buffer_t *b0,
{ \
TRACE_OUTPUT_PKT_IP##ipv *t = \
vlib_add_trace (vm, node, b1, sizeof (*t)); \
- t->pkt_type = HICN_PKT_TYPE_INTEREST; \
+ t->pkt_type = HICN_PACKET_TYPE_INTEREST; \
t->sw_if_index = vnet_buffer (b1)->sw_if_index[VLIB_RX]; \
t->next_index = next1; \
clib_memcpy_fast (t->packet_data, vlib_buffer_get_current (b1), \
@@ -824,7 +926,8 @@ VLIB_REGISTER_NODE (hicn4_iface_output_node) = {
.next_nodes = { [HICN4_IFACE_OUTPUT_NEXT_DROP] = "error-drop",
[HICN4_IFACE_OUTPUT_NEXT_LOOKUP] = "ip4-lookup",
[HICN4_IFACE_OUTPUT_NEXT_UDP4_ENCAP] = "udp4-encap",
- [HICN4_IFACE_OUTPUT_NEXT_UDP6_ENCAP] = "udp6-encap" },
+ [HICN4_IFACE_OUTPUT_NEXT_UDP6_ENCAP] = "udp6-encap",
+ [HICN4_IFACE_OUTPUT_NEXT_PG] = "hicnpg-data" },
};
static uword
@@ -893,7 +996,8 @@ VLIB_REGISTER_NODE (hicn6_iface_output_node) = {
.next_nodes = { [HICN6_IFACE_OUTPUT_NEXT_DROP] = "error-drop",
[HICN6_IFACE_OUTPUT_NEXT_LOOKUP] = "ip6-lookup",
[HICN6_IFACE_OUTPUT_NEXT_UDP4_ENCAP] = "udp4-encap",
- [HICN6_IFACE_OUTPUT_NEXT_UDP6_ENCAP] = "udp6-encap" },
+ [HICN6_IFACE_OUTPUT_NEXT_UDP6_ENCAP] = "udp6-encap",
+ [HICN6_IFACE_OUTPUT_NEXT_PG] = "hicnpg-data" },
};
/*
@@ -902,4 +1006,4 @@ VLIB_REGISTER_NODE (hicn6_iface_output_node) = {
* Local Variables:
* eval: (c-set-style "gnu")
* End:
- */
+ */ \ No newline at end of file