2 * Copyright (C) 2008 Sun Microsystems, Inc.
4 * This file is part of Quagga.
6 * Quagga is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * Quagga is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #include "bgpd/bgpd.h"
32 #include "bgpd/bgp_attr.h"
33 #include "bgpd/bgp_open.h"
34 #include "bgpd/bgp_debug.h"
35 #include "bgpd/bgp_route.h"
36 #include "bgpd/bgp_packet.h"
37 #include "bgpd/bgp_mplsvpn.h"
38 #include "bgpd/bgp_nexthop.h"
39 #include "bgpd/bgp_vty.h"
40 #include "bgpd/bgp_network.h"
42 #define VT100_RESET "\x1b[0m"
43 #define VT100_RED "\x1b[31m"
44 #define VT100_GREEN "\x1b[32m"
45 #define VT100_YELLOW "\x1b[33m"
51 /* need these to link in libbgp */
52 struct zebra_privs_t
*bgpd_privs
= NULL
;
53 struct thread_master
*master
= NULL
;
55 static int failed
= 0;
58 /* test segments to parse and validate, and use for other tests */
59 static struct test_segment
{
62 const uint8_t data
[1024];
64 #define SHOULD_PARSE 0
66 int parses
; /* whether it should parse or not */
67 } mp_reach_segments
[] = {
70 "IPV6 MP Reach, global nexthop, 1 NLRI",
75 /* nexthop bytes */ 16,
76 /* Nexthop (global) */ 0xff,
92 /* SNPA (defunct, MBZ) */ 0x0,
97 0x2, /* fffe:102::/32 */
104 "IPV6 MP Reach, global nexthop, 2 NLRIs",
106 /* AFI / SAFI */ 0x0,
109 /* nexthop bytes */ 16,
110 /* Nexthop (global) */ 0xff,
113 0x2, /* ffee:102:... */
126 /* SNPA (defunct, MBZ) */ 0x0,
127 /* NLRI tuples */ 32,
131 0x2, /* fffe:102::/32 */
136 0x1, /* fffe:1:2:3::/64 */
142 (4 + 16 + 1 + 5 + 9),
147 "IPV6 MP Reach, global nexthop, 2 NLRIs + default",
149 /* AFI / SAFI */ 0x0,
152 /* nexthop bytes */ 16,
153 /* Nexthop (global) */ 0xff,
169 /* SNPA (defunct, MBZ) */ 0x0,
170 /* NLRI tuples */ 32,
174 0x2, /* fffe:102::/32 */
179 0x1, /* fffe:1:2:3::/64 */
186 (4 + 16 + 1 + 5 + 9 + 1),
191 "IPV6 MP Reach, global+local nexthops, 2 NLRIs + default",
193 /* AFI / SAFI */ 0x0,
196 /* nexthop bytes */ 32,
197 /* Nexthop (global) */ 0xff,
200 0x2, /* fffe:102:... */
213 /* Nexthop (local) */ 0xfe,
216 0x0, /* fe80::210:2ff:.. */
229 /* SNPA (defunct, MBZ) */ 0x0,
230 /* NLRI tuples */ 32,
234 0x2, /* fffe:102::/32 */
239 0x1, /* fffe:1:2:3::/64 */
246 (4 + 32 + 1 + 5 + 9 + 1),
251 "IPV6 MP Reach, inappropriate nexthop length",
253 /* AFI / SAFI */ 0x0,
256 /* nexthop bytes */ 4,
257 /* Nexthop (global) */ 0xff,
260 0x2, /* fffe:102:... */
273 /* Nexthop (local) */ 0xfe,
276 0x0, /* fe80::210:2ff:.. */
289 /* SNPA (defunct, MBZ) */ 0x0,
290 /* NLRI tuples */ 32,
294 0x2, /* fffe:102::/32 */
299 0x1, /* fffe:1:2:3::/64 */
306 (4 + 32 + 1 + 5 + 9 + 1),
311 "IPV6 MP Reach, invalid nexthop length",
313 /* AFI / SAFI */ 0x0,
316 /* nexthop bytes */ 5,
317 /* Nexthop (global) */ 0xff,
320 0x2, /* fffe:102:... */
333 /* Nexthop (local) */ 0xfe,
336 0x0, /* fe80::210:2ff:.. */
349 /* SNPA (defunct, MBZ) */ 0x0,
350 /* NLRI tuples */ 32,
354 0x2, /* fffe:102::/32 */
359 0x1, /* fffe:1:2:3::/64 */
366 (4 + 32 + 1 + 5 + 9 + 1),
371 "IPV6 MP Reach, nexthop length overflow",
373 /* AFI / SAFI */ 0x0,
376 /* nexthop bytes */ 32,
377 /* Nexthop (global) */ 0xff,
380 0x2, /* fffe:102:... */
399 "IPV6 MP Reach, nexthop length short",
401 /* AFI / SAFI */ 0x0,
404 /* nexthop bytes */ 16,
405 /* Nexthop (global) */ 0xff,
408 0x2, /* fffe:102:... */
421 /* Nexthop (local) */ 0xfe,
424 0x0, /* fe80::210:2ff:.. */
437 /* SNPA (defunct, MBZ) */ 0x0,
438 /* NLRI tuples */ 32,
442 0x2, /* fffe:102::/32 */
447 0x1, /* fffe:1:2:3::/64 */
454 (4 + 32 + 1 + 5 + 9 + 1),
459 "IPV6 MP Reach, NLRI bitlen overflow",
461 /* AFI / SAFI */ 0x0,
464 /* nexthop bytes */ 32,
465 /* Nexthop (global) */ 0xff,
468 0x2, /* fffe:102:... */
481 /* Nexthop (local) */ 0xfe,
484 0x0, /* fe80::210:2ff:.. */
497 /* SNPA (defunct, MBZ) */ 0x0,
498 /* NLRI tuples */ 120,
502 0x2, /* fffe:102::/32 */
507 0x1, /* fffe:1:2:3::/64 */
514 (4 + 32 + 1 + 5 + 9 + 1),
519 "IPv4 MP Reach, 2 NLRIs + default",
521 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
522 /* nexthop bytes */ 4,
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, nexthop lenth overflow",
536 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
537 /* nexthop bytes */ 32,
538 /* Nexthop */ 192, 168, 0, 1,
539 /* SNPA (defunct, MBZ) */ 0x0,
540 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
541 17, 10, 2, 3, /* 10.2.3/17 */
544 (4 + 4 + 1 + 3 + 4 + 1),
549 "IPv4 MP Reach, nlri lenth overflow",
551 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
552 /* nexthop bytes */ 4,
553 /* Nexthop */ 192, 168, 0, 1,
554 /* SNPA (defunct, MBZ) */ 0x0,
555 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
558 (4 + 4 + 1 + 3 + 2 + 1),
563 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs",
565 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
566 /* nexthop bytes */ 12,
567 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
569 /* Nexthop */ 192, 168, 0, 1,
570 /* SNPA (defunct, MBZ) */ 0x0,
571 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
573 0, 0, /* RD_TYPE_AS */
574 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
576 88 + 17, 0xff, 0, 0, /* tag */
578 0, 0, /* RD_TYPE_IP */
579 192, 168, 0, 1, /* IPv4 */
580 10, 2, 3, /* 10.2.3/17 */
582 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
586 "IPv4-VPNv4-bogus-plen",
587 "IPv4/MPLS-labeled VPN MP Reach, RD, Nexthop, NLRI / bogus p'len",
589 /* AFI / SAFI */ 0x0,
592 /* nexthop bytes */ 12,
605 /* SNPA (defunct, MBZ) */ 0x0,
606 /* NLRI tuples */ 16,
615 (3 + 1 + 3 * 4 + 1 + 3 + 4 + 1),
619 "IPv4-VPNv4-plen1-short",
620 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, 1st plen short",
622 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
623 /* nexthop bytes */ 12,
624 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
626 /* Nexthop */ 192, 168, 0, 1,
627 /* SNPA (defunct, MBZ) */ 0x0,
628 /* NLRI tuples */ 88 + 1, 0, 1, 2, /* tag */
630 0, 0, /* RD_TYPE_AS */
631 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
633 88 + 17, 0xff, 0, 0, /* tag */
635 0, 0, /* RD_TYPE_IP */
636 192, 168, 0, 1, /* IPv4 */
637 10, 2, 3, /* 10.2.3/17 */
639 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
643 "IPv4-VPNv4-plen1-long",
644 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, 1st plen long",
646 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
647 /* nexthop bytes */ 12,
648 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
650 /* Nexthop */ 192, 168, 0, 1,
651 /* SNPA (defunct, MBZ) */ 0x0,
652 /* NLRI tuples */ 88 + 32, 0, 1, 2, /* tag */
654 0, 0, /* RD_TYPE_AS */
655 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
657 88 + 17, 0xff, 0, 0, /* tag */
659 0, 0, /* RD_TYPE_IP */
660 192, 168, 0, 1, /* IPv4 */
661 10, 2, 3, /* 10.2.3/17 */
663 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
667 "IPv4-VPNv4-plenn-long",
668 "IPv4/VPNv4 MP Reach, RD, Nexthop, 3 NLRIs, last plen long",
670 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
671 /* nexthop bytes */ 12,
672 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
674 /* Nexthop */ 192, 168, 0, 1,
675 /* SNPA (defunct, MBZ) */ 0x0,
676 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
678 0, 0, /* RD_TYPE_AS */
679 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
681 88 + 17, 0xff, 0, 0, /* tag */
683 0, 0, /* RD_TYPE_IP */
684 192, 168, 0, 1, /* IPv4 */
685 10, 2, 3, /* 10.2.3/17 */
688 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3) + 1),
692 "IPv4-VPNv4-plenn-short",
693 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, last plen short",
695 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
696 /* nexthop bytes */ 12,
697 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
699 /* Nexthop */ 192, 168, 0, 1,
700 /* SNPA (defunct, MBZ) */ 0x0,
701 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
703 0, 0, /* RD_TYPE_AS */
704 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
706 88 + 2, 0xff, 0, 0, /* tag */
708 0, 0, /* RD_TYPE_IP */
709 192, 168, 0, 1, /* IPv4 */
710 10, 2, 3, /* 10.2.3/17 */
712 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
716 "IPv4-VPNv4-bogus-rd-type",
717 "IPv4/VPNv4 MP Reach, RD, NH, 2 NLRI, unknown RD in 1st (log, but parse)",
719 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
720 /* nexthop bytes */ 12,
721 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
723 /* Nexthop */ 192, 168, 0, 1,
724 /* SNPA (defunct, MBZ) */ 0x0,
725 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
727 0xff, 0, /* Bogus RD */
728 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
730 88 + 17, 0xff, 0, 0, /* tag */
732 0, 0, /* RD_TYPE_IP */
733 192, 168, 0, 1, /* IPv4 */
734 10, 2, 3, /* 10.2.3/17 */
736 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
741 "IPv4/VPNv4 MP Reach, RD, Nexthop, 3 NLRI, 3rd 0 bogus",
743 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
744 /* nexthop bytes */ 12,
745 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
747 /* Nexthop */ 192, 168, 0, 1,
748 /* SNPA (defunct, MBZ) */ 0x0,
749 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
751 0, 0, /* RD_TYPE_AS */
752 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
754 88 + 17, 0xff, 0, 0, /* tag */
756 0, 0, /* RD_TYPE_IP */
757 192, 168, 0, 1, /* IPv4 */
758 10, 2, 3, /* 10.2.3/17 */
759 0 /* 0/0, bogus for vpnv4 ?? */
761 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3) + 1),
768 "IPv6, global nexthop, 1 default NLRI",
770 /* AFI / SAFI */ 0x0,
773 /* nexthop bytes */ 0x20,
774 /* Nexthop (global) */ 0x20,
790 /* Nexthop (local) */ 0xfe,
806 /* SNPA (defunct, MBZ) */ 0,
807 /* NLRI tuples */ /* Should have 0 here for ::/0, but
815 .desc
= "IPV4 MP Reach, flowspec, 1 NLRI",
817 /* AFI / SAFI */ 0x0,
822 0x06, /* FS Length */
823 0x01, /* FS dest prefix ID */
831 .parses
= SHOULD_PARSE
,
833 {NULL
, NULL
, {0}, 0, 0}};
835 /* MP_UNREACH_NLRI tests */
836 static struct test_segment mp_unreach_segments
[] = {
839 "IPV6 MP Unreach, 1 NLRI",
841 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
842 /* NLRI tuples */ 32, 0xff, 0xfe, 0x1,
843 0x2, /* fffe:102::/32 */
850 "IPV6 MP Unreach, 2 NLRIs",
852 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
853 /* NLRI tuples */ 32, 0xff, 0xfe, 0x1,
854 0x2, /* fffe:102::/32 */
855 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */
862 "IPv6-unreach-default",
863 "IPV6 MP Unreach, 2 NLRIs + default",
865 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
866 /* NLRI tuples */ 32, 0xff, 0xfe, 0x1,
867 0x2, /* fffe:102::/32 */
868 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */
869 0x0, 0x2, 0x0, 0x3, 0x0, /* ::/0 */
876 "IPV6 MP Unreach, NLRI bitlen overflow",
878 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
879 /* NLRI tuples */ 120, 0xff, 0xfe, 0x1,
880 0x2, /* fffe:102::/32 */
881 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */
882 0x0, 0x2, 0x0, 0x3, 0, /* ::/0 */
889 "IPv4 MP Unreach, 2 NLRIs + default",
891 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
892 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
893 17, 10, 2, 3, /* 10.2.3/17 */
900 "IPv4-unreach-nlrilen",
901 "IPv4 MP Unreach, nlri length overflow",
903 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
904 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
911 "IPv4-unreach-VPNv4",
912 "IPv4/MPLS-labeled VPN MP Unreach, RD, 3 NLRIs",
914 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
915 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
917 0, 0, /* RD_TYPE_AS */
918 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
920 88 + 17, 0xff, 0, 0, /* tag */
922 0, 0, /* RD_TYPE_IP */
923 192, 168, 0, 1, /* IPv4 */
924 10, 2, 3, /* 10.2.3/17 */
926 (3 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
931 .desc
= "IPV4 MP Unreach, flowspec, 1 NLRI",
933 /* AFI / SAFI */ 0x0,
936 0x06, /* FS Length */
937 0x01, /* FS dest prefix ID */
945 .parses
= SHOULD_PARSE
,
947 {NULL
, NULL
, {0}, 0, 0}};
949 static struct test_segment mp_prefix_sid
[] = {
955 0x00, 0x00, 0x00, 0x00,
957 0x03, 0x00, 0x08, 0x00,
958 0x00, 0x0a, 0x1b, 0xfe,
962 .parses
= SHOULD_PARSE
,
964 {NULL
, NULL
, { 0 }, 0, 0},
967 /* nlri_parse indicates 0 on successful parse, and -1 otherwise.
968 * attr_parse indicates BGP_ATTR_PARSE_PROCEED/0 on success,
969 * and BGP_ATTR_PARSE_ERROR/-1 or lower negative ret on err.
971 static void handle_result(struct peer
*peer
, struct test_segment
*t
,
972 int parse_ret
, int nlri_ret
)
974 int oldfailed
= failed
;
976 printf("mp attr parsed?: %s\n", parse_ret
? "no" : "yes");
978 printf("nrli parsed?: %s\n", nlri_ret
? "no" : "yes");
979 printf("should parse?: %s\n", t
->parses
? "no" : "yes");
981 if ((parse_ret
!= 0 || nlri_ret
!= 0) != (t
->parses
!= 0))
987 (failed
> oldfailed
) ? VT100_RED
"failed!" VT100_RESET
988 : VT100_GREEN
"OK" VT100_RESET
);
990 printf("%s", (failed
> oldfailed
) ? "failed!" : "OK");
993 printf(" (%u)", failed
);
998 /* basic parsing test */
999 static void parse_test(struct peer
*peer
, struct test_segment
*t
, int type
)
1001 int parse_ret
= 0, nlri_ret
= 0;
1002 struct attr attr
= {};
1003 struct bgp_nlri nlri
= {};
1004 struct bgp_attr_parser_args attr_args
= {
1010 .flags
= BGP_ATTR_FLAG_OPTIONAL
,
1011 .startp
= BGP_INPUT_PNT(peer
),
1013 #define RANDOM_FUZZ 35
1014 stream_reset(peer
->curr
);
1015 stream_put(peer
->curr
, NULL
, RANDOM_FUZZ
);
1016 stream_set_getp(peer
->curr
, RANDOM_FUZZ
);
1018 stream_write(peer
->curr
, t
->data
, t
->len
);
1020 printf("%s: %s\n", t
->name
, t
->desc
);
1023 case BGP_ATTR_MP_REACH_NLRI
:
1024 parse_ret
= bgp_mp_reach_parse(&attr_args
, &nlri
);
1026 case BGP_ATTR_MP_UNREACH_NLRI
:
1027 parse_ret
= bgp_mp_unreach_parse(&attr_args
, &nlri
);
1029 case BGP_ATTR_PREFIX_SID
:
1030 parse_ret
= bgp_attr_prefix_sid(t
->len
, &attr_args
, &nlri
);
1033 printf("unknown type");
1038 iana_safi_t pkt_safi
;
1040 /* Convert AFI, SAFI to internal values, check. */
1041 if (bgp_map_afi_safi_int2iana(nlri
.afi
, nlri
.safi
, &pkt_afi
,
1045 printf("MP: %u(%u)/%u(%u): recv %u, nego %u\n", nlri
.afi
,
1046 pkt_afi
, nlri
.safi
, pkt_safi
,
1047 peer
->afc_recv
[nlri
.afi
][nlri
.safi
],
1048 peer
->afc_nego
[nlri
.afi
][nlri
.safi
]);
1052 if (type
== BGP_ATTR_MP_REACH_NLRI
)
1053 nlri_ret
= bgp_nlri_parse(peer
, &attr
, &nlri
, 0);
1054 else if (type
== BGP_ATTR_MP_UNREACH_NLRI
)
1055 nlri_ret
= bgp_nlri_parse(peer
, &attr
, &nlri
, 1);
1057 handle_result(peer
, t
, parse_ret
, nlri_ret
);
1060 static struct bgp
*bgp
;
1061 static as_t asn
= 100;
1065 struct interface ifp
;
1069 conf_bgp_debug_neighbor_events
= -1UL;
1070 conf_bgp_debug_packet
= -1UL;
1071 conf_bgp_debug_as4
= -1UL;
1072 conf_bgp_debug_flowspec
= -1UL;
1073 term_bgp_debug_neighbor_events
= -1UL;
1074 term_bgp_debug_packet
= -1UL;
1075 term_bgp_debug_as4
= -1UL;
1076 term_bgp_debug_flowspec
= -1UL;
1081 master
= thread_master_create("test mp attr");
1082 bgp_master_init(master
, BGP_SOCKET_SNDBUF_SIZE
);
1083 vrf_init(NULL
, NULL
, NULL
, NULL
, NULL
);
1084 bgp_option_set(BGP_OPT_NO_LISTEN
);
1087 if (fileno(stdout
) >= 0)
1088 tty
= isatty(fileno(stdout
));
1090 if (bgp_get(&bgp
, &asn
, NULL
, BGP_INSTANCE_TYPE_DEFAULT
) < 0)
1093 peer
= peer_create_accept(bgp
);
1094 peer
->host
= (char *)"foo";
1095 peer
->status
= Established
;
1096 peer
->curr
= stream_new(BGP_MAX_PACKET_SIZE
);
1099 peer
->nexthop
.ifp
= &ifp
;
1101 for (i
= AFI_IP
; i
< AFI_MAX
; i
++)
1102 for (j
= SAFI_UNICAST
; j
< SAFI_MAX
; j
++) {
1103 peer
->afc
[i
][j
] = 1;
1104 peer
->afc_adv
[i
][j
] = 1;
1108 while (mp_reach_segments
[i
].name
)
1109 parse_test(peer
, &mp_reach_segments
[i
++],
1110 BGP_ATTR_MP_REACH_NLRI
);
1113 while (mp_unreach_segments
[i
].name
)
1114 parse_test(peer
, &mp_unreach_segments
[i
++],
1115 BGP_ATTR_MP_UNREACH_NLRI
);
1118 while (mp_prefix_sid
[i
].name
)
1119 parse_test(peer
, &mp_prefix_sid
[i
++],
1120 BGP_ATTR_PREFIX_SID
);
1121 printf("failures: %d\n", failed
);