]>
git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_asbr.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2001 Yasuhiro Ohara
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"
17 extern unsigned char conf_debug_ospf6_asbr
;
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)
22 struct ospf6_external_info
{
23 /* External route type */
26 /* Originating Link State ID */
29 struct in6_addr forwarding
;
37 /* OSPF6 ASBR Summarisation */
39 OSPF6_ROUTE_AGGR_NONE
= 0,
42 OSPF6_ROUTE_AGGR_MODIFY
43 } ospf6_aggr_action_t
;
45 #define OSPF6_EXTERNAL_AGGRT_NO_ADVERTISE 0x1
46 #define OSPF6_EXTERNAL_AGGRT_ORIGINATED 0x2
48 #define OSPF6_EXTERNAL_RT_COUNT(aggr) \
49 (((struct ospf6_external_aggr_rt *)aggr)->match_extnl_hash->count)
51 struct ospf6_external_aggr_rt
{
52 /* range address and masklen */
55 /* use bits for OSPF6_EXTERNAL_AGGRT_NO_ADVERTISE and
56 * OSPF6_EXTERNAL_AGGRT_ORIGINATED
60 /* To store external metric-type */
63 /* Route tag for summary address */
66 /* To store aggregated metric config */
69 /* To Store the LS ID when LSA is originated */
72 /* Action to be done after delay timer expiry */
75 /* OSPFv3 route generated by summary address. */
76 struct ospf6_route
*route
;
78 /* Hash table of matching external routes */
79 struct hash
*match_extnl_hash
;
83 #define OSPF6_AS_EXTERNAL_LSA_MIN_SIZE 4U /* w/o IPv6 prefix */
84 struct ospf6_as_external_lsa
{
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 */
93 #define OSPF6_ASBR_BIT_T ntohl (0x01000000)
94 #define OSPF6_ASBR_BIT_F ntohl (0x02000000)
95 #define OSPF6_ASBR_BIT_E ntohl (0x04000000)
97 #define OSPF6_ASBR_METRIC(E) (ntohl ((E)->bits_metric & htonl (0x00ffffff)))
98 #define OSPF6_ASBR_METRIC_SET(E, C) \
100 (E)->bits_metric &= htonl(0xff000000); \
101 (E)->bits_metric |= htonl(0x00ffffff) & htonl(C); \
104 extern void ospf6_asbr_lsa_add(struct ospf6_lsa
*lsa
);
106 extern void ospf6_asbr_lsa_remove(struct ospf6_lsa
*lsa
,
107 struct ospf6_route
*asbr_entry
);
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
);
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
,
116 unsigned int nexthop_num
,
117 struct in6_addr
*nexthop
,
118 route_tag_t tag
, struct ospf6
*ospf6
);
119 extern void ospf6_asbr_redistribute_remove(int type
, ifindex_t ifindex
,
120 struct prefix
*prefix
,
121 struct ospf6
*ospf6
);
123 extern int ospf6_redistribute_config_write(struct vty
*vty
,
124 struct ospf6
*ospf6
);
126 extern void ospf6_asbr_init(void);
127 extern void ospf6_asbr_redistribute_disable(struct ospf6
*ospf6
);
128 extern void ospf6_asbr_redistribute_reset(struct ospf6
*ospf6
);
129 extern void ospf6_asbr_terminate(void);
130 extern void ospf6_asbr_send_externals_to_area(struct ospf6_area
*);
131 extern void ospf6_asbr_remove_externals_from_area(struct ospf6_area
*oa
);
133 extern int config_write_ospf6_debug_asbr(struct vty
*vty
);
134 extern int ospf6_distribute_config_write(struct vty
*vty
, struct ospf6
*ospf6
);
135 extern void install_element_ospf6_debug_asbr(void);
136 extern void ospf6_asbr_update_route_ecmp_path(struct ospf6_route
*old
,
137 struct ospf6_route
*route
,
138 struct ospf6
*ospf6
);
139 extern void ospf6_asbr_distribute_list_update(struct ospf6
*ospf6
,
140 struct ospf6_redist
*red
);
141 struct ospf6_redist
*ospf6_redist_lookup(struct ospf6
*ospf6
, int type
,
142 unsigned short instance
);
143 extern void ospf6_asbr_routemap_update(const char *mapname
);
144 extern struct ospf6_lsa
*
145 ospf6_as_external_lsa_originate(struct ospf6_route
*route
,
146 struct ospf6
*ospf6
);
147 extern void ospf6_asbr_status_update(struct ospf6
*ospf6
, int status
);
149 int ospf6_asbr_external_rt_advertise(struct ospf6
*ospf6
,
151 int ospf6_external_aggr_delay_timer_set(struct ospf6
*ospf6
, uint16_t interval
);
152 int ospf6_asbr_external_rt_no_advertise(struct ospf6
*ospf6
,
155 struct ospf6_external_aggr_rt
*
156 ospf6_external_aggr_config_lookup(struct ospf6
*ospf6
, struct prefix
*p
);
158 int ospf6_external_aggr_config_set(struct ospf6
*ospf6
, struct prefix
*p
,
159 route_tag_t tag
, int metric
, int mtype
);
161 int ospf6_external_aggr_config_unset(struct ospf6
*ospf6
,
163 void ospf6_handle_external_lsa_origination(struct ospf6
*ospf6
,
164 struct ospf6_route
*rt
,
166 void ospf6_external_aggregator_free(struct ospf6_external_aggr_rt
*aggr
);
167 void ospf6_unset_all_aggr_flag(struct ospf6
*ospf6
);
168 void ospf6_fill_aggr_route_details(struct ospf6
*ospf6
,
169 struct ospf6_external_aggr_rt
*aggr
);
170 void ospf6_asbr_summary_config_delete(struct ospf6
*ospf6
,
171 struct route_node
*rn
);
172 #endif /* OSPF6_ASBR_H */