]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_orr.h
bgpd: fix the IGP metric for best path selection on VPN import
[mirror_frr.git] / bgpd / bgp_orr.h
1 /*
2 * BGP Optimal Route Reflection
3 * Copyright (C) 2021 Samsung R&D Institute India - Bangalore.
4 * Madhurilatha Kuruganti
5 *
6 * This program 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 Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * 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 _FRR_BGP_ORR_H
22 #define _FRR_BGP_ORR_H
23 #include <zebra.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /* Macro to log debug message */
30 #define bgp_orr_debug(...) \
31 do { \
32 if (BGP_DEBUG(optimal_route_reflection, ORR)) \
33 zlog_debug("[BGP-ORR] " __VA_ARGS__); \
34 } while (0)
35
36
37 /* BGP ORR Message Type */
38 enum bgp_orr_msg_type {
39 BGP_ORR_IMSG_INVALID = 0,
40
41 /* ORR group update */
42 BGP_ORR_IMSG_GROUP_CREATE = 1,
43 BGP_ORR_IMSG_GROUP_DELETE,
44 BGP_ORR_IMSG_GROUP_UPDATE,
45
46 /* ORR group update on a BGP RR Client */
47 BGP_ORR_IMSG_SET_ORR_ON_PEER = 4,
48 BGP_ORR_IMSG_UNSET_ORR_ON_PEER,
49
50 /* ORR IGP Metric Update from IGP from requested Location */
51 BGP_ORR_IMSG_IGP_METRIC_UPDATE = 6,
52
53 /* ORR Group Related Information display */
54 BGP_ORR_IMSG_SHOW_ORR = 7,
55 BGP_ORR_IMSG_SHOW_ORR_GROUP,
56
57 /* Invalid Message Type*/
58 BGP_ORR_IMSG_MAX
59 };
60
61 extern struct zclient *zclient;
62
63 extern void bgp_config_write_orr(struct vty *vty, struct bgp *bgp, afi_t afi,
64 safi_t safi);
65
66 extern int bgp_afi_safi_orr_group_set_vty(struct vty *vty, afi_t afi,
67 safi_t safi, const char *name,
68 const char *primary_str,
69 const char *secondary_str,
70 const char *tertiary_str, bool unset);
71 extern int peer_orr_group_unset(struct peer *peer, afi_t afi, safi_t safi,
72 const char *orr_group_name);
73 extern int peer_orr_group_set_vty(struct vty *vty, const char *ip_str,
74 afi_t afi, safi_t safi,
75 const char *orr_group_name, bool unset);
76 extern bool peer_orr_rrclient_check(struct peer *peer, afi_t afi, safi_t safi);
77
78 extern int bgp_show_orr(struct vty *vty, struct bgp *bgp, afi_t afi,
79 safi_t safi, const char *orr_group_name,
80 uint8_t show_flags);
81
82 extern int bgp_afi_safi_orr_group_set(struct bgp *bgp, afi_t afi, safi_t safi,
83 const char *name, struct peer *primary,
84 struct peer *secondary,
85 struct peer *tertiary);
86 extern int bgp_afi_safi_orr_group_unset(struct bgp *bgp, afi_t afi, safi_t safi,
87 const char *name);
88
89 extern void bgp_peer_update_orr_active_roots(struct peer *peer);
90
91 extern int bgg_orr_message_process(enum bgp_orr_msg_type msg_type, void *msg);
92
93 extern struct bgp_orr_group *bgp_orr_group_lookup_by_name(struct bgp *bgp,
94 afi_t afi,
95 safi_t safi,
96 const char *name);
97 extern void bgp_orr_cleanup(struct bgp *bgp);
98 #ifdef __cplusplus
99 }
100 #endif
101
102 #endif /* _FRR_BGP_ORR_H */