summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/pnat
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/nat/pnat')
-rw-r--r--src/plugins/nat/pnat/pnat.api2
-rw-r--r--src/plugins/nat/pnat/pnat.c10
-rw-r--r--src/plugins/nat/pnat/pnat_api.c4
-rw-r--r--src/plugins/nat/pnat/tests/pnat_test.c2
4 files changed, 13 insertions, 5 deletions
diff --git a/src/plugins/nat/pnat/pnat.api b/src/plugins/nat/pnat/pnat.api
index fe7bf98b00b..b6632159d7c 100644
--- a/src/plugins/nat/pnat/pnat.api
+++ b/src/plugins/nat/pnat/pnat.api
@@ -30,7 +30,7 @@ enum pnat_mask
enum pnat_attachment_point
{
- PNAT_IP4_INPUT,
+ PNAT_IP4_INPUT = 0,
PNAT_IP4_OUTPUT,
PNAT_ATTACHMENT_POINT_MAX,
};
diff --git a/src/plugins/nat/pnat/pnat.c b/src/plugins/nat/pnat/pnat.c
index 7f02ec4b2f8..547b063f286 100644
--- a/src/plugins/nat/pnat/pnat.c
+++ b/src/plugins/nat/pnat/pnat.c
@@ -110,9 +110,15 @@ static clib_error_t *pnat_enable_interface(u32 sw_if_index,
if (input) {
/* TODO: Make shallow virtual reassembly configurable */
- ip4_sv_reass_enable_disable_with_refcnt(sw_if_index, 1);
+ if (ip4_sv_reass_enable_disable_with_refcnt(sw_if_index, 1) != 0)
+ return clib_error_return(0, "PNAT SVR enable failed on %u",
+ sw_if_index);
+
} else {
- ip4_sv_reass_output_enable_disable_with_refcnt(sw_if_index, 1);
+ if (ip4_sv_reass_output_enable_disable_with_refcnt(sw_if_index,
+ 1) != 0)
+ return clib_error_return(0, "PNAT SVR enable failed on %u",
+ sw_if_index);
}
interface->lookup_mask[attachment] = mask;
diff --git a/src/plugins/nat/pnat/pnat_api.c b/src/plugins/nat/pnat/pnat_api.c
index cb7afaaedb1..eaefbaf4738 100644
--- a/src/plugins/nat/pnat/pnat_api.c
+++ b/src/plugins/nat/pnat/pnat_api.c
@@ -143,9 +143,9 @@ static void send_interfaces_details(u32 index, vl_api_registration_t *rp,
REPLY_MACRO_DETAILS4(
VL_API_PNAT_INTERFACES_DETAILS, rp, context, ({
rmp->sw_if_index = i->sw_if_index;
- clib_memcpy(rmp->enabled, i->enabled, PNAT_ATTACHMENT_POINT_MAX);
+ clib_memcpy(rmp->enabled, i->enabled, sizeof(rmp->enabled));
clib_memcpy(rmp->lookup_mask, i->lookup_mask,
- sizeof(vl_api_pnat_mask_t) * PNAT_ATTACHMENT_POINT_MAX);
+ sizeof(rmp->lookup_mask));
/* Endian hack until apigen registers _details
* endian functions */
diff --git a/src/plugins/nat/pnat/tests/pnat_test.c b/src/plugins/nat/pnat/tests/pnat_test.c
index fd91ab2f88a..e7d946941b9 100644
--- a/src/plugins/nat/pnat/tests/pnat_test.c
+++ b/src/plugins/nat/pnat/tests/pnat_test.c
@@ -347,6 +347,7 @@ extern vlib_node_registration_t pnat_input_node;
static void test_table(test_t *t, int no_tests) {
// walk through table of tests
int i;
+ vlib_main_init();
vlib_main_t *vm = vlib_get_first_main();
/* Generate packet data */
@@ -559,6 +560,7 @@ int main(int argc, char **argv) {
clib_mem_init(0, 3ULL << 30);
+ vlib_main_init();
vlib_main_t *vm = vlib_get_first_main();
buffers_vector = buffer_init(buffers_vector, 256);