summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorAkshayaNadahalli <anadahal@cisco.com>2017-03-28 12:19:54 +0530
committerAkshayaNadahalli <anadahal@cisco.com>2017-03-28 12:19:54 +0530
commitf9bb3b45d1693c8bd2d80025848f70a20d84d32b (patch)
tree1fcba5d46bb330a01d8b1039158dc25abc9f64a9 /src/vnet
parentcb92fc6edc3a97f4b80f0a84ccb05b06945e4e97 (diff)
Fix output feature processing (VPP-670)
Double committing to 17.04 as its a bug-fix. Change-Id: I94539812191ad0eb8abe78e2dad25ab96c780f30 Signed-off-by: AkshayaNadahalli <anadahal@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/adj/adj_nbr.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c
index 9ef3651de66..072abd0300d 100644
--- a/src/vnet/adj/adj_nbr.c
+++ b/src/vnet/adj/adj_nbr.c
@@ -132,6 +132,46 @@ adj_get_nd_node (fib_protocol_t proto)
return (ip4_arp_node.index);
}
+/**
+ * @brief Check and set feature flags if o/p interface has any o/p features.
+ */
+static void
+adj_nbr_evaluate_feature (adj_index_t ai)
+{
+ ip_adjacency_t *adj;
+ vnet_feature_main_t *fm = &feature_main;
+ i16 feature_count;
+ u8 arc_index;
+ u32 sw_if_index;
+
+ adj = adj_get(ai);
+
+ switch (adj->ia_link)
+ {
+ case VNET_LINK_IP4:
+ arc_index = ip4_main.lookup_main.output_feature_arc_index;
+ break;
+ case VNET_LINK_IP6:
+ arc_index = ip6_main.lookup_main.output_feature_arc_index;
+ break;
+ case VNET_LINK_MPLS:
+ arc_index = mpls_main.output_feature_arc_index;
+ break;
+ default:
+ return;
+ }
+
+ sw_if_index = adj->rewrite_header.sw_if_index;
+ if (vec_len(fm->feature_count_by_sw_if_index[arc_index]) > sw_if_index)
+ {
+ feature_count = fm->feature_count_by_sw_if_index[arc_index][sw_if_index];
+ if (feature_count > 0)
+ adj->rewrite_header.flags |= VNET_REWRITE_HAS_FEATURES;
+ }
+
+ return;
+}
+
static ip_adjacency_t*
adj_nbr_alloc (fib_protocol_t nh_proto,
vnet_link_t link_type,
@@ -158,6 +198,7 @@ adj_nbr_alloc (fib_protocol_t nh_proto,
memset(&adj->sub_type.midchain.next_dpo, 0,
sizeof(adj->sub_type.midchain.next_dpo));
+ adj_nbr_evaluate_feature (adj_get_index(adj));
return (adj);
}