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