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"
41 #define VT100_RESET "\x1b[0m"
42 #define VT100_RED "\x1b[31m"
43 #define VT100_GREEN "\x1b[32m"
44 #define VT100_YELLOW "\x1b[33m"
50 /* need these to link in libbgp */
51 struct zebra_privs_t
*bgpd_privs
= NULL
;
52 struct thread_master
*master
= NULL
;
54 static int failed
= 0;
57 /* test segments to parse and validate, and use for other tests */
58 static struct test_segment
{
61 const uint8_t data
[1024];
63 #define SHOULD_PARSE 0
65 int parses
; /* whether it should parse or not */
66 } mp_reach_segments
[] = {
69 "IPV6 MP Reach, global nexthop, 1 NLRI",
74 /* nexthop bytes */ 16,
75 /* Nexthop (global) */ 0xff,
91 /* SNPA (defunct, MBZ) */ 0x0,
96 0x2, /* fffe:102::/32 */
103 "IPV6 MP Reach, global nexthop, 2 NLRIs",
105 /* AFI / SAFI */ 0x0,
108 /* nexthop bytes */ 16,
109 /* Nexthop (global) */ 0xff,
112 0x2, /* ffee:102:... */
125 /* SNPA (defunct, MBZ) */ 0x0,
126 /* NLRI tuples */ 32,
130 0x2, /* fffe:102::/32 */
135 0x1, /* fffe:1:2:3::/64 */
141 (4 + 16 + 1 + 5 + 9),
146 "IPV6 MP Reach, global nexthop, 2 NLRIs + default",
148 /* AFI / SAFI */ 0x0,
151 /* nexthop bytes */ 16,
152 /* Nexthop (global) */ 0xff,
168 /* SNPA (defunct, MBZ) */ 0x0,
169 /* NLRI tuples */ 32,
173 0x2, /* fffe:102::/32 */
178 0x1, /* fffe:1:2:3::/64 */
185 (4 + 16 + 1 + 5 + 9 + 1),
190 "IPV6 MP Reach, global+local nexthops, 2 NLRIs + default",
192 /* AFI / SAFI */ 0x0,
195 /* nexthop bytes */ 32,
196 /* Nexthop (global) */ 0xff,
199 0x2, /* fffe:102:... */
212 /* Nexthop (local) */ 0xfe,
215 0x0, /* fe80::210:2ff:.. */
228 /* SNPA (defunct, MBZ) */ 0x0,
229 /* NLRI tuples */ 32,
233 0x2, /* fffe:102::/32 */
238 0x1, /* fffe:1:2:3::/64 */
245 (4 + 32 + 1 + 5 + 9 + 1),
250 "IPV6 MP Reach, inappropriate nexthop length",
252 /* AFI / SAFI */ 0x0,
255 /* nexthop bytes */ 4,
256 /* Nexthop (global) */ 0xff,
259 0x2, /* fffe:102:... */
272 /* Nexthop (local) */ 0xfe,
275 0x0, /* fe80::210:2ff:.. */
288 /* SNPA (defunct, MBZ) */ 0x0,
289 /* NLRI tuples */ 32,
293 0x2, /* fffe:102::/32 */
298 0x1, /* fffe:1:2:3::/64 */
305 (4 + 32 + 1 + 5 + 9 + 1),
310 "IPV6 MP Reach, invalid nexthop length",
312 /* AFI / SAFI */ 0x0,
315 /* nexthop bytes */ 5,
316 /* Nexthop (global) */ 0xff,
319 0x2, /* fffe:102:... */
332 /* Nexthop (local) */ 0xfe,
335 0x0, /* fe80::210:2ff:.. */
348 /* SNPA (defunct, MBZ) */ 0x0,
349 /* NLRI tuples */ 32,
353 0x2, /* fffe:102::/32 */
358 0x1, /* fffe:1:2:3::/64 */
365 (4 + 32 + 1 + 5 + 9 + 1),
370 "IPV6 MP Reach, nexthop length overflow",
372 /* AFI / SAFI */ 0x0,
375 /* nexthop bytes */ 32,
376 /* Nexthop (global) */ 0xff,
379 0x2, /* fffe:102:... */
398 "IPV6 MP Reach, nexthop length short",
400 /* AFI / SAFI */ 0x0,
403 /* nexthop bytes */ 16,
404 /* Nexthop (global) */ 0xff,
407 0x2, /* fffe:102:... */
420 /* Nexthop (local) */ 0xfe,
423 0x0, /* fe80::210:2ff:.. */
436 /* SNPA (defunct, MBZ) */ 0x0,
437 /* NLRI tuples */ 32,
441 0x2, /* fffe:102::/32 */
446 0x1, /* fffe:1:2:3::/64 */
453 (4 + 32 + 1 + 5 + 9 + 1),
458 "IPV6 MP Reach, NLRI bitlen overflow",
460 /* AFI / SAFI */ 0x0,
463 /* nexthop bytes */ 32,
464 /* Nexthop (global) */ 0xff,
467 0x2, /* fffe:102:... */
480 /* Nexthop (local) */ 0xfe,
483 0x0, /* fe80::210:2ff:.. */
496 /* SNPA (defunct, MBZ) */ 0x0,
497 /* NLRI tuples */ 120,
501 0x2, /* fffe:102::/32 */
506 0x1, /* fffe:1:2:3::/64 */
513 (4 + 32 + 1 + 5 + 9 + 1),
518 "IPv4 MP Reach, 2 NLRIs + default",
520 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
521 /* nexthop bytes */ 4,
522 /* Nexthop */ 192, 168, 0, 1,
523 /* SNPA (defunct, MBZ) */ 0x0,
524 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
525 17, 10, 2, 3, /* 10.2.3/17 */
528 (4 + 4 + 1 + 3 + 4 + 1),
533 "IPv4 MP Reach, nexthop lenth overflow",
535 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
536 /* nexthop bytes */ 32,
537 /* Nexthop */ 192, 168, 0, 1,
538 /* SNPA (defunct, MBZ) */ 0x0,
539 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
540 17, 10, 2, 3, /* 10.2.3/17 */
543 (4 + 4 + 1 + 3 + 4 + 1),
548 "IPv4 MP Reach, nlri lenth overflow",
550 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
551 /* nexthop bytes */ 4,
552 /* Nexthop */ 192, 168, 0, 1,
553 /* SNPA (defunct, MBZ) */ 0x0,
554 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
557 (4 + 4 + 1 + 3 + 2 + 1),
562 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs",
564 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
565 /* nexthop bytes */ 12,
566 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
568 /* Nexthop */ 192, 168, 0, 1,
569 /* SNPA (defunct, MBZ) */ 0x0,
570 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
572 0, 0, /* RD_TYPE_AS */
573 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
575 88 + 17, 0xff, 0, 0, /* tag */
577 0, 0, /* RD_TYPE_IP */
578 192, 168, 0, 1, /* IPv4 */
579 10, 2, 3, /* 10.2.3/17 */
581 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
585 "IPv4-VPNv4-bogus-plen",
586 "IPv4/MPLS-labeled VPN MP Reach, RD, Nexthop, NLRI / bogus p'len",
588 /* AFI / SAFI */ 0x0,
591 /* nexthop bytes */ 12,
604 /* SNPA (defunct, MBZ) */ 0x0,
605 /* NLRI tuples */ 16,
614 (3 + 1 + 3 * 4 + 1 + 3 + 4 + 1),
618 "IPv4-VPNv4-plen1-short",
619 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, 1st plen short",
621 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
622 /* nexthop bytes */ 12,
623 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
625 /* Nexthop */ 192, 168, 0, 1,
626 /* SNPA (defunct, MBZ) */ 0x0,
627 /* NLRI tuples */ 88 + 1, 0, 1, 2, /* tag */
629 0, 0, /* RD_TYPE_AS */
630 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
632 88 + 17, 0xff, 0, 0, /* tag */
634 0, 0, /* RD_TYPE_IP */
635 192, 168, 0, 1, /* IPv4 */
636 10, 2, 3, /* 10.2.3/17 */
638 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
642 "IPv4-VPNv4-plen1-long",
643 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, 1st plen long",
645 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
646 /* nexthop bytes */ 12,
647 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
649 /* Nexthop */ 192, 168, 0, 1,
650 /* SNPA (defunct, MBZ) */ 0x0,
651 /* NLRI tuples */ 88 + 32, 0, 1, 2, /* tag */
653 0, 0, /* RD_TYPE_AS */
654 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
656 88 + 17, 0xff, 0, 0, /* tag */
658 0, 0, /* RD_TYPE_IP */
659 192, 168, 0, 1, /* IPv4 */
660 10, 2, 3, /* 10.2.3/17 */
662 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
666 "IPv4-VPNv4-plenn-long",
667 "IPv4/VPNv4 MP Reach, RD, Nexthop, 3 NLRIs, last plen long",
669 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
670 /* nexthop bytes */ 12,
671 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
673 /* Nexthop */ 192, 168, 0, 1,
674 /* SNPA (defunct, MBZ) */ 0x0,
675 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
677 0, 0, /* RD_TYPE_AS */
678 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
680 88 + 17, 0xff, 0, 0, /* tag */
682 0, 0, /* RD_TYPE_IP */
683 192, 168, 0, 1, /* IPv4 */
684 10, 2, 3, /* 10.2.3/17 */
687 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3) + 1),
691 "IPv4-VPNv4-plenn-short",
692 "IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, last plen short",
694 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
695 /* nexthop bytes */ 12,
696 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
698 /* Nexthop */ 192, 168, 0, 1,
699 /* SNPA (defunct, MBZ) */ 0x0,
700 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
702 0, 0, /* RD_TYPE_AS */
703 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
705 88 + 2, 0xff, 0, 0, /* tag */
707 0, 0, /* RD_TYPE_IP */
708 192, 168, 0, 1, /* IPv4 */
709 10, 2, 3, /* 10.2.3/17 */
711 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
715 "IPv4-VPNv4-bogus-rd-type",
716 "IPv4/VPNv4 MP Reach, RD, NH, 2 NLRI, unknown RD in 1st (log, but parse)",
718 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
719 /* nexthop bytes */ 12,
720 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
722 /* Nexthop */ 192, 168, 0, 1,
723 /* SNPA (defunct, MBZ) */ 0x0,
724 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
726 0xff, 0, /* Bogus RD */
727 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
729 88 + 17, 0xff, 0, 0, /* tag */
731 0, 0, /* RD_TYPE_IP */
732 192, 168, 0, 1, /* IPv4 */
733 10, 2, 3, /* 10.2.3/17 */
735 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
740 "IPv4/VPNv4 MP Reach, RD, Nexthop, 3 NLRI, 3rd 0 bogus",
742 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
743 /* nexthop bytes */ 12,
744 /* RD */ 0, 0, 0, 0, /* RD defined to be 0 */
746 /* Nexthop */ 192, 168, 0, 1,
747 /* SNPA (defunct, MBZ) */ 0x0,
748 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
750 0, 0, /* RD_TYPE_AS */
751 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
753 88 + 17, 0xff, 0, 0, /* tag */
755 0, 0, /* RD_TYPE_IP */
756 192, 168, 0, 1, /* IPv4 */
757 10, 2, 3, /* 10.2.3/17 */
758 0 /* 0/0, bogus for vpnv4 ?? */
760 (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3) + 1),
767 "IPv6, global nexthop, 1 default NLRI",
769 /* AFI / SAFI */ 0x0,
772 /* nexthop bytes */ 0x20,
773 /* Nexthop (global) */ 0x20,
789 /* Nexthop (local) */ 0xfe,
805 /* SNPA (defunct, MBZ) */ 0,
806 /* NLRI tuples */ /* Should have 0 here for ::/0, but
814 .desc
= "IPV4 MP Reach, flowspec, 1 NLRI",
816 /* AFI / SAFI */ 0x0,
821 0x06, /* FS Length */
822 0x01, /* FS dest prefix ID */
830 .parses
= SHOULD_PARSE
,
832 {NULL
, NULL
, {0}, 0, 0}};
834 /* MP_UNREACH_NLRI tests */
835 static struct test_segment mp_unreach_segments
[] = {
838 "IPV6 MP Unreach, 1 NLRI",
840 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
841 /* NLRI tuples */ 32, 0xff, 0xfe, 0x1,
842 0x2, /* fffe:102::/32 */
849 "IPV6 MP Unreach, 2 NLRIs",
851 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
852 /* NLRI tuples */ 32, 0xff, 0xfe, 0x1,
853 0x2, /* fffe:102::/32 */
854 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */
861 "IPv6-unreach-default",
862 "IPV6 MP Unreach, 2 NLRIs + default",
864 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
865 /* NLRI tuples */ 32, 0xff, 0xfe, 0x1,
866 0x2, /* fffe:102::/32 */
867 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */
868 0x0, 0x2, 0x0, 0x3, 0x0, /* ::/0 */
875 "IPV6 MP Unreach, NLRI bitlen overflow",
877 /* AFI / SAFI */ 0x0, AFI_IP6
, SAFI_UNICAST
,
878 /* NLRI tuples */ 120, 0xff, 0xfe, 0x1,
879 0x2, /* fffe:102::/32 */
880 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */
881 0x0, 0x2, 0x0, 0x3, 0, /* ::/0 */
888 "IPv4 MP Unreach, 2 NLRIs + default",
890 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
891 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
892 17, 10, 2, 3, /* 10.2.3/17 */
899 "IPv4-unreach-nlrilen",
900 "IPv4 MP Unreach, nlri length overflow",
902 /* AFI / SAFI */ 0x0, AFI_IP
, SAFI_UNICAST
,
903 /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */
910 "IPv4-unreach-VPNv4",
911 "IPv4/MPLS-labeled VPN MP Unreach, RD, 3 NLRIs",
913 /* AFI / SAFI */ 0x0, AFI_IP
, IANA_SAFI_MPLS_VPN
,
914 /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */
916 0, 0, /* RD_TYPE_AS */
917 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */
919 88 + 17, 0xff, 0, 0, /* tag */
921 0, 0, /* RD_TYPE_IP */
922 192, 168, 0, 1, /* IPv4 */
923 10, 2, 3, /* 10.2.3/17 */
925 (3 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)),
930 .desc
= "IPV4 MP Unreach, flowspec, 1 NLRI",
932 /* AFI / SAFI */ 0x0,
935 0x06, /* FS Length */
936 0x01, /* FS dest prefix ID */
944 .parses
= SHOULD_PARSE
,
946 {NULL
, NULL
, {0}, 0, 0}};
948 static struct test_segment mp_prefix_sid
[] = {
954 0x00, 0x00, 0x00, 0x00,
956 0x03, 0x00, 0x08, 0x00,
957 0x00, 0x0a, 0x1b, 0xfe,
961 .parses
= SHOULD_PARSE
,
963 {NULL
, NULL
, { 0 }, 0, 0},
966 /* nlri_parse indicates 0 on successful parse, and -1 otherwise.
967 * attr_parse indicates BGP_ATTR_PARSE_PROCEED/0 on success,
968 * and BGP_ATTR_PARSE_ERROR/-1 or lower negative ret on err.
970 static void handle_result(struct peer
*peer
, struct test_segment
*t
,
971 int parse_ret
, int nlri_ret
)
973 int oldfailed
= failed
;
975 printf("mp attr parsed?: %s\n", parse_ret
? "no" : "yes");
977 printf("nrli parsed?: %s\n", nlri_ret
? "no" : "yes");
978 printf("should parse?: %s\n", t
->parses
? "no" : "yes");
980 if ((parse_ret
!= 0 || nlri_ret
!= 0) != (t
->parses
!= 0))
986 (failed
> oldfailed
) ? VT100_RED
"failed!" VT100_RESET
987 : VT100_GREEN
"OK" VT100_RESET
);
989 printf("%s", (failed
> oldfailed
) ? "failed!" : "OK");
992 printf(" (%u)", failed
);
997 /* basic parsing test */
998 static void parse_test(struct peer
*peer
, struct test_segment
*t
, int type
)
1000 int parse_ret
= 0, nlri_ret
= 0;
1001 struct attr attr
= {};
1002 struct bgp_nlri nlri
= {};
1003 struct bgp_attr_parser_args attr_args
= {
1009 .flags
= BGP_ATTR_FLAG_OPTIONAL
,
1010 .startp
= BGP_INPUT_PNT(peer
),
1012 #define RANDOM_FUZZ 35
1013 stream_reset(peer
->curr
);
1014 stream_put(peer
->curr
, NULL
, RANDOM_FUZZ
);
1015 stream_set_getp(peer
->curr
, RANDOM_FUZZ
);
1017 stream_write(peer
->curr
, t
->data
, t
->len
);
1019 printf("%s: %s\n", t
->name
, t
->desc
);
1022 case BGP_ATTR_MP_REACH_NLRI
:
1023 parse_ret
= bgp_mp_reach_parse(&attr_args
, &nlri
);
1025 case BGP_ATTR_MP_UNREACH_NLRI
:
1026 parse_ret
= bgp_mp_unreach_parse(&attr_args
, &nlri
);
1028 case BGP_ATTR_PREFIX_SID
:
1029 parse_ret
= bgp_attr_prefix_sid(t
->len
, &attr_args
, &nlri
);
1032 printf("unknown type");
1037 iana_safi_t pkt_safi
;
1039 /* Convert AFI, SAFI to internal values, check. */
1040 if (bgp_map_afi_safi_int2iana(nlri
.afi
, nlri
.safi
, &pkt_afi
,
1044 printf("MP: %u(%u)/%u(%u): recv %u, nego %u\n", nlri
.afi
,
1045 pkt_afi
, nlri
.safi
, pkt_safi
,
1046 peer
->afc_recv
[nlri
.afi
][nlri
.safi
],
1047 peer
->afc_nego
[nlri
.afi
][nlri
.safi
]);
1051 if (type
== BGP_ATTR_MP_REACH_NLRI
)
1052 nlri_ret
= bgp_nlri_parse(peer
, &attr
, &nlri
, 0);
1053 else if (type
== BGP_ATTR_MP_UNREACH_NLRI
)
1054 nlri_ret
= bgp_nlri_parse(peer
, &attr
, &nlri
, 1);
1056 handle_result(peer
, t
, parse_ret
, nlri_ret
);
1059 static struct bgp
*bgp
;
1060 static as_t asn
= 100;
1064 struct interface ifp
;
1068 conf_bgp_debug_neighbor_events
= -1UL;
1069 conf_bgp_debug_packet
= -1UL;
1070 conf_bgp_debug_as4
= -1UL;
1071 conf_bgp_debug_flowspec
= -1UL;
1072 term_bgp_debug_neighbor_events
= -1UL;
1073 term_bgp_debug_packet
= -1UL;
1074 term_bgp_debug_as4
= -1UL;
1075 term_bgp_debug_flowspec
= -1UL;
1080 master
= thread_master_create("test mp attr");
1081 bgp_master_init(master
);
1082 vrf_init(NULL
, NULL
, NULL
, NULL
, NULL
);
1083 bgp_option_set(BGP_OPT_NO_LISTEN
);
1086 if (fileno(stdout
) >= 0)
1087 tty
= isatty(fileno(stdout
));
1089 if (bgp_get(&bgp
, &asn
, NULL
, BGP_INSTANCE_TYPE_DEFAULT
))
1092 peer
= peer_create_accept(bgp
);
1093 peer
->host
= (char *)"foo";
1094 peer
->status
= Established
;
1095 peer
->curr
= stream_new(BGP_MAX_PACKET_SIZE
);
1098 peer
->nexthop
.ifp
= &ifp
;
1100 for (i
= AFI_IP
; i
< AFI_MAX
; i
++)
1101 for (j
= SAFI_UNICAST
; j
< SAFI_MAX
; j
++) {
1102 peer
->afc
[i
][j
] = 1;
1103 peer
->afc_adv
[i
][j
] = 1;
1107 while (mp_reach_segments
[i
].name
)
1108 parse_test(peer
, &mp_reach_segments
[i
++],
1109 BGP_ATTR_MP_REACH_NLRI
);
1112 while (mp_unreach_segments
[i
].name
)
1113 parse_test(peer
, &mp_unreach_segments
[i
++],
1114 BGP_ATTR_MP_UNREACH_NLRI
);
1117 while (mp_prefix_sid
[i
].name
)
1118 parse_test(peer
, &mp_prefix_sid
[i
++],
1119 BGP_ATTR_PREFIX_SID
);
1120 printf("failures: %d\n", failed
);