2 * Copyright (C) 2000 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra 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 * GNU Zebra 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
37 #include "bgpd/bgpd.h"
38 #include "bgpd/bgp_table.h"
39 #include "bgpd/bgp_route.h"
40 #include "bgpd/bgp_attr.h"
41 #include "bgpd/bgp_nexthop.h"
42 #include "bgpd/bgp_nht.h"
43 #include "bgpd/bgp_debug.h"
44 #include "bgpd/bgp_damp.h"
45 #include "bgpd/bgp_fsm.h"
46 #include "bgpd/bgp_vty.h"
48 DEFINE_MTYPE_STATIC(BGPD
, MARTIAN_STRING
, "BGP Martian Address Intf String");
50 char *bnc_str(struct bgp_nexthop_cache
*bnc
, char *buf
, int size
)
52 prefix2str(&(bnc
->node
->p
), buf
, size
);
56 void bnc_nexthop_free(struct bgp_nexthop_cache
*bnc
)
58 nexthops_free(bnc
->nexthop
);
61 struct bgp_nexthop_cache
*bnc_new(void)
63 struct bgp_nexthop_cache
*bnc
;
65 bnc
= XCALLOC(MTYPE_BGP_NEXTHOP_CACHE
,
66 sizeof(struct bgp_nexthop_cache
));
67 LIST_INIT(&(bnc
->paths
));
71 void bnc_free(struct bgp_nexthop_cache
*bnc
)
73 bnc_nexthop_free(bnc
);
74 XFREE(MTYPE_BGP_NEXTHOP_CACHE
, bnc
);
77 /* Reset and free all BGP nexthop cache. */
78 static void bgp_nexthop_cache_reset(struct bgp_table
*table
)
81 struct bgp_nexthop_cache
*bnc
;
83 for (rn
= bgp_table_top(table
); rn
; rn
= bgp_route_next(rn
)) {
84 bnc
= bgp_node_get_bgp_nexthop_info(rn
);
88 while (!LIST_EMPTY(&(bnc
->paths
))) {
89 struct bgp_path_info
*path
= LIST_FIRST(&(bnc
->paths
));
91 path_nh_map(path
, bnc
, false);
95 bgp_node_set_bgp_nexthop_info(rn
, NULL
);
100 static void *bgp_tip_hash_alloc(void *p
)
102 const struct in_addr
*val
= (const struct in_addr
*)p
;
103 struct tip_addr
*addr
;
105 addr
= XMALLOC(MTYPE_TIP_ADDR
, sizeof(struct tip_addr
));
107 addr
->addr
.s_addr
= val
->s_addr
;
112 static void bgp_tip_hash_free(void *addr
)
114 XFREE(MTYPE_TIP_ADDR
, addr
);
117 static unsigned int bgp_tip_hash_key_make(const void *p
)
119 const struct tip_addr
*addr
= p
;
121 return jhash_1word(addr
->addr
.s_addr
, 0);
124 static bool bgp_tip_hash_cmp(const void *p1
, const void *p2
)
126 const struct tip_addr
*addr1
= p1
;
127 const struct tip_addr
*addr2
= p2
;
129 return addr1
->addr
.s_addr
== addr2
->addr
.s_addr
;
132 void bgp_tip_hash_init(struct bgp
*bgp
)
134 bgp
->tip_hash
= hash_create(bgp_tip_hash_key_make
, bgp_tip_hash_cmp
,
138 void bgp_tip_hash_destroy(struct bgp
*bgp
)
140 if (bgp
->tip_hash
== NULL
)
142 hash_clean(bgp
->tip_hash
, bgp_tip_hash_free
);
143 hash_free(bgp
->tip_hash
);
144 bgp
->tip_hash
= NULL
;
147 void bgp_tip_add(struct bgp
*bgp
, struct in_addr
*tip
)
150 struct tip_addr
*addr
;
154 addr
= hash_get(bgp
->tip_hash
, &tmp
, bgp_tip_hash_alloc
);
161 void bgp_tip_del(struct bgp
*bgp
, struct in_addr
*tip
)
164 struct tip_addr
*addr
;
168 addr
= hash_lookup(bgp
->tip_hash
, &tmp
);
169 /* may have been deleted earlier by bgp_interface_down() */
175 if (addr
->refcnt
== 0) {
176 hash_release(bgp
->tip_hash
, addr
);
177 XFREE(MTYPE_TIP_ADDR
, addr
);
181 /* BGP own address structure */
184 struct list
*ifp_name_list
;
187 static void show_address_entry(struct hash_bucket
*bucket
, void *args
)
189 struct vty
*vty
= (struct vty
*)args
;
190 struct bgp_addr
*addr
= (struct bgp_addr
*)bucket
->data
;
192 struct listnode
*node
;
194 vty_out(vty
, "addr: %s, count: %d : ", inet_ntoa(addr
->addr
),
195 addr
->ifp_name_list
->count
);
197 for (ALL_LIST_ELEMENTS_RO(addr
->ifp_name_list
, node
, name
)) {
198 vty_out(vty
, " %s,", name
);
204 void bgp_nexthop_show_address_hash(struct vty
*vty
, struct bgp
*bgp
)
206 hash_iterate(bgp
->address_hash
,
207 (void (*)(struct hash_bucket
*, void *))show_address_entry
,
211 static void bgp_address_hash_string_del(void *val
)
215 XFREE(MTYPE_MARTIAN_STRING
, data
);
218 static void *bgp_address_hash_alloc(void *p
)
220 const struct in_addr
*val
= (const struct in_addr
*)p
;
221 struct bgp_addr
*addr
;
223 addr
= XMALLOC(MTYPE_BGP_ADDR
, sizeof(struct bgp_addr
));
224 addr
->addr
.s_addr
= val
->s_addr
;
226 addr
->ifp_name_list
= list_new();
227 addr
->ifp_name_list
->del
= bgp_address_hash_string_del
;
232 static void bgp_address_hash_free(void *data
)
234 struct bgp_addr
*addr
= data
;
236 list_delete(&addr
->ifp_name_list
);
237 XFREE(MTYPE_BGP_ADDR
, addr
);
240 static unsigned int bgp_address_hash_key_make(const void *p
)
242 const struct bgp_addr
*addr
= p
;
244 return jhash_1word(addr
->addr
.s_addr
, 0);
247 static bool bgp_address_hash_cmp(const void *p1
, const void *p2
)
249 const struct bgp_addr
*addr1
= p1
;
250 const struct bgp_addr
*addr2
= p2
;
252 return addr1
->addr
.s_addr
== addr2
->addr
.s_addr
;
255 void bgp_address_init(struct bgp
*bgp
)
258 hash_create(bgp_address_hash_key_make
, bgp_address_hash_cmp
,
262 void bgp_address_destroy(struct bgp
*bgp
)
264 if (bgp
->address_hash
== NULL
)
266 hash_clean(bgp
->address_hash
, bgp_address_hash_free
);
267 hash_free(bgp
->address_hash
);
268 bgp
->address_hash
= NULL
;
271 static void bgp_address_add(struct bgp
*bgp
, struct connected
*ifc
,
275 struct bgp_addr
*addr
;
276 struct listnode
*node
;
279 tmp
.addr
= p
->u
.prefix4
;
281 addr
= hash_get(bgp
->address_hash
, &tmp
, bgp_address_hash_alloc
);
283 for (ALL_LIST_ELEMENTS_RO(addr
->ifp_name_list
, node
, name
)) {
284 if (strcmp(ifc
->ifp
->name
, name
) == 0)
288 name
= XSTRDUP(MTYPE_MARTIAN_STRING
, ifc
->ifp
->name
);
289 listnode_add(addr
->ifp_name_list
, name
);
293 static void bgp_address_del(struct bgp
*bgp
, struct connected
*ifc
,
297 struct bgp_addr
*addr
;
298 struct listnode
*node
;
301 tmp
.addr
= p
->u
.prefix4
;
303 addr
= hash_lookup(bgp
->address_hash
, &tmp
);
304 /* may have been deleted earlier by bgp_interface_down() */
308 for (ALL_LIST_ELEMENTS_RO(addr
->ifp_name_list
, node
, name
)) {
309 if (strcmp(ifc
->ifp
->name
, name
) == 0)
314 list_delete_node(addr
->ifp_name_list
, node
);
315 XFREE(MTYPE_MARTIAN_STRING
, name
);
318 if (addr
->ifp_name_list
->count
== 0) {
319 hash_release(bgp
->address_hash
, addr
);
320 list_delete(&addr
->ifp_name_list
);
321 XFREE(MTYPE_BGP_ADDR
, addr
);
326 struct bgp_connected_ref
{
330 void bgp_connected_add(struct bgp
*bgp
, struct connected
*ifc
)
335 struct bgp_connected_ref
*bc
;
336 struct listnode
*node
, *nnode
;
341 p
= *(CONNECTED_PREFIX(ifc
));
342 if (addr
->family
== AF_INET
) {
343 apply_mask_ipv4((struct prefix_ipv4
*)&p
);
345 if (prefix_ipv4_any((struct prefix_ipv4
*)&p
))
348 bgp_address_add(bgp
, ifc
, addr
);
350 rn
= bgp_node_get(bgp
->connected_table
[AFI_IP
],
351 (struct prefix
*)&p
);
352 bc
= bgp_node_get_bgp_connected_ref_info(rn
);
356 bc
= XCALLOC(MTYPE_BGP_CONN
,
357 sizeof(struct bgp_connected_ref
));
359 bgp_node_set_bgp_connected_ref_info(rn
, bc
);
362 for (ALL_LIST_ELEMENTS(bgp
->peer
, node
, nnode
, peer
)) {
364 && (strcmp(peer
->conf_if
, ifc
->ifp
->name
) == 0)
365 && peer
->status
!= Established
366 && !CHECK_FLAG(peer
->flags
,
367 PEER_FLAG_IFPEER_V6ONLY
)) {
368 if (peer_active(peer
))
369 BGP_EVENT_ADD(peer
, BGP_Stop
);
370 BGP_EVENT_ADD(peer
, BGP_Start
);
373 } else if (addr
->family
== AF_INET6
) {
374 apply_mask_ipv6((struct prefix_ipv6
*)&p
);
376 if (IN6_IS_ADDR_UNSPECIFIED(&p
.u
.prefix6
))
379 if (IN6_IS_ADDR_LINKLOCAL(&p
.u
.prefix6
))
382 rn
= bgp_node_get(bgp
->connected_table
[AFI_IP6
],
383 (struct prefix
*)&p
);
385 bc
= bgp_node_get_bgp_connected_ref_info(rn
);
389 bc
= XCALLOC(MTYPE_BGP_CONN
,
390 sizeof(struct bgp_connected_ref
));
392 bgp_node_set_bgp_connected_ref_info(rn
, bc
);
397 void bgp_connected_delete(struct bgp
*bgp
, struct connected
*ifc
)
401 struct bgp_node
*rn
= NULL
;
402 struct bgp_connected_ref
*bc
;
406 p
= *(CONNECTED_PREFIX(ifc
));
408 if (addr
->family
== AF_INET
) {
409 if (prefix_ipv4_any((struct prefix_ipv4
*)&p
))
412 bgp_address_del(bgp
, ifc
, addr
);
414 rn
= bgp_node_lookup(bgp
->connected_table
[AFI_IP
], &p
);
415 } else if (addr
->family
== AF_INET6
) {
416 if (IN6_IS_ADDR_UNSPECIFIED(&p
.u
.prefix6
))
419 if (IN6_IS_ADDR_LINKLOCAL(&p
.u
.prefix6
))
422 rn
= bgp_node_lookup(bgp
->connected_table
[AFI_IP6
],
423 (struct prefix
*)&p
);
429 bc
= bgp_node_get_bgp_connected_ref_info(rn
);
431 if (bc
->refcnt
== 0) {
432 XFREE(MTYPE_BGP_CONN
, bc
);
433 bgp_node_set_bgp_connected_ref_info(rn
, NULL
);
439 static void bgp_connected_cleanup(struct route_table
*table
,
440 struct route_node
*rn
)
442 struct bgp_connected_ref
*bc
;
443 struct bgp_node
*bn
= bgp_node_from_rnode(rn
);
445 bc
= bgp_node_get_bgp_connected_ref_info(bn
);
450 if (bc
->refcnt
== 0) {
451 XFREE(MTYPE_BGP_CONN
, bc
);
452 bgp_node_set_bgp_connected_ref_info(bn
, NULL
);
456 int bgp_nexthop_self(struct bgp
*bgp
, struct in_addr nh_addr
)
458 struct bgp_addr tmp
, *addr
;
459 struct tip_addr tmp_tip
, *tip
;
463 addr
= hash_lookup(bgp
->address_hash
, &tmp
);
467 tmp_tip
.addr
= nh_addr
;
468 tip
= hash_lookup(bgp
->tip_hash
, &tmp_tip
);
475 int bgp_multiaccess_check_v4(struct in_addr nexthop
, struct peer
*peer
)
477 struct bgp_node
*rn1
;
478 struct bgp_node
*rn2
;
483 p
.prefixlen
= IPV4_MAX_BITLEN
;
484 p
.u
.prefix4
= nexthop
;
486 rn1
= bgp_node_match(peer
->bgp
->connected_table
[AFI_IP
], &p
);
491 p
.prefixlen
= IPV4_MAX_BITLEN
;
492 p
.u
.prefix4
= peer
->su
.sin
.sin_addr
;
494 rn2
= bgp_node_match(peer
->bgp
->connected_table
[AFI_IP
], &p
);
496 bgp_unlock_node(rn1
);
500 ret
= (rn1
== rn2
) ? 1 : 0;
502 bgp_unlock_node(rn1
);
503 bgp_unlock_node(rn2
);
508 int bgp_multiaccess_check_v6(struct in6_addr nexthop
, struct peer
*peer
)
510 struct bgp_node
*rn1
;
511 struct bgp_node
*rn2
;
516 p
.prefixlen
= IPV6_MAX_BITLEN
;
517 p
.u
.prefix6
= nexthop
;
519 rn1
= bgp_node_match(peer
->bgp
->connected_table
[AFI_IP6
], &p
);
524 p
.prefixlen
= IPV6_MAX_BITLEN
;
525 p
.u
.prefix6
= peer
->su
.sin6
.sin6_addr
;
527 rn2
= bgp_node_match(peer
->bgp
->connected_table
[AFI_IP6
], &p
);
529 bgp_unlock_node(rn1
);
533 ret
= (rn1
== rn2
) ? 1 : 0;
535 bgp_unlock_node(rn1
);
536 bgp_unlock_node(rn2
);
541 int bgp_subgrp_multiaccess_check_v6(struct in6_addr nexthop
,
542 struct update_subgroup
*subgrp
)
544 struct bgp_node
*rn1
= NULL
, *rn2
= NULL
;
545 struct peer_af
*paf
= NULL
;
546 struct prefix p
= {0}, np
= {0};
547 struct bgp
*bgp
= NULL
;
549 np
.family
= AF_INET6
;
550 np
.prefixlen
= IPV6_MAX_BITLEN
;
551 np
.u
.prefix6
= nexthop
;
554 p
.prefixlen
= IPV6_MAX_BITLEN
;
556 bgp
= SUBGRP_INST(subgrp
);
557 rn1
= bgp_node_match(bgp
->connected_table
[AFI_IP6
], &np
);
561 SUBGRP_FOREACH_PEER (subgrp
, paf
) {
563 p
.u
.prefix6
= paf
->peer
->su
.sin6
.sin6_addr
;
564 rn2
= bgp_node_match(bgp
->connected_table
[AFI_IP6
], &p
);
566 bgp_unlock_node(rn1
);
567 bgp_unlock_node(rn2
);
572 bgp_unlock_node(rn2
);
575 bgp_unlock_node(rn1
);
579 int bgp_subgrp_multiaccess_check_v4(struct in_addr nexthop
,
580 struct update_subgroup
*subgrp
)
582 struct bgp_node
*rn1
, *rn2
;
588 np
.prefixlen
= IPV4_MAX_BITLEN
;
589 np
.u
.prefix4
= nexthop
;
592 p
.prefixlen
= IPV4_MAX_BITLEN
;
594 bgp
= SUBGRP_INST(subgrp
);
595 rn1
= bgp_node_match(bgp
->connected_table
[AFI_IP
], &np
);
599 SUBGRP_FOREACH_PEER (subgrp
, paf
) {
600 p
.u
.prefix4
= paf
->peer
->su
.sin
.sin_addr
;
602 rn2
= bgp_node_match(bgp
->connected_table
[AFI_IP
], &p
);
604 bgp_unlock_node(rn1
);
605 bgp_unlock_node(rn2
);
610 bgp_unlock_node(rn2
);
613 bgp_unlock_node(rn1
);
617 static void bgp_show_nexthops_detail(struct vty
*vty
, struct bgp
*bgp
,
618 struct bgp_nexthop_cache
*bnc
)
620 char buf
[PREFIX2STR_BUFFER
];
621 struct nexthop
*nexthop
;
623 for (nexthop
= bnc
->nexthop
; nexthop
; nexthop
= nexthop
->next
)
624 switch (nexthop
->type
) {
625 case NEXTHOP_TYPE_IPV6
:
626 vty_out(vty
, " gate %s\n",
627 inet_ntop(AF_INET6
, &nexthop
->gate
.ipv6
, buf
,
630 case NEXTHOP_TYPE_IPV6_IFINDEX
:
631 vty_out(vty
, " gate %s, if %s\n",
632 inet_ntop(AF_INET6
, &nexthop
->gate
.ipv6
, buf
,
634 ifindex2ifname(nexthop
->ifindex
, bgp
->vrf_id
));
636 case NEXTHOP_TYPE_IPV4
:
637 vty_out(vty
, " gate %s\n",
638 inet_ntop(AF_INET
, &nexthop
->gate
.ipv4
, buf
,
641 case NEXTHOP_TYPE_IFINDEX
:
642 vty_out(vty
, " if %s\n",
643 ifindex2ifname(nexthop
->ifindex
, bgp
->vrf_id
));
645 case NEXTHOP_TYPE_IPV4_IFINDEX
:
646 vty_out(vty
, " gate %s, if %s\n",
647 inet_ntop(AF_INET
, &nexthop
->gate
.ipv4
, buf
,
649 ifindex2ifname(nexthop
->ifindex
, bgp
->vrf_id
));
651 case NEXTHOP_TYPE_BLACKHOLE
:
652 vty_out(vty
, " blackhole\n");
655 vty_out(vty
, " invalid nexthop type %u\n",
660 static void bgp_show_nexthops(struct vty
*vty
, struct bgp
*bgp
, int detail
,
664 struct bgp_nexthop_cache
*bnc
;
665 char buf
[PREFIX2STR_BUFFER
];
668 struct bgp_table
**table
;
671 vty_out(vty
, "Current BGP import check cache:\n");
673 vty_out(vty
, "Current BGP nexthop cache:\n");
675 table
= bgp
->import_check_table
;
677 table
= bgp
->nexthop_cache_table
;
678 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++) {
679 if (!table
|| !table
[afi
])
681 for (rn
= bgp_table_top(table
[afi
]); rn
;
682 rn
= bgp_route_next(rn
)) {
685 bnc
= bgp_node_get_bgp_nexthop_info(rn
);
688 peer
= (struct peer
*)bnc
->nht_info
;
690 if (CHECK_FLAG(bnc
->flags
, BGP_NEXTHOP_VALID
)) {
692 " %s valid [IGP metric %d], #paths %d",
693 inet_ntop(rn
->p
.family
,
694 &rn
->p
.u
.prefix
, buf
,
696 bnc
->metric
, bnc
->path_count
);
698 vty_out(vty
, ", peer %s", peer
->host
);
704 bgp_show_nexthops_detail(vty
, bgp
, bnc
);
707 vty_out(vty
, " %s invalid",
708 inet_ntop(rn
->p
.family
,
709 &rn
->p
.u
.prefix
, buf
,
712 vty_out(vty
, ", peer %s", peer
->host
);
714 if (CHECK_FLAG(bnc
->flags
,
715 BGP_NEXTHOP_CONNECTED
))
716 vty_out(vty
, " Must be Connected\n");
717 if (!CHECK_FLAG(bnc
->flags
,
718 BGP_NEXTHOP_REGISTERED
))
719 vty_out(vty
, " Is not Registered\n");
721 tbuf
= time(NULL
) - (bgp_clock() - bnc
->last_update
);
722 vty_out(vty
, " Last update: %s", ctime(&tbuf
));
728 static int show_ip_bgp_nexthop_table(struct vty
*vty
, const char *name
,
729 int detail
, bool import_table
)
734 bgp
= bgp_lookup_by_name(name
);
736 bgp
= bgp_get_default();
738 vty_out(vty
, "%% No such BGP instance exist\n");
742 bgp_show_nexthops(vty
, bgp
, detail
, import_table
);
747 static void bgp_show_all_instances_nexthops_vty(struct vty
*vty
)
749 struct listnode
*node
, *nnode
;
752 for (ALL_LIST_ELEMENTS(bm
->bgp
, node
, nnode
, bgp
)) {
753 vty_out(vty
, "\nInstance %s:\n",
754 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
757 bgp_show_nexthops(vty
, bgp
, 0, false);
761 DEFUN (show_ip_bgp_nexthop
,
762 show_ip_bgp_nexthop_cmd
,
763 "show [ip] bgp [<view|vrf> VIEWVRFNAME] nexthop [detail]",
767 BGP_INSTANCE_HELP_STR
768 "BGP nexthop table\n"
769 "Show detailed information\n")
774 if (argv_find(argv
, argc
, "view", &idx
)
775 || argv_find(argv
, argc
, "vrf", &idx
))
776 vrf
= argv
[++idx
]->arg
;
777 int detail
= argv_find(argv
, argc
, "detail", &idx
) ? 1 : 0;
779 return show_ip_bgp_nexthop_table(vty
, vrf
, detail
, false);
782 DEFUN (show_ip_bgp_import_check
,
783 show_ip_bgp_import_check_cmd
,
784 "show [ip] bgp [<view|vrf> VIEWVRFNAME] import-check-table [detail]",
788 BGP_INSTANCE_HELP_STR
789 "BGP import check table\n"
790 "Show detailed information\n")
795 if (argv_find(argv
, argc
, "view", &idx
)
796 || argv_find(argv
, argc
, "vrf", &idx
))
797 vrf
= argv
[++idx
]->arg
;
798 int detail
= argv_find(argv
, argc
, "detail", &idx
) ? 1 : 0;
799 return show_ip_bgp_nexthop_table(vty
, vrf
, detail
, true);
802 DEFUN (show_ip_bgp_instance_all_nexthop
,
803 show_ip_bgp_instance_all_nexthop_cmd
,
804 "show [ip] bgp <view|vrf> all nexthop",
808 BGP_INSTANCE_ALL_HELP_STR
809 "BGP nexthop table\n")
811 bgp_show_all_instances_nexthops_vty(vty
);
815 void bgp_scan_init(struct bgp
*bgp
)
819 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++) {
820 bgp
->nexthop_cache_table
[afi
] =
821 bgp_table_init(bgp
, afi
, SAFI_UNICAST
);
822 bgp
->connected_table
[afi
] = bgp_table_init(bgp
, afi
,
824 bgp
->import_check_table
[afi
] =
825 bgp_table_init(bgp
, afi
, SAFI_UNICAST
);
829 void bgp_scan_vty_init(void)
831 install_element(VIEW_NODE
, &show_ip_bgp_nexthop_cmd
);
832 install_element(VIEW_NODE
, &show_ip_bgp_import_check_cmd
);
833 install_element(VIEW_NODE
, &show_ip_bgp_instance_all_nexthop_cmd
);
836 void bgp_scan_finish(struct bgp
*bgp
)
840 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++) {
841 /* Only the current one needs to be reset. */
842 bgp_nexthop_cache_reset(bgp
->nexthop_cache_table
[afi
]);
843 bgp_table_unlock(bgp
->nexthop_cache_table
[afi
]);
844 bgp
->nexthop_cache_table
[afi
] = NULL
;
846 bgp
->connected_table
[afi
]->route_table
->cleanup
=
847 bgp_connected_cleanup
;
848 bgp_table_unlock(bgp
->connected_table
[afi
]);
849 bgp
->connected_table
[afi
] = NULL
;
851 bgp_table_unlock(bgp
->import_check_table
[afi
]);
852 bgp
->import_check_table
[afi
] = NULL
;