]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_nht.h
Merge pull request #5703 from ton31337/feature/limit_outgoing_prefixes
[mirror_frr.git] / bgpd / bgp_nht.h
CommitLineData
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 27extern 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
DS
36 * a - afi: AFI_IP or AF_IP6
37 * p - path for which the nexthop object is being looked up
fc9a856f
DS
38 * peer - The BGP peer associated with this NHT
39 * connected - True if NH MUST be a connected route
fb018d25 40 */
960035b2 41extern int bgp_find_or_add_nexthop(struct bgp *bgp_route,
4b7e6066
DS
42 struct bgp *bgp_nexthop, afi_t a,
43 struct bgp_path_info *p, struct peer *peer,
44 int connected);
fb018d25
DS
45
46/**
47 * bgp_unlink_nexthop() - Unlink the nexthop object from the path structure.
48 * ARGUMENTS:
49 * p - path structure.
50 */
4b7e6066
DS
51extern void bgp_unlink_nexthop(struct bgp_path_info *p);
52void bgp_unlink_nexthop_by_peer(struct peer *peer);
fb018d25 53
9a233a02
DS
54/**
55 * bgp_delete_connected_nexthop() - Reset the 'peer' pointer for a connected
56 * nexthop entry. If no paths reference the nexthop, it will be unregistered
57 * and freed.
58 * ARGUMENTS:
59 * afi - afi: AFI_IP or AF_IP6
60 * peer - Ptr to peer
61 */
d62a17ae 62extern void bgp_delete_connected_nexthop(afi_t afi, struct peer *peer);
9a233a02 63
ee7ca6c0 64/*
65 * Cleanup nexthop registration and status information for BGP nexthops
66 * pertaining to this VRF. This is invoked upon VRF deletion.
67 */
68extern void bgp_cleanup_nexthops(struct bgp *bgp);
69
7f040da1
DS
70/*
71 * Add or remove the tracking of the bgp_path_info that
72 * uses this nexthop
73 */
74extern void path_nh_map(struct bgp_path_info *path,
75 struct bgp_nexthop_cache *bnc, bool make);
1ee0a2df
DS
76/*
77 * When we actually have the connection to
78 * the zebra daemon, we need to reregister
79 * any nexthops we may have sitting around
80 */
81extern void bgp_nht_register_nexthops(struct bgp *bgp);
7f040da1 82
1ea03b90
DS
83/*
84 * When we have the the PEER_FLAG_CAPABILITY_ENHE flag
85 * set on a peer *after* it has been brought up we need
86 * to notice and setup the interface based RA,
87 * this code can walk the registered nexthops and
88 * register the important ones with zebra for RA.
89 */
90extern void bgp_nht_register_enhe_capability_interfaces(struct peer *peer);
91
fb018d25 92#endif /* _BGP_NHT_H */