1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2008 Sun Microsystems, Inc.
16 #include "bgpd/bgpd.h"
17 #include "bgpd/bgp_attr.h"
18 #include "bgpd/bgp_open.h"
19 #include "bgpd/bgp_debug.h"
20 #include "bgpd/bgp_route.h"
21 #include "bgpd/bgp_packet.h"
22 #include "bgpd/bgp_mplsvpn.h"
23 #include "bgpd/bgp_nexthop.h"
24 #include "bgpd/bgp_vty.h"
25 #include "bgpd/bgp_network.h"
27 #define VT100_RESET "\x1b[0m"
28 #define VT100_RED "\x1b[31m"
29 #define VT100_GREEN "\x1b[32m"
30 #define VT100_YELLOW "\x1b[33m"
36 /* need these to link in libbgp */
37 struct zebra_privs_t bgpd_privs
= {};
38 struct event_loop
*master
= NULL
;
40 static int failed
= 0;
43 /* test segments to parse and validate, and use for other tests */
44 static struct test_segment
{
47 const uint8_t data
[1024];
49 #define SHOULD_PARSE 0
51 int parses
; /* whether it should parse or not */
52 } mp_reach_segments
[] = {
55 "IPV6 MP Reach, global nexthop, 1 NLRI",
60 /* nexthop bytes */ 16,
61 /* Nexthop (global) */ 0xff,
77 /* SNPA (defunct, MBZ) */ 0x0,
82 0x2, /* fffe:102::/32 */
89 "IPV6 MP Reach, global nexthop, 2 NLRIs",
94 /* nexthop bytes */ 16,
95 /* Nexthop (global) */ 0xff,
98 0x2, /* ffee:102:... */
111 /* SNPA (defunct, MBZ) */ 0x0,
112 /* NLRI tuples */ 32,
116 0x2, /* fffe:102::/32 */
121 0x1, /* fffe:1:2:3::/64 */
127 (4 + 16 + 1 + 5 + 9),
132 "IPV6 MP Reach, global nexthop, 2 NLRIs + default",
134 /* AFI / SAFI */ 0x0,
137 /* nexthop bytes */ 16,
138 /* Nexthop (global) */ 0xff,
154 /* SNPA (defunct, MBZ) */ 0x0,
155 /* NLRI tuples */ 32,
159 0x2, /* fffe:102::/32 */
164 0x1, /* fffe:1:2:3::/64 */
171 (4 + 16 + 1 + 5 + 9 + 1),
176 "IPV6 MP Reach, global+local nexthops, 2 NLRIs + default",
178 /* AFI / SAFI */ 0x0,
181 /* nexthop bytes */ 32,
182 /* Nexthop (global) */ 0xff,
185 0x2, /* fffe:102:... */
198 /* Nexthop (local) */ 0xfe,
201 0x0, /* fe80::210:2ff:.. */
214 /* SNPA (defunct, MBZ) */ 0x0,
215 /* NLRI tuples */ 32,
219 0x2, /* fffe:102::/32 */
224 0x1, /* fffe:1:2:3::/64 */
231 (4 + 32 + 1 + 5 + 9 + 1),
236 "IPV6 MP Reach, inappropriate nexthop length",
238 /* AFI / SAFI */ 0x0,
241 /* nexthop bytes */ 4,
242 /* Nexthop (global) */ 0xff,
245 0x2, /* fffe:102:... */
258 /* Nexthop (local) */ 0xfe,
261 0x0, /* fe80::210:2ff:.. */
274 /* SNPA (defunct, MBZ) */ 0x0,
275 /* NLRI tuples */ 32,
279 0x2, /* fffe:102::/32 */
284 0x1, /* fffe:1:2:3::/64 */
291 (4 + 32 + 1 + 5 + 9 + 1),
296 "IPV6 MP Reach, invalid nexthop length",
298 /* AFI / SAFI */ 0x0,
301 /* nexthop bytes */ 5,
302 /* Nexthop (global) */ 0xff,
305 0x2, /* fffe:102:... */
318 /* Nexthop (local) */ 0xfe,
321 0x0, /* fe80::210:2ff:.. */
334 /* SNPA (defunct, MBZ) */ 0x0,
335 /* NLRI tuples */ 32,
339 0x2, /* fffe:102::/32 */
344 0x1, /* fffe:1:2:3::/64 */
351 (4 + 32 + 1 + 5 + 9 + 1),
356 "IPV6 MP Reach, nexthop length overflow",
358 /* AFI / SAFI */ 0x0,
361 /* nexthop bytes */ 32,
362 /* Nexthop (global) */ 0xff,
365 0x2, /* fffe:102:... */
384 "IPV6 MP Reach, nexthop length short",
386 /* AFI / SAFI */ 0x0,
389 /* nexthop bytes */ 16,
390 /* Nexthop (global) */ 0xff,
393 0x2, /* fffe:102:... */
406 /* Nexthop (local) */ 0xfe,
409 0x0, /* fe80::210:2ff:.. */
422 /* SNPA (defunct, MBZ) */ 0x0,
423 /* NLRI tuples */ 32,
427 0x2, /* fffe:102::/32 */
432 0x1, /* fffe:1:2:3::/64 */
439 (4 + 32 + 1 + 5 + 9 + 1),
444 "IPV6 MP Reach, NLRI bitlen overflow",
446 /* AFI / SAFI */ 0x0,
449 /* nexthop bytes */ 32,
450 /* Nexthop (global) */ 0xff,
453 0x2, /* fffe:102:... */
466 /* Nexthop (local) */ 0xfe,
469 0x0, /* fe80::210:2ff:.. */
482 /* SNPA (defunct, MBZ) */ 0x0,
483 /* NLRI tuples */ 120,
487 0x2, /* fffe:102::/32 */
492 0x1, /* fffe:1:2:3::/64 */
499 (4 + 32 + 1 + 5 + 9 + 1),
504 "IPv4 MP Reach, 2 NLRIs + default",
506 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
507 /* nexthop bytes */ 4,
508 /* Nexthop */ 192, 168, 0, 1,
509 /* SNPA (defunct, MBZ) */ 0x0,
510 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
511 17, 10, 2, 3, /* 10.2.3/17 */
514 (4 + 4 + 1 + 3 + 4 + 1),
519 "IPv4 MP Reach, nexthop lenth overflow",
521 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
522 /* nexthop bytes */ 32,
523 /* Nexthop */ 192, 168, 0, 1,
524 /* SNPA (defunct, MBZ) */ 0x0,
525 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
526 17, 10, 2, 3, /* 10.2.3/17 */
529 (4 + 4 + 1 + 3 + 4 + 1),
534 "IPv4 MP Reach, nlri lenth overflow",
536 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
537 /* nexthop bytes */ 4,
538 /* Nexthop */ 192, 168, 0, 1,
539 /* SNPA (defunct, MBZ) */ 0x0,
540 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
543 (4 + 4 + 1 + 3 + 2 + 1),
548 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs",
550 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
551 /* nexthop bytes */ 12,
552 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
554 /* Nexthop */ 192, 168, 0, 1,
555 /* SNPA (defunct, MBZ) */ 0x0,
556 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
558 0, 0, /* RD_TYPE_AS */
559 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
561 88 + 17, 0xff, 0, 0, /* tag */
563 0, 0, /* RD_TYPE_IP */
564 192, 168, 0, 1, /* IPv4 */
565 10, 2, 3, /* 10.2.3/17 */
567 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
571 "IPv4-VPNv4-bogus-plen",
572 "IPv4/MPLS-labeled VPN MP Reach, RD, Nexthop, NLRI / bogus p'len",
574 /* AFI / SAFI */ 0x0,
577 /* nexthop bytes */ 12,
590 /* SNPA (defunct, MBZ) */ 0x0,
591 /* NLRI tuples */ 16,
600 (3 + 1 + 3 * 4 + 1 + 3 + 4 + 1),
604 "IPv4-VPNv4-plen1-short",
605 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, 1st plen short",
607 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
608 /* nexthop bytes */ 12,
609 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
611 /* Nexthop */ 192, 168, 0, 1,
612 /* SNPA (defunct, MBZ) */ 0x0,
613 /* NLRI tuples */ 88 + 1, 0, 1, 2, /* tag */
615 0, 0, /* RD_TYPE_AS */
616 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
618 88 + 17, 0xff, 0, 0, /* tag */
620 0, 0, /* RD_TYPE_IP */
621 192, 168, 0, 1, /* IPv4 */
622 10, 2, 3, /* 10.2.3/17 */
624 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
628 "IPv4-VPNv4-plen1-long",
629 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, 1st plen long",
631 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
632 /* nexthop bytes */ 12,
633 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
635 /* Nexthop */ 192, 168, 0, 1,
636 /* SNPA (defunct, MBZ) */ 0x0,
637 /* NLRI tuples */ 88 + 32, 0, 1, 2, /* tag */
639 0, 0, /* RD_TYPE_AS */
640 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
642 88 + 17, 0xff, 0, 0, /* tag */
644 0, 0, /* RD_TYPE_IP */
645 192, 168, 0, 1, /* IPv4 */
646 10, 2, 3, /* 10.2.3/17 */
648 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
652 "IPv4-VPNv4-plenn-long",
653 "IPv4/VPNv4 MP Reach, RD, Nexthop, 3 NLRIs, last plen long",
655 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
656 /* nexthop bytes */ 12,
657 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
659 /* Nexthop */ 192, 168, 0, 1,
660 /* SNPA (defunct, MBZ) */ 0x0,
661 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
663 0, 0, /* RD_TYPE_AS */
664 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
666 88 + 17, 0xff, 0, 0, /* tag */
668 0, 0, /* RD_TYPE_IP */
669 192, 168, 0, 1, /* IPv4 */
670 10, 2, 3, /* 10.2.3/17 */
673 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3) + 1),
677 "IPv4-VPNv4-plenn-short",
678 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, last plen short",
680 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
681 /* nexthop bytes */ 12,
682 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
684 /* Nexthop */ 192, 168, 0, 1,
685 /* SNPA (defunct, MBZ) */ 0x0,
686 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
688 0, 0, /* RD_TYPE_AS */
689 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
691 88 + 2, 0xff, 0, 0, /* tag */
693 0, 0, /* RD_TYPE_IP */
694 192, 168, 0, 1, /* IPv4 */
695 10, 2, 3, /* 10.2.3/17 */
697 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
701 "IPv4-VPNv4-bogus-rd-type",
702 "IPv4/VPNv4 MP Reach, RD, NH, 2 NLRI, unknown RD in 1st (log, but parse)",
704 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
705 /* nexthop bytes */ 12,
706 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
708 /* Nexthop */ 192, 168, 0, 1,
709 /* SNPA (defunct, MBZ) */ 0x0,
710 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
712 0xff, 0, /* Bogus RD */
713 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
715 88 + 17, 0xff, 0, 0, /* tag */
717 0, 0, /* RD_TYPE_IP */
718 192, 168, 0, 1, /* IPv4 */
719 10, 2, 3, /* 10.2.3/17 */
721 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
726 "IPv4/VPNv4 MP Reach, RD, Nexthop, 3 NLRI, 3rd 0 bogus",
728 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
729 /* nexthop bytes */ 12,
730 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
732 /* Nexthop */ 192, 168, 0, 1,
733 /* SNPA (defunct, MBZ) */ 0x0,
734 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
736 0, 0, /* RD_TYPE_AS */
737 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
739 88 + 17, 0xff, 0, 0, /* tag */
741 0, 0, /* RD_TYPE_IP */
742 192, 168, 0, 1, /* IPv4 */
743 10, 2, 3, /* 10.2.3/17 */
744 0 /* 0/0, bogus for vpnv4 ?? */
746 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3) + 1),
753 "IPv6, global nexthop, 1 default NLRI",
755 /* AFI / SAFI */ 0x0,
758 /* nexthop bytes */ 0x20,
759 /* Nexthop (global) */ 0x20,
775 /* Nexthop (local) */ 0xfe,
791 /* SNPA (defunct, MBZ) */ 0,
792 /* NLRI tuples */ /* Should have 0 here for ::/0, but
800 .desc
= "IPV4 MP Reach, flowspec, 1 NLRI",
802 /* AFI / SAFI */ 0x0,
807 0x06, /* FS Length */
808 0x01, /* FS dest prefix ID */
816 .parses
= SHOULD_PARSE
,
818 {NULL
, NULL
, {0}, 0, 0}};
820 /* MP_UNREACH_NLRI tests */
821 static struct test_segment mp_unreach_segments
[] = {
824 "IPV6 MP Unreach, 1 NLRI",
826 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
827 /* NLRI tuples */ 32, 0xff, 0xfe, 0x1,
828 0x2, /* fffe:102::/32 */
835 "IPV6 MP Unreach, 2 NLRIs",
837 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
838 /* NLRI tuples */ 32, 0xff, 0xfe, 0x1,
839 0x2, /* fffe:102::/32 */
840 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */
847 "IPv6-unreach-default",
848 "IPV6 MP Unreach, 2 NLRIs + default",
850 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
851 /* NLRI tuples */ 32, 0xff, 0xfe, 0x1,
852 0x2, /* fffe:102::/32 */
853 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */
854 0x0, 0x2, 0x0, 0x3, 0x0, /* ::/0 */
861 "IPV6 MP Unreach, NLRI bitlen overflow",
863 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
864 /* NLRI tuples */ 120, 0xff, 0xfe, 0x1,
865 0x2, /* fffe:102::/32 */
866 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */
867 0x0, 0x2, 0x0, 0x3, 0, /* ::/0 */
874 "IPv4 MP Unreach, 2 NLRIs + default",
876 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
877 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
878 17, 10, 2, 3, /* 10.2.3/17 */
885 "IPv4-unreach-nlrilen",
886 "IPv4 MP Unreach, nlri length overflow",
888 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
889 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
896 "IPv4-unreach-VPNv4",
897 "IPv4/MPLS-labeled VPN MP Unreach, RD, 3 NLRIs",
899 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
900 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
902 0, 0, /* RD_TYPE_AS */
903 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
905 88 + 17, 0xff, 0, 0, /* tag */
907 0, 0, /* RD_TYPE_IP */
908 192, 168, 0, 1, /* IPv4 */
909 10, 2, 3, /* 10.2.3/17 */
911 (3 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
916 .desc
= "IPV4 MP Unreach, flowspec, 1 NLRI",
918 /* AFI / SAFI */ 0x0,
921 0x06, /* FS Length */
922 0x01, /* FS dest prefix ID */
930 .parses
= SHOULD_PARSE
,
932 {NULL
, NULL
, {0}, 0, 0}};
934 static struct test_segment mp_prefix_sid
[] = {
939 /* TLV[0] Latel-Index TLV */
940 0x01, /* Type 0x01:Label-Index */
941 0x00, 0x07, /* Length */
943 0x00, 0x00, /* Flags */
944 0x00, 0x00, 0x00, 0x02, /* Label Index */
946 /* TLV[1] SRGB TLV */
947 0x03, /* Type 0x03:SRGB */
948 0x00, 0x08, /* Length */
949 0x00, 0x00, /* Flags */
950 0x0a, 0x1b, 0xfe, /* SRGB[0] first label */
951 0x00, 0x00, 0x0a /* SRBG[0] nb-labels in range */
954 .parses
= SHOULD_PARSE
,
956 {NULL
, NULL
, { 0 }, 0, 0},
959 /* nlri_parse indicates 0 on successful parse, and -1 otherwise.
960 * attr_parse indicates BGP_ATTR_PARSE_PROCEED/0 on success,
961 * and BGP_ATTR_PARSE_ERROR/-1 or lower negative ret on err.
963 static void handle_result(struct peer
*peer
, struct test_segment
*t
,
964 int parse_ret
, int nlri_ret
)
966 int oldfailed
= failed
;
968 printf("mp attr parsed?: %s\n", parse_ret
? "no" : "yes");
970 printf("nrli parsed?: %s\n", nlri_ret
? "no" : "yes");
971 printf("should parse?: %s\n", t
->parses
? "no" : "yes");
973 if ((parse_ret
!= 0 || nlri_ret
!= 0) != (t
->parses
!= 0))
979 (failed
> oldfailed
) ? VT100_RED
"failed!" VT100_RESET
980 : VT100_GREEN
"OK" VT100_RESET
);
982 printf("%s", (failed
> oldfailed
) ? "failed!" : "OK");
985 printf(" (%u)", failed
);
990 /* basic parsing test */
991 static void parse_test(struct peer
*peer
, struct test_segment
*t
, int type
)
993 int parse_ret
= 0, nlri_ret
= 0;
994 struct attr attr
= {};
995 struct bgp_nlri nlri
= {};
996 struct bgp_attr_parser_args attr_args
= {
1002 .flags
= BGP_ATTR_FLAG_OPTIONAL
,
1003 .startp
= BGP_INPUT_PNT(peer
),
1005 #define RANDOM_FUZZ 35
1006 stream_reset(peer
->curr
);
1007 stream_put(peer
->curr
, NULL
, RANDOM_FUZZ
);
1008 stream_set_getp(peer
->curr
, RANDOM_FUZZ
);
1010 stream_write(peer
->curr
, t
->data
, t
->len
);
1012 printf("%s: %s\n", t
->name
, t
->desc
);
1015 case BGP_ATTR_MP_REACH_NLRI
:
1016 parse_ret
= bgp_mp_reach_parse(&attr_args
, &nlri
);
1018 case BGP_ATTR_MP_UNREACH_NLRI
:
1019 parse_ret
= bgp_mp_unreach_parse(&attr_args
, &nlri
);
1021 case BGP_ATTR_PREFIX_SID
:
1022 parse_ret
= bgp_attr_prefix_sid(&attr_args
);
1025 printf("unknown type");
1030 iana_safi_t pkt_safi
;
1032 /* Convert AFI, SAFI to internal values, check. */
1033 if (bgp_map_afi_safi_int2iana(nlri
.afi
, nlri
.safi
, &pkt_afi
,
1037 printf("MP: %u(%u)/%u(%u): recv %u, nego %u\n", nlri
.afi
,
1038 pkt_afi
, nlri
.safi
, pkt_safi
,
1039 peer
->afc_recv
[nlri
.afi
][nlri
.safi
],
1040 peer
->afc_nego
[nlri
.afi
][nlri
.safi
]);
1044 if (type
== BGP_ATTR_MP_REACH_NLRI
)
1045 nlri_ret
= bgp_nlri_parse(peer
, &attr
, &nlri
, false);
1046 else if (type
== BGP_ATTR_MP_UNREACH_NLRI
)
1047 nlri_ret
= bgp_nlri_parse(peer
, &attr
, &nlri
, true);
1049 handle_result(peer
, t
, parse_ret
, nlri_ret
);
1052 static struct bgp
*bgp
;
1053 static as_t asn
= 100;
1057 struct interface ifp
;
1061 conf_bgp_debug_neighbor_events
= -1UL;
1062 conf_bgp_debug_packet
= -1UL;
1063 conf_bgp_debug_as4
= -1UL;
1064 conf_bgp_debug_flowspec
= -1UL;
1065 term_bgp_debug_neighbor_events
= -1UL;
1066 term_bgp_debug_packet
= -1UL;
1067 term_bgp_debug_as4
= -1UL;
1068 term_bgp_debug_flowspec
= -1UL;
1073 master
= event_master_create("test mp attr");
1074 bgp_master_init(master
, BGP_SOCKET_SNDBUF_SIZE
, list_new());
1075 vrf_init(NULL
, NULL
, NULL
, NULL
);
1076 bgp_option_set(BGP_OPT_NO_LISTEN
);
1079 if (fileno(stdout
) >= 0)
1080 tty
= isatty(fileno(stdout
));
1082 if (bgp_get(&bgp
, &asn
, NULL
, BGP_INSTANCE_TYPE_DEFAULT
, NULL
,
1083 ASNOTATION_PLAIN
) < 0)
1086 peer
= peer_create_accept(bgp
);
1087 peer
->host
= (char *)"foo";
1088 peer
->status
= Established
;
1089 peer
->curr
= stream_new(BGP_MAX_PACKET_SIZE
);
1092 peer
->nexthop
.ifp
= &ifp
;
1094 for (i
= AFI_IP
; i
< AFI_MAX
; i
++)
1095 for (j
= SAFI_UNICAST
; j
< SAFI_MAX
; j
++) {
1096 peer
->afc
[i
][j
] = 1;
1097 peer
->afc_adv
[i
][j
] = 1;
1101 while (mp_reach_segments
[i
].name
)
1102 parse_test(peer
, &mp_reach_segments
[i
++],
1103 BGP_ATTR_MP_REACH_NLRI
);
1106 while (mp_unreach_segments
[i
].name
)
1107 parse_test(peer
, &mp_unreach_segments
[i
++],
1108 BGP_ATTR_MP_UNREACH_NLRI
);
1111 while (mp_prefix_sid
[i
].name
)
1112 parse_test(peer
, &mp_prefix_sid
[i
++],
1113 BGP_ATTR_PREFIX_SID
);
1114 printf("failures: %d\n", failed
);