return;
ha->in_resync = 0;
- nat_log_info ("resync completed with result %s",
- ha->resync_ack_missed ? "FAILED" : "SUCESS");
+ if (ha->resync_ack_missed)
+ {
+ nat_elog_info ("resync completed with result FAILED");
+ }
+ else
+ {
+ nat_elog_info ("resync completed with result SUCCESS");
+ }
if (ha->event_callback)
ha->event_callback (ha->client_index, ha->pid, ha->resync_ack_missed);
}
}
vec_free (td->resend_queue[i].data);
vec_del1 (td->resend_queue, i);
- nat_log_debug ("ACK for seq %d received", clib_net_to_host_u32 (seq));
+ nat_elog_debug_X1 ("ACK for seq %d received", "i4",
+ clib_net_to_host_u32 (seq));
return;
}
/* maximum retry reached delete cached data */
if (td->resend_queue[i].retry_count >= NAT_HA_RETRIES)
{
- nat_log_notice ("seq %d missed",
- clib_net_to_host_u32 (td->resend_queue[i].seq));
+ nat_elog_notice_X1 ("seq %d missed", "i4",
+ clib_net_to_host_u32 (td->resend_queue[i].seq));
if (td->resend_queue[i].is_resync)
{
clib_atomic_fetch_add (&ha->resync_ack_missed, 1);
}
/* retry to send non-ACKed data */
- nat_log_debug ("state sync seq %d resend",
- clib_net_to_host_u32 (td->resend_queue[i].seq));
+ nat_elog_debug_X1 ("state sync seq %d resend", "i4",
+ clib_net_to_host_u32 (td->resend_queue[i].seq));
td->resend_queue[i].retry_count++;
vlib_increment_simple_counter (&ha->counters[NAT_HA_COUNTER_RETRY_COUNT],
thread_index, 0, 1);
if (vlib_buffer_alloc (vm, &bi, 1) != 1)
{
- nat_log_warn ("HA NAT state sync can't allocate buffer");
+ nat_elog_warn ("HA NAT state sync can't allocate buffer");
return;
}
b = vlib_get_buffer (vm, bi);
{
udp_register_dst_port (ha->vlib_main, port, nat_ha_node.index, 1);
}
- nat_log_info ("HA listening on port %d for state sync", port);
+ nat_elog_info_X1 ("HA listening on port %d for state sync", "i4", port);
}
return 0;
nat_ha_recv_refresh (event, now, thread_index);
break;
default:
- nat_log_notice ("Unsupported HA event type %d", event->event_type);
+ nat_elog_notice_X1 ("Unsupported HA event type %d", "i4",
+ event->event_type);
break;
}
}
if (vlib_buffer_alloc (vm, &bi, 1) != 1)
{
- nat_log_warn ("HA NAT state sync can't allocate buffer");
+ nat_elog_warn ("HA NAT state sync can't allocate buffer");
return;
}
vlib_process_wait_for_event (vm);
event_type = vlib_process_get_events (vm, &event_data);
if (event_type)
- nat_log_info ("nat-ha-process: bogus kickoff event received");
+ nat_elog_info ("nat-ha-process: bogus kickoff event received");
vec_reset_length (event_data);
while (1)
*resync_ack_missed = ha->resync_ack_missed;
}
-int
-nat44_ha_resync (u32 client_index, u32 pid,
- nat_ha_resync_event_cb_t event_callback)
-{
- nat_ha_main_t *ha = &nat_ha_main;
- snat_main_t *sm = &snat_main;
- snat_session_t *ses;
- snat_main_per_thread_data_t *tsm;
-
- if (ha->in_resync)
- return VNET_API_ERROR_IN_PROGRESS;
-
- ha->in_resync = 1;
- ha->resync_ack_count = 0;
- ha->resync_ack_missed = 0;
- ha->event_callback = event_callback;
- ha->client_index = client_index;
- ha->pid = pid;
-
- /* *INDENT-OFF* */
- vec_foreach (tsm, sm->per_thread_data)
- {
- pool_foreach (ses, tsm->sessions, ({
- nat_ha_sadd (&ses->in2out.addr, ses->in2out.port,
- &ses->out2in.addr, ses->out2in.port,
- &ses->ext_host_addr, ses->ext_host_port,
- &ses->ext_host_nat_addr, ses->ext_host_nat_port,
- ses->in2out.protocol, ses->in2out.fib_index,
- ses->flags, 0, 1);
- }));
- }
- /* *INDENT-ON* */
-
- nat_ha_flush (1);
-
- return 0;
-}
-
typedef struct
{
ip4_address_t addr;