2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* OSPF AS Boundary Router functions.
|
|
|
|
* Copyright (C) 1999, 2000 Kunihiro Ishiguro, Toshiaki Takada
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ZEBRA_OSPF_ASBR_H
|
|
|
|
#define _ZEBRA_OSPF_ASBR_H
|
|
|
|
|
|
|
|
struct route_map_set_values {
|
|
|
|
int32_t metric;
|
|
|
|
int32_t metric_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Redistributed external information. */
|
|
|
|
struct external_info {
|
2021-10-14 20:06:38 +02:00
|
|
|
struct ospf *ospf;
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Type of source protocol. */
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t type;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
unsigned short instance;
|
Multi-Instance OSPF Summary
——————————————-------------
- etc/init.d/quagga is modified to support creating separate ospf daemon
process for each instance. Each individual instance is monitored by
watchquagga just like any protocol daemons.(requires initd-mi.patch).
- Vtysh is modified to able to connect to multiple daemons of the same
protocol (supported for OSPF only for now).
- ospfd is modified to remember the Instance-ID that its invoked with. For
the entire life of the process it caters to any command request that
matches that instance-ID (unless its a non instance specific command).
Routes/messages to zebra are tagged with instance-ID.
- zebra route/redistribute mechanisms are modified to work with
[protocol type + instance-id]
- bgpd now has ability to have multiple instance specific redistribution
for a protocol (OSPF only supported/tested for now).
- zlog ability to display instance-id besides the protocol/daemon name.
- Changes in other daemons are to because of the needed integration with
some of the modified APIs/routines. (Didn’t prefer replicating too many
separate instance specific APIs.)
- config/show/debug commands are modified to take instance-id argument
as appropriate.
Guidelines to start using multi-instance ospf
---------------------------------------------
The patch is backward compatible, i.e for any previous way of single ospf
deamon(router ospf <cr>) will continue to work as is, including all the
show commands etc.
To enable multiple instances, do the following:
1. service quagga stop
2. Modify /etc/quagga/daemons to add instance-ids of each desired
instance in the following format:
ospfd=“yes"
ospfd_instances="1,2,3"
assuming you want to enable 3 instances with those instance ids.
3. Create corresponding ospfd config files as ospfd-1.conf, ospfd-2.conf
and ospfd-3.conf.
4. service quagga start/restart
5. Verify that the deamons are started as expected. You should see
ospfd started with -n <instance-id> option.
ps –ef | grep quagga
With that /var/run/quagga/ should have ospfd-<instance-id>.pid and
ospfd-<instance-id>/vty to each instance.
6. vtysh to work with instances as you would with any other deamons.
7. Overall most quagga semantics are the same working with the instance
deamon, like it is for any other daemon.
NOTE:
To safeguard against errors leading to too many processes getting invoked,
a hard limit on number of instance-ids is in place, currently its 5.
Allowed instance-id range is <1-65535>
Once daemons are up, show running from vtysh should show the instance-id
of each daemon as 'router ospf <instance-id>’ (without needing explicit
configuration)
Instance-id can not be changed via vtysh, other router ospf configuration
is allowed as before.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
2015-05-20 03:03:42 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Prefix. */
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
|
|
|
|
/* Interface index. */
|
2016-01-18 11:12:10 +01:00
|
|
|
ifindex_t ifindex;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
/* Nexthop address. */
|
|
|
|
struct in_addr nexthop;
|
|
|
|
|
|
|
|
/* Additional Route tag. */
|
2016-10-01 20:42:34 +02:00
|
|
|
route_tag_t tag;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-05-18 07:02:34 +02:00
|
|
|
/* Actual tag received from zebra*/
|
|
|
|
route_tag_t orig_tag;
|
|
|
|
|
2023-03-31 05:36:13 +02:00
|
|
|
uint32_t metric;
|
2023-04-06 06:55:13 +02:00
|
|
|
uint32_t min_metric;
|
|
|
|
uint32_t max_metric;
|
2023-03-31 05:36:13 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
struct route_map_set_values route_map_set;
|
2020-08-15 09:27:25 +02:00
|
|
|
#define ROUTEMAP_METRIC(E) (E)->route_map_set.metric
|
2002-12-13 21:15:29 +01:00
|
|
|
#define ROUTEMAP_METRIC_TYPE(E) (E)->route_map_set.metric_type
|
2020-08-15 09:27:25 +02:00
|
|
|
|
|
|
|
/* Back pointer to summary address */
|
|
|
|
struct ospf_external_aggr_rt *aggr_route;
|
|
|
|
|
|
|
|
/* To identify the routes to be originated
|
|
|
|
* after a summary address deletion.
|
|
|
|
*/
|
|
|
|
bool to_be_processed;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OSPF_EXTL_AGGR_DEFAULT_DELAY 5
|
|
|
|
|
|
|
|
#define OSPF_EXTERNAL_RT_COUNT(aggr) \
|
|
|
|
(((struct ospf_external_aggr_rt *)aggr)->match_extnl_hash->count)
|
|
|
|
|
|
|
|
enum ospf_aggr_action_t {
|
|
|
|
OSPF_ROUTE_AGGR_NONE = 0,
|
|
|
|
OSPF_ROUTE_AGGR_ADD,
|
|
|
|
OSPF_ROUTE_AGGR_DEL,
|
|
|
|
OSPF_ROUTE_AGGR_MODIFY
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OSPF_SUCCESS 1
|
|
|
|
#define OSPF_FAILURE 0
|
|
|
|
#define OSPF_INVALID -1
|
|
|
|
|
|
|
|
#define OSPF_EXTERNAL_AGGRT_NO_ADVERTISE 0x1
|
|
|
|
#define OSPF_EXTERNAL_AGGRT_ORIGINATED 0x2
|
|
|
|
|
|
|
|
/* Data structures for external route aggregator */
|
|
|
|
struct ospf_external_aggr_rt {
|
|
|
|
/* Prefix. */
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
|
|
|
|
/* Bit 1 : Dont advertise.
|
|
|
|
* Bit 2 : Originated as Type-5
|
|
|
|
*/
|
|
|
|
uint8_t flags;
|
|
|
|
|
|
|
|
/* Tag for summary route */
|
|
|
|
route_tag_t tag;
|
|
|
|
|
|
|
|
/* Action to be done at the delay
|
|
|
|
* timer expairy.
|
|
|
|
*/
|
|
|
|
enum ospf_aggr_action_t action;
|
|
|
|
|
|
|
|
/* Hash Table of external routes */
|
|
|
|
struct hash *match_extnl_hash;
|
2002-12-13 21:15:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#define OSPF_ASBR_CHECK_DELAY 30
|
2023-07-19 14:03:46 +02:00
|
|
|
#define OSPF_ASBR_REDIST_UPDATE_DELAY 9
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2005-05-06 23:37:42 +02:00
|
|
|
extern void ospf_external_route_remove(struct ospf *, struct prefix_ipv4 *);
|
2021-10-14 20:06:38 +02:00
|
|
|
extern struct external_info *ospf_external_info_new(struct ospf *, uint8_t,
|
|
|
|
unsigned short);
|
2005-05-06 23:37:42 +02:00
|
|
|
extern void ospf_reset_route_map_set_values(struct route_map_set_values *);
|
|
|
|
extern int ospf_route_map_set_compare(struct route_map_set_values *,
|
2003-07-12 23:30:57 +02:00
|
|
|
struct route_map_set_values *);
|
2023-03-31 05:36:13 +02:00
|
|
|
extern struct external_info *
|
|
|
|
ospf_external_info_add(struct ospf *, uint8_t, unsigned short,
|
|
|
|
struct prefix_ipv4, ifindex_t, struct in_addr,
|
|
|
|
route_tag_t, uint32_t metric);
|
2018-03-27 21:13:34 +02:00
|
|
|
extern void ospf_external_info_delete(struct ospf *, uint8_t, unsigned short,
|
2017-11-21 02:21:03 +01:00
|
|
|
struct prefix_ipv4);
|
2024-11-15 19:58:49 +01:00
|
|
|
extern void ospf_external_info_delete_multi_instance(struct ospf *ospf, uint8_t type,
|
|
|
|
struct prefix_ipv4 p,
|
|
|
|
unsigned long preserve_instance);
|
|
|
|
#define OSPF_DELETE_ANY_INSTANCE 0xffffffff
|
2018-03-27 21:13:34 +02:00
|
|
|
extern struct external_info *ospf_external_info_lookup(struct ospf *, uint8_t,
|
|
|
|
unsigned short,
|
|
|
|
struct prefix_ipv4 *);
|
|
|
|
extern void ospf_asbr_status_update(struct ospf *, uint8_t);
|
2023-07-19 14:03:46 +02:00
|
|
|
extern void ospf_schedule_asbr_redist_update(struct ospf *ospf);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2018-03-27 21:13:34 +02:00
|
|
|
extern void ospf_redistribute_withdraw(struct ospf *, uint8_t, unsigned short);
|
2005-05-06 23:37:42 +02:00
|
|
|
extern void ospf_asbr_check(void);
|
|
|
|
extern void ospf_schedule_asbr_check(void);
|
|
|
|
extern void ospf_asbr_route_install_lsa(struct ospf_lsa *);
|
|
|
|
extern struct ospf_lsa *ospf_external_info_find_lsa(struct ospf *,
|
2003-07-12 23:30:57 +02:00
|
|
|
struct prefix_ipv4 *p);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2020-08-15 10:27:40 +02:00
|
|
|
/* External Route Aggregator */
|
|
|
|
extern void ospf_asbr_external_aggregator_init(struct ospf *instance);
|
|
|
|
extern void ospf_external_aggregator_free(struct ospf_external_aggr_rt *aggr);
|
2020-09-01 09:58:47 +02:00
|
|
|
extern bool is_valid_summary_addr(struct prefix_ipv4 *p);
|
2020-08-15 11:55:40 +02:00
|
|
|
extern struct ospf_external_aggr_rt *
|
|
|
|
ospf_external_aggr_match(struct ospf *ospf, struct prefix_ipv4 *p);
|
|
|
|
extern void ospf_unlink_ei_from_aggr(struct ospf *ospf,
|
|
|
|
struct ospf_external_aggr_rt *aggr,
|
|
|
|
struct external_info *ei);
|
|
|
|
extern struct ospf_lsa *
|
|
|
|
ospf_originate_summary_lsa(struct ospf *ospf,
|
|
|
|
struct ospf_external_aggr_rt *aggr,
|
|
|
|
struct external_info *ei);
|
|
|
|
extern int ospf_external_aggregator_timer_set(struct ospf *ospf,
|
2022-01-28 15:01:54 +01:00
|
|
|
uint16_t interval);
|
2020-08-15 11:55:40 +02:00
|
|
|
extern void ospf_external_aggrigator_free(struct ospf_external_aggr_rt *aggr);
|
|
|
|
|
|
|
|
extern struct ospf_external_aggr_rt *
|
2025-01-03 15:55:40 +01:00
|
|
|
ospf_external_aggregator_lookup(struct ospf *ospf, struct prefix_ipv4 *p);
|
2020-08-15 11:55:40 +02:00
|
|
|
|
|
|
|
void ospf_unset_all_aggr_flag(struct ospf *ospf);
|
2020-09-01 09:58:47 +02:00
|
|
|
|
|
|
|
extern int ospf_asbr_external_aggregator_set(struct ospf *ospf,
|
|
|
|
struct prefix_ipv4 *p,
|
|
|
|
route_tag_t tag);
|
|
|
|
extern int ospf_asbr_external_aggregator_unset(struct ospf *ospf,
|
|
|
|
struct prefix_ipv4 *p,
|
|
|
|
route_tag_t tag);
|
|
|
|
extern int ospf_asbr_external_rt_no_advertise(struct ospf *ospf,
|
|
|
|
struct prefix_ipv4 *p);
|
|
|
|
extern int ospf_asbr_external_rt_advertise(struct ospf *ospf,
|
|
|
|
struct prefix_ipv4 *p);
|
2002-12-13 21:15:29 +01:00
|
|
|
#endif /* _ZEBRA_OSPF_ASBR_H */
|