]> git.proxmox.com Git - mirror_frr.git/blame - ospfd/ospf_asbr.h
Merge pull request #10945 from taspelund/ra_log_gooder
[mirror_frr.git] / ospfd / ospf_asbr.h
CommitLineData
718e3744 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 *
896014f4
DL
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
718e3744 20 */
21
22#ifndef _ZEBRA_OSPF_ASBR_H
23#define _ZEBRA_OSPF_ASBR_H
24
d62a17ae 25struct route_map_set_values {
26 int32_t metric;
27 int32_t metric_type;
718e3744 28};
29
30/* Redistributed external information. */
d62a17ae 31struct external_info {
4030e186
IR
32 struct ospf *ospf;
33
d62a17ae 34 /* Type of source protocol. */
d7c0a89a 35 uint8_t type;
718e3744 36
d7c0a89a 37 unsigned short instance;
7c8ff89e 38
d62a17ae 39 /* Prefix. */
40 struct prefix_ipv4 p;
718e3744 41
d62a17ae 42 /* Interface index. */
43 ifindex_t ifindex;
718e3744 44
d62a17ae 45 /* Nexthop address. */
46 struct in_addr nexthop;
718e3744 47
d62a17ae 48 /* Additional Route tag. */
49 route_tag_t tag;
718e3744 50
04e94d39 51 /* Actual tag received from zebra*/
52 route_tag_t orig_tag;
53
d62a17ae 54 struct route_map_set_values route_map_set;
cb2bc4cb 55#define ROUTEMAP_METRIC(E) (E)->route_map_set.metric
718e3744 56#define ROUTEMAP_METRIC_TYPE(E) (E)->route_map_set.metric_type
cb2bc4cb 57
58 /* Back pointer to summary address */
59 struct ospf_external_aggr_rt *aggr_route;
60
61 /* To identify the routes to be originated
62 * after a summary address deletion.
63 */
64 bool to_be_processed;
65};
66
67#define OSPF_EXTL_AGGR_DEFAULT_DELAY 5
68
69#define OSPF_EXTERNAL_RT_COUNT(aggr) \
70 (((struct ospf_external_aggr_rt *)aggr)->match_extnl_hash->count)
71
72enum ospf_aggr_action_t {
73 OSPF_ROUTE_AGGR_NONE = 0,
74 OSPF_ROUTE_AGGR_ADD,
75 OSPF_ROUTE_AGGR_DEL,
76 OSPF_ROUTE_AGGR_MODIFY
77};
78
79#define OSPF_SUCCESS 1
80#define OSPF_FAILURE 0
81#define OSPF_INVALID -1
82
83#define OSPF_EXTERNAL_AGGRT_NO_ADVERTISE 0x1
84#define OSPF_EXTERNAL_AGGRT_ORIGINATED 0x2
85
86/* Data structures for external route aggregator */
87struct ospf_external_aggr_rt {
88 /* Prefix. */
89 struct prefix_ipv4 p;
90
91 /* Bit 1 : Dont advertise.
92 * Bit 2 : Originated as Type-5
93 */
94 uint8_t flags;
95
96 /* Tag for summary route */
97 route_tag_t tag;
98
99 /* Action to be done at the delay
100 * timer expairy.
101 */
102 enum ospf_aggr_action_t action;
103
104 /* Hash Table of external routes */
105 struct hash *match_extnl_hash;
718e3744 106};
107
108#define OSPF_ASBR_CHECK_DELAY 30
1c1c342d 109#define OSPF_ASBR_NSSA_REDIST_UPDATE_DELAY 9
718e3744 110
d62a17ae 111extern void ospf_external_route_remove(struct ospf *, struct prefix_ipv4 *);
4030e186
IR
112extern struct external_info *ospf_external_info_new(struct ospf *, uint8_t,
113 unsigned short);
d62a17ae 114extern void ospf_reset_route_map_set_values(struct route_map_set_values *);
115extern int ospf_route_map_set_compare(struct route_map_set_values *,
116 struct route_map_set_values *);
d7c0a89a
QY
117extern struct external_info *ospf_external_info_add(struct ospf *, uint8_t,
118 unsigned short,
119 struct prefix_ipv4,
d62a17ae 120 ifindex_t, struct in_addr,
121 route_tag_t);
d7c0a89a 122extern void ospf_external_info_delete(struct ospf *, uint8_t, unsigned short,
de1ac5fd 123 struct prefix_ipv4);
d7c0a89a
QY
124extern struct external_info *ospf_external_info_lookup(struct ospf *, uint8_t,
125 unsigned short,
126 struct prefix_ipv4 *);
d7c0a89a 127extern void ospf_asbr_status_update(struct ospf *, uint8_t);
1c1c342d 128extern void ospf_schedule_asbr_nssa_redist_update(struct ospf *ospf);
718e3744 129
d7c0a89a 130extern void ospf_redistribute_withdraw(struct ospf *, uint8_t, unsigned short);
d62a17ae 131extern void ospf_asbr_check(void);
132extern void ospf_schedule_asbr_check(void);
133extern void ospf_asbr_route_install_lsa(struct ospf_lsa *);
134extern struct ospf_lsa *ospf_external_info_find_lsa(struct ospf *,
135 struct prefix_ipv4 *p);
718e3744 136
ad7222b7 137/* External Route Aggregator */
138extern void ospf_asbr_external_aggregator_init(struct ospf *instance);
ad7222b7 139extern void ospf_external_aggregator_free(struct ospf_external_aggr_rt *aggr);
423e71c4 140extern bool is_valid_summary_addr(struct prefix_ipv4 *p);
63f0e941 141extern struct ospf_external_aggr_rt *
142ospf_external_aggr_match(struct ospf *ospf, struct prefix_ipv4 *p);
63f0e941 143extern void ospf_unlink_ei_from_aggr(struct ospf *ospf,
144 struct ospf_external_aggr_rt *aggr,
145 struct external_info *ei);
63f0e941 146extern struct ospf_lsa *
147ospf_originate_summary_lsa(struct ospf *ospf,
148 struct ospf_external_aggr_rt *aggr,
149 struct external_info *ei);
150extern int ospf_external_aggregator_timer_set(struct ospf *ospf,
4b939ad2 151 uint16_t interval);
63f0e941 152extern void ospf_external_aggrigator_free(struct ospf_external_aggr_rt *aggr);
153
154extern struct ospf_external_aggr_rt *
155ospf_extrenal_aggregator_lookup(struct ospf *ospf, struct prefix_ipv4 *p);
156
157void ospf_unset_all_aggr_flag(struct ospf *ospf);
423e71c4 158
159extern int ospf_asbr_external_aggregator_set(struct ospf *ospf,
160 struct prefix_ipv4 *p,
161 route_tag_t tag);
162extern int ospf_asbr_external_aggregator_unset(struct ospf *ospf,
163 struct prefix_ipv4 *p,
164 route_tag_t tag);
165extern int ospf_asbr_external_rt_no_advertise(struct ospf *ospf,
166 struct prefix_ipv4 *p);
167extern int ospf_asbr_external_rt_advertise(struct ospf *ospf,
168 struct prefix_ipv4 *p);
718e3744 169#endif /* _ZEBRA_OSPF_ASBR_H */