aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/snat
diff options
context:
space:
mode:
authorMartin Gálik <magalik@cisco.com>2017-04-27 02:13:26 -0700
committerOle Trøan <otroan@employees.org>2017-04-27 12:03:46 +0000
commitf7e655d69a3325b8050eb09bc6065fac10bcb81b (patch)
tree26a37d5b9edc9b724988c8cad94e503f54598879 /src/plugins/snat
parent3ef16710dc33b5b27730ced10008e2a69f81e147 (diff)
CGN: Send ICMP error packet if user is out of sessions available
Change-Id: I19a6015fde7342588cfa9c7a4f07016aa339cc72 Signed-off-by: Martin Gálik <magalik@cisco.com>
Diffstat (limited to 'src/plugins/snat')
-rw-r--r--src/plugins/snat/in2out.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/plugins/snat/in2out.c b/src/plugins/snat/in2out.c
index 4970fce3..f7d29c69 100644
--- a/src/plugins/snat/in2out.c
+++ b/src/plugins/snat/in2out.c
@@ -1635,8 +1635,13 @@ snat_det_in2out_node_fn (vlib_main_t * vm,
}
if (PREDICT_FALSE(!ses0))
{
- next0 = SNAT_IN2OUT_NEXT_DROP;
- b0->error = node->errors[SNAT_IN2OUT_ERROR_OUT_OF_PORTS];
+ /* too many sessions for user, send ICMP error packet */
+
+ vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0;
+ icmp4_error_set_vnet_buffer (b0, ICMP4_destination_unreachable,
+ ICMP4_destination_unreachable_destination_unreachable_host,
+ 0);
+ next0 = SNAT_IN2OUT_NEXT_ICMP_ERROR;
goto trace0;
}
}
@@ -1780,8 +1785,13 @@ snat_det_in2out_node_fn (vlib_main_t * vm,
}
if (PREDICT_FALSE(!ses1))
{
- next1 = SNAT_IN2OUT_NEXT_DROP;
- b1->error = node->errors[SNAT_IN2OUT_ERROR_OUT_OF_PORTS];
+ /* too many sessions for user, send ICMP error packet */
+
+ vnet_buffer (b1)->sw_if_index[VLIB_TX] = (u32) ~ 0;
+ icmp4_error_set_vnet_buffer (b1, ICMP4_destination_unreachable,
+ ICMP4_destination_unreachable_destination_unreachable_host,
+ 0);
+ next1 = SNAT_IN2OUT_NEXT_ICMP_ERROR;
goto trace1;
}
}
@@ -1961,8 +1971,13 @@ snat_det_in2out_node_fn (vlib_main_t * vm,
}
if (PREDICT_FALSE(!ses0))
{
- next0 = SNAT_IN2OUT_NEXT_DROP;
- b0->error = node->errors[SNAT_IN2OUT_ERROR_OUT_OF_PORTS];
+ /* too many sessions for user, send ICMP error packet */
+
+ vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0;
+ icmp4_error_set_vnet_buffer (b0, ICMP4_destination_unreachable,
+ ICMP4_destination_unreachable_destination_unreachable_host,
+ 0);
+ next0 = SNAT_IN2OUT_NEXT_ICMP_ERROR;
goto trace00;
}
}