summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44_api.c
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2020-11-09 12:24:03 +0100
committerOle Tr�an <otroan@employees.org>2020-11-13 15:45:23 +0000
commit25fd8ad03e6ef321604437fe8fc56ab2b3858cd7 (patch)
treef362bfad633f80ebad6c811dbf7c98ef5a701ddb /src/plugins/nat/nat44_api.c
parente655240550f0670279b0ca40942887715b8f514e (diff)
nat: cleanup & reorganization
Fixed compatibility issue between nat ei and nat ed modes. Moved nat syslogging to nat librarry. Deprecating apis that will be integrated in upcoming candidate configuration patch. Type: refactor Change-Id: I334b1b05b81b74667c5c76a05f768442e0dcf7e8 Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat44_api.c')
-rw-r--r--src/plugins/nat/nat44_api.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/plugins/nat/nat44_api.c b/src/plugins/nat/nat44_api.c
index 2028b3510df..6e282856943 100644
--- a/src/plugins/nat/nat44_api.c
+++ b/src/plugins/nat/nat44_api.c
@@ -129,6 +129,15 @@ vl_api_nat44_show_running_config_t_handler (vl_api_nat44_show_running_config_t
rmp->user_buckets = htonl (sm->user_buckets);
rmp->translation_buckets = htonl (sm->translation_buckets);
+ rmp->timeouts.udp = htonl (sm->timeouts.udp);
+ rmp->timeouts.tcp_established = htonl (sm->timeouts.tcp.established);
+ rmp->timeouts.tcp_transitory = htonl (sm->timeouts.tcp.transitory);
+ rmp->timeouts.icmp = htonl (sm->timeouts.icmp);
+
+ rmp->forwarding_enabled = sm->forwarding_enabled == 1;
+ // consider how to split functionality between subplugins
+ rmp->ipfix_logging_enabled = nat_ipfix_logging_enabled ();
+
if (rc->endpoint_dependent)
rmp->flags |= NAT44_IS_ENDPOINT_DEPENDENT;
else
@@ -300,10 +309,10 @@ vl_api_nat_set_timeouts_t_handler (vl_api_nat_set_timeouts_t * mp)
vl_api_nat_set_timeouts_reply_t *rmp;
int rv = 0;
- sm->udp_timeout = ntohl (mp->udp);
- sm->tcp_established_timeout = ntohl (mp->tcp_established);
- sm->tcp_transitory_timeout = ntohl (mp->tcp_transitory);
- sm->icmp_timeout = ntohl (mp->icmp);
+ sm->timeouts.udp = ntohl (mp->udp);
+ sm->timeouts.tcp.established = ntohl (mp->tcp_established);
+ sm->timeouts.tcp.transitory = ntohl (mp->tcp_transitory);
+ sm->timeouts.icmp = ntohl (mp->icmp);
REPLY_MACRO (VL_API_NAT_SET_TIMEOUTS_REPLY);
}
@@ -318,10 +327,10 @@ vl_api_nat_get_timeouts_t_handler (vl_api_nat_get_timeouts_t * mp)
/* *INDENT-OFF* */
REPLY_MACRO2 (VL_API_NAT_GET_TIMEOUTS_REPLY,
({
- rmp->udp = htonl (sm->udp_timeout);
- rmp->tcp_established = htonl (sm->tcp_established_timeout);
- rmp->tcp_transitory = htonl (sm->tcp_transitory_timeout);
- rmp->icmp = htonl (sm->icmp_timeout);
+ rmp->udp = htonl (sm->timeouts.udp);
+ rmp->tcp_established = htonl (sm->timeouts.tcp.established);
+ rmp->tcp_transitory = htonl (sm->timeouts.tcp.transitory);
+ rmp->icmp = htonl (sm->timeouts.icmp);
}))
/* *INDENT-ON* */
}
@@ -335,6 +344,12 @@ static void
int rv = 0;
u16 port_start, port_end;
+ if (sm->endpoint_dependent)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
switch (mp->alg)
{
case NAT_ADDR_AND_PORT_ALLOC_ALG_DEFAULT: