VPP-48 Fixes for ip4/6 ttl checks and icmp responses
[vpp.git] / vnet / vnet / ip / ip6_input.c
index f96a1cf..05929c5 100644 (file)
@@ -149,18 +149,18 @@ ip6_input (vlib_main_t * vm,
          cm0 = lm->rx_config_mains + cast0;
          cm1 = lm->rx_config_mains + cast1;
 
-         vnet_buffer (p0)->ip.current_config_index = vec_elt (cm0->config_index_by_sw_if_index, sw_if_index0);
-         vnet_buffer (p1)->ip.current_config_index = vec_elt (cm1->config_index_by_sw_if_index, sw_if_index1);
+         p0->current_config_index = vec_elt (cm0->config_index_by_sw_if_index, sw_if_index0);
+         p1->current_config_index = vec_elt (cm1->config_index_by_sw_if_index, sw_if_index1);
 
          vnet_buffer (p0)->ip.adj_index[VLIB_RX] = ~0;
          vnet_buffer (p1)->ip.adj_index[VLIB_RX] = ~0;
 
          vnet_get_config_data (&cm0->config_main,
-                               &vnet_buffer (p0)->ip.current_config_index,
+                               &p0->current_config_index,
                                &next0,
                                /* # bytes of config data */ 0);
          vnet_get_config_data (&cm1->config_main,
-                               &vnet_buffer (p1)->ip.current_config_index,
+                               &p1->current_config_index,
                                &next1,
                                /* # bytes of config data */ 0);
 
@@ -177,8 +177,8 @@ ip6_input (vlib_main_t * vm,
            * like dhcpv6 packets from client has hop-limit 1, which should not
            * be dropped.
            */
-         error0 = ip0->hop_limit <= 1 ? IP6_ERROR_TIME_EXPIRED : error0;
-         error1 = ip1->hop_limit <= 1 ? IP6_ERROR_TIME_EXPIRED : error1;
+         error0 = ip0->hop_limit < 1 ? IP6_ERROR_TIME_EXPIRED : error0;
+         error1 = ip1->hop_limit < 1 ? IP6_ERROR_TIME_EXPIRED : error1;
 
          /* L2 length must be at least minimal IP header. */
          error0 = p0->current_length < sizeof (ip0[0]) ? IP6_ERROR_TOO_SHORT : error0;
@@ -234,11 +234,11 @@ ip6_input (vlib_main_t * vm,
          sw_if_index0 = vnet_buffer (p0)->sw_if_index[VLIB_RX];
          cast0 = ip6_address_is_multicast (&ip0->dst_address) ? VNET_MULTICAST : VNET_UNICAST;
          cm0 = lm->rx_config_mains + cast0;
-         vnet_buffer (p0)->ip.current_config_index = vec_elt (cm0->config_index_by_sw_if_index, sw_if_index0);
+         p0->current_config_index = vec_elt (cm0->config_index_by_sw_if_index, sw_if_index0);
          vnet_buffer (p0)->ip.adj_index[VLIB_RX] = ~0;
 
          vnet_get_config_data (&cm0->config_main,
-                               &vnet_buffer (p0)->ip.current_config_index,
+                               &p0->current_config_index,
                                &next0,
                                /* # bytes of config data */ 0);
 
@@ -252,7 +252,7 @@ ip6_input (vlib_main_t * vm,
            * like dhcpv6 packets from client has hop-limit 1, which should not
            * be dropped.
            */
-         error0 = ip0->hop_limit <= 1 ? IP6_ERROR_TIME_EXPIRED : error0;
+         error0 = ip0->hop_limit < 1 ? IP6_ERROR_TIME_EXPIRED : error0;
 
          /* L2 length must be at least minimal IP header. */
          error0 = p0->current_length < sizeof (ip0[0]) ? IP6_ERROR_TOO_SHORT : error0;
@@ -305,6 +305,8 @@ VLIB_REGISTER_NODE (ip6_input_node) = {
   .format_trace = format_ip6_input_trace,
 };
 
+VLIB_NODE_FUNCTION_MULTIARCH (ip6_input_node, ip6_input)
+
 static clib_error_t * ip6_init (vlib_main_t * vm)
 {
   ethernet_register_input_type (vm, ETHERNET_TYPE_IP6,