ipsec: show fast path flag in cli
This patch updates the "show ipsec spd" cli to display
policies maintained by fast path bihash table.
Type: feature
@@ -153,8 +153,8 @@ format_ipsec_replay_window (u8 * s, va_list * args)
return s;
}
-u8 *
-format_ipsec_policy (u8 * s, va_list * args)
+static u8 *
+format_ipsec_policy_with_suffix (u8 *s, va_list *args, u8 *suffix)
{
u32 pi = va_arg (*args, u32);
ip46_type_t ip_type = IP46_TYPE_IP4;
@@ -180,6 +180,9 @@ format_ipsec_policy (u8 * s, va_list * args)
{
s = format (s, " sa %u", p->sa_id);
}
+ if (suffix)
+ s = format (s, " %s", suffix);
+
if (p->is_ipv6)
{
ip_type = IP46_TYPE_IP6;
@@ -200,6 +203,18 @@ format_ipsec_policy (u8 * s, va_list * args)
return (s);
}
+u8 *
+format_ipsec_policy (u8 *s, va_list *args)
+{
+ return format_ipsec_policy_with_suffix (s, args, 0);
+}
+
+u8 *
+format_ipsec_policy_fp (u8 *s, va_list *args)
+{
+ return format_ipsec_policy_with_suffix (s, args, (u8 *) "<fast-path>");
+}
+
u8 *
format_ipsec_spd (u8 * s, va_list * args)
{
@@ -223,6 +238,10 @@ format_ipsec_spd (u8 * s, va_list * args)
vec_foreach (i, spd->policies[IPSEC_SPD_POLICY_##v]) \
{ \
s = format (s, "\n %U", format_ipsec_policy, *i); \
+ } \
+ vec_foreach (i, spd->fp_spd.fp_policies[IPSEC_SPD_POLICY_##v]) \
+ { \
+ s = format (s, "\n %U", format_ipsec_policy_fp, *i); \
}
foreach_ipsec_spd_policy_type;
#undef _
