nat: avoid crash if plugin not enabled
Avoid crash if nat pool not allocated when issuing "show nat44 summary". Type: fix Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: I55661cf699bab04f4673e9d471fe12486e972067
This commit is contained in:
@ -448,26 +448,29 @@ nat44_show_lru_summary (vlib_main_t * vm, snat_main_per_thread_data_t * tsm,
|
|||||||
snat_session_t *s;
|
snat_session_t *s;
|
||||||
u32 oldest_index;
|
u32 oldest_index;
|
||||||
|
|
||||||
#define _(n, d) \
|
if (tsm->lru_pool)
|
||||||
oldest_index = \
|
{
|
||||||
clib_dlist_remove_head (tsm->lru_pool, tsm->n##_lru_head_index); \
|
#define _(n, d) \
|
||||||
if (~0 != oldest_index) \
|
oldest_index = \
|
||||||
{ \
|
clib_dlist_remove_head (tsm->lru_pool, tsm->n##_lru_head_index); \
|
||||||
oldest_elt = pool_elt_at_index (tsm->lru_pool, oldest_index); \
|
if (~0 != oldest_index) \
|
||||||
s = pool_elt_at_index (tsm->sessions, oldest_elt->value); \
|
{ \
|
||||||
sess_timeout_time = \
|
oldest_elt = pool_elt_at_index (tsm->lru_pool, oldest_index); \
|
||||||
s->last_heard + (f64)nat44_session_get_timeout (sm, s); \
|
s = pool_elt_at_index (tsm->sessions, oldest_elt->value); \
|
||||||
vlib_cli_output (vm, d " LRU min session timeout %llu (now %llu)", \
|
sess_timeout_time = \
|
||||||
sess_timeout_time, now); \
|
s->last_heard + (f64) nat44_session_get_timeout (sm, s); \
|
||||||
clib_dlist_addhead (tsm->lru_pool, tsm->n##_lru_head_index, \
|
vlib_cli_output (vm, d " LRU min session timeout %llu (now %llu)", \
|
||||||
oldest_index); \
|
sess_timeout_time, now); \
|
||||||
|
clib_dlist_addhead (tsm->lru_pool, tsm->n##_lru_head_index, \
|
||||||
|
oldest_index); \
|
||||||
}
|
}
|
||||||
_(tcp_estab, "established tcp");
|
_ (tcp_estab, "established tcp");
|
||||||
_(tcp_trans, "transitory tcp");
|
_ (tcp_trans, "transitory tcp");
|
||||||
_(udp, "udp");
|
_ (udp, "udp");
|
||||||
_(unk_proto, "unknown protocol");
|
_ (unk_proto, "unknown protocol");
|
||||||
_(icmp, "icmp");
|
_ (icmp, "icmp");
|
||||||
#undef _
|
#undef _
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static clib_error_t *
|
static clib_error_t *
|
||||||
|
Reference in New Issue
Block a user