]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_nexthop.c
lib: migrate to new memory-type handling
[mirror_frr.git] / bgpd / bgp_nexthop.c
CommitLineData
718e3744 1/* BGP nexthop scan
2 Copyright (C) 2000 Kunihiro Ishiguro
3
4This file is part of GNU Zebra.
5
6GNU Zebra is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11GNU Zebra is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Zebra; see the file COPYING. If not, write to the Free
18Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1902111-1307, USA. */
20
21#include <zebra.h>
22
23#include "command.h"
24#include "thread.h"
25#include "prefix.h"
26#include "zclient.h"
27#include "stream.h"
28#include "network.h"
29#include "log.h"
30#include "memory.h"
10f9bf3f
JBD
31#include "hash.h"
32#include "jhash.h"
fb018d25 33#include "nexthop.h"
3f9c7369 34#include "queue.h"
039f3a34 35#include "filter.h"
718e3744 36
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"
fb018d25 42#include "bgpd/bgp_nht.h"
718e3744 43#include "bgpd/bgp_debug.h"
44#include "bgpd/bgp_damp.h"
8ffedcea 45#include "bgpd/bgp_fsm.h"
8386ac43 46#include "bgpd/bgp_vty.h"
718e3744 47#include "zebra/rib.h"
48#include "zebra/zserv.h" /* For ZEBRA_SERV_PATH. */
49
fb018d25 50
718e3744 51
fb018d25
DS
52char *
53bnc_str (struct bgp_nexthop_cache *bnc, char *buf, int size)
54{
55 prefix2str(&(bnc->node->p), buf, size);
56 return buf;
57}
58
fb018d25 59void
718e3744 60bnc_nexthop_free (struct bgp_nexthop_cache *bnc)
61{
62 struct nexthop *nexthop;
63 struct nexthop *next = NULL;
64
65 for (nexthop = bnc->nexthop; nexthop; nexthop = next)
66 {
67 next = nexthop->next;
68 XFREE (MTYPE_NEXTHOP, nexthop);
69 }
70}
71
fb018d25 72struct bgp_nexthop_cache *
ffd0c037 73bnc_new (void)
718e3744 74{
fb018d25
DS
75 struct bgp_nexthop_cache *bnc;
76
77 bnc = XCALLOC (MTYPE_BGP_NEXTHOP_CACHE, sizeof (struct bgp_nexthop_cache));
78 LIST_INIT(&(bnc->paths));
79 return bnc;
718e3744 80}
81
fb018d25 82void
718e3744 83bnc_free (struct bgp_nexthop_cache *bnc)
84{
85 bnc_nexthop_free (bnc);
86 XFREE (MTYPE_BGP_NEXTHOP_CACHE, bnc);
87}
6b0655a2 88
718e3744 89/* Reset and free all BGP nexthop cache. */
94f2b392 90static void
718e3744 91bgp_nexthop_cache_reset (struct bgp_table *table)
92{
93 struct bgp_node *rn;
94 struct bgp_nexthop_cache *bnc;
95
96 for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn))
97 if ((bnc = rn->info) != NULL)
98 {
99 bnc_free (bnc);
100 rn->info = NULL;
101 bgp_unlock_node (rn);
102 }
103}
104
10f9bf3f
JBD
105/* BGP own address structure */
106struct bgp_addr
107{
108 struct in_addr addr;
109 int refcnt;
110};
111
10f9bf3f
JBD
112static void *
113bgp_address_hash_alloc (void *p)
114{
ffd0c037 115 const struct in_addr *val = (const struct in_addr *)p;
10f9bf3f
JBD
116 struct bgp_addr *addr;
117
118 addr = XMALLOC (MTYPE_BGP_ADDR, sizeof (struct bgp_addr));
119 addr->refcnt = 0;
120 addr->addr.s_addr = val->s_addr;
121
122 return addr;
123}
124
125static unsigned int
126bgp_address_hash_key_make (void *p)
127{
128 const struct bgp_addr *addr = p;
129
130 return jhash_1word(addr->addr.s_addr, 0);
131}
132
133static int
134bgp_address_hash_cmp (const void *p1, const void *p2)
135{
136 const struct bgp_addr *addr1 = p1;
137 const struct bgp_addr *addr2 = p2;
138
139 return addr1->addr.s_addr == addr2->addr.s_addr;
140}
141
142void
6aeb9e78 143bgp_address_init (struct bgp *bgp)
10f9bf3f 144{
6aeb9e78 145 bgp->address_hash = hash_create (bgp_address_hash_key_make,
10f9bf3f
JBD
146 bgp_address_hash_cmp);
147}
148
bb86c601
LB
149void
150bgp_address_destroy (struct bgp *bgp)
151{
005b6bc0
LB
152 if (bgp->address_hash == NULL)
153 return;
bb86c601
LB
154 hash_clean(bgp->address_hash, NULL);
155 hash_free(bgp->address_hash);
156 bgp->address_hash = NULL;
157}
158
10f9bf3f 159static void
6aeb9e78 160bgp_address_add (struct bgp *bgp, struct prefix *p)
10f9bf3f
JBD
161{
162 struct bgp_addr tmp;
163 struct bgp_addr *addr;
164
165 tmp.addr = p->u.prefix4;
166
6aeb9e78 167 addr = hash_get (bgp->address_hash, &tmp, bgp_address_hash_alloc);
5ce10e92
DS
168 if (!addr)
169 return;
170
10f9bf3f
JBD
171 addr->refcnt++;
172}
173
174static void
6aeb9e78 175bgp_address_del (struct bgp *bgp, struct prefix *p)
10f9bf3f
JBD
176{
177 struct bgp_addr tmp;
178 struct bgp_addr *addr;
179
180 tmp.addr = p->u.prefix4;
181
6aeb9e78 182 addr = hash_lookup (bgp->address_hash, &tmp);
9e47abd8
RG
183 /* may have been deleted earlier by bgp_interface_down() */
184 if (addr == NULL)
185 return;
186
10f9bf3f
JBD
187 addr->refcnt--;
188
189 if (addr->refcnt == 0)
190 {
6aeb9e78 191 hash_release (bgp->address_hash, addr);
10f9bf3f
JBD
192 XFREE (MTYPE_BGP_ADDR, addr);
193 }
194}
195
6b0655a2 196
5932020b 197struct bgp_connected_ref
718e3744 198{
199 unsigned int refcnt;
200};
201
202void
6aeb9e78 203bgp_connected_add (struct bgp *bgp, struct connected *ifc)
718e3744 204{
205 struct prefix p;
206 struct prefix *addr;
718e3744 207 struct bgp_node *rn;
5932020b 208 struct bgp_connected_ref *bc;
6aeb9e78 209 struct listnode *node, *nnode;
8ffedcea 210 struct peer *peer;
718e3744 211
718e3744 212 addr = ifc->address;
718e3744 213
4608cb43 214 p = *(CONNECTED_PREFIX(ifc));
718e3744 215 if (addr->family == AF_INET)
216 {
718e3744 217 apply_mask_ipv4 ((struct prefix_ipv4 *) &p);
218
219 if (prefix_ipv4_any ((struct prefix_ipv4 *) &p))
220 return;
221
6aeb9e78 222 bgp_address_add (bgp, addr);
10f9bf3f 223
6aeb9e78 224 rn = bgp_node_get (bgp->connected_table[AFI_IP], (struct prefix *) &p);
718e3744 225 if (rn->info)
226 {
227 bc = rn->info;
228 bc->refcnt++;
229 }
230 else
231 {
6c88b44d 232 bc = XCALLOC (MTYPE_BGP_CONN, sizeof (struct bgp_connected_ref));
718e3744 233 bc->refcnt = 1;
234 rn->info = bc;
235 }
8ffedcea 236
6aeb9e78
DS
237 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
238 {
239 if (peer->conf_if && (strcmp (peer->conf_if, ifc->ifp->name) == 0) &&
e5d1e72d 240 peer->status != Established &&
6aeb9e78
DS
241 !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))
242 {
243 if (peer_active(peer))
244 BGP_EVENT_ADD (peer, BGP_Stop);
245 BGP_EVENT_ADD (peer, BGP_Start);
246 }
247 }
718e3744 248 }
249#ifdef HAVE_IPV6
e4529636 250 else if (addr->family == AF_INET6)
718e3744 251 {
718e3744 252 apply_mask_ipv6 ((struct prefix_ipv6 *) &p);
253
254 if (IN6_IS_ADDR_UNSPECIFIED (&p.u.prefix6))
255 return;
256
257 if (IN6_IS_ADDR_LINKLOCAL (&p.u.prefix6))
258 return;
259
6aeb9e78 260 rn = bgp_node_get (bgp->connected_table[AFI_IP6], (struct prefix *) &p);
718e3744 261 if (rn->info)
262 {
263 bc = rn->info;
264 bc->refcnt++;
265 }
266 else
267 {
6c88b44d 268 bc = XCALLOC (MTYPE_BGP_CONN, sizeof (struct bgp_connected_ref));
718e3744 269 bc->refcnt = 1;
270 rn->info = bc;
271 }
272 }
273#endif /* HAVE_IPV6 */
274}
275
276void
6aeb9e78 277bgp_connected_delete (struct bgp *bgp, struct connected *ifc)
718e3744 278{
279 struct prefix p;
280 struct prefix *addr;
718e3744 281 struct bgp_node *rn;
5932020b 282 struct bgp_connected_ref *bc;
718e3744 283
718e3744 284 addr = ifc->address;
718e3744 285
4608cb43 286 p = *(CONNECTED_PREFIX(ifc));
718e3744 287 if (addr->family == AF_INET)
288 {
718e3744 289 apply_mask_ipv4 ((struct prefix_ipv4 *) &p);
290
291 if (prefix_ipv4_any ((struct prefix_ipv4 *) &p))
292 return;
293
6aeb9e78 294 bgp_address_del (bgp, addr);
10f9bf3f 295
6aeb9e78 296 rn = bgp_node_lookup (bgp->connected_table[AFI_IP], &p);
718e3744 297 if (! rn)
298 return;
299
300 bc = rn->info;
301 bc->refcnt--;
302 if (bc->refcnt == 0)
303 {
6c88b44d 304 XFREE (MTYPE_BGP_CONN, bc);
718e3744 305 rn->info = NULL;
306 }
307 bgp_unlock_node (rn);
308 bgp_unlock_node (rn);
309 }
310#ifdef HAVE_IPV6
311 else if (addr->family == AF_INET6)
312 {
718e3744 313 apply_mask_ipv6 ((struct prefix_ipv6 *) &p);
314
315 if (IN6_IS_ADDR_UNSPECIFIED (&p.u.prefix6))
316 return;
317
318 if (IN6_IS_ADDR_LINKLOCAL (&p.u.prefix6))
319 return;
320
6aeb9e78 321 rn = bgp_node_lookup (bgp->connected_table[AFI_IP6], (struct prefix *) &p);
718e3744 322 if (! rn)
323 return;
324
325 bc = rn->info;
326 bc->refcnt--;
327 if (bc->refcnt == 0)
328 {
6c88b44d 329 XFREE (MTYPE_BGP_CONN, bc);
718e3744 330 rn->info = NULL;
331 }
332 bgp_unlock_node (rn);
333 bgp_unlock_node (rn);
334 }
335#endif /* HAVE_IPV6 */
336}
337
338int
6aeb9e78 339bgp_nexthop_self (struct bgp *bgp, struct attr *attr)
718e3744 340{
10f9bf3f 341 struct bgp_addr tmp, *addr;
718e3744 342
10f9bf3f
JBD
343 tmp.addr = attr->nexthop;
344
6aeb9e78 345 addr = hash_lookup (bgp->address_hash, &tmp);
10f9bf3f
JBD
346 if (addr)
347 return 1;
718e3744 348
718e3744 349 return 0;
350}
6b0655a2 351
718e3744 352int
fc9a856f 353bgp_multiaccess_check_v4 (struct in_addr nexthop, struct peer *peer)
718e3744 354{
355 struct bgp_node *rn1;
356 struct bgp_node *rn2;
fc9a856f 357 struct prefix p;
718e3744 358 int ret;
359
fc9a856f
DS
360 p.family = AF_INET;
361 p.prefixlen = IPV4_MAX_BITLEN;
362 p.u.prefix4 = nexthop;
718e3744 363
6aeb9e78 364 rn1 = bgp_node_match (peer->bgp->connected_table[AFI_IP], &p);
fc9a856f 365 if (!rn1)
718e3744 366 return 0;
718e3744 367
fc9a856f
DS
368 p.family = AF_INET;
369 p.prefixlen = IPV4_MAX_BITLEN;
370 p.u.prefix4 = peer->su.sin.sin_addr;
718e3744 371
6aeb9e78 372 rn2 = bgp_node_match (peer->bgp->connected_table[AFI_IP], &p);
fc9a856f 373 if (!rn2)
718e3744 374 {
fc9a856f
DS
375 bgp_unlock_node(rn1);
376 return 0;
718e3744 377 }
378
fc9a856f 379 ret = (rn1 == rn2) ? 1 : 0;
718e3744 380
fc9a856f
DS
381 bgp_unlock_node(rn1);
382 bgp_unlock_node(rn2);
718e3744 383
fc9a856f 384 return (ret);
718e3744 385}
386
f186de26 387static void
388bgp_show_nexthops (struct vty *vty, struct bgp *bgp, int detail)
fb018d25
DS
389{
390 struct bgp_node *rn;
391 struct bgp_nexthop_cache *bnc;
da11a696 392 char buf[PREFIX2STR_BUFFER];
77217fd4 393 struct nexthop *nexthop;
fb018d25 394 time_t tbuf;
da11a696 395 afi_t afi;
fb018d25
DS
396
397 vty_out (vty, "Current BGP nexthop cache:%s", VTY_NEWLINE);
da11a696
DS
398 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
399 {
6aeb9e78 400 for (rn = bgp_table_top (bgp->nexthop_cache_table[afi]); rn; rn = bgp_route_next (rn))
fb018d25 401 {
da11a696
DS
402 if ((bnc = rn->info) != NULL)
403 {
404 if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID))
77217fd4 405 {
da11a696
DS
406 vty_out (vty, " %s valid [IGP metric %d], #paths %d%s",
407 inet_ntop (rn->p.family, &rn->p.u.prefix, buf, sizeof (buf)),
408 bnc->metric, bnc->path_count, VTY_NEWLINE);
409 if (detail)
410 for (nexthop = bnc->nexthop; nexthop; nexthop = nexthop->next)
411 switch (nexthop->type)
412 {
413 case NEXTHOP_TYPE_IPV6:
414 vty_out (vty, " gate %s%s",
415 inet_ntop (AF_INET6, &nexthop->gate.ipv6,
416 buf, sizeof (buf)), VTY_NEWLINE);
417 break;
418 case NEXTHOP_TYPE_IPV6_IFINDEX:
419 vty_out(vty, " gate %s, if %s%s",
420 inet_ntop(AF_INET6, &nexthop->gate.ipv6, buf,
421 sizeof (buf)),
422 ifindex2ifname(nexthop->ifindex),
423 VTY_NEWLINE);
424 break;
425 case NEXTHOP_TYPE_IPV4:
426 vty_out (vty, " gate %s%s",
427 inet_ntop (AF_INET, &nexthop->gate.ipv4, buf,
428 sizeof (buf)), VTY_NEWLINE);
429 break;
430 case NEXTHOP_TYPE_IFINDEX:
431 vty_out (vty, " if %s%s",
432 ifindex2ifname(nexthop->ifindex), VTY_NEWLINE);
433 break;
434 case NEXTHOP_TYPE_IPV4_IFINDEX:
435 vty_out (vty, " gate %s, if %s%s",
436 inet_ntop(AF_INET, &nexthop->gate.ipv4, buf,
437 sizeof (buf)),
438 ifindex2ifname(nexthop->ifindex), VTY_NEWLINE);
439 break;
440 default:
441 vty_out (vty, " invalid nexthop type %u%s",
442 nexthop->type, VTY_NEWLINE);
443 }
444 }
445 else
446 {
447 vty_out (vty, " %s invalid%s",
448 inet_ntop (rn->p.family, &rn->p.u.prefix,
449 buf, sizeof (buf)), VTY_NEWLINE);
450 if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED))
451 vty_out (vty, " Must be Connected%s", VTY_NEWLINE);
77217fd4 452 }
fb018d25 453#ifdef HAVE_CLOCK_MONOTONIC
da11a696
DS
454 tbuf = time(NULL) - (bgp_clock() - bnc->last_update);
455 vty_out (vty, " Last update: %s", ctime(&tbuf));
fb018d25 456#else
da11a696 457 vty_out (vty, " Last update: %s", ctime(&bnc->uptime));
fb018d25 458#endif /* HAVE_CLOCK_MONOTONIC */
da11a696
DS
459 vty_out(vty, "%s", VTY_NEWLINE);
460 }
fb018d25 461 }
da11a696 462 }
f186de26 463}
464
465static int
466show_ip_bgp_nexthop_table (struct vty *vty, const char *name, int detail)
467{
468 struct bgp *bgp;
469
470 if (name)
471 bgp = bgp_lookup_by_name (name);
472 else
473 bgp = bgp_get_default ();
474 if (!bgp)
475 {
476 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
477 return CMD_WARNING;
478 }
479
480 bgp_show_nexthops (vty, bgp, detail);
481
fb018d25
DS
482 return CMD_SUCCESS;
483}
484
f186de26 485static void
486bgp_show_all_instances_nexthops_vty (struct vty *vty)
487{
488 struct listnode *node, *nnode;
489 struct bgp *bgp;
490
491 for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
492 {
493 vty_out (vty, "%sInstance %s:%s",
494 VTY_NEWLINE,
495 (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name,
496 VTY_NEWLINE);
497 bgp_show_nexthops (vty, bgp, 0);
498 }
499}
500
fb018d25
DS
501DEFUN (show_ip_bgp_nexthop,
502 show_ip_bgp_nexthop_cmd,
503 "show ip bgp nexthop",
504 SHOW_STR
505 IP_STR
506 BGP_STR
507 "BGP nexthop table\n")
508{
6aeb9e78 509 return show_ip_bgp_nexthop_table (vty, NULL, 0);
fb018d25
DS
510}
511
512DEFUN (show_ip_bgp_nexthop_detail,
513 show_ip_bgp_nexthop_detail_cmd,
514 "show ip bgp nexthop detail",
515 SHOW_STR
516 IP_STR
517 BGP_STR
518 "BGP nexthop table\n")
519{
6aeb9e78 520 return show_ip_bgp_nexthop_table (vty, NULL, 1);
fb018d25
DS
521}
522
8386ac43 523DEFUN (show_ip_bgp_instance_nexthop,
524 show_ip_bgp_instance_nexthop_cmd,
525 "show ip bgp " BGP_INSTANCE_CMD " nexthop",
50ef26d4 526 SHOW_STR
527 IP_STR
528 BGP_STR
8386ac43 529 BGP_INSTANCE_HELP_STR
50ef26d4 530 "BGP nexthop table\n")
531{
532 return show_ip_bgp_nexthop_table (vty, argv[1], 0);
533}
534
f186de26 535DEFUN (show_ip_bgp_instance_all_nexthop,
536 show_ip_bgp_instance_all_nexthop_cmd,
537 "show ip bgp " BGP_INSTANCE_ALL_CMD " nexthop",
538 SHOW_STR
539 IP_STR
540 BGP_STR
541 BGP_INSTANCE_ALL_HELP_STR
542 "BGP nexthop table\n")
543{
544 bgp_show_all_instances_nexthops_vty (vty);
545 return CMD_SUCCESS;
546}
547
8386ac43 548DEFUN (show_ip_bgp_instance_nexthop_detail,
549 show_ip_bgp_instance_nexthop_detail_cmd,
550 "show ip bgp " BGP_INSTANCE_CMD " nexthop detail",
50ef26d4 551 SHOW_STR
552 IP_STR
553 BGP_STR
8386ac43 554 BGP_INSTANCE_HELP_STR
50ef26d4 555 "BGP nexthop table\n")
556{
557 return show_ip_bgp_nexthop_table (vty, argv[1], 1);
558}
559
718e3744 560void
6aeb9e78 561bgp_scan_init (struct bgp *bgp)
718e3744 562{
6aeb9e78
DS
563 bgp->nexthop_cache_table[AFI_IP] = bgp_table_init (AFI_IP, SAFI_UNICAST);
564 bgp->connected_table[AFI_IP] = bgp_table_init (AFI_IP, SAFI_UNICAST);
565 bgp->import_check_table[AFI_IP] = bgp_table_init (AFI_IP, SAFI_UNICAST);
718e3744 566
6aeb9e78
DS
567 bgp->nexthop_cache_table[AFI_IP6] = bgp_table_init (AFI_IP6, SAFI_UNICAST);
568 bgp->connected_table[AFI_IP6] = bgp_table_init (AFI_IP6, SAFI_UNICAST);
569 bgp->import_check_table[AFI_IP6] = bgp_table_init (AFI_IP6, SAFI_UNICAST);
718e3744 570
0adfc788
DS
571 bgp->nexthop_cache_table[AFI_ETHER] = bgp_table_init (AFI_ETHER, SAFI_UNICAST);
572 bgp->connected_table[AFI_ETHER] = bgp_table_init (AFI_ETHER, SAFI_UNICAST);
573 bgp->import_check_table[AFI_ETHER] = bgp_table_init (AFI_ETHER, SAFI_UNICAST);
fc9a856f
DS
574}
575
576void
ffd0c037 577bgp_scan_vty_init (void)
fc9a856f
DS
578{
579 install_element (ENABLE_NODE, &show_ip_bgp_nexthop_cmd);
fb018d25
DS
580 install_element (VIEW_NODE, &show_ip_bgp_nexthop_cmd);
581 install_element (VIEW_NODE, &show_ip_bgp_nexthop_detail_cmd);
fb018d25 582 install_element (ENABLE_NODE, &show_ip_bgp_nexthop_detail_cmd);
8386ac43 583 install_element (ENABLE_NODE, &show_ip_bgp_instance_nexthop_cmd);
f186de26 584 install_element (ENABLE_NODE, &show_ip_bgp_instance_all_nexthop_cmd);
8386ac43 585 install_element (VIEW_NODE, &show_ip_bgp_instance_nexthop_cmd);
f186de26 586 install_element (VIEW_NODE, &show_ip_bgp_instance_all_nexthop_cmd);
8386ac43 587 install_element (VIEW_NODE, &show_ip_bgp_instance_nexthop_detail_cmd);
588 install_element (ENABLE_NODE, &show_ip_bgp_instance_nexthop_detail_cmd);
718e3744 589}
228da428
CC
590
591void
6aeb9e78 592bgp_scan_finish (struct bgp *bgp)
228da428 593{
6c88b44d 594 /* Only the current one needs to be reset. */
6aeb9e78 595 bgp_nexthop_cache_reset (bgp->nexthop_cache_table[AFI_IP]);
6c88b44d 596
6aeb9e78
DS
597 bgp_table_unlock (bgp->nexthop_cache_table[AFI_IP]);
598 bgp->nexthop_cache_table[AFI_IP] = NULL;
228da428 599
6aeb9e78
DS
600 bgp_table_unlock (bgp->connected_table[AFI_IP]);
601 bgp->connected_table[AFI_IP] = NULL;
228da428 602
6aeb9e78
DS
603 bgp_table_unlock (bgp->import_check_table[AFI_IP]);
604 bgp->import_check_table[AFI_IP] = NULL;
078430f6 605
228da428 606#ifdef HAVE_IPV6
6c88b44d 607 /* Only the current one needs to be reset. */
6aeb9e78 608 bgp_nexthop_cache_reset (bgp->nexthop_cache_table[AFI_IP6]);
6c88b44d 609
6aeb9e78
DS
610 bgp_table_unlock (bgp->nexthop_cache_table[AFI_IP6]);
611 bgp->nexthop_cache_table[AFI_IP6] = NULL;
228da428 612
6aeb9e78
DS
613 bgp_table_unlock (bgp->connected_table[AFI_IP6]);
614 bgp->connected_table[AFI_IP6] = NULL;
078430f6 615
6aeb9e78
DS
616 bgp_table_unlock (bgp->import_check_table[AFI_IP6]);
617 bgp->import_check_table[AFI_IP6] = NULL;
228da428
CC
618#endif /* HAVE_IPV6 */
619}