2002-12-13 21:15:29 +01:00
|
|
|
/*
|
|
|
|
* RIPngd and zebra interface.
|
|
|
|
* Copyright (C) 1998, 1999 Kunihiro Ishiguro
|
|
|
|
*
|
|
|
|
* This file is part of GNU Zebra.
|
|
|
|
*
|
|
|
|
* GNU Zebra is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
* later version.
|
|
|
|
*
|
|
|
|
* GNU Zebra is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Zebra; see the file COPYING. If not, write to the Free
|
|
|
|
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zebra.h>
|
|
|
|
|
|
|
|
#include "command.h"
|
|
|
|
#include "prefix.h"
|
|
|
|
#include "stream.h"
|
|
|
|
#include "routemap.h"
|
|
|
|
#include "zclient.h"
|
|
|
|
#include "log.h"
|
|
|
|
|
|
|
|
#include "ripngd/ripngd.h"
|
|
|
|
|
|
|
|
/* All information about zebra. */
|
|
|
|
struct zclient *zclient = NULL;
|
|
|
|
|
|
|
|
/* Callback prototypes for zebra client service. */
|
|
|
|
int ripng_interface_up (int, struct zclient *, zebra_size_t);
|
|
|
|
int ripng_interface_down (int, struct zclient *, zebra_size_t);
|
|
|
|
int ripng_interface_add (int, struct zclient *, zebra_size_t);
|
|
|
|
int ripng_interface_delete (int, struct zclient *, zebra_size_t);
|
|
|
|
int ripng_interface_address_add (int, struct zclient *, zebra_size_t);
|
|
|
|
int ripng_interface_address_delete (int, struct zclient *, zebra_size_t);
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
void
|
|
|
|
ripng_zebra_ipv6_add (struct prefix_ipv6 *p, struct in6_addr *nexthop,
|
2005-08-27 08:19:39 +02:00
|
|
|
unsigned int ifindex, u_char metric)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
struct zapi_ipv6 api;
|
|
|
|
|
2015-05-20 03:03:45 +02:00
|
|
|
if (zclient->redist[AFI_IP6][ZEBRA_ROUTE_RIPNG].enabled)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
api.type = ZEBRA_ROUTE_RIPNG;
|
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
|
|
|
api.instance = 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
api.flags = 0;
|
|
|
|
api.message = 0;
|
2011-12-05 13:35:14 +01:00
|
|
|
api.safi = SAFI_UNICAST;
|
2002-12-13 21:15:29 +01:00
|
|
|
SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP);
|
|
|
|
api.nexthop_num = 1;
|
|
|
|
api.nexthop = &nexthop;
|
|
|
|
SET_FLAG (api.message, ZAPI_MESSAGE_IFINDEX);
|
|
|
|
api.ifindex_num = 1;
|
|
|
|
api.ifindex = &ifindex;
|
2005-08-27 08:19:39 +02:00
|
|
|
SET_FLAG (api.message, ZAPI_MESSAGE_METRIC);
|
|
|
|
api.metric = metric;
|
|
|
|
|
2004-05-08 13:48:26 +02:00
|
|
|
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, p, &api);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ripng_zebra_ipv6_delete (struct prefix_ipv6 *p, struct in6_addr *nexthop,
|
|
|
|
unsigned int ifindex)
|
|
|
|
{
|
|
|
|
struct zapi_ipv6 api;
|
|
|
|
|
2015-05-20 03:03:45 +02:00
|
|
|
if (zclient->redist[AFI_IP6][ZEBRA_ROUTE_RIPNG].enabled)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
api.type = ZEBRA_ROUTE_RIPNG;
|
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
|
|
|
api.instance = 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
api.flags = 0;
|
|
|
|
api.message = 0;
|
2011-12-05 13:35:14 +01:00
|
|
|
api.safi = SAFI_UNICAST;
|
2002-12-13 21:15:29 +01:00
|
|
|
SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP);
|
|
|
|
api.nexthop_num = 1;
|
|
|
|
api.nexthop = &nexthop;
|
|
|
|
SET_FLAG (api.message, ZAPI_MESSAGE_IFINDEX);
|
|
|
|
api.ifindex_num = 1;
|
|
|
|
api.ifindex = &ifindex;
|
|
|
|
|
2004-05-08 13:48:26 +02:00
|
|
|
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, p, &api);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Zebra route add and delete treatment. */
|
2008-08-15 14:45:30 +02:00
|
|
|
static int
|
2002-12-13 21:15:29 +01:00
|
|
|
ripng_zebra_read_ipv6 (int command, struct zclient *zclient,
|
|
|
|
zebra_size_t length)
|
|
|
|
{
|
|
|
|
struct stream *s;
|
|
|
|
struct zapi_ipv6 api;
|
|
|
|
unsigned long ifindex;
|
|
|
|
struct in6_addr nexthop;
|
|
|
|
struct prefix_ipv6 p;
|
|
|
|
|
|
|
|
s = zclient->ibuf;
|
|
|
|
ifindex = 0;
|
|
|
|
memset (&nexthop, 0, sizeof (struct in6_addr));
|
|
|
|
|
|
|
|
/* Type, flags, message. */
|
|
|
|
api.type = stream_getc (s);
|
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
|
|
|
api.instance = stream_getw (s);
|
2002-12-13 21:15:29 +01:00
|
|
|
api.flags = stream_getc (s);
|
|
|
|
api.message = stream_getc (s);
|
|
|
|
|
|
|
|
/* IPv6 prefix. */
|
|
|
|
memset (&p, 0, sizeof (struct prefix_ipv6));
|
|
|
|
p.family = AF_INET6;
|
|
|
|
p.prefixlen = stream_getc (s);
|
|
|
|
stream_get (&p.prefix, s, PSIZE (p.prefixlen));
|
|
|
|
|
|
|
|
/* Nexthop, ifindex, distance, metric. */
|
|
|
|
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP))
|
|
|
|
{
|
|
|
|
api.nexthop_num = stream_getc (s);
|
|
|
|
stream_get (&nexthop, s, 16);
|
|
|
|
}
|
|
|
|
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_IFINDEX))
|
|
|
|
{
|
|
|
|
api.ifindex_num = stream_getc (s);
|
|
|
|
ifindex = stream_getl (s);
|
|
|
|
}
|
|
|
|
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_DISTANCE))
|
|
|
|
api.distance = stream_getc (s);
|
|
|
|
else
|
|
|
|
api.distance = 0;
|
|
|
|
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_METRIC))
|
|
|
|
api.metric = stream_getl (s);
|
|
|
|
else
|
|
|
|
api.metric = 0;
|
|
|
|
|
|
|
|
if (command == ZEBRA_IPV6_ROUTE_ADD)
|
2003-05-25 19:10:12 +02:00
|
|
|
ripng_redistribute_add (api.type, RIPNG_ROUTE_REDISTRIBUTE, &p, ifindex, &nexthop);
|
2002-12-13 21:15:29 +01:00
|
|
|
else
|
2003-05-25 19:10:12 +02:00
|
|
|
ripng_redistribute_delete (api.type, RIPNG_ROUTE_REDISTRIBUTE, &p, ifindex);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
void
|
2008-08-15 14:45:30 +02:00
|
|
|
ripng_zclient_reset (void)
|
2003-05-25 19:10:12 +02:00
|
|
|
{
|
|
|
|
zclient_reset (zclient);
|
|
|
|
}
|
|
|
|
|
2008-08-15 14:45:30 +02:00
|
|
|
static int
|
2002-12-13 21:15:29 +01:00
|
|
|
ripng_redistribute_unset (int type)
|
|
|
|
{
|
2015-05-20 03:03:45 +02:00
|
|
|
if (! zclient->redist[AFI_IP6][type].enabled)
|
2002-12-13 21:15:29 +01:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
2015-05-20 03:03:45 +02:00
|
|
|
redist_del_instance(&zclient->redist[AFI_IP6][type], 0);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
if (zclient->sock > 0)
|
2015-05-20 03:03:45 +02:00
|
|
|
zebra_redistribute_send (ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP6, type, 0);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
ripng_redistribute_withdraw (type);
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
int
|
|
|
|
ripng_redistribute_check (int type)
|
|
|
|
{
|
2015-05-20 03:03:45 +02:00
|
|
|
return (zclient->redist[AFI_IP6][type].enabled);
|
2003-05-25 19:10:12 +02:00
|
|
|
}
|
|
|
|
|
2008-08-15 14:45:30 +02:00
|
|
|
static void
|
2002-12-13 21:15:29 +01:00
|
|
|
ripng_redistribute_metric_set (int type, int metric)
|
|
|
|
{
|
|
|
|
ripng->route_map[type].metric_config = 1;
|
|
|
|
ripng->route_map[type].metric = metric;
|
|
|
|
}
|
|
|
|
|
2008-08-15 14:45:30 +02:00
|
|
|
static int
|
2002-12-13 21:15:29 +01:00
|
|
|
ripng_redistribute_metric_unset (int type)
|
|
|
|
{
|
|
|
|
ripng->route_map[type].metric_config = 0;
|
|
|
|
ripng->route_map[type].metric = 0;
|
2003-05-25 19:10:12 +02:00
|
|
|
return 0;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2008-08-15 14:45:30 +02:00
|
|
|
static void
|
2004-10-11 14:57:57 +02:00
|
|
|
ripng_redistribute_routemap_set (int type, const char *name)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
if (ripng->route_map[type].name)
|
|
|
|
free (ripng->route_map[type].name);
|
|
|
|
|
|
|
|
ripng->route_map[type].name = strdup (name);
|
|
|
|
ripng->route_map[type].map = route_map_lookup_by_name (name);
|
|
|
|
}
|
|
|
|
|
2008-08-15 14:45:30 +02:00
|
|
|
static void
|
2002-12-13 21:15:29 +01:00
|
|
|
ripng_redistribute_routemap_unset (int type)
|
|
|
|
{
|
|
|
|
if (ripng->route_map[type].name)
|
|
|
|
free (ripng->route_map[type].name);
|
|
|
|
|
|
|
|
ripng->route_map[type].name = NULL;
|
|
|
|
ripng->route_map[type].map = NULL;
|
|
|
|
}
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
/* Redistribution types */
|
|
|
|
static struct {
|
|
|
|
int type;
|
|
|
|
int str_min_len;
|
2004-10-08 08:32:23 +02:00
|
|
|
const char *str;
|
2003-05-25 19:10:12 +02:00
|
|
|
} redist_type[] = {
|
|
|
|
{ZEBRA_ROUTE_KERNEL, 1, "kernel"},
|
|
|
|
{ZEBRA_ROUTE_CONNECT, 1, "connected"},
|
|
|
|
{ZEBRA_ROUTE_STATIC, 1, "static"},
|
|
|
|
{ZEBRA_ROUTE_OSPF6, 1, "ospf6"},
|
2012-02-09 20:58:07 +01:00
|
|
|
{ZEBRA_ROUTE_BGP, 2, "bgp"},
|
|
|
|
{ZEBRA_ROUTE_BABEL, 2, "babel"},
|
2003-05-25 19:10:12 +02:00
|
|
|
{0, 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
ripng_redistribute_clean ()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; redist_type[i].str; i++)
|
|
|
|
{
|
2015-05-20 03:03:45 +02:00
|
|
|
if (zclient->redist[AFI_IP6][redist_type[i].type].enabled)
|
2003-05-25 19:10:12 +02:00
|
|
|
{
|
|
|
|
if (zclient->sock > 0)
|
|
|
|
zebra_redistribute_send (ZEBRA_REDISTRIBUTE_DELETE,
|
2015-05-20 03:03:45 +02:00
|
|
|
zclient, AFI_IP6, redist_type[i].type, 0);
|
2003-05-25 19:10:12 +02:00
|
|
|
|
2015-05-20 03:03:45 +02:00
|
|
|
redist_del_instance(&zclient->redist[AFI_IP6][redist_type[i].type], 0);
|
2003-05-25 19:10:12 +02:00
|
|
|
|
|
|
|
/* Remove the routes from RIPng table. */
|
|
|
|
ripng_redistribute_withdraw (redist_type[i].type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
DEFUN (router_zebra,
|
|
|
|
router_zebra_cmd,
|
|
|
|
"router zebra",
|
|
|
|
"Enable a routing process\n"
|
|
|
|
"Make connection to zebra daemon\n")
|
|
|
|
{
|
|
|
|
vty->node = ZEBRA_NODE;
|
|
|
|
zclient->enable = 1;
|
|
|
|
zclient_start (zclient);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (no_router_zebra,
|
|
|
|
no_router_zebra_cmd,
|
|
|
|
"no router zebra",
|
|
|
|
NO_STR
|
|
|
|
"Disable a routing process\n"
|
|
|
|
"Stop connection to zebra daemon\n")
|
|
|
|
{
|
|
|
|
zclient->enable = 0;
|
|
|
|
zclient_stop (zclient);
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (ripng_redistribute_ripng,
|
|
|
|
ripng_redistribute_ripng_cmd,
|
|
|
|
"redistribute ripng",
|
|
|
|
"Redistribute information from another routing protocol\n"
|
|
|
|
"RIPng route\n")
|
|
|
|
{
|
2015-05-20 03:03:45 +02:00
|
|
|
redist_add_instance(&zclient->redist[AFI_IP6][ZEBRA_ROUTE_RIPNG], 0);
|
2002-12-13 21:15:29 +01:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFUN (no_ripng_redistribute_ripng,
|
|
|
|
no_ripng_redistribute_ripng_cmd,
|
|
|
|
"no redistribute ripng",
|
|
|
|
NO_STR
|
|
|
|
"Redistribute information from another routing protocol\n"
|
|
|
|
"RIPng route\n")
|
|
|
|
{
|
2015-05-20 03:03:45 +02:00
|
|
|
redist_del_instance(&zclient->redist[AFI_IP6][ZEBRA_ROUTE_RIPNG], 0);
|
2002-12-13 21:15:29 +01:00
|
|
|
return CMD_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
DEFUN (ripng_redistribute_type,
|
|
|
|
ripng_redistribute_type_cmd,
|
2012-02-09 20:58:07 +01:00
|
|
|
"redistribute " QUAGGA_REDIST_STR_RIPNGD,
|
|
|
|
"Redistribute\n"
|
|
|
|
QUAGGA_REDIST_HELP_STR_RIPNGD)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2012-02-09 20:58:07 +01:00
|
|
|
int type;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2012-02-09 20:58:07 +01:00
|
|
|
type = proto_redistnum(AFI_IP6, argv[0]);
|
|
|
|
|
|
|
|
if (type < 0)
|
2003-05-25 19:10:12 +02:00
|
|
|
{
|
2012-02-09 20:58:07 +01:00
|
|
|
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
|
|
|
|
return CMD_WARNING;
|
2003-05-25 19:10:12 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2015-05-20 03:03:45 +02:00
|
|
|
zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0);
|
2012-02-09 20:58:07 +01:00
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
DEFUN (no_ripng_redistribute_type,
|
|
|
|
no_ripng_redistribute_type_cmd,
|
2012-02-09 20:58:07 +01:00
|
|
|
"no redistribute " QUAGGA_REDIST_STR_RIPNGD,
|
2002-12-13 21:15:29 +01:00
|
|
|
NO_STR
|
2012-02-09 20:58:07 +01:00
|
|
|
"Redistribute\n"
|
|
|
|
QUAGGA_REDIST_HELP_STR_RIPNGD)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2012-02-09 20:58:07 +01:00
|
|
|
int type;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2012-02-09 20:58:07 +01:00
|
|
|
type = proto_redistnum(AFI_IP6, argv[0]);
|
|
|
|
|
|
|
|
if (type < 0)
|
2003-05-25 19:10:12 +02:00
|
|
|
{
|
2012-02-09 20:58:07 +01:00
|
|
|
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
|
|
|
|
return CMD_WARNING;
|
2003-05-25 19:10:12 +02:00
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2012-02-09 20:58:07 +01:00
|
|
|
ripng_redistribute_metric_unset (type);
|
|
|
|
ripng_redistribute_routemap_unset (type);
|
|
|
|
return ripng_redistribute_unset (type);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
DEFUN (ripng_redistribute_type_metric,
|
|
|
|
ripng_redistribute_type_metric_cmd,
|
2012-02-09 20:58:07 +01:00
|
|
|
"redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16>",
|
|
|
|
"Redistribute\n"
|
|
|
|
QUAGGA_REDIST_HELP_STR_RIPNGD
|
2002-12-13 21:15:29 +01:00
|
|
|
"Metric\n"
|
|
|
|
"Metric value\n")
|
|
|
|
{
|
2012-02-09 20:58:07 +01:00
|
|
|
int type;
|
2003-05-25 19:10:12 +02:00
|
|
|
int metric;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
metric = atoi (argv[1]);
|
2012-02-09 20:58:07 +01:00
|
|
|
type = proto_redistnum(AFI_IP6, argv[0]);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2012-02-09 20:58:07 +01:00
|
|
|
if (type < 0)
|
|
|
|
{
|
|
|
|
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2012-02-09 20:58:07 +01:00
|
|
|
ripng_redistribute_metric_set (type, metric);
|
2015-05-20 03:03:45 +02:00
|
|
|
zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0);
|
2012-02-09 20:58:07 +01:00
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
ALIAS (no_ripng_redistribute_type,
|
|
|
|
no_ripng_redistribute_type_metric_cmd,
|
2012-02-09 20:58:07 +01:00
|
|
|
"no redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16>",
|
2002-12-13 21:15:29 +01:00
|
|
|
NO_STR
|
2012-02-09 20:58:07 +01:00
|
|
|
"Redistribute\n"
|
|
|
|
QUAGGA_REDIST_HELP_STR_RIPNGD
|
2002-12-13 21:15:29 +01:00
|
|
|
"Metric\n"
|
|
|
|
"Metric value\n")
|
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
DEFUN (ripng_redistribute_type_routemap,
|
|
|
|
ripng_redistribute_type_routemap_cmd,
|
2012-02-09 20:58:07 +01:00
|
|
|
"redistribute " QUAGGA_REDIST_STR_RIPNGD " route-map WORD",
|
|
|
|
"Redistribute\n"
|
|
|
|
QUAGGA_REDIST_HELP_STR_RIPNGD
|
2002-12-13 21:15:29 +01:00
|
|
|
"Route map reference\n"
|
|
|
|
"Pointer to route-map entries\n")
|
|
|
|
{
|
2012-02-09 20:58:07 +01:00
|
|
|
int type;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2012-02-09 20:58:07 +01:00
|
|
|
type = proto_redistnum(AFI_IP6, argv[0]);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2012-02-09 20:58:07 +01:00
|
|
|
if (type < 0)
|
|
|
|
{
|
|
|
|
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
2003-05-25 19:10:12 +02:00
|
|
|
|
2012-02-09 20:58:07 +01:00
|
|
|
ripng_redistribute_routemap_set (type, argv[1]);
|
2015-05-20 03:03:45 +02:00
|
|
|
zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0);
|
2012-02-09 20:58:07 +01:00
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
ALIAS (no_ripng_redistribute_type,
|
|
|
|
no_ripng_redistribute_type_routemap_cmd,
|
2012-02-09 20:58:07 +01:00
|
|
|
"no redistribute " QUAGGA_REDIST_STR_RIPNGD " route-map WORD",
|
2002-12-13 21:15:29 +01:00
|
|
|
NO_STR
|
2012-02-09 20:58:07 +01:00
|
|
|
"Redistribute\n"
|
|
|
|
QUAGGA_REDIST_HELP_STR_RIPNGD
|
2002-12-13 21:15:29 +01:00
|
|
|
"Route map reference\n"
|
|
|
|
"Pointer to route-map entries\n")
|
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
DEFUN (ripng_redistribute_type_metric_routemap,
|
|
|
|
ripng_redistribute_type_metric_routemap_cmd,
|
2012-02-09 20:58:07 +01:00
|
|
|
"redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16> route-map WORD",
|
|
|
|
"Redistribute\n"
|
|
|
|
QUAGGA_REDIST_HELP_STR_RIPNGD
|
2002-12-13 21:15:29 +01:00
|
|
|
"Metric\n"
|
|
|
|
"Metric value\n"
|
|
|
|
"Route map reference\n"
|
|
|
|
"Pointer to route-map entries\n")
|
|
|
|
{
|
2012-02-09 20:58:07 +01:00
|
|
|
int type;
|
2003-05-25 19:10:12 +02:00
|
|
|
int metric;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2012-02-09 20:58:07 +01:00
|
|
|
type = proto_redistnum(AFI_IP6, argv[0]);
|
2003-05-25 19:10:12 +02:00
|
|
|
metric = atoi (argv[1]);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2012-02-09 20:58:07 +01:00
|
|
|
if (type < 0)
|
|
|
|
{
|
|
|
|
vty_out(vty, "Invalid type %s%s", argv[0], VTY_NEWLINE);
|
|
|
|
return CMD_WARNING;
|
|
|
|
}
|
|
|
|
|
|
|
|
ripng_redistribute_metric_set (type, metric);
|
|
|
|
ripng_redistribute_routemap_set (type, argv[2]);
|
2015-05-20 03:03:45 +02:00
|
|
|
zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6, type, 0);
|
2012-02-09 20:58:07 +01:00
|
|
|
return CMD_SUCCESS;
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
|
2003-05-25 19:10:12 +02:00
|
|
|
ALIAS (no_ripng_redistribute_type,
|
|
|
|
no_ripng_redistribute_type_metric_routemap_cmd,
|
2012-02-09 20:58:07 +01:00
|
|
|
"no redistribute " QUAGGA_REDIST_STR_RIPNGD " metric <0-16> route-map WORD",
|
2002-12-13 21:15:29 +01:00
|
|
|
NO_STR
|
2012-02-09 20:58:07 +01:00
|
|
|
"Redistribute\n"
|
|
|
|
QUAGGA_REDIST_HELP_STR_RIPNGD
|
2002-12-13 21:15:29 +01:00
|
|
|
"Route map reference\n"
|
|
|
|
"Pointer to route-map entries\n")
|
|
|
|
|
|
|
|
void
|
2003-05-25 19:10:12 +02:00
|
|
|
ripng_redistribute_write (struct vty *vty, int config_mode)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
|
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
|
|
|
if (i != zclient->redist_default &&
|
2015-05-20 03:03:45 +02:00
|
|
|
zclient->redist[AFI_IP6][i].enabled)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
2003-05-25 19:10:12 +02:00
|
|
|
if (config_mode)
|
|
|
|
{
|
|
|
|
if (ripng->route_map[i].metric_config)
|
|
|
|
{
|
|
|
|
if (ripng->route_map[i].name)
|
|
|
|
vty_out (vty, " redistribute %s metric %d route-map %s%s",
|
2005-10-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* zebra.h: Declare new functions zebra_route_string() and
zebra_route_char().
* log.c: (zroute_lookup,zebra_route_string,zebra_route_char) New
functions to map zebra route numbers to strings.
* zebra_vty.c: (route_type_str) Remove obsolete function: use new
library function zebra_route_string() instead. Note that there
are a few differences: for IPv6 routes, we now get "ripng" and
"ospf6" instead of the old behavior ("rip" and "ospf").
(route_type_char) Remove obsolete function: ues new library function
zebra_route_char() instead. Note that there is one difference:
the old function returned 'S' for a ZEBRA_ROUTE_SYSTEM route,
whereas the new one returns 'X'.
(vty_show_ip_route_detail,vty_show_ipv6_route_detail) Replace
route_type_str() with zebra_route_string().
(vty_show_ip_route,vty_show_ipv6_route) Replace route_type_char()
with zebra_route_char().
* bgp_vty.c: (bgp_config_write_redistribute) Use new library function
zebra_route_string instead of a local hard-coded table.
* ospf6_asbr.c: Remove local hard-coded tables zroute_name and
zroute_abname. Change the ZROUTE_NAME macro to use new library
function zebra_route_string(). Remove the ZROUTE_ABNAME macro.
(ospf6_asbr_external_route_show): Replace ZROUTE_ABNAME() with
a call to zebra_route_char(), and be sure to fix the format string,
since we now have a char instead of a char *.
* ospf6_zebra.c: Remove local hard-coded tables zebra_route_name and
zebra_route_abname. Note that the zebra_route_name[] table
contained mixed-case strings, whereas the zebra_route_string()
function returns lower-case strings.
(ospf6_zebra_read_ipv6): Change debug message to use new library
function zebra_route_string() instead of zebra_route_name[].
(show_zebra): Use new library function zebra_route_string() instead
of zebra_route_name[].
* ospf_dump.c: Remove local hard-coded table ospf_redistributed_proto.
(ospf_redist_string) New function implemented using new library
function zebra_route_string(). Note that there are a few differences
in the output that will result: the new function returns strings
that are lower-case, whereas the old table was mixed case. Also,
the old table mapped ZEBRA_ROUTE_OSPF6 to "OSPFv3", whereas the
new function returns "ospf6".
* ospfd.h: Remove extern struct message ospf_redistributed_proto[],
and add extern const char *ospf_redist_string(u_int route_type)
instead.
* ospf_asbr.c: (ospf_external_info_add) In two messages, use
ospf_redist_string instead of LOOKUP(ospf_redistributed_proto).
* ospf_vty.c: Remove local hard-coded table distribute_str.
(config_write_ospf_redistribute,config_write_ospf_distribute): Use
new library function zebra_route_string() instead of distribute_str[].
* ospf_zebra.c: (ospf_redistribute_set,ospf_redistribute_unset,
ospf_redistribute_default_set,ospf_redistribute_check)
In debug messages, use ospf_redist_string() instead of
LOOKUP(ospf_redistributed_proto).
* rip_zebra.c: (config_write_rip_redistribute): Remove local hard-coded
table str[]. Replace str[] with calls to new library function
zebra_route_string().
* ripd.c: Remove local hard-coded table route_info[].
(show_ip_rip) Replace uses of str[] with calls to new library
functions zebra_route_char and zebra_route_string.
* ripng_zebra.c: (ripng_redistribute_write) Remove local hard-coded
table str[]. Replace str[i] with new library function
zebra_route_string(i).
* ripngd.c: Remove local hard-coded table route_info[].
(show_ipv6_ripng) Use new library function zebra_route_char() instead
of table route_info[].
2005-10-01 19:38:06 +02:00
|
|
|
zebra_route_string(i), ripng->route_map[i].metric,
|
2003-05-25 19:10:12 +02:00
|
|
|
ripng->route_map[i].name, VTY_NEWLINE);
|
|
|
|
else
|
|
|
|
vty_out (vty, " redistribute %s metric %d%s",
|
2005-10-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* zebra.h: Declare new functions zebra_route_string() and
zebra_route_char().
* log.c: (zroute_lookup,zebra_route_string,zebra_route_char) New
functions to map zebra route numbers to strings.
* zebra_vty.c: (route_type_str) Remove obsolete function: use new
library function zebra_route_string() instead. Note that there
are a few differences: for IPv6 routes, we now get "ripng" and
"ospf6" instead of the old behavior ("rip" and "ospf").
(route_type_char) Remove obsolete function: ues new library function
zebra_route_char() instead. Note that there is one difference:
the old function returned 'S' for a ZEBRA_ROUTE_SYSTEM route,
whereas the new one returns 'X'.
(vty_show_ip_route_detail,vty_show_ipv6_route_detail) Replace
route_type_str() with zebra_route_string().
(vty_show_ip_route,vty_show_ipv6_route) Replace route_type_char()
with zebra_route_char().
* bgp_vty.c: (bgp_config_write_redistribute) Use new library function
zebra_route_string instead of a local hard-coded table.
* ospf6_asbr.c: Remove local hard-coded tables zroute_name and
zroute_abname. Change the ZROUTE_NAME macro to use new library
function zebra_route_string(). Remove the ZROUTE_ABNAME macro.
(ospf6_asbr_external_route_show): Replace ZROUTE_ABNAME() with
a call to zebra_route_char(), and be sure to fix the format string,
since we now have a char instead of a char *.
* ospf6_zebra.c: Remove local hard-coded tables zebra_route_name and
zebra_route_abname. Note that the zebra_route_name[] table
contained mixed-case strings, whereas the zebra_route_string()
function returns lower-case strings.
(ospf6_zebra_read_ipv6): Change debug message to use new library
function zebra_route_string() instead of zebra_route_name[].
(show_zebra): Use new library function zebra_route_string() instead
of zebra_route_name[].
* ospf_dump.c: Remove local hard-coded table ospf_redistributed_proto.
(ospf_redist_string) New function implemented using new library
function zebra_route_string(). Note that there are a few differences
in the output that will result: the new function returns strings
that are lower-case, whereas the old table was mixed case. Also,
the old table mapped ZEBRA_ROUTE_OSPF6 to "OSPFv3", whereas the
new function returns "ospf6".
* ospfd.h: Remove extern struct message ospf_redistributed_proto[],
and add extern const char *ospf_redist_string(u_int route_type)
instead.
* ospf_asbr.c: (ospf_external_info_add) In two messages, use
ospf_redist_string instead of LOOKUP(ospf_redistributed_proto).
* ospf_vty.c: Remove local hard-coded table distribute_str.
(config_write_ospf_redistribute,config_write_ospf_distribute): Use
new library function zebra_route_string() instead of distribute_str[].
* ospf_zebra.c: (ospf_redistribute_set,ospf_redistribute_unset,
ospf_redistribute_default_set,ospf_redistribute_check)
In debug messages, use ospf_redist_string() instead of
LOOKUP(ospf_redistributed_proto).
* rip_zebra.c: (config_write_rip_redistribute): Remove local hard-coded
table str[]. Replace str[] with calls to new library function
zebra_route_string().
* ripd.c: Remove local hard-coded table route_info[].
(show_ip_rip) Replace uses of str[] with calls to new library
functions zebra_route_char and zebra_route_string.
* ripng_zebra.c: (ripng_redistribute_write) Remove local hard-coded
table str[]. Replace str[i] with new library function
zebra_route_string(i).
* ripngd.c: Remove local hard-coded table route_info[].
(show_ipv6_ripng) Use new library function zebra_route_char() instead
of table route_info[].
2005-10-01 19:38:06 +02:00
|
|
|
zebra_route_string(i), ripng->route_map[i].metric,
|
|
|
|
VTY_NEWLINE);
|
2003-05-25 19:10:12 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ripng->route_map[i].name)
|
|
|
|
vty_out (vty, " redistribute %s route-map %s%s",
|
2005-10-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* zebra.h: Declare new functions zebra_route_string() and
zebra_route_char().
* log.c: (zroute_lookup,zebra_route_string,zebra_route_char) New
functions to map zebra route numbers to strings.
* zebra_vty.c: (route_type_str) Remove obsolete function: use new
library function zebra_route_string() instead. Note that there
are a few differences: for IPv6 routes, we now get "ripng" and
"ospf6" instead of the old behavior ("rip" and "ospf").
(route_type_char) Remove obsolete function: ues new library function
zebra_route_char() instead. Note that there is one difference:
the old function returned 'S' for a ZEBRA_ROUTE_SYSTEM route,
whereas the new one returns 'X'.
(vty_show_ip_route_detail,vty_show_ipv6_route_detail) Replace
route_type_str() with zebra_route_string().
(vty_show_ip_route,vty_show_ipv6_route) Replace route_type_char()
with zebra_route_char().
* bgp_vty.c: (bgp_config_write_redistribute) Use new library function
zebra_route_string instead of a local hard-coded table.
* ospf6_asbr.c: Remove local hard-coded tables zroute_name and
zroute_abname. Change the ZROUTE_NAME macro to use new library
function zebra_route_string(). Remove the ZROUTE_ABNAME macro.
(ospf6_asbr_external_route_show): Replace ZROUTE_ABNAME() with
a call to zebra_route_char(), and be sure to fix the format string,
since we now have a char instead of a char *.
* ospf6_zebra.c: Remove local hard-coded tables zebra_route_name and
zebra_route_abname. Note that the zebra_route_name[] table
contained mixed-case strings, whereas the zebra_route_string()
function returns lower-case strings.
(ospf6_zebra_read_ipv6): Change debug message to use new library
function zebra_route_string() instead of zebra_route_name[].
(show_zebra): Use new library function zebra_route_string() instead
of zebra_route_name[].
* ospf_dump.c: Remove local hard-coded table ospf_redistributed_proto.
(ospf_redist_string) New function implemented using new library
function zebra_route_string(). Note that there are a few differences
in the output that will result: the new function returns strings
that are lower-case, whereas the old table was mixed case. Also,
the old table mapped ZEBRA_ROUTE_OSPF6 to "OSPFv3", whereas the
new function returns "ospf6".
* ospfd.h: Remove extern struct message ospf_redistributed_proto[],
and add extern const char *ospf_redist_string(u_int route_type)
instead.
* ospf_asbr.c: (ospf_external_info_add) In two messages, use
ospf_redist_string instead of LOOKUP(ospf_redistributed_proto).
* ospf_vty.c: Remove local hard-coded table distribute_str.
(config_write_ospf_redistribute,config_write_ospf_distribute): Use
new library function zebra_route_string() instead of distribute_str[].
* ospf_zebra.c: (ospf_redistribute_set,ospf_redistribute_unset,
ospf_redistribute_default_set,ospf_redistribute_check)
In debug messages, use ospf_redist_string() instead of
LOOKUP(ospf_redistributed_proto).
* rip_zebra.c: (config_write_rip_redistribute): Remove local hard-coded
table str[]. Replace str[] with calls to new library function
zebra_route_string().
* ripd.c: Remove local hard-coded table route_info[].
(show_ip_rip) Replace uses of str[] with calls to new library
functions zebra_route_char and zebra_route_string.
* ripng_zebra.c: (ripng_redistribute_write) Remove local hard-coded
table str[]. Replace str[i] with new library function
zebra_route_string(i).
* ripngd.c: Remove local hard-coded table route_info[].
(show_ipv6_ripng) Use new library function zebra_route_char() instead
of table route_info[].
2005-10-01 19:38:06 +02:00
|
|
|
zebra_route_string(i), ripng->route_map[i].name,
|
|
|
|
VTY_NEWLINE);
|
2003-05-25 19:10:12 +02:00
|
|
|
else
|
2005-10-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* zebra.h: Declare new functions zebra_route_string() and
zebra_route_char().
* log.c: (zroute_lookup,zebra_route_string,zebra_route_char) New
functions to map zebra route numbers to strings.
* zebra_vty.c: (route_type_str) Remove obsolete function: use new
library function zebra_route_string() instead. Note that there
are a few differences: for IPv6 routes, we now get "ripng" and
"ospf6" instead of the old behavior ("rip" and "ospf").
(route_type_char) Remove obsolete function: ues new library function
zebra_route_char() instead. Note that there is one difference:
the old function returned 'S' for a ZEBRA_ROUTE_SYSTEM route,
whereas the new one returns 'X'.
(vty_show_ip_route_detail,vty_show_ipv6_route_detail) Replace
route_type_str() with zebra_route_string().
(vty_show_ip_route,vty_show_ipv6_route) Replace route_type_char()
with zebra_route_char().
* bgp_vty.c: (bgp_config_write_redistribute) Use new library function
zebra_route_string instead of a local hard-coded table.
* ospf6_asbr.c: Remove local hard-coded tables zroute_name and
zroute_abname. Change the ZROUTE_NAME macro to use new library
function zebra_route_string(). Remove the ZROUTE_ABNAME macro.
(ospf6_asbr_external_route_show): Replace ZROUTE_ABNAME() with
a call to zebra_route_char(), and be sure to fix the format string,
since we now have a char instead of a char *.
* ospf6_zebra.c: Remove local hard-coded tables zebra_route_name and
zebra_route_abname. Note that the zebra_route_name[] table
contained mixed-case strings, whereas the zebra_route_string()
function returns lower-case strings.
(ospf6_zebra_read_ipv6): Change debug message to use new library
function zebra_route_string() instead of zebra_route_name[].
(show_zebra): Use new library function zebra_route_string() instead
of zebra_route_name[].
* ospf_dump.c: Remove local hard-coded table ospf_redistributed_proto.
(ospf_redist_string) New function implemented using new library
function zebra_route_string(). Note that there are a few differences
in the output that will result: the new function returns strings
that are lower-case, whereas the old table was mixed case. Also,
the old table mapped ZEBRA_ROUTE_OSPF6 to "OSPFv3", whereas the
new function returns "ospf6".
* ospfd.h: Remove extern struct message ospf_redistributed_proto[],
and add extern const char *ospf_redist_string(u_int route_type)
instead.
* ospf_asbr.c: (ospf_external_info_add) In two messages, use
ospf_redist_string instead of LOOKUP(ospf_redistributed_proto).
* ospf_vty.c: Remove local hard-coded table distribute_str.
(config_write_ospf_redistribute,config_write_ospf_distribute): Use
new library function zebra_route_string() instead of distribute_str[].
* ospf_zebra.c: (ospf_redistribute_set,ospf_redistribute_unset,
ospf_redistribute_default_set,ospf_redistribute_check)
In debug messages, use ospf_redist_string() instead of
LOOKUP(ospf_redistributed_proto).
* rip_zebra.c: (config_write_rip_redistribute): Remove local hard-coded
table str[]. Replace str[] with calls to new library function
zebra_route_string().
* ripd.c: Remove local hard-coded table route_info[].
(show_ip_rip) Replace uses of str[] with calls to new library
functions zebra_route_char and zebra_route_string.
* ripng_zebra.c: (ripng_redistribute_write) Remove local hard-coded
table str[]. Replace str[i] with new library function
zebra_route_string(i).
* ripngd.c: Remove local hard-coded table route_info[].
(show_ipv6_ripng) Use new library function zebra_route_char() instead
of table route_info[].
2005-10-01 19:38:06 +02:00
|
|
|
vty_out (vty, " redistribute %s%s", zebra_route_string(i),
|
|
|
|
VTY_NEWLINE);
|
2003-05-25 19:10:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2005-10-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* zebra.h: Declare new functions zebra_route_string() and
zebra_route_char().
* log.c: (zroute_lookup,zebra_route_string,zebra_route_char) New
functions to map zebra route numbers to strings.
* zebra_vty.c: (route_type_str) Remove obsolete function: use new
library function zebra_route_string() instead. Note that there
are a few differences: for IPv6 routes, we now get "ripng" and
"ospf6" instead of the old behavior ("rip" and "ospf").
(route_type_char) Remove obsolete function: ues new library function
zebra_route_char() instead. Note that there is one difference:
the old function returned 'S' for a ZEBRA_ROUTE_SYSTEM route,
whereas the new one returns 'X'.
(vty_show_ip_route_detail,vty_show_ipv6_route_detail) Replace
route_type_str() with zebra_route_string().
(vty_show_ip_route,vty_show_ipv6_route) Replace route_type_char()
with zebra_route_char().
* bgp_vty.c: (bgp_config_write_redistribute) Use new library function
zebra_route_string instead of a local hard-coded table.
* ospf6_asbr.c: Remove local hard-coded tables zroute_name and
zroute_abname. Change the ZROUTE_NAME macro to use new library
function zebra_route_string(). Remove the ZROUTE_ABNAME macro.
(ospf6_asbr_external_route_show): Replace ZROUTE_ABNAME() with
a call to zebra_route_char(), and be sure to fix the format string,
since we now have a char instead of a char *.
* ospf6_zebra.c: Remove local hard-coded tables zebra_route_name and
zebra_route_abname. Note that the zebra_route_name[] table
contained mixed-case strings, whereas the zebra_route_string()
function returns lower-case strings.
(ospf6_zebra_read_ipv6): Change debug message to use new library
function zebra_route_string() instead of zebra_route_name[].
(show_zebra): Use new library function zebra_route_string() instead
of zebra_route_name[].
* ospf_dump.c: Remove local hard-coded table ospf_redistributed_proto.
(ospf_redist_string) New function implemented using new library
function zebra_route_string(). Note that there are a few differences
in the output that will result: the new function returns strings
that are lower-case, whereas the old table was mixed case. Also,
the old table mapped ZEBRA_ROUTE_OSPF6 to "OSPFv3", whereas the
new function returns "ospf6".
* ospfd.h: Remove extern struct message ospf_redistributed_proto[],
and add extern const char *ospf_redist_string(u_int route_type)
instead.
* ospf_asbr.c: (ospf_external_info_add) In two messages, use
ospf_redist_string instead of LOOKUP(ospf_redistributed_proto).
* ospf_vty.c: Remove local hard-coded table distribute_str.
(config_write_ospf_redistribute,config_write_ospf_distribute): Use
new library function zebra_route_string() instead of distribute_str[].
* ospf_zebra.c: (ospf_redistribute_set,ospf_redistribute_unset,
ospf_redistribute_default_set,ospf_redistribute_check)
In debug messages, use ospf_redist_string() instead of
LOOKUP(ospf_redistributed_proto).
* rip_zebra.c: (config_write_rip_redistribute): Remove local hard-coded
table str[]. Replace str[] with calls to new library function
zebra_route_string().
* ripd.c: Remove local hard-coded table route_info[].
(show_ip_rip) Replace uses of str[] with calls to new library
functions zebra_route_char and zebra_route_string.
* ripng_zebra.c: (ripng_redistribute_write) Remove local hard-coded
table str[]. Replace str[i] with new library function
zebra_route_string(i).
* ripngd.c: Remove local hard-coded table route_info[].
(show_ipv6_ripng) Use new library function zebra_route_char() instead
of table route_info[].
2005-10-01 19:38:06 +02:00
|
|
|
vty_out (vty, " %s", zebra_route_string(i));
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* RIPng configuration write function. */
|
2008-08-15 14:45:30 +02:00
|
|
|
static int
|
2002-12-13 21:15:29 +01:00
|
|
|
zebra_config_write (struct vty *vty)
|
|
|
|
{
|
|
|
|
if (! zclient->enable)
|
|
|
|
{
|
|
|
|
vty_out (vty, "no router zebra%s", VTY_NEWLINE);
|
|
|
|
return 1;
|
|
|
|
}
|
2015-05-20 03:03:45 +02:00
|
|
|
else if (! zclient->redist[AFI_IP6][ZEBRA_ROUTE_RIPNG].enabled)
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
vty_out (vty, "router zebra%s", VTY_NEWLINE);
|
|
|
|
vty_out (vty, " no redistribute ripng%s", VTY_NEWLINE);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Zebra node structure. */
|
2008-12-01 20:10:34 +01:00
|
|
|
static struct cmd_node zebra_node =
|
2002-12-13 21:15:29 +01:00
|
|
|
{
|
|
|
|
ZEBRA_NODE,
|
|
|
|
"%s(config-router)# ",
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Initialize zebra structure and it's commands. */
|
|
|
|
void
|
|
|
|
zebra_init ()
|
|
|
|
{
|
|
|
|
/* Allocate zebra structure. */
|
|
|
|
zclient = zclient_new ();
|
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
|
|
|
zclient_init (zclient, ZEBRA_ROUTE_RIPNG, 0);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
zclient->interface_up = ripng_interface_up;
|
|
|
|
zclient->interface_down = ripng_interface_down;
|
|
|
|
zclient->interface_add = ripng_interface_add;
|
|
|
|
zclient->interface_delete = ripng_interface_delete;
|
|
|
|
zclient->interface_address_add = ripng_interface_address_add;
|
|
|
|
zclient->interface_address_delete = ripng_interface_address_delete;
|
|
|
|
zclient->ipv6_route_add = ripng_zebra_read_ipv6;
|
|
|
|
zclient->ipv6_route_delete = ripng_zebra_read_ipv6;
|
|
|
|
|
|
|
|
/* Install zebra node. */
|
|
|
|
install_node (&zebra_node, zebra_config_write);
|
|
|
|
|
|
|
|
/* Install command element for zebra node. */
|
|
|
|
install_element (CONFIG_NODE, &router_zebra_cmd);
|
|
|
|
install_element (CONFIG_NODE, &no_router_zebra_cmd);
|
|
|
|
install_default (ZEBRA_NODE);
|
|
|
|
install_element (ZEBRA_NODE, &ripng_redistribute_ripng_cmd);
|
|
|
|
install_element (ZEBRA_NODE, &no_ripng_redistribute_ripng_cmd);
|
2003-05-25 19:10:12 +02:00
|
|
|
|
|
|
|
/* Install command elements to ripng node */
|
|
|
|
install_element (RIPNG_NODE, &ripng_redistribute_type_cmd);
|
|
|
|
install_element (RIPNG_NODE, &ripng_redistribute_type_routemap_cmd);
|
|
|
|
install_element (RIPNG_NODE, &ripng_redistribute_type_metric_cmd);
|
|
|
|
install_element (RIPNG_NODE, &ripng_redistribute_type_metric_routemap_cmd);
|
|
|
|
install_element (RIPNG_NODE, &no_ripng_redistribute_type_cmd);
|
|
|
|
install_element (RIPNG_NODE, &no_ripng_redistribute_type_routemap_cmd);
|
|
|
|
install_element (RIPNG_NODE, &no_ripng_redistribute_type_metric_cmd);
|
|
|
|
install_element (RIPNG_NODE, &no_ripng_redistribute_type_metric_routemap_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
}
|