]>
Commit | Line | Data |
---|---|---|
fb018d25 DS |
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 | * | |
896014f4 DL |
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 | |
fb018d25 DS |
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 | */ | |
7076bb2f | 27 | extern void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id); |
fb018d25 | 28 | |
fb018d25 DS |
29 | /** |
30 | * bgp_find_or_add_nexthop() - lookup the nexthop cache table for the bnc | |
31 | * object. If not found, create a new object and register with ZEBRA for | |
32 | * nexthop notification. | |
33 | * ARGUMENTS: | |
960035b2 PZ |
34 | * bgp_route - BGP instance of route |
35 | * bgp_nexthop - BGP instance of nexthop | |
fb018d25 | 36 | * a - afi: AFI_IP or AF_IP6 |
4053e952 | 37 | * safi - safi: to check which table nhs are being imported to |
fb018d25 | 38 | * p - path for which the nexthop object is being looked up |
fc9a856f DS |
39 | * peer - The BGP peer associated with this NHT |
40 | * connected - True if NH MUST be a connected route | |
fb018d25 | 41 | */ |
960035b2 | 42 | extern int bgp_find_or_add_nexthop(struct bgp *bgp_route, |
4b7e6066 | 43 | struct bgp *bgp_nexthop, afi_t a, |
4053e952 PR |
44 | safi_t safi, struct bgp_path_info *p, |
45 | struct peer *peer, int connected); | |
fb018d25 DS |
46 | |
47 | /** | |
48 | * bgp_unlink_nexthop() - Unlink the nexthop object from the path structure. | |
49 | * ARGUMENTS: | |
50 | * p - path structure. | |
51 | */ | |
4b7e6066 DS |
52 | extern void bgp_unlink_nexthop(struct bgp_path_info *p); |
53 | void bgp_unlink_nexthop_by_peer(struct peer *peer); | |
996319e6 | 54 | void bgp_replace_nexthop_by_peer(struct peer *from, struct peer *to); |
9a233a02 DS |
55 | /** |
56 | * bgp_delete_connected_nexthop() - Reset the 'peer' pointer for a connected | |
57 | * nexthop entry. If no paths reference the nexthop, it will be unregistered | |
58 | * and freed. | |
59 | * ARGUMENTS: | |
60 | * afi - afi: AFI_IP or AF_IP6 | |
61 | * peer - Ptr to peer | |
62 | */ | |
d62a17ae | 63 | extern void bgp_delete_connected_nexthop(afi_t afi, struct peer *peer); |
9a233a02 | 64 | |
ee7ca6c0 | 65 | /* |
66 | * Cleanup nexthop registration and status information for BGP nexthops | |
67 | * pertaining to this VRF. This is invoked upon VRF deletion. | |
68 | */ | |
69 | extern void bgp_cleanup_nexthops(struct bgp *bgp); | |
70 | ||
7f040da1 DS |
71 | /* |
72 | * Add or remove the tracking of the bgp_path_info that | |
73 | * uses this nexthop | |
74 | */ | |
75 | extern void path_nh_map(struct bgp_path_info *path, | |
76 | struct bgp_nexthop_cache *bnc, bool make); | |
1ee0a2df DS |
77 | /* |
78 | * When we actually have the connection to | |
79 | * the zebra daemon, we need to reregister | |
80 | * any nexthops we may have sitting around | |
81 | */ | |
82 | extern void bgp_nht_register_nexthops(struct bgp *bgp); | |
7f040da1 | 83 | |
1ea03b90 DS |
84 | /* |
85 | * When we have the the PEER_FLAG_CAPABILITY_ENHE flag | |
86 | * set on a peer *after* it has been brought up we need | |
87 | * to notice and setup the interface based RA, | |
88 | * this code can walk the registered nexthops and | |
89 | * register the important ones with zebra for RA. | |
90 | */ | |
b3a3290e DS |
91 | extern void bgp_nht_reg_enhe_cap_intfs(struct peer *peer); |
92 | extern void bgp_nht_dereg_enhe_cap_intfs(struct peer *peer); | |
021b6596 | 93 | extern void evaluate_paths(struct bgp_nexthop_cache *bnc); |
1ea03b90 | 94 | |
c589d847 AK |
95 | /* APIs for setting up and allocating L3 nexthop group ids */ |
96 | extern uint32_t bgp_l3nhg_id_alloc(void); | |
97 | extern void bgp_l3nhg_id_free(uint32_t nhg_id); | |
98 | extern void bgp_l3nhg_init(void); | |
99 | void bgp_l3nhg_finish(void); | |
100 | ||
8761cd6d DS |
101 | extern void bgp_nht_ifp_up(struct interface *ifp); |
102 | extern void bgp_nht_ifp_down(struct interface *ifp); | |
103 | ||
104 | extern void bgp_nht_interface_events(struct peer *peer); | |
fb018d25 | 105 | #endif /* _BGP_NHT_H */ |