]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_zebra.h
bgpd: use nexthop interface when adding LSP in BGP MPLSVPN
[mirror_frr.git] / bgpd / bgp_zebra.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
718e3744 2/* zebra connection and redistribute fucntions.
896014f4 3 * Copyright (C) 1999 Kunihiro Ishiguro
896014f4 4 */
718e3744 5
00d252cb 6#ifndef _QUAGGA_BGP_ZEBRA_H
7#define _QUAGGA_BGP_ZEBRA_H
8
1a98c087
MK
9#include "vxlan.h"
10
ad1844f7
IS
11/* Macro to update bgp_original based on bpg_path_info */
12#define BGP_ORIGINAL_UPDATE(_bgp_orig, _mpinfo, _bgp) \
13 ((_mpinfo->extra && _mpinfo->extra->bgp_orig \
14 && _mpinfo->sub_type == BGP_ROUTE_IMPORTED) \
15 ? (_bgp_orig = _mpinfo->extra->bgp_orig) \
16 : (_bgp_orig = _bgp))
17
f7e1c681 18/* Default weight for next hop, if doing weighted ECMP. */
19#define BGP_ZEBRA_DEFAULT_NHOP_WEIGHT 1
20
f533be73 21extern void bgp_zebra_init(struct thread_master *master,
22 unsigned short instance);
4cd690ae 23extern void bgp_if_init(void);
6818e7e5 24extern void bgp_zebra_init_tm_connect(struct bgp *bgp);
31c28cd7 25extern uint32_t bgp_zebra_tm_get_id(void);
6818e7e5 26extern bool bgp_zebra_tm_chunk_obtained(void);
d62a17ae 27extern void bgp_zebra_destroy(void);
b98f7728
PG
28extern int bgp_zebra_get_table_range(uint32_t chunk_size,
29 uint32_t *start, uint32_t *end);
d62a17ae 30extern int bgp_if_update_all(void);
9bcb3eef 31extern void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
4b7e6066
DS
32 struct bgp_path_info *path, struct bgp *bgp,
33 afi_t afi, safi_t safi);
50b3ceb0 34extern void bgp_zebra_announce_table(struct bgp *bgp, afi_t afi, safi_t safi);
5a1ae2c2
DS
35extern void bgp_zebra_withdraw(const struct prefix *p,
36 struct bgp_path_info *path, struct bgp *bgp,
37 safi_t safi);
d62a17ae 38
c163f297
DS
39/* Announce routes of any bgp subtype of a table to zebra */
40extern void bgp_zebra_announce_table_all_subtypes(struct bgp *bgp, afi_t afi,
41 safi_t safi);
42
43/* Withdraw all entries of any subtype in a BGP instances RIB table from Zebra */
44extern void bgp_zebra_withdraw_table_all_subtypes(struct bgp *bgp, afi_t afi,
45 safi_t safi);
46
d62a17ae 47extern void bgp_zebra_initiate_radv(struct bgp *bgp, struct peer *peer);
48extern void bgp_zebra_terminate_radv(struct bgp *bgp, struct peer *peer);
49
50b3ceb0
DS
50extern void bgp_zebra_instance_register(struct bgp *bgp);
51extern void bgp_zebra_instance_deregister(struct bgp *bgp);
d62a17ae 52
fc2408ec 53extern void bgp_redistribute_redo(struct bgp *bgp);
50b3ceb0
DS
54extern struct bgp_redist *bgp_redist_lookup(struct bgp *bgp, afi_t afi,
55 uint8_t type,
56 unsigned short instance);
57extern struct bgp_redist *bgp_redist_add(struct bgp *bgp, afi_t afi,
58 uint8_t type, unsigned short instance);
59extern int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type,
60 unsigned short instance, bool changed);
61extern int bgp_redistribute_resend(struct bgp *bgp, afi_t afi, int type,
62 unsigned short instance);
3dc339cd
DA
63extern bool bgp_redistribute_rmap_set(struct bgp_redist *red, const char *name,
64 struct route_map *route_map);
50b3ceb0
DS
65extern bool bgp_redistribute_metric_set(struct bgp *bgp, struct bgp_redist *red,
66 afi_t afi, int type, uint32_t metric);
67extern int bgp_redistribute_unset(struct bgp *bgp, afi_t afi, int type,
68 unsigned short instance);
69extern int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type,
70 unsigned short instance);
d62a17ae 71
50b3ceb0
DS
72extern struct interface *if_lookup_by_ipv4(struct in_addr *addr,
73 vrf_id_t vrf_id);
74extern struct interface *if_lookup_by_ipv4_exact(struct in_addr *addr,
75 vrf_id_t vrf_id);
76extern struct interface *if_lookup_by_ipv6(struct in6_addr *addr,
77 ifindex_t ifindex, vrf_id_t vrf_id);
78extern struct interface *if_lookup_by_ipv6_exact(struct in6_addr *addr,
79 ifindex_t ifindex,
80 vrf_id_t vrf_id);
31310b25
MK
81extern int bgp_zebra_advertise_subnet(struct bgp *bgp, int advertise,
82 vni_t vni);
50b3ceb0
DS
83extern int bgp_zebra_advertise_gw_macip(struct bgp *bgp, int advertise,
84 vni_t vni);
a8016157
CS
85extern int bgp_zebra_advertise_svi_macip(struct bgp *bgp, int advertise,
86 vni_t vni);
50b3ceb0 87extern int bgp_zebra_advertise_all_vni(struct bgp *bgp, int advertise);
0b9d9cd0 88extern int bgp_zebra_dup_addr_detection(struct bgp *bgp);
fd069644
DS
89extern int bgp_zebra_vxlan_flood_control(struct bgp *bgp,
90 enum vxlan_flood_control flood_ctrl);
7724c0a1 91
afbb1c59
LB
92extern int bgp_zebra_num_connects(void);
93
50b3ceb0
DS
94extern bool bgp_zebra_nexthop_set(union sockunion *local,
95 union sockunion *remote,
96 struct bgp_nexthop *nexthop,
97 struct peer *peer);
30d50e6d
PG
98struct bgp_pbr_action;
99struct bgp_pbr_match;
6cfe5d15 100struct bgp_pbr_rule;
30d50e6d 101struct bgp_pbr_match_entry;
2d3dd828 102
30d50e6d 103extern void bgp_send_pbr_rule_action(struct bgp_pbr_action *pbra,
6cfe5d15
PG
104 struct bgp_pbr_rule *pbr,
105 bool install);
30d50e6d
PG
106extern void bgp_send_pbr_ipset_match(struct bgp_pbr_match *pbrim,
107 bool install);
108extern void bgp_send_pbr_ipset_entry_match(struct bgp_pbr_match_entry *pbrime,
109 bool install);
c16a0a62
PG
110extern void bgp_send_pbr_iptable(struct bgp_pbr_action *pba,
111 struct bgp_pbr_match *pbm,
112 bool install);
30d50e6d 113
f7df1907
PG
114extern void bgp_zebra_announce_default(struct bgp *bgp, struct nexthop *nh,
115 afi_t afi, uint32_t table_id, bool announce);
2d3dd828 116extern int bgp_zebra_send_capabilities(struct bgp *bgp, bool disable);
115ccb9a
DS
117extern int bgp_zebra_update(struct bgp *bgp, afi_t afi, safi_t safi,
118 enum zserv_client_capabilities);
2d3dd828 119extern int bgp_zebra_stale_timer_update(struct bgp *bgp);
a0281b2e 120extern int bgp_zebra_srv6_manager_get_locator_chunk(const char *name);
0249b8b6 121extern int bgp_zebra_srv6_manager_release_locator_chunk(const char *name);
92d5e31a 122extern void bgp_zebra_send_nexthop_label(int cmd, mpls_label_t label,
aa274376 123 ifindex_t index, vrf_id_t vrfid,
92d5e31a
PG
124 enum lsp_types_t ltype,
125 struct prefix *p);
00d252cb 126#endif /* _QUAGGA_BGP_ZEBRA_H */