35 #define _(v,f,str) case IPSEC_POLICY_ACTION_##f: t = str; break; 53 #define _(f,str) case IPSEC_SPD_POLICY_##f: t = str; break; 66 u32 *r = va_arg (*args,
u32 *);
69 #define _(v,f,s) else if (unformat (input, s)) *r = IPSEC_POLICY_ACTION_##f; 85 #define _(v,f,str) case IPSEC_CRYPTO_ALG_##f: t = (u8 *) str; break; 98 u32 *r = va_arg (*args,
u32 *);
101 #define _(v,f,s) else if (unformat (input, s)) *r = IPSEC_CRYPTO_ALG_##f; 117 #define _(v,f,str) case IPSEC_INTEG_ALG_##f: t = (u8 *) str; break; 121 s =
format (s,
"unknown");
130 u32 *r = va_arg (*args,
u32 *);
133 #define _(v,f,s) else if (unformat (input, s)) *r = IPSEC_INTEG_ALG_##f; 144 u64 w = va_arg (*args,
u64);
147 for (i = 0; i < 64; i++)
149 s =
format (s,
"%u", w & (1ULL << i) ? 1 : 0);
158 u32 pi = va_arg (*args,
u32);
166 s =
format (s,
" [%d] priority %d action %U type %U protocol ",
178 if (p->
policy == IPSEC_POLICY_ACTION_PROTECT)
187 s =
format (s,
"\n local addr range %U - %U port range %u - %u",
191 s =
format (s,
"\n remote addr range %U - %U port range %u - %u",
205 u32 si = va_arg (*args,
u32);
212 s =
format (s,
"No such SPD index: %d", si);
221 s = format (s, "\n %s:", n); \ 222 vec_foreach(i, spd->policies[IPSEC_SPD_POLICY_##v]) \ 224 s = format (s, "\n %U", format_ipsec_policy, *i); \ 262 #define _(v, f, str) if (flags & IPSEC_SA_FLAG_##f) s = format(s, "%s ", str); 271 u32 sai = va_arg (*args,
u32);
280 s =
format (s,
"No such SA index: %d", sai);
286 s =
format (s,
"[%d] sa %u (0x%x) spi %u (0x%08x) protocol:%s flags:[%U]",
294 s =
format (s,
"\n salt 0x%x", clib_net_to_host_u32 (sa->
salt));
296 s =
format (s,
"\n last-seq %u last-seq-hi %u window %U",
299 s =
format (s,
"\n crypto alg %U",
304 s =
format (s,
" key [redacted]");
305 s =
format (s,
"\n integrity alg %U",
307 if (sa->
integ_alg && (flags & IPSEC_FORMAT_INSECURE))
310 s =
format (s,
" key [redacted]");
315 if (ipsec_sa_is_set_IS_TUNNEL (sa))
319 s =
format (s,
"\n table-ID %d tunnel src %U dst %U",
323 if (!ipsec_sa_is_set_IS_INBOUND (sa))
326 format (s,
"\n resovle via fib-entry: %d",
328 s =
format (s,
"\n stacked on:");
341 u32 ti = va_arg (*args,
u32);
346 s =
format (s,
"No such tunnel index: %d", ti);
359 s =
format (s,
" out-bound sa: ");
363 s =
format (s,
" in-bound sa: ");
374 u32 itpi = va_arg (*args,
u32);
380 s =
format (s,
"No such tunnel index: %d", itpi);
388 s =
format (s,
"\n output-sa:");
393 s =
format (s,
"\n input-sa:");
408 ipsec4_tunnel_key_t *
key = va_arg (*args, ipsec4_tunnel_key_t *);
410 s =
format (s,
"remote:%U spi:%u (0x%08x)",
412 clib_net_to_host_u32 (key->spi),
413 clib_net_to_host_u32 (key->spi));
421 ipsec6_tunnel_key_t *
key = va_arg (*args, ipsec6_tunnel_key_t *);
423 s =
format (s,
"remote:%U spi:%u (0x%08x)",
425 clib_net_to_host_u32 (key->spi),
426 clib_net_to_host_u32 (key->spi));
format_function_t format_vnet_hw_if_index_name
ipsec_tunnel_if_t * tunnel_interfaces
ip46_address_t tunnel_src_addr
vnet_main_t * vnet_get_main(void)
ip46_address_range_t laddr
#define foreach_ipsec_crypto_alg
enum ipsec_format_flags_t_ ipsec_format_flags_t
ipsec_integ_alg_t integ_alg
Combined counter to hold both packets and byte differences.
#define foreach_ipsec_integ_alg
A Secruity Policy Database.
void ipsec_mk_key(ipsec_key_t *key, const u8 *data, u8 len)
format_function_t format_vnet_sw_if_index_name
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_combined_counter_main_t ipsec_spd_policy_counters
Policy packet & bytes counters.
counter_t packets
packet counter
fib_node_index_t fib_entry_index
ipsec_spd_policy_type_t type
ip46_address_t tunnel_dst_addr
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
#define vec_free(V)
Free vector's memory (no header).
ipsec_policy_action_t policy
enum ipsec_sad_flags_t_ ipsec_sa_flags_t
#define FOR_EACH_IPSEC_PROTECT_INPUT_SAI(_itp, _sai, body)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
vlib_combined_counter_main_t ipsec_sa_counters
SA packet & bytes counters.
u8 data[IPSEC_KEY_MAX_LEN]
ipsec_policy_t * policies
ipsec_tun_protect_t * ipsec_protect_pool
Pool of tunnel protection objects.
u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
ipsec_protocol_t protocol
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
counter_t bytes
byte counter
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
ip46_address_range_t raddr
u32 fn_locks
Number of dependents on this node.
u32 id
the User's ID for this policy
ipsec_crypto_alg_t crypto_alg
#define foreach_ipsec_spd_policy_type