aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-09-25 09:16:53 -0400
committerDave Barach <dave@barachs.net>2016-09-25 09:17:29 -0400
commitb3bfb3efd19ae67a8f2930a1fb1bb28ed4266d4d (patch)
treed20ea6ac96f3c19f902f4ffc99df54faa349939a
parentf2e6a2d010435fcaf39c99c6e50675b725b76cf3 (diff)
Packet-generator related fib 2.0 fixes
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>
-rw-r--r--vnet/vnet/ip/icmp4.c7
-rw-r--r--vnet/vnet/ip/ip4_forward.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/vnet/vnet/ip/icmp4.c b/vnet/vnet/ip/icmp4.c
index abad5bd9efc..a02b52950a3 100644
--- a/vnet/vnet/ip/icmp4.c
+++ b/vnet/vnet/ip/icmp4.c
@@ -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);
diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c
index f7cc7667069..8914abecc72 100644
--- a/vnet/vnet/ip/ip4_forward.c
+++ b/vnet/vnet/ip/ip4_forward.c
@@ -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