vl_api_nat_set_workers_reply_t *rmp;
int rv = 0;
uword *bitmap = 0;
- u64 mask = clib_net_to_host_u64 (mp->worker_mask);
+ u64 mask;
+
+ if (sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
+ mask = clib_net_to_host_u64 (mp->worker_mask);
if (sm->num_workers < 2)
{
snat_main_t *sm = &snat_main;
u32 *worker_index;
+ if (sm->deterministic)
+ return;
+
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
int rv = 0;
u32 *tmp;
+ if (sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
if (sm->static_mapping_only)
{
rv = VNET_API_ERROR_FEATURE_DISABLED;
snat_main_t *sm = &snat_main;
snat_address_t *a;
+ if (sm->deterministic)
+ return;
+
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
u32 sw_if_index = ntohl (mp->sw_if_index);
int rv = 0;
+ if (sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
VALIDATE_SW_IF_INDEX (mp);
rv = snat_interface_add_del_output_feature (sw_if_index, mp->is_inside,
is_del);
BAD_SW_IF_INDEX_LABEL;
-
+send_reply:
REPLY_MACRO (VL_API_NAT44_INTERFACE_ADD_DEL_OUTPUT_FEATURE_REPLY);
}
snat_main_t *sm = &snat_main;
snat_interface_t *i;
+ if (sm->deterministic)
+ return;
+
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
ip4_address_t local_addr, external_addr;
u16 local_port = 0, external_port = 0;
u32 vrf_id, external_sw_if_index;
+ twice_nat_type_t twice_nat = TWICE_NAT_DISABLED;
int rv = 0;
snat_protocol_t proto;
u8 *tag = 0;
+ if (sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
memcpy (&local_addr.as_u8, mp->local_ip_address, 4);
memcpy (&external_addr.as_u8, mp->external_ip_address, 4);
if (mp->addr_only == 0)
vrf_id = clib_net_to_host_u32 (mp->vrf_id);
external_sw_if_index = clib_net_to_host_u32 (mp->external_sw_if_index);
proto = ip_proto_to_snat_proto (mp->protocol);
+ if (mp->twice_nat)
+ twice_nat = TWICE_NAT;
+ else if (mp->self_twice_nat)
+ twice_nat = TWICE_NAT_SELF;
mp->tag[sizeof (mp->tag) - 1] = 0;
tag = format (0, "%s", mp->tag);
vec_terminate_c_string (tag);
rv = snat_add_static_mapping (local_addr, external_addr, local_port,
external_port, vrf_id, mp->addr_only,
external_sw_if_index, proto, mp->is_add,
- mp->twice_nat, mp->out2in_only, tag);
+ twice_nat, mp->out2in_only, tag);
vec_free (tag);
+send_reply:
REPLY_MACRO (VL_API_NAT44_ADD_DEL_STATIC_MAPPING_REPLY);
}
rmp->external_sw_if_index = ~0;
rmp->vrf_id = htonl (m->vrf_id);
rmp->context = context;
- rmp->twice_nat = m->twice_nat;
+ if (m->twice_nat == TWICE_NAT)
+ rmp->twice_nat = 1;
+ else if (m->twice_nat == TWICE_NAT_SELF)
+ rmp->self_twice_nat = 1;
rmp->out2in_only = m->out2in_only;
if (m->addr_only == 0)
{
snat_static_map_resolve_t *rp;
int j;
+ if (sm->deterministic)
+ return;
+
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
snat_protocol_t proto = ~0;
u8 *tag = 0;
+ if (sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
if (mp->addr_only == 0)
{
port = clib_net_to_host_u16 (mp->port);
vec_free (tag);
+send_reply:
REPLY_MACRO (VL_API_NAT44_ADD_DEL_IDENTITY_MAPPING_REPLY);
}
snat_static_map_resolve_t *rp;
int j;
+ if (sm->deterministic)
+ return;
+
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
u32 sw_if_index = ntohl (mp->sw_if_index);
int rv = 0;
+ if (sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
VALIDATE_SW_IF_INDEX (mp);
rv = snat_add_interface_address (sm, sw_if_index, is_del, mp->twice_nat);
BAD_SW_IF_INDEX_LABEL;
-
+send_reply:
REPLY_MACRO (VL_API_NAT44_ADD_DEL_INTERFACE_ADDR_REPLY);
}
snat_main_t *sm = &snat_main;
u32 *i;
+ if (sm->deterministic)
+ return;
+
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
snat_main_per_thread_data_t *tsm;
snat_user_t *u;
+ if (sm->deterministic)
+ return;
+
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
dlist_elt_t *head, *elt;
ip4_header_t ip;
+ if (sm->deterministic)
+ return;
+
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
{
snat_main_t *sm = &snat_main;
vl_api_nat44_add_del_lb_static_mapping_reply_t *rmp;
+ twice_nat_type_t twice_nat = TWICE_NAT_DISABLED;
int rv = 0;
nat44_lb_addr_port_t *locals = 0;
ip4_address_t e_addr;
snat_protocol_t proto;
u8 *tag = 0;
+ if (sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
locals = unformat_nat44_lb_addr_port (mp->locals, mp->local_num);
clib_memcpy (&e_addr, mp->external_addr, 4);
proto = ip_proto_to_snat_proto (mp->protocol);
+ if (mp->twice_nat)
+ twice_nat = TWICE_NAT;
+ else if (mp->self_twice_nat)
+ twice_nat = TWICE_NAT_SELF;
mp->tag[sizeof (mp->tag) - 1] = 0;
tag = format (0, "%s", mp->tag);
vec_terminate_c_string (tag);
nat44_add_del_lb_static_mapping (e_addr,
clib_net_to_host_u16 (mp->external_port),
proto, clib_net_to_host_u32 (mp->vrf_id),
- locals, mp->is_add, mp->twice_nat,
+ locals, mp->is_add, twice_nat,
mp->out2in_only, tag);
vec_free (locals);
vec_free (tag);
+send_reply:
REPLY_MACRO (VL_API_NAT44_ADD_DEL_LB_STATIC_MAPPING_REPLY);
}
rmp->protocol = snat_proto_to_ip_proto (m->proto);
rmp->vrf_id = ntohl (m->vrf_id);
rmp->context = context;
- rmp->twice_nat = m->twice_nat;
+ if (m->twice_nat == TWICE_NAT)
+ rmp->twice_nat = 1;
+ else if (m->twice_nat == TWICE_NAT_SELF)
+ rmp->self_twice_nat = 1;
rmp->out2in_only = m->out2in_only;
if (m->tag)
strncpy ((char *) rmp->tag, (char *) m->tag, vec_len (m->tag));
snat_main_t *sm = &snat_main;
snat_static_mapping_t *m;
+ if (sm->deterministic)
+ return;
+
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
int rv = 0;
snat_protocol_t proto;
+ if (sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
memcpy (&addr.as_u8, mp->address, 4);
port = clib_net_to_host_u16 (mp->port);
vrf_id = clib_net_to_host_u32 (mp->vrf_id);
rv = nat44_del_session (sm, &addr, port, proto, vrf_id, mp->is_in);
+send_reply:
REPLY_MACRO (VL_API_NAT44_DEL_SESSION_REPLY);
}
int rv = 0;
ip4_address_t in_addr, out_addr;
+ if (!sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
if (!mp->is_nat44)
{
rv = VNET_API_ERROR_UNIMPLEMENTED;
snat_det_map_t *dm;
ip4_address_t in_addr, out_addr;
+ if (!sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ REPLY_MACRO (VL_API_NAT_DET_FORWARD_REPLY);
+ return;
+ }
+
if (!mp->is_nat44)
{
out_addr.as_u32 = 0;
ip4_address_t out_addr, in_addr;
snat_det_map_t *dm;
+ if (!sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ REPLY_MACRO (VL_API_NAT_DET_REVERSE_REPLY);
+ return;
+ }
+
in_addr.as_u32 = 0;
clib_memcpy (&out_addr, mp->out_addr, 4);
dm = snat_det_map_by_out (sm, &out_addr);
snat_main_t *sm = &snat_main;
snat_det_map_t *m;
+ if (!sm->deterministic)
+ return;
+
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
vl_api_nat_det_set_timeouts_reply_t *rmp;
int rv = 0;
+ if (!sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
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);
+send_reply:
REPLY_MACRO (VL_API_NAT_DET_SET_TIMEOUTS_REPLY);
}
vl_api_nat_det_get_timeouts_reply_t *rmp;
int rv = 0;
+ if (!sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ REPLY_MACRO (VL_API_NAT_DET_GET_TIMEOUTS_REPLY);
+ return;
+ }
+
/* *INDENT-OFF* */
REPLY_MACRO2 (VL_API_NAT_DET_GET_TIMEOUTS_REPLY,
({
snat_det_session_t *ses;
int rv = 0;
+ if (!sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
clib_memcpy (&out_addr, mp->out_addr, 4);
clib_memcpy (&ext_addr, mp->ext_addr, 4);
snat_det_session_t *ses;
int rv = 0;
+ if (!sm->deterministic)
+ {
+ rv = VNET_API_ERROR_UNSUPPORTED;
+ goto send_reply;
+ }
+
if (!mp->is_nat44)
{
rv = VNET_API_ERROR_UNIMPLEMENTED;
snat_det_session_t *s, empty_ses;
u16 i;
+ if (!sm->deterministic)
+ return;
+
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;