Add minimal support for flowspec in the table-mp MRT format.
authorclaudio <claudio@openbsd.org>
Wed, 19 Apr 2023 09:03:00 +0000 (09:03 +0000)
committerclaudio <claudio@openbsd.org>
Wed, 19 Apr 2023 09:03:00 +0000 (09:03 +0000)
In general people should use table-v2 which handles flowspec just fine.
OK tb@

usr.sbin/bgpd/mrt.c

index d24cf37..e0c94d1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: mrt.c,v 1.113 2023/03/28 15:17:34 claudio Exp $ */
+/*     $OpenBSD: mrt.c,v 1.114 2023/04/19 09:03:00 claudio Exp $ */
 
 /*
  * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -488,6 +488,15 @@ mrt_dump_entry_mp(struct mrt *mrt, struct prefix *p, uint16_t snum,
                        goto fail;
                }
                break;
+       case AID_FLOWSPECv4:
+       case AID_FLOWSPECv6:
+               if (p->pt->aid == AID_FLOWSPECv4)
+                       DUMP_SHORT(h2buf, AFI_IPv4);    /* afi */
+               else
+                       DUMP_SHORT(h2buf, AFI_IPv6);    /* afi */
+               DUMP_BYTE(h2buf, SAFI_FLOWSPEC);        /* safi */
+               DUMP_BYTE(h2buf, 0);                    /* nhlen */
+               break;
        default:
                log_warnx("king bula found new AF in %s", __func__);
                goto fail;