]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_nht.h
isisd: implement the 'if-state-change' notification
[mirror_frr.git] / bgpd / bgp_nht.h
1 /* BGP Nexthop tracking
2 * Copyright (C) 2013 Cumulus Networks, Inc.
3 *
4 * This file is part of GNU Zebra.
5 *
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
9 * later version.
10 *
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.
15 *
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
19 */
20
21 #ifndef _BGP_NHT_H
22 #define _BGP_NHT_H
23
24 /**
25 * bgp_parse_nexthop_update() - parse a nexthop update message from Zebra.
26 */
27 extern void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id);
28
29 /**
30 * bgp_find_nexthop() - lookup the nexthop cache table for the bnc object
31 * ARGUMENTS:
32 * p - path for which the nexthop object is being looked up
33 * connected - True if NH MUST be a connected route
34 */
35 extern int bgp_find_nexthop(struct bgp_path_info *p, int connected);
36
37 /**
38 * bgp_find_or_add_nexthop() - lookup the nexthop cache table for the bnc
39 * object. If not found, create a new object and register with ZEBRA for
40 * nexthop notification.
41 * ARGUMENTS:
42 * bgp_route - BGP instance of route
43 * bgp_nexthop - BGP instance of nexthop
44 * a - afi: AFI_IP or AF_IP6
45 * p - path for which the nexthop object is being looked up
46 * peer - The BGP peer associated with this NHT
47 * connected - True if NH MUST be a connected route
48 */
49 extern int bgp_find_or_add_nexthop(struct bgp *bgp_route,
50 struct bgp *bgp_nexthop, afi_t a,
51 struct bgp_path_info *p, struct peer *peer,
52 int connected);
53
54 /**
55 * bgp_unlink_nexthop() - Unlink the nexthop object from the path structure.
56 * ARGUMENTS:
57 * p - path structure.
58 */
59 extern void bgp_unlink_nexthop(struct bgp_path_info *p);
60 void bgp_unlink_nexthop_by_peer(struct peer *peer);
61
62 /**
63 * bgp_delete_connected_nexthop() - Reset the 'peer' pointer for a connected
64 * nexthop entry. If no paths reference the nexthop, it will be unregistered
65 * and freed.
66 * ARGUMENTS:
67 * afi - afi: AFI_IP or AF_IP6
68 * peer - Ptr to peer
69 */
70 extern void bgp_delete_connected_nexthop(afi_t afi, struct peer *peer);
71
72 /*
73 * Cleanup nexthop registration and status information for BGP nexthops
74 * pertaining to this VRF. This is invoked upon VRF deletion.
75 */
76 extern void bgp_cleanup_nexthops(struct bgp *bgp);
77
78 /*
79 * Add or remove the tracking of the bgp_path_info that
80 * uses this nexthop
81 */
82 extern void path_nh_map(struct bgp_path_info *path,
83 struct bgp_nexthop_cache *bnc, bool make);
84 /*
85 * When we actually have the connection to
86 * the zebra daemon, we need to reregister
87 * any nexthops we may have sitting around
88 */
89 extern void bgp_nht_register_nexthops(struct bgp *bgp);
90
91 /*
92 * When we have the the PEER_FLAG_CAPABILITY_ENHE flag
93 * set on a peer *after* it has been brought up we need
94 * to notice and setup the interface based RA,
95 * this code can walk the registered nexthops and
96 * register the important ones with zebra for RA.
97 */
98 extern void bgp_nht_register_enhe_capability_interfaces(struct peer *peer);
99
100 #endif /* _BGP_NHT_H */