summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2016-09-30 09:22:36 +0200
committerDave Barach <openvpp@barachs.net>2016-10-12 19:49:33 +0000
commit1e66d5c54b81b8d6290153f1b3c2b021c4b62fad (patch)
tree5c29b8e298a3b568cee371263dbc4c17e28260ad /vnet
parent5899fdedad93eec01088dca980e9f5fd70aae9c4 (diff)
VPP-213: vnet classifier does not work for l3 ip4 rules
The classifier was written with the assumption that next-indicies of IP4 and IP6 IP_LOOKUP_NEXT nodes are equal. That's not true, and this patch splits the classifier session for IP4 and IP6. Change-Id: Id0368f17bb1d3f145b771d2dc283b56871264e99 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/classify/vnet_classify.c60
1 files changed, 34 insertions, 26 deletions
diff --git a/vnet/vnet/classify/vnet_classify.c b/vnet/vnet/classify/vnet_classify.c
index a9d60494ca3..e179045814c 100644
--- a/vnet/vnet/classify/vnet_classify.c
+++ b/vnet/vnet/classify/vnet_classify.c
@@ -2090,9 +2090,9 @@ classify_session_command_fn (vlib_main_t * vm,
VLIB_CLI_COMMAND (classify_session_command, static) = {
.path = "classify session",
- .short_help =
- "classify session [hit-next|l2-hit-next|acl-hit-next <next_index>|"
- "policer-hit-next <policer_name>]"
+ .short_help =
+ "classify session [hit-next|l2-hit-next|"
+ "acl-hit-next <next_index>|policer-hit-next <policer_name>]"
"\n table-index <nn> match [hex] [l2] [l3 ip4] [opaque-index <index>]",
.function = classify_session_command_fn,
};
@@ -2112,27 +2112,31 @@ unformat_opaque_sw_if_index (unformat_input_t * input, va_list * args)
return 0;
}
-static uword
+static uword
unformat_ip_next_node (unformat_input_t * input, va_list * args)
{
vnet_classify_main_t * cm = &vnet_classify_main;
u32 * next_indexp = va_arg (*args, u32 *);
u32 node_index;
- u32 next_index, rv;
+ u32 next_index = ~0;
- if (unformat (input, "node %U", unformat_vlib_node,
+ if (unformat (input, "ip6-node %U", unformat_vlib_node,
cm->vlib_main, &node_index))
{
- rv = next_index = vlib_node_add_next
- (cm->vlib_main, ip4_classify_node.index, node_index);
- next_index = vlib_node_add_next
- (cm->vlib_main, ip6_classify_node.index, node_index);
- ASSERT(rv == next_index);
-
- *next_indexp = next_index;
- return 1;
+ next_index = vlib_node_add_next (cm->vlib_main,
+ ip6_classify_node.index, node_index);
}
- return 0;
+ else if (unformat (input, "ip4-node %U", unformat_vlib_node,
+ cm->vlib_main, &node_index))
+ {
+ next_index = vlib_node_add_next (cm->vlib_main,
+ ip4_classify_node.index, node_index);
+ }
+ else
+ return 0;
+
+ *next_indexp = next_index;
+ return 1;
}
static uword
@@ -2141,21 +2145,25 @@ unformat_acl_next_node (unformat_input_t * input, va_list * args)
vnet_classify_main_t * cm = &vnet_classify_main;
u32 * next_indexp = va_arg (*args, u32 *);
u32 node_index;
- u32 next_index, rv;
+ u32 next_index;
- if (unformat (input, "node %U", unformat_vlib_node,
+ if (unformat (input, "ip6-node %U", unformat_vlib_node,
cm->vlib_main, &node_index))
{
- rv = next_index = vlib_node_add_next
- (cm->vlib_main, ip4_inacl_node.index, node_index);
- next_index = vlib_node_add_next
- (cm->vlib_main, ip6_inacl_node.index, node_index);
- ASSERT(rv == next_index);
-
- *next_indexp = next_index;
- return 1;
+ next_index = vlib_node_add_next (cm->vlib_main,
+ ip6_inacl_node.index, node_index);
}
- return 0;
+ else if (unformat (input, "ip4-node %U", unformat_vlib_node,
+ cm->vlib_main, &node_index))
+ {
+ next_index = vlib_node_add_next (cm->vlib_main,
+ ip4_inacl_node.index, node_index);
+ }
+ else
+ return 0;
+
+ *next_indexp = next_index;
+ return 1;
}
static uword