Packet-generator related fib 2.0 fixes 22/3122/1
authorDave Barach <dave@barachs.net>
Sun, 25 Sep 2016 13:16:53 +0000 (09:16 -0400)
committerDave Barach <dave@barachs.net>
Sun, 25 Sep 2016 13:17:29 +0000 (09:17 -0400)
Fix dpo0->dpo1 typo in ip4_local source RPF check.

Pass source RPF check on drop adjacencies. Add a bit of defensive driving
in ip4_icmp_error(...).

Change-Id: I0e444886953f5500766f9b9662fad79fef44a260
Signed-off-by: Dave Barach <dave@barachs.net>
vnet/vnet/ip/icmp4.c
vnet/vnet/ip/ip4_forward.c

index abad5bd..a02b529 100644 (file)
@@ -510,8 +510,11 @@ ip4_icmp_error (vlib_main_t * vm,
       out_ip0->ttl = 0xff;
       out_ip0->protocol = IP_PROTOCOL_ICMP;
       out_ip0->dst_address = ip0->src_address;
-      if_add_index0 = 
-       lm->if_address_pool_index_by_sw_if_index[sw_if_index0];
+      if_add_index0 = ~0;
+      if (PREDICT_TRUE (vec_len (lm->if_address_pool_index_by_sw_if_index)
+                        > sw_if_index0))
+          if_add_index0 = 
+              lm->if_address_pool_index_by_sw_if_index[sw_if_index0];
       if (PREDICT_TRUE(if_add_index0 != ~0)) {
        ip_interface_address_t *if_add = 
          pool_elt_at_index(lm->if_address_pool, if_add_index0);
index f7cc766..8914abe 100644 (file)
@@ -1506,6 +1506,7 @@ ip4_local (vlib_main_t * vm,
                    && dpo0->dpoi_type != DPO_ADJACENCY
                    && dpo0->dpoi_type != DPO_ADJACENCY_INCOMPLETE
                    && dpo0->dpoi_type != DPO_RECEIVE
+                   && dpo0->dpoi_type != DPO_DROP
                    && dpo0->dpoi_type != DPO_ADJACENCY_GLEAN
                    && ip0->dst_address.as_u32 != 0xFFFFFFFF
                    ? IP4_ERROR_SRC_LOOKUP_MISS
@@ -1516,8 +1517,9 @@ ip4_local (vlib_main_t * vm,
          error1 = (error1 == IP4_ERROR_UNKNOWN_PROTOCOL
                    && dpo1->dpoi_type != DPO_ADJACENCY
                    && dpo1->dpoi_type != DPO_ADJACENCY_INCOMPLETE
-                   && dpo0->dpoi_type != DPO_RECEIVE
-                   && dpo0->dpoi_type != DPO_ADJACENCY_GLEAN
+                   && dpo1->dpoi_type != DPO_RECEIVE
+                   && dpo1->dpoi_type != DPO_DROP
+                   && dpo1->dpoi_type != DPO_ADJACENCY_GLEAN
                    && ip1->dst_address.as_u32 != 0xFFFFFFFF
                    ? IP4_ERROR_SRC_LOOKUP_MISS
                    : error1);
@@ -1673,6 +1675,7 @@ ip4_local (vlib_main_t * vm,
                    && dpo0->dpoi_type != DPO_ADJACENCY
                    && dpo0->dpoi_type != DPO_ADJACENCY_INCOMPLETE
                    && dpo0->dpoi_type != DPO_RECEIVE
+                   && dpo0->dpoi_type != DPO_DROP
                    && dpo0->dpoi_type != DPO_ADJACENCY_GLEAN
                    && ip0->dst_address.as_u32 != 0xFFFFFFFF
                    ? IP4_ERROR_SRC_LOOKUP_MISS