]> git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_asbr.h
topotests: increase OSPF convergence speed
[mirror_frr.git] / ospfd / ospf_asbr.h
1 /*
2 * OSPF AS Boundary Router functions.
3 * Copyright (C) 1999, 2000 Kunihiro Ishiguro, Toshiaki Takada
4 *
5 * This file is part of GNU Zebra.
6 *
7 * GNU Zebra is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #ifndef _ZEBRA_OSPF_ASBR_H
23 #define _ZEBRA_OSPF_ASBR_H
24
25 struct route_map_set_values {
26 int32_t metric;
27 int32_t metric_type;
28 };
29
30 /* Redistributed external information. */
31 struct external_info {
32 /* Type of source protocol. */
33 uint8_t type;
34
35 unsigned short instance;
36
37 /* Prefix. */
38 struct prefix_ipv4 p;
39
40 /* Interface index. */
41 ifindex_t ifindex;
42
43 /* Nexthop address. */
44 struct in_addr nexthop;
45
46 /* Additional Route tag. */
47 route_tag_t tag;
48
49 /* Actual tag received from zebra*/
50 route_tag_t orig_tag;
51
52 struct route_map_set_values route_map_set;
53 #define ROUTEMAP_METRIC(E) (E)->route_map_set.metric
54 #define ROUTEMAP_METRIC_TYPE(E) (E)->route_map_set.metric_type
55
56 /* Back pointer to summary address */
57 struct ospf_external_aggr_rt *aggr_route;
58
59 /* To identify the routes to be originated
60 * after a summary address deletion.
61 */
62 bool to_be_processed;
63 };
64
65 #define OSPF_EXTL_AGGR_DEFAULT_DELAY 5
66
67 #define OSPF_EXTERNAL_RT_COUNT(aggr) \
68 (((struct ospf_external_aggr_rt *)aggr)->match_extnl_hash->count)
69
70 enum ospf_aggr_action_t {
71 OSPF_ROUTE_AGGR_NONE = 0,
72 OSPF_ROUTE_AGGR_ADD,
73 OSPF_ROUTE_AGGR_DEL,
74 OSPF_ROUTE_AGGR_MODIFY
75 };
76
77 #define OSPF_SUCCESS 1
78 #define OSPF_FAILURE 0
79 #define OSPF_INVALID -1
80
81 #define OSPF_EXTERNAL_AGGRT_NO_ADVERTISE 0x1
82 #define OSPF_EXTERNAL_AGGRT_ORIGINATED 0x2
83
84 /* Data structures for external route aggregator */
85 struct ospf_external_aggr_rt {
86 /* Prefix. */
87 struct prefix_ipv4 p;
88
89 /* Bit 1 : Dont advertise.
90 * Bit 2 : Originated as Type-5
91 */
92 uint8_t flags;
93
94 /* Tag for summary route */
95 route_tag_t tag;
96
97 /* Action to be done at the delay
98 * timer expairy.
99 */
100 enum ospf_aggr_action_t action;
101
102 /* Hash Table of external routes */
103 struct hash *match_extnl_hash;
104 };
105
106 #define OSPF_ASBR_CHECK_DELAY 30
107 #define OSPF_ASBR_NSSA_REDIST_UPDATE_DELAY 9
108
109 extern void ospf_external_route_remove(struct ospf *, struct prefix_ipv4 *);
110 extern struct external_info *ospf_external_info_new(uint8_t, unsigned short);
111 extern void ospf_reset_route_map_set_values(struct route_map_set_values *);
112 extern int ospf_route_map_set_compare(struct route_map_set_values *,
113 struct route_map_set_values *);
114 extern struct external_info *ospf_external_info_add(struct ospf *, uint8_t,
115 unsigned short,
116 struct prefix_ipv4,
117 ifindex_t, struct in_addr,
118 route_tag_t);
119 extern void ospf_external_info_delete(struct ospf *, uint8_t, unsigned short,
120 struct prefix_ipv4);
121 extern struct external_info *ospf_external_info_lookup(struct ospf *, uint8_t,
122 unsigned short,
123 struct prefix_ipv4 *);
124 extern void ospf_asbr_status_update(struct ospf *, uint8_t);
125 extern void ospf_schedule_asbr_nssa_redist_update(struct ospf *ospf);
126
127 extern void ospf_redistribute_withdraw(struct ospf *, uint8_t, unsigned short);
128 extern void ospf_asbr_check(void);
129 extern void ospf_schedule_asbr_check(void);
130 extern void ospf_asbr_route_install_lsa(struct ospf_lsa *);
131 extern struct ospf_lsa *ospf_external_info_find_lsa(struct ospf *,
132 struct prefix_ipv4 *p);
133
134 /* External Route Aggregator */
135 extern void ospf_asbr_external_aggregator_init(struct ospf *instance);
136 extern void ospf_external_aggregator_free(struct ospf_external_aggr_rt *aggr);
137 extern bool is_valid_summary_addr(struct prefix_ipv4 *p);
138 extern struct ospf_external_aggr_rt *
139 ospf_external_aggr_match(struct ospf *ospf, struct prefix_ipv4 *p);
140 extern void ospf_unlink_ei_from_aggr(struct ospf *ospf,
141 struct ospf_external_aggr_rt *aggr,
142 struct external_info *ei);
143 extern struct ospf_lsa *
144 ospf_originate_summary_lsa(struct ospf *ospf,
145 struct ospf_external_aggr_rt *aggr,
146 struct external_info *ei);
147 extern int ospf_external_aggregator_timer_set(struct ospf *ospf,
148 unsigned int interval);
149 extern void ospf_external_aggrigator_free(struct ospf_external_aggr_rt *aggr);
150
151 extern struct ospf_external_aggr_rt *
152 ospf_extrenal_aggregator_lookup(struct ospf *ospf, struct prefix_ipv4 *p);
153
154 void ospf_unset_all_aggr_flag(struct ospf *ospf);
155
156 extern int ospf_asbr_external_aggregator_set(struct ospf *ospf,
157 struct prefix_ipv4 *p,
158 route_tag_t tag);
159 extern int ospf_asbr_external_aggregator_unset(struct ospf *ospf,
160 struct prefix_ipv4 *p,
161 route_tag_t tag);
162 extern int ospf_asbr_external_rt_no_advertise(struct ospf *ospf,
163 struct prefix_ipv4 *p);
164 extern int ospf_asbr_external_rt_advertise(struct ospf *ospf,
165 struct prefix_ipv4 *p);
166 #endif /* _ZEBRA_OSPF_ASBR_H */