]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
2 | * Copyright (C) 2001 Yasuhiro Ohara | |
3 | * | |
4 | * This file is part of GNU Zebra. | |
5 | * | |
6 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2, or (at your option) any | |
9 | * later version. | |
10 | * | |
11 | * GNU Zebra is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * General Public License for more details. | |
15 | * | |
896014f4 DL |
16 | * You should have received a copy of the GNU General Public License along |
17 | * with this program; see the file COPYING; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
718e3744 | 19 | */ |
20 | ||
21 | #ifndef OSPF6_ASBR_H | |
22 | #define OSPF6_ASBR_H | |
23 | ||
87362ceb DO |
24 | /* for struct ospf6_prefix */ |
25 | #include "ospf6_proto.h" | |
26 | /* for struct ospf6_lsa */ | |
27 | #include "ospf6_lsa.h" | |
28 | /* for struct ospf6_route */ | |
29 | #include "ospf6_route.h" | |
30 | ||
508e53e2 | 31 | /* Debug option */ |
32 | extern unsigned char conf_debug_ospf6_asbr; | |
d62a17ae | 33 | #define OSPF6_DEBUG_ASBR_ON() (conf_debug_ospf6_asbr = 1) |
34 | #define OSPF6_DEBUG_ASBR_OFF() (conf_debug_ospf6_asbr = 0) | |
35 | #define IS_OSPF6_DEBUG_ASBR (conf_debug_ospf6_asbr) | |
718e3744 | 36 | |
d62a17ae | 37 | struct ospf6_external_info { |
38 | /* External route type */ | |
39 | int type; | |
718e3744 | 40 | |
d62a17ae | 41 | /* Originating Link State ID */ |
d7c0a89a | 42 | uint32_t id; |
718e3744 | 43 | |
d62a17ae | 44 | struct in6_addr forwarding; |
464015fa | 45 | |
d62a17ae | 46 | route_tag_t tag; |
42a7debf | 47 | |
d62a17ae | 48 | ifindex_t ifindex; |
4dc43886 MR |
49 | |
50 | }; | |
51 | ||
52 | /* OSPF6 ASBR Summarisation */ | |
53 | typedef enum { | |
54 | OSPF6_ROUTE_AGGR_NONE = 0, | |
55 | OSPF6_ROUTE_AGGR_ADD, | |
56 | OSPF6_ROUTE_AGGR_DEL, | |
57 | OSPF6_ROUTE_AGGR_MODIFY | |
c3a70f65 | 58 | } ospf6_aggr_action_t; |
4dc43886 MR |
59 | |
60 | #define OSPF6_EXTERNAL_AGGRT_NO_ADVERTISE 0x1 | |
61 | #define OSPF6_EXTERNAL_AGGRT_ORIGINATED 0x2 | |
62 | ||
63 | #define OSPF6_EXTERNAL_RT_COUNT(aggr) \ | |
c3a70f65 | 64 | (((struct ospf6_external_aggr_rt *)aggr)->match_extnl_hash->count) |
4dc43886 MR |
65 | |
66 | struct ospf6_external_aggr_rt { | |
67 | /* range address and masklen */ | |
68 | struct prefix p; | |
69 | ||
70 | /* use bits for OSPF6_EXTERNAL_AGGRT_NO_ADVERTISE and | |
71 | * OSPF6_EXTERNAL_AGGRT_ORIGINATED | |
72 | */ | |
73 | uint16_t aggrflags; | |
74 | ||
75 | /* To store external metric-type */ | |
76 | uint8_t mtype; | |
77 | ||
78 | /* Route tag for summary address */ | |
79 | route_tag_t tag; | |
80 | ||
81 | /* To store aggregated metric config */ | |
82 | int metric; | |
83 | ||
84 | /* To Store the LS ID when LSA is originated */ | |
85 | uint32_t id; | |
86 | ||
4dc43886 MR |
87 | /* Action to be done after delay timer expiry */ |
88 | int action; | |
89 | ||
c405b00f MR |
90 | /* OSPFv3 route generated by summary address. */ |
91 | struct ospf6_route *route; | |
92 | ||
4dc43886 MR |
93 | /* Hash table of matching external routes */ |
94 | struct hash *match_extnl_hash; | |
718e3744 | 95 | }; |
96 | ||
718e3744 | 97 | /* AS-External-LSA */ |
abc7ef44 | 98 | #define OSPF6_AS_EXTERNAL_LSA_MIN_SIZE 4U /* w/o IPv6 prefix */ |
d62a17ae | 99 | struct ospf6_as_external_lsa { |
d7c0a89a | 100 | uint32_t bits_metric; |
d62a17ae | 101 | |
102 | struct ospf6_prefix prefix; | |
103 | /* followed by none or one forwarding address */ | |
104 | /* followed by none or one external route tag */ | |
105 | /* followed by none or one referenced LS-ID */ | |
718e3744 | 106 | }; |
107 | ||
108 | #define OSPF6_ASBR_BIT_T ntohl (0x01000000) | |
109 | #define OSPF6_ASBR_BIT_F ntohl (0x02000000) | |
110 | #define OSPF6_ASBR_BIT_E ntohl (0x04000000) | |
111 | ||
112 | #define OSPF6_ASBR_METRIC(E) (ntohl ((E)->bits_metric & htonl (0x00ffffff))) | |
d62a17ae | 113 | #define OSPF6_ASBR_METRIC_SET(E, C) \ |
114 | { \ | |
115 | (E)->bits_metric &= htonl(0xff000000); \ | |
116 | (E)->bits_metric |= htonl(0x00ffffff) & htonl(C); \ | |
117 | } | |
118 | ||
f5f26b8f | 119 | extern void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa); |
ad500b22 | 120 | |
07b37f93 CS |
121 | extern void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa, |
122 | struct ospf6_route *asbr_entry); | |
beadc736 | 123 | extern void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry, |
124 | struct ospf6 *ospf6); | |
125 | extern void ospf6_asbr_lsentry_remove(struct ospf6_route *asbr_entry, | |
126 | struct ospf6 *ospf6); | |
d62a17ae | 127 | |
128 | extern int ospf6_asbr_is_asbr(struct ospf6 *o); | |
129 | extern void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, | |
130 | struct prefix *prefix, | |
d7c0a89a | 131 | unsigned int nexthop_num, |
d62a17ae | 132 | struct in6_addr *nexthop, |
beadc736 | 133 | route_tag_t tag, struct ospf6 *ospf6); |
d62a17ae | 134 | extern void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex, |
beadc736 | 135 | struct prefix *prefix, |
136 | struct ospf6 *ospf6); | |
d62a17ae | 137 | |
beadc736 | 138 | extern int ospf6_redistribute_config_write(struct vty *vty, |
139 | struct ospf6 *ospf6); | |
d62a17ae | 140 | |
141 | extern void ospf6_asbr_init(void); | |
f71ed6df | 142 | extern void ospf6_asbr_redistribute_disable(struct ospf6 *ospf6); |
a069482f | 143 | extern void ospf6_asbr_redistribute_reset(struct ospf6 *ospf6); |
d62a17ae | 144 | extern void ospf6_asbr_terminate(void); |
145 | extern void ospf6_asbr_send_externals_to_area(struct ospf6_area *); | |
bac66c5c | 146 | extern void ospf6_asbr_remove_externals_from_area(struct ospf6_area *oa); |
d62a17ae | 147 | |
148 | extern int config_write_ospf6_debug_asbr(struct vty *vty); | |
b19502d3 | 149 | extern int ospf6_distribute_config_write(struct vty *vty, struct ospf6 *ospf6); |
d62a17ae | 150 | extern void install_element_ospf6_debug_asbr(void); |
064d4355 | 151 | extern void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old, |
beadc736 | 152 | struct ospf6_route *route, |
153 | struct ospf6 *ospf6); | |
2f43e34d MR |
154 | extern void ospf6_asbr_distribute_list_update(struct ospf6 *ospf6, |
155 | struct ospf6_redist *red); | |
a069482f K |
156 | struct ospf6_redist *ospf6_redist_lookup(struct ospf6 *ospf6, int type, |
157 | unsigned short instance); | |
ad500b22 | 158 | extern void ospf6_asbr_routemap_update(const char *mapname); |
c3a70f65 MR |
159 | extern struct ospf6_lsa * |
160 | ospf6_as_external_lsa_originate(struct ospf6_route *route, | |
161 | struct ospf6 *ospf6); | |
ad500b22 K |
162 | extern void ospf6_asbr_status_update(struct ospf6 *ospf6, int status); |
163 | ||
4dc43886 | 164 | int ospf6_asbr_external_rt_advertise(struct ospf6 *ospf6, |
c3a70f65 | 165 | struct prefix *p); |
74e8311e | 166 | int ospf6_external_aggr_delay_timer_set(struct ospf6 *ospf6, uint16_t interval); |
4dc43886 | 167 | int ospf6_asbr_external_rt_no_advertise(struct ospf6 *ospf6, |
c3a70f65 | 168 | struct prefix *p); |
4dc43886 MR |
169 | |
170 | struct ospf6_external_aggr_rt * | |
171 | ospf6_external_aggr_config_lookup(struct ospf6 *ospf6, struct prefix *p); | |
172 | ||
173 | int ospf6_external_aggr_config_set(struct ospf6 *ospf6, struct prefix *p, | |
c3a70f65 | 174 | route_tag_t tag, int metric, int mtype); |
4dc43886 MR |
175 | |
176 | int ospf6_external_aggr_config_unset(struct ospf6 *ospf6, | |
177 | struct prefix *p); | |
178 | void ospf6_handle_external_lsa_origination(struct ospf6 *ospf6, | |
179 | struct ospf6_route *rt, | |
180 | struct prefix *p); | |
181 | void ospf6_external_aggregator_free(struct ospf6_external_aggr_rt *aggr); | |
182 | void ospf6_unset_all_aggr_flag(struct ospf6 *ospf6); | |
c3a70f65 | 183 | void ospf6_fill_aggr_route_details(struct ospf6 *ospf6, |
c405b00f | 184 | struct ospf6_external_aggr_rt *aggr); |
718e3744 | 185 | #endif /* OSPF6_ASBR_H */ |