1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* zebra connection and redistribute fucntions.
3 * Copyright (C) 1999 Kunihiro Ishiguro
6 #ifndef _QUAGGA_BGP_ZEBRA_H
7 #define _QUAGGA_BGP_ZEBRA_H
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) \
18 /* Default weight for next hop, if doing weighted ECMP. */
19 #define BGP_ZEBRA_DEFAULT_NHOP_WEIGHT 1
21 extern void bgp_zebra_init(struct thread_master
*master
,
22 unsigned short instance
);
23 extern void bgp_if_init(void);
24 extern void bgp_zebra_init_tm_connect(struct bgp
*bgp
);
25 extern uint32_t bgp_zebra_tm_get_id(void);
26 extern bool bgp_zebra_tm_chunk_obtained(void);
27 extern void bgp_zebra_destroy(void);
28 extern int bgp_zebra_get_table_range(uint32_t chunk_size
,
29 uint32_t *start
, uint32_t *end
);
30 extern int bgp_if_update_all(void);
31 extern void bgp_zebra_announce(struct bgp_dest
*dest
, const struct prefix
*p
,
32 struct bgp_path_info
*path
, struct bgp
*bgp
,
33 afi_t afi
, safi_t safi
);
34 extern void bgp_zebra_announce_table(struct bgp
*bgp
, afi_t afi
, safi_t safi
);
35 extern void bgp_zebra_withdraw(const struct prefix
*p
,
36 struct bgp_path_info
*path
, struct bgp
*bgp
,
39 /* Announce routes of any bgp subtype of a table to zebra */
40 extern void bgp_zebra_announce_table_all_subtypes(struct bgp
*bgp
, afi_t afi
,
43 /* Withdraw all entries of any subtype in a BGP instances RIB table from Zebra */
44 extern void bgp_zebra_withdraw_table_all_subtypes(struct bgp
*bgp
, afi_t afi
,
47 extern void bgp_zebra_initiate_radv(struct bgp
*bgp
, struct peer
*peer
);
48 extern void bgp_zebra_terminate_radv(struct bgp
*bgp
, struct peer
*peer
);
50 extern void bgp_zebra_instance_register(struct bgp
*bgp
);
51 extern void bgp_zebra_instance_deregister(struct bgp
*bgp
);
53 extern void bgp_redistribute_redo(struct bgp
*bgp
);
54 extern struct bgp_redist
*bgp_redist_lookup(struct bgp
*bgp
, afi_t afi
,
56 unsigned short instance
);
57 extern struct bgp_redist
*bgp_redist_add(struct bgp
*bgp
, afi_t afi
,
58 uint8_t type
, unsigned short instance
);
59 extern int bgp_redistribute_set(struct bgp
*bgp
, afi_t afi
, int type
,
60 unsigned short instance
, bool changed
);
61 extern int bgp_redistribute_resend(struct bgp
*bgp
, afi_t afi
, int type
,
62 unsigned short instance
);
63 extern bool bgp_redistribute_rmap_set(struct bgp_redist
*red
, const char *name
,
64 struct route_map
*route_map
);
65 extern bool bgp_redistribute_metric_set(struct bgp
*bgp
, struct bgp_redist
*red
,
66 afi_t afi
, int type
, uint32_t metric
);
67 extern int bgp_redistribute_unset(struct bgp
*bgp
, afi_t afi
, int type
,
68 unsigned short instance
);
69 extern int bgp_redistribute_unreg(struct bgp
*bgp
, afi_t afi
, int type
,
70 unsigned short instance
);
72 extern struct interface
*if_lookup_by_ipv4(struct in_addr
*addr
,
74 extern struct interface
*if_lookup_by_ipv4_exact(struct in_addr
*addr
,
76 extern struct interface
*if_lookup_by_ipv6(struct in6_addr
*addr
,
77 ifindex_t ifindex
, vrf_id_t vrf_id
);
78 extern struct interface
*if_lookup_by_ipv6_exact(struct in6_addr
*addr
,
81 extern int bgp_zebra_advertise_subnet(struct bgp
*bgp
, int advertise
,
83 extern int bgp_zebra_advertise_gw_macip(struct bgp
*bgp
, int advertise
,
85 extern int bgp_zebra_advertise_svi_macip(struct bgp
*bgp
, int advertise
,
87 extern int bgp_zebra_advertise_all_vni(struct bgp
*bgp
, int advertise
);
88 extern int bgp_zebra_dup_addr_detection(struct bgp
*bgp
);
89 extern int bgp_zebra_vxlan_flood_control(struct bgp
*bgp
,
90 enum vxlan_flood_control flood_ctrl
);
92 extern int bgp_zebra_num_connects(void);
94 extern bool bgp_zebra_nexthop_set(union sockunion
*local
,
95 union sockunion
*remote
,
96 struct bgp_nexthop
*nexthop
,
98 struct bgp_pbr_action
;
101 struct bgp_pbr_match_entry
;
103 extern void bgp_send_pbr_rule_action(struct bgp_pbr_action
*pbra
,
104 struct bgp_pbr_rule
*pbr
,
106 extern void bgp_send_pbr_ipset_match(struct bgp_pbr_match
*pbrim
,
108 extern void bgp_send_pbr_ipset_entry_match(struct bgp_pbr_match_entry
*pbrime
,
110 extern void bgp_send_pbr_iptable(struct bgp_pbr_action
*pba
,
111 struct bgp_pbr_match
*pbm
,
114 extern void bgp_zebra_announce_default(struct bgp
*bgp
, struct nexthop
*nh
,
115 afi_t afi
, uint32_t table_id
, bool announce
);
116 extern int bgp_zebra_send_capabilities(struct bgp
*bgp
, bool disable
);
117 extern int bgp_zebra_update(afi_t afi
, safi_t safi
, vrf_id_t vrf_id
, int type
);
118 extern int bgp_zebra_stale_timer_update(struct bgp
*bgp
);
119 extern int bgp_zebra_srv6_manager_get_locator_chunk(const char *name
);
120 extern int bgp_zebra_srv6_manager_release_locator_chunk(const char *name
);
121 #endif /* _QUAGGA_BGP_ZEBRA_H */