return (0);
}
+void
+fib_prefix_normalize (const fib_prefix_t *p,
+ fib_prefix_t *out)
+{
+ fib_prefix_copy (out, p);
+
+ switch (p->fp_proto)
+ {
+ case FIB_PROTOCOL_IP4:
+ ip4_address_normalize(&out->fp_addr.ip4, out->fp_len);
+ break;
+ case FIB_PROTOCOL_IP6:
+ ip6_address_normalize(&out->fp_addr.ip6, out->fp_len);
+ break;
+ case FIB_PROTOCOL_MPLS:
+ break;
+ }
+}
+
u8 *
format_fib_prefix (u8 * s, va_list * args)
{
rpath->frp_weight = 1;
rpath->frp_flags |= FIB_ROUTE_PATH_LOCAL;
}
- else if (unformat (input, "%U",
- unformat_mfib_itf_flags, &rpath->frp_mitf_flags))
- ;
else if (unformat (input, "out-labels"))
{
while (unformat (input, "%U",
{
rpath->frp_proto = *payload_proto;
}
+ else if (unformat (input, "%U",
+ unformat_mfib_itf_flags, &rpath->frp_mitf_flags))
+ ;
else if (unformat (input, "via"))
{
/* new path, back up and return */
return (1);
}
+
+/*
+ * Return true if the path is attached
+ */
+int
+fib_route_path_is_attached (const fib_route_path_t *rpath)
+{
+ /*
+ * DVR paths are not attached, since we are not playing the
+ * L3 game with these
+ */
+ if (rpath->frp_flags & (FIB_ROUTE_PATH_DVR |
+ FIB_ROUTE_PATH_UDP_ENCAP))
+ {
+ return (0);
+ }
+
+ /*
+ * - All zeros next-hop
+ * - a valid interface
+ */
+ if (ip46_address_is_zero(&rpath->frp_addr) &&
+ (~0 != rpath->frp_sw_if_index))
+ {
+ return (!0);
+ }
+ else if (rpath->frp_flags & FIB_ROUTE_PATH_ATTACHED ||
+ rpath->frp_flags & FIB_ROUTE_PATH_GLEAN)
+ {
+ return (!0);
+ }
+ return (0);
+}