diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-20 03:03:42 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-20 03:03:42 +0200 |
commit | 7c8ff89e9346227f0e721f7686d4c4d58f9c9135 (patch) | |
tree | 7a5f73baf68e31220396e2391cdd216cdf981d51 /ospfd/ospf_asbr.c | |
parent | initd: initd-mi.patch (diff) | |
download | frr-7c8ff89e9346227f0e721f7686d4c4d58f9c9135.tar.xz frr-7c8ff89e9346227f0e721f7686d4c4d58f9c9135.zip |
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>
Diffstat (limited to 'ospfd/ospf_asbr.c')
-rw-r--r-- | ospfd/ospf_asbr.c | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index f4140b858..5eb97d8f6 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -99,13 +99,14 @@ ospf_external_route_lookup (struct ospf *ospf, /* Add an External info for AS-external-LSA. */ struct external_info * -ospf_external_info_new (u_char type) +ospf_external_info_new (u_char type, u_short instance) { struct external_info *new; new = (struct external_info *) XCALLOC (MTYPE_OSPF_EXTERNAL_INFO, sizeof (struct external_info)); new->type = type; + new->instance = instance; ospf_reset_route_map_set_values (&new->route_map_set); return new; @@ -134,32 +135,33 @@ ospf_route_map_set_compare (struct route_map_set_values *values1, /* Add an External info for AS-external-LSA. */ struct external_info * -ospf_external_info_add (u_char type, struct prefix_ipv4 p, +ospf_external_info_add (u_char type, u_short instance, struct prefix_ipv4 p, unsigned int ifindex, struct in_addr nexthop, u_short tag) { struct external_info *new; struct route_node *rn; + struct ospf_external *ext; - /* Initialize route table. */ - if (EXTERNAL_INFO (type) == NULL) - EXTERNAL_INFO (type) = route_table_init (); + ext = ospf_external_lookup(type, instance); + if (!ext) + ext = ospf_external_add(type, instance); - rn = route_node_get (EXTERNAL_INFO (type), (struct prefix *) &p); + rn = route_node_get (EXTERNAL_INFO (ext), (struct prefix *) &p); /* If old info exists, -- discard new one or overwrite with new one? */ if (rn) if (rn->info) { route_unlock_node (rn); - zlog_warn ("Redistribute[%s]: %s/%d already exists, discard.", - ospf_redist_string(type), + zlog_warn ("Redistribute[%s][%d]: %s/%d already exists, discard.", + ospf_redist_string(type), instance, inet_ntoa (p.prefix), p.prefixlen); /* XFREE (MTYPE_OSPF_TMP, rn->info); */ return rn->info; } /* Create new External info instance. */ - new = ospf_external_info_new (type); + new = ospf_external_info_new (type, instance); new->p = p; new->ifindex = ifindex; new->nexthop = nexthop; @@ -176,11 +178,16 @@ ospf_external_info_add (u_char type, struct prefix_ipv4 p, } void -ospf_external_info_delete (u_char type, struct prefix_ipv4 p) +ospf_external_info_delete (u_char type, u_short instance, struct prefix_ipv4 p) { struct route_node *rn; + struct ospf_external *ext; - rn = route_node_lookup (EXTERNAL_INFO (type), (struct prefix *) &p); + ext = ospf_external_lookup(type, instance); + if (!ext) + return; + + rn = route_node_lookup (EXTERNAL_INFO (ext), (struct prefix *) &p); if (rn) { ospf_external_info_free (rn->info); @@ -191,10 +198,16 @@ ospf_external_info_delete (u_char type, struct prefix_ipv4 p) } struct external_info * -ospf_external_info_lookup (u_char type, struct prefix_ipv4 *p) +ospf_external_info_lookup (u_char type, u_short instance, struct prefix_ipv4 *p) { struct route_node *rn; - rn = route_node_lookup (EXTERNAL_INFO (type), (struct prefix *) p); + struct ospf_external *ext; + + ext = ospf_external_lookup(type, instance); + if (!ext) + return NULL; + + rn = route_node_lookup (EXTERNAL_INFO (ext), (struct prefix *) p); if (rn) { route_unlock_node (rn); @@ -271,14 +284,19 @@ ospf_asbr_status_update (struct ospf *ospf, u_char status) } void -ospf_redistribute_withdraw (struct ospf *ospf, u_char type) +ospf_redistribute_withdraw (struct ospf *ospf, u_char type, u_short instance) { struct route_node *rn; struct external_info *ei; + struct ospf_external *ext; + + ext = ospf_external_lookup(type, instance); + if (!ext) + return; /* Delete external info for specified type. */ - if (EXTERNAL_INFO (type)) - for (rn = route_top (EXTERNAL_INFO (type)); rn; rn = route_next (rn)) + if (EXTERNAL_INFO (ext)) + for (rn = route_top (EXTERNAL_INFO (ext)); rn; rn = route_next (rn)) if ((ei = rn->info)) if (ospf_external_info_find_lsa (ospf, &ei->p)) { |