1 /* BGP Nexthop tracking
2 * Copyright (C) 2013 Cumulus Networks, Inc.
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
17 * along with GNU Zebra; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
36 #include "bgpd/bgpd.h"
37 #include "bgpd/bgp_table.h"
38 #include "bgpd/bgp_route.h"
39 #include "bgpd/bgp_attr.h"
40 #include "bgpd/bgp_nexthop.h"
41 #include "bgpd/bgp_debug.h"
42 #include "bgpd/bgp_nht.h"
43 #include "bgpd/bgp_fsm.h"
44 #include "bgpd/bgp_zebra.h"
46 extern struct zclient
*zclient
;
48 static void register_zebra_rnh(struct bgp_nexthop_cache
*bnc
,
49 int is_bgp_static_route
);
50 static void unregister_zebra_rnh(struct bgp_nexthop_cache
*bnc
,
51 int is_bgp_static_route
);
52 static void evaluate_paths(struct bgp_nexthop_cache
*bnc
);
53 static int make_prefix(int afi
, struct bgp_info
*ri
, struct prefix
*p
);
54 static void path_nh_map(struct bgp_info
*path
, struct bgp_nexthop_cache
*bnc
,
57 static int bgp_isvalid_nexthop(struct bgp_nexthop_cache
*bnc
)
59 return (bgp_zebra_num_connects() == 0
60 || (bnc
&& CHECK_FLAG(bnc
->flags
, BGP_NEXTHOP_VALID
)));
63 int bgp_find_nexthop(struct bgp_info
*path
, int connected
)
65 struct bgp_nexthop_cache
*bnc
= path
->nexthop
;
71 * We are cheating here. Views have no associated underlying
72 * ability to detect nexthops. So when we have a view
73 * just tell everyone the nexthop is valid
75 if (path
->peer
&& path
->peer
->bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
)
78 if (connected
&& !(CHECK_FLAG(bnc
->flags
, BGP_NEXTHOP_CONNECTED
)))
81 return (bgp_isvalid_nexthop(bnc
));
84 static void bgp_unlink_nexthop_check(struct bgp_nexthop_cache
*bnc
)
86 if (LIST_EMPTY(&(bnc
->paths
)) && !bnc
->nht_info
) {
87 if (BGP_DEBUG(nht
, NHT
)) {
88 char buf
[PREFIX2STR_BUFFER
];
89 zlog_debug("bgp_unlink_nexthop: freeing bnc %s",
90 bnc_str(bnc
, buf
, PREFIX2STR_BUFFER
));
92 unregister_zebra_rnh(bnc
,
93 CHECK_FLAG(bnc
->flags
, BGP_STATIC_ROUTE
));
94 bnc
->node
->info
= NULL
;
95 bgp_unlock_node(bnc
->node
);
101 void bgp_unlink_nexthop(struct bgp_info
*path
)
103 struct bgp_nexthop_cache
*bnc
= path
->nexthop
;
108 path_nh_map(path
, NULL
, 0);
110 bgp_unlink_nexthop_check(bnc
);
113 void bgp_unlink_nexthop_by_peer(struct peer
*peer
)
117 struct bgp_nexthop_cache
*bnc
;
118 afi_t afi
= family2afi(peer
->su
.sa
.sa_family
);
120 if (!sockunion2hostprefix(&peer
->su
, &p
))
123 rn
= bgp_node_get(peer
->bgp
->nexthop_cache_table
[afi
], &p
);
130 /* cleanup the peer reference */
131 bnc
->nht_info
= NULL
;
133 bgp_unlink_nexthop_check(bnc
);
136 int bgp_find_or_add_nexthop(struct bgp
*bgp
, afi_t afi
, struct bgp_info
*ri
,
137 struct peer
*peer
, int connected
)
140 struct bgp_nexthop_cache
*bnc
;
142 int is_bgp_static_route
= 0;
145 is_bgp_static_route
= ((ri
->type
== ZEBRA_ROUTE_BGP
)
146 && (ri
->sub_type
== BGP_ROUTE_STATIC
))
150 /* Since Extended Next-hop Encoding (RFC5549) support, we want
152 address-family from the next-hop. */
153 if (!is_bgp_static_route
)
154 afi
= BGP_ATTR_NEXTHOP_AFI_IP6(ri
->attr
) ? AFI_IP6
157 /* This will return TRUE if the global IPv6 NH is a link local
159 if (make_prefix(afi
, ri
, &p
) < 0)
162 /* Don't register link local NH */
164 && IN6_IS_ADDR_LINKLOCAL(&peer
->su
.sin6
.sin6_addr
))
167 if (!sockunion2hostprefix(&peer
->su
, &p
)) {
168 if (BGP_DEBUG(nht
, NHT
)) {
170 "%s: Attempting to register with unknown AFI %d (not %d or %d)",
171 __FUNCTION__
, afi
, AFI_IP
, AFI_IP6
);
178 if (is_bgp_static_route
)
179 rn
= bgp_node_get(bgp
->import_check_table
[afi
], &p
);
181 rn
= bgp_node_get(bgp
->nexthop_cache_table
[afi
], &p
);
189 if (BGP_DEBUG(nht
, NHT
)) {
190 char buf
[PREFIX2STR_BUFFER
];
192 zlog_debug("Allocated bnc %s peer %p",
193 bnc_str(bnc
, buf
, PREFIX2STR_BUFFER
), peer
);
199 if (is_bgp_static_route
) {
200 SET_FLAG(bnc
->flags
, BGP_STATIC_ROUTE
);
202 /* If we're toggling the type, re-register */
203 if ((bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
204 && !CHECK_FLAG(bnc
->flags
, BGP_STATIC_ROUTE_EXACT_MATCH
)) {
205 SET_FLAG(bnc
->flags
, BGP_STATIC_ROUTE_EXACT_MATCH
);
206 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_REGISTERED
);
207 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_VALID
);
208 } else if ((!bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
209 && CHECK_FLAG(bnc
->flags
,
210 BGP_STATIC_ROUTE_EXACT_MATCH
)) {
211 UNSET_FLAG(bnc
->flags
, BGP_STATIC_ROUTE_EXACT_MATCH
);
212 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_REGISTERED
);
213 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_VALID
);
216 /* When nexthop is already known, but now requires 'connected'
218 * re-register it. The reverse scenario where the nexthop currently
220 * 'connected' resolution does not need a re-register (i.e., we treat
221 * 'connected-required' as an override) except in the scenario where
223 * is actually a case of tracking a peer for connectivity (e.g., after
224 * disable connected-check).
225 * NOTE: We don't track the number of paths separately for 'connected-
226 * required' vs 'connected-not-required' as this change is not a common
229 else if (connected
&& !CHECK_FLAG(bnc
->flags
, BGP_NEXTHOP_CONNECTED
)) {
230 SET_FLAG(bnc
->flags
, BGP_NEXTHOP_CONNECTED
);
231 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_REGISTERED
);
232 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_VALID
);
233 } else if (peer
&& !connected
234 && CHECK_FLAG(bnc
->flags
, BGP_NEXTHOP_CONNECTED
)) {
235 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_CONNECTED
);
236 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_REGISTERED
);
237 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_VALID
);
239 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
) {
240 bnc
->flags
|= BGP_NEXTHOP_REGISTERED
;
241 bnc
->flags
|= BGP_NEXTHOP_VALID
;
242 } else if (!CHECK_FLAG(bnc
->flags
, BGP_NEXTHOP_REGISTERED
))
243 register_zebra_rnh(bnc
, is_bgp_static_route
);
244 if (ri
&& ri
->nexthop
!= bnc
) {
245 /* Unlink from existing nexthop cache, if any. This will also
247 * the nexthop cache entry, if appropriate.
249 bgp_unlink_nexthop(ri
);
251 path_nh_map(ri
, bnc
, 1); /* updates NHT ri list reference */
253 if (CHECK_FLAG(bnc
->flags
, BGP_NEXTHOP_VALID
) && bnc
->metric
)
254 (bgp_info_extra_get(ri
))->igpmetric
= bnc
->metric
;
256 ri
->extra
->igpmetric
= 0;
258 bnc
->nht_info
= (void *)peer
; /* NHT peer reference */
261 * We are cheating here. Views have no associated underlying
262 * ability to detect nexthops. So when we have a view
263 * just tell everyone the nexthop is valid
265 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
)
268 return (bgp_isvalid_nexthop(bnc
));
271 void bgp_delete_connected_nexthop(afi_t afi
, struct peer
*peer
)
274 struct bgp_nexthop_cache
*bnc
;
280 /* We don't register link local address for NHT */
281 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL(&peer
->su
.sin6
.sin6_addr
))
284 if (!sockunion2hostprefix(&peer
->su
, &p
))
287 rn
= bgp_node_lookup(
288 peer
->bgp
->nexthop_cache_table
[family2afi(p
.family
)], &p
);
289 if (!rn
|| !rn
->info
) {
290 if (BGP_DEBUG(nht
, NHT
))
291 zlog_debug("Cannot find connected NHT node for peer %s",
301 if (bnc
->nht_info
!= peer
) {
302 if (BGP_DEBUG(nht
, NHT
))
304 "Connected NHT %p node for peer %s points to %p",
305 bnc
, peer
->host
, bnc
->nht_info
);
309 bnc
->nht_info
= NULL
;
311 if (LIST_EMPTY(&(bnc
->paths
))) {
312 if (BGP_DEBUG(nht
, NHT
))
313 zlog_debug("Freeing connected NHT node %p for peer %s",
315 unregister_zebra_rnh(bnc
, 0);
316 bnc
->node
->info
= NULL
;
317 bgp_unlock_node(bnc
->node
);
322 void bgp_parse_nexthop_update(int command
, vrf_id_t vrf_id
)
325 struct bgp_node
*rn
= NULL
;
326 struct bgp_nexthop_cache
*bnc
;
327 struct nexthop
*nexthop
;
328 struct nexthop
*oldnh
;
329 struct nexthop
*nhlist_head
= NULL
;
330 struct nexthop
*nhlist_tail
= NULL
;
337 bgp
= bgp_lookup_by_vrf_id(vrf_id
);
340 "parse nexthop update: instance not found for vrf_id %d",
347 memset(&p
, 0, sizeof(struct prefix
));
348 p
.family
= stream_getw(s
);
349 p
.prefixlen
= stream_getc(s
);
352 p
.u
.prefix4
.s_addr
= stream_get_ipv4(s
);
355 stream_get(&p
.u
.prefix6
, s
, 16);
361 if (command
== ZEBRA_NEXTHOP_UPDATE
)
362 rn
= bgp_node_lookup(
363 bgp
->nexthop_cache_table
[family2afi(p
.family
)], &p
);
364 else if (command
== ZEBRA_IMPORT_CHECK_UPDATE
)
365 rn
= bgp_node_lookup(
366 bgp
->import_check_table
[family2afi(p
.family
)], &p
);
368 if (!rn
|| !rn
->info
) {
369 if (BGP_DEBUG(nht
, NHT
)) {
370 char buf
[PREFIX2STR_BUFFER
];
371 prefix2str(&p
, buf
, sizeof(buf
));
372 zlog_debug("parse nexthop update(%s): rn not found",
382 bnc
->last_update
= bgp_clock();
383 bnc
->change_flags
= 0;
384 stream_getc(s
); // Distance but not currently used
385 metric
= stream_getl(s
);
386 nexthop_num
= stream_getc(s
);
388 /* debug print the input */
389 if (BGP_DEBUG(nht
, NHT
)) {
390 char buf
[PREFIX2STR_BUFFER
];
391 prefix2str(&p
, buf
, sizeof(buf
));
393 "%d: NH update for %s - metric %d (cur %d) #nhops %d (cur %d)",
394 vrf_id
, buf
, metric
, bnc
->metric
, nexthop_num
,
398 if (metric
!= bnc
->metric
)
399 bnc
->change_flags
|= BGP_NEXTHOP_METRIC_CHANGED
;
401 if (nexthop_num
!= bnc
->nexthop_num
)
402 bnc
->change_flags
|= BGP_NEXTHOP_CHANGED
;
405 /* notify bgp fsm if nbr ip goes from invalid->valid */
406 if (!bnc
->nexthop_num
)
407 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_PEER_NOTIFIED
);
409 bnc
->flags
|= BGP_NEXTHOP_VALID
;
410 bnc
->metric
= metric
;
411 bnc
->nexthop_num
= nexthop_num
;
413 for (i
= 0; i
< nexthop_num
; i
++) {
414 nexthop
= nexthop_new();
415 nexthop
->type
= stream_getc(s
);
416 switch (nexthop
->type
) {
417 case NEXTHOP_TYPE_IPV4
:
418 nexthop
->gate
.ipv4
.s_addr
= stream_get_ipv4(s
);
419 nexthop
->ifindex
= stream_getl(s
);
421 case NEXTHOP_TYPE_IFINDEX
:
422 nexthop
->ifindex
= stream_getl(s
);
424 case NEXTHOP_TYPE_IPV4_IFINDEX
:
425 nexthop
->gate
.ipv4
.s_addr
= stream_get_ipv4(s
);
426 nexthop
->ifindex
= stream_getl(s
);
428 case NEXTHOP_TYPE_IPV6
:
429 stream_get(&nexthop
->gate
.ipv6
, s
, 16);
430 nexthop
->ifindex
= stream_getl(s
);
432 case NEXTHOP_TYPE_IPV6_IFINDEX
:
433 stream_get(&nexthop
->gate
.ipv6
, s
, 16);
434 nexthop
->ifindex
= stream_getl(s
);
441 if (BGP_DEBUG(nht
, NHT
)) {
442 char buf
[NEXTHOP_STRLEN
];
445 nexthop2str(nexthop
, buf
, sizeof(buf
)));
449 nhlist_tail
->next
= nexthop
;
450 nhlist_tail
= nexthop
;
452 nhlist_tail
= nexthop
;
453 nhlist_head
= nexthop
;
456 /* No need to evaluate the nexthop if we have already
458 * that there has been a change.
460 if (bnc
->change_flags
& BGP_NEXTHOP_CHANGED
)
463 for (oldnh
= bnc
->nexthop
; oldnh
; oldnh
= oldnh
->next
)
464 if (nexthop_same_no_recurse(oldnh
, nexthop
))
468 bnc
->change_flags
|= BGP_NEXTHOP_CHANGED
;
470 bnc_nexthop_free(bnc
);
471 bnc
->nexthop
= nhlist_head
;
473 bnc
->flags
&= ~BGP_NEXTHOP_VALID
;
474 bnc
->nexthop_num
= nexthop_num
;
476 /* notify bgp fsm if nbr ip goes from valid->invalid */
477 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_PEER_NOTIFIED
);
479 bnc_nexthop_free(bnc
);
487 * make_prefix - make a prefix structure from the path (essentially
490 static int make_prefix(int afi
, struct bgp_info
*ri
, struct prefix
*p
)
493 int is_bgp_static
= ((ri
->type
== ZEBRA_ROUTE_BGP
)
494 && (ri
->sub_type
== BGP_ROUTE_STATIC
))
498 memset(p
, 0, sizeof(struct prefix
));
503 p
->u
.prefix4
= ri
->net
->p
.u
.prefix4
;
504 p
->prefixlen
= ri
->net
->p
.prefixlen
;
506 p
->u
.prefix4
= ri
->attr
->nexthop
;
507 p
->prefixlen
= IPV4_MAX_BITLEN
;
511 /* We don't register link local NH */
512 if (ri
->attr
->extra
->mp_nexthop_len
513 != BGP_ATTR_NHLEN_IPV6_GLOBAL
514 || IN6_IS_ADDR_LINKLOCAL(
515 &ri
->attr
->extra
->mp_nexthop_global
))
518 p
->family
= AF_INET6
;
521 p
->u
.prefix6
= ri
->net
->p
.u
.prefix6
;
522 p
->prefixlen
= ri
->net
->p
.prefixlen
;
524 p
->u
.prefix6
= ri
->attr
->extra
->mp_nexthop_global
;
525 p
->prefixlen
= IPV6_MAX_BITLEN
;
529 if (BGP_DEBUG(nht
, NHT
)) {
531 "%s: Attempting to make prefix with unknown AFI %d (not %d or %d)",
532 __FUNCTION__
, afi
, AFI_IP
, AFI_IP6
);
540 * sendmsg_zebra_rnh -- Format and send a nexthop register/Unregister
543 * struct bgp_nexthop_cache *bnc -- the nexthop structure.
544 * int command -- command to send to zebra
548 static void sendmsg_zebra_rnh(struct bgp_nexthop_cache
*bnc
, int command
)
555 if (!zclient
|| zclient
->sock
< 0)
558 /* Don't try to register if Zebra doesn't know of this instance. */
559 if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bnc
->bgp
))
565 zclient_create_header(s
, command
, bnc
->bgp
->vrf_id
);
566 if (CHECK_FLAG(bnc
->flags
, BGP_NEXTHOP_CONNECTED
)
567 || CHECK_FLAG(bnc
->flags
, BGP_STATIC_ROUTE_EXACT_MATCH
))
572 stream_putw(s
, PREFIX_FAMILY(p
));
573 stream_putc(s
, p
->prefixlen
);
574 switch (PREFIX_FAMILY(p
)) {
576 stream_put_in_addr(s
, &p
->u
.prefix4
);
579 stream_put(s
, &(p
->u
.prefix6
), 16);
584 stream_putw_at(s
, 0, stream_get_endp(s
));
586 ret
= zclient_send_message(zclient
);
587 /* TBD: handle the failure */
589 zlog_warn("sendmsg_nexthop: zclient_send_message() failed");
591 if ((command
== ZEBRA_NEXTHOP_REGISTER
)
592 || (command
== ZEBRA_IMPORT_ROUTE_REGISTER
))
593 SET_FLAG(bnc
->flags
, BGP_NEXTHOP_REGISTERED
);
594 else if ((command
== ZEBRA_NEXTHOP_UNREGISTER
)
595 || (command
== ZEBRA_IMPORT_ROUTE_UNREGISTER
))
596 UNSET_FLAG(bnc
->flags
, BGP_NEXTHOP_REGISTERED
);
601 * register_zebra_rnh - register a NH/route with Zebra for notification
602 * when the route or the route to the nexthop changes.
604 * struct bgp_nexthop_cache *bnc
608 static void register_zebra_rnh(struct bgp_nexthop_cache
*bnc
,
609 int is_bgp_import_route
)
611 /* Check if we have already registered */
612 if (bnc
->flags
& BGP_NEXTHOP_REGISTERED
)
614 if (is_bgp_import_route
)
615 sendmsg_zebra_rnh(bnc
, ZEBRA_IMPORT_ROUTE_REGISTER
);
617 sendmsg_zebra_rnh(bnc
, ZEBRA_NEXTHOP_REGISTER
);
621 * unregister_zebra_rnh -- Unregister the route/nexthop from Zebra.
623 * struct bgp_nexthop_cache *bnc
627 static void unregister_zebra_rnh(struct bgp_nexthop_cache
*bnc
,
628 int is_bgp_import_route
)
630 /* Check if we have already registered */
631 if (!CHECK_FLAG(bnc
->flags
, BGP_NEXTHOP_REGISTERED
))
634 if (is_bgp_import_route
)
635 sendmsg_zebra_rnh(bnc
, ZEBRA_IMPORT_ROUTE_UNREGISTER
);
637 sendmsg_zebra_rnh(bnc
, ZEBRA_NEXTHOP_UNREGISTER
);
641 * evaluate_paths - Evaluate the paths/nets associated with a nexthop.
643 * struct bgp_nexthop_cache *bnc -- the nexthop structure.
647 static void evaluate_paths(struct bgp_nexthop_cache
*bnc
)
650 struct bgp_info
*path
;
651 struct bgp
*bgp
= bnc
->bgp
;
653 struct peer
*peer
= (struct peer
*)bnc
->nht_info
;
655 if (BGP_DEBUG(nht
, NHT
)) {
656 char buf
[PREFIX2STR_BUFFER
];
657 bnc_str(bnc
, buf
, PREFIX2STR_BUFFER
);
659 "NH update for %s - flags 0x%x chgflags 0x%x - evaluate paths",
660 buf
, bnc
->flags
, bnc
->change_flags
);
663 LIST_FOREACH(path
, &(bnc
->paths
), nh_thread
)
665 if (!(path
->type
== ZEBRA_ROUTE_BGP
666 && ((path
->sub_type
== BGP_ROUTE_NORMAL
)
667 || (path
->sub_type
== BGP_ROUTE_STATIC
))))
671 afi
= family2afi(rn
->p
.family
);
673 /* Path becomes valid/invalid depending on whether the nexthop
674 * reachable/unreachable.
676 if ((CHECK_FLAG(path
->flags
, BGP_INFO_VALID
) ? 1 : 0)
677 != (bgp_isvalid_nexthop(bnc
) ? 1 : 0)) {
678 if (CHECK_FLAG(path
->flags
, BGP_INFO_VALID
)) {
679 bgp_aggregate_decrement(bgp
, &rn
->p
, path
, afi
,
681 bgp_info_unset_flag(rn
, path
, BGP_INFO_VALID
);
683 bgp_info_set_flag(rn
, path
, BGP_INFO_VALID
);
684 bgp_aggregate_increment(bgp
, &rn
->p
, path
, afi
,
689 /* Copy the metric to the path. Will be used for bestpath
691 if (bgp_isvalid_nexthop(bnc
) && bnc
->metric
)
692 (bgp_info_extra_get(path
))->igpmetric
= bnc
->metric
;
693 else if (path
->extra
)
694 path
->extra
->igpmetric
= 0;
696 if (CHECK_FLAG(bnc
->change_flags
, BGP_NEXTHOP_METRIC_CHANGED
)
697 || CHECK_FLAG(bnc
->change_flags
, BGP_NEXTHOP_CHANGED
))
698 SET_FLAG(path
->flags
, BGP_INFO_IGP_CHANGED
);
700 bgp_process(bgp
, rn
, afi
, SAFI_UNICAST
);
703 if (peer
&& !CHECK_FLAG(bnc
->flags
, BGP_NEXTHOP_PEER_NOTIFIED
)) {
704 if (BGP_DEBUG(nht
, NHT
))
705 zlog_debug("%s: Updating peer (%s) status with NHT",
706 __FUNCTION__
, peer
->host
);
707 bgp_fsm_nht_update(peer
, bgp_isvalid_nexthop(bnc
));
708 SET_FLAG(bnc
->flags
, BGP_NEXTHOP_PEER_NOTIFIED
);
711 RESET_FLAG(bnc
->change_flags
);
715 * path_nh_map - make or break path-to-nexthop association.
717 * path - pointer to the path structure
718 * bnc - pointer to the nexthop structure
719 * make - if set, make the association. if unset, just break the existing
722 static void path_nh_map(struct bgp_info
*path
, struct bgp_nexthop_cache
*bnc
,
726 LIST_REMOVE(path
, nh_thread
);
727 path
->nexthop
->path_count
--;
728 path
->nexthop
= NULL
;
731 LIST_INSERT_HEAD(&(bnc
->paths
), path
, nh_thread
);
733 path
->nexthop
->path_count
++;