summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKingwel Xie <kingwel.xie@ericsson.com>2019-03-20 03:45:47 -0400
committerDamjan Marion <dmarion@me.com>2019-03-26 11:08:17 +0000
commitcb36a1dbaf29babb536bd10d0ff3ff35ca57bfa3 (patch)
treecea70ee6590b56f354c068bf2d8002cfba84fc8f
parentc59b9a26ed9a6bc083db2868b6993add6fd2ba5b (diff)
ip6-rewrite: bug fix buffer->error in dual loop
error should be recorded in buffer so that process-error-punt can handle them correctly Per Damjan's comments, move counter to under else clause of last error0==NONE check. Both v4 and v6 are changed. Change-Id: I707c7877ccb12589337155173fc4a5200b42ee93 Signed-off-by: Kingwel Xie <kingwel.xie@ericsson.com>
-rw-r--r--src/vnet/ip/ip4_forward.c15
-rw-r--r--src/vnet/ip/ip6_forward.c14
2 files changed, 24 insertions, 5 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index ec4eda4e96a..981dfe3c91f 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -2297,8 +2297,6 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm,
IP4_ERROR_SAME_INTERFACE : error1);
}
- b[0]->error = error_node->errors[error0];
- b[1]->error = error_node->errors[error1];
/* Don't adjust the buffer for ttl issue; icmp-error node wants
* to see the IP headerr */
if (PREDICT_TRUE (error0 == IP4_ERROR_NONE))
@@ -2315,6 +2313,10 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm,
tx_sw_if_index0, &next_index, b[0]);
next[0] = next_index;
}
+ else
+ {
+ b[0]->error = error_node->errors[error0];
+ }
if (PREDICT_TRUE (error1 == IP4_ERROR_NONE))
{
u32 next_index = adj1[0].rewrite_header.next_index;
@@ -2330,6 +2332,10 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm,
tx_sw_if_index1, &next_index, b[1]);
next[1] = next_index;
}
+ else
+ {
+ b[1]->error = error_node->errors[error1];
+ }
/* Guess we are only writing on simple Ethernet header. */
vnet_rewrite_two_headers (adj0[0], adj1[0],
@@ -2420,7 +2426,6 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm,
vnet_buffer (b[0])->sw_if_index[VLIB_RX]) ?
IP4_ERROR_SAME_INTERFACE : error0);
}
- b[0]->error = error_node->errors[error0];
/* Don't adjust the buffer for ttl issue; icmp-error node wants
* to see the IP headerr */
@@ -2438,6 +2443,10 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm,
tx_sw_if_index0, &next_index, b[0]);
next[0] = next_index;
}
+ else
+ {
+ b[0]->error = error_node->errors[error0];
+ }
/* Guess we are only writing on simple Ethernet header. */
vnet_rewrite_one_header (adj0[0], ip0, sizeof (ethernet_header_t));
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index f599392742c..858dd73a712 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -1808,6 +1808,10 @@ ip6_rewrite_inline_with_gso (vlib_main_t * vm,
vnet_feature_arc_start (lm->output_feature_arc_index,
tx_sw_if_index0, &next0, p0);
}
+ else
+ {
+ p0->error = error_node->errors[error0];
+ }
if (PREDICT_TRUE (error1 == IP6_ERROR_NONE))
{
p1->current_data -= rw_len1;
@@ -1822,6 +1826,10 @@ ip6_rewrite_inline_with_gso (vlib_main_t * vm,
vnet_feature_arc_start (lm->output_feature_arc_index,
tx_sw_if_index1, &next1, p1);
}
+ else
+ {
+ p1->error = error_node->errors[error1];
+ }
/* Guess we are only writing on simple Ethernet header. */
vnet_rewrite_two_headers (adj0[0], adj1[0],
@@ -1954,6 +1962,10 @@ ip6_rewrite_inline_with_gso (vlib_main_t * vm,
vnet_feature_arc_start (lm->output_feature_arc_index,
tx_sw_if_index0, &next0, p0);
}
+ else
+ {
+ p0->error = error_node->errors[error0];
+ }
if (is_midchain)
{
@@ -1969,8 +1981,6 @@ ip6_rewrite_inline_with_gso (vlib_main_t * vm,
(u8 *) ip0);
}
- p0->error = error_node->errors[error0];
-
from += 1;
n_left_from -= 1;
to_next += 1;