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