2002-12-13 21:15:29 +01:00
|
|
|
|
/* Interface related function for RIP.
|
|
|
|
|
* Copyright (C) 1997, 98 Kunihiro Ishiguro <kunihiro@zebra.org>
|
|
|
|
|
*
|
|
|
|
|
* 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 "if.h"
|
|
|
|
|
#include "sockunion.h"
|
|
|
|
|
#include "prefix.h"
|
|
|
|
|
#include "memory.h"
|
|
|
|
|
#include "network.h"
|
|
|
|
|
#include "table.h"
|
|
|
|
|
#include "log.h"
|
|
|
|
|
#include "stream.h"
|
|
|
|
|
#include "thread.h"
|
|
|
|
|
#include "zclient.h"
|
|
|
|
|
#include "filter.h"
|
|
|
|
|
#include "sockopt.h"
|
2003-06-04 15:59:38 +02:00
|
|
|
|
#include "privs.h"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
#include "zebra/connected.h"
|
|
|
|
|
|
|
|
|
|
#include "ripd/ripd.h"
|
|
|
|
|
#include "ripd/rip_debug.h"
|
|
|
|
|
|
|
|
|
|
void rip_enable_apply (struct interface *);
|
|
|
|
|
void rip_passive_interface_apply (struct interface *);
|
|
|
|
|
int rip_if_down(struct interface *ifp);
|
2004-10-11 14:57:57 +02:00
|
|
|
|
int rip_enable_if_lookup (const char *ifname);
|
2003-05-25 16:49:19 +02:00
|
|
|
|
int rip_enable_network_lookup2 (struct connected *connected);
|
|
|
|
|
void rip_enable_apply_all ();
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
struct message ri_version_msg[] =
|
|
|
|
|
{
|
|
|
|
|
{RI_RIP_VERSION_1, "1"},
|
|
|
|
|
{RI_RIP_VERSION_2, "2"},
|
|
|
|
|
{RI_RIP_VERSION_1_AND_2, "1 2"},
|
|
|
|
|
{0, NULL}
|
|
|
|
|
};
|
|
|
|
|
|
2003-06-04 15:59:38 +02:00
|
|
|
|
extern struct zebra_privs_t ripd_privs;
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
/* RIP enabled network vector. */
|
|
|
|
|
vector rip_enable_interface;
|
|
|
|
|
|
|
|
|
|
/* RIP enabled interface table. */
|
|
|
|
|
struct route_table *rip_enable_network;
|
|
|
|
|
|
|
|
|
|
/* Vector to store passive-interface name. */
|
2003-06-07 03:04:45 +02:00
|
|
|
|
static int passive_default; /* are we in passive-interface default mode? */
|
|
|
|
|
vector Vrip_passive_nondefault;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
/* Join to the RIP version 2 multicast group. */
|
|
|
|
|
int
|
|
|
|
|
ipv4_multicast_join (int sock,
|
|
|
|
|
struct in_addr group,
|
|
|
|
|
struct in_addr ifa,
|
|
|
|
|
unsigned int ifindex)
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
ret = setsockopt_multicast_ipv4 (sock,
|
|
|
|
|
IP_ADD_MEMBERSHIP,
|
|
|
|
|
ifa,
|
|
|
|
|
group.s_addr,
|
|
|
|
|
ifindex);
|
|
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
|
zlog (NULL, LOG_INFO, "can't setsockopt IP_ADD_MEMBERSHIP %s",
|
2004-11-20 03:06:59 +01:00
|
|
|
|
safe_strerror (errno));
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Leave from the RIP version 2 multicast group. */
|
|
|
|
|
int
|
|
|
|
|
ipv4_multicast_leave (int sock,
|
|
|
|
|
struct in_addr group,
|
|
|
|
|
struct in_addr ifa,
|
|
|
|
|
unsigned int ifindex)
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
ret = setsockopt_multicast_ipv4 (sock,
|
|
|
|
|
IP_DROP_MEMBERSHIP,
|
|
|
|
|
ifa,
|
|
|
|
|
group.s_addr,
|
|
|
|
|
ifindex);
|
|
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
|
zlog (NULL, LOG_INFO, "can't setsockopt IP_DROP_MEMBERSHIP");
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Allocate new RIP's interface configuration. */
|
|
|
|
|
struct rip_interface *
|
|
|
|
|
rip_interface_new ()
|
|
|
|
|
{
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ri = XMALLOC (MTYPE_RIP_INTERFACE, sizeof (struct rip_interface));
|
|
|
|
|
memset (ri, 0, sizeof (struct rip_interface));
|
|
|
|
|
|
|
|
|
|
/* Default authentication type is simple password for Cisco
|
|
|
|
|
compatibility. */
|
2005-06-02 10:20:53 +02:00
|
|
|
|
ri->auth_type = RIP_NO_AUTH;
|
2004-06-07 00:06:33 +02:00
|
|
|
|
ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
/* Set default split-horizon behavior. If the interface is Frame
|
|
|
|
|
Relay or SMDS is enabled, the default value for split-horizon is
|
|
|
|
|
off. But currently Zebra does detect Frame Relay or SMDS
|
|
|
|
|
interface. So all interface is set to split horizon. */
|
2003-05-25 16:49:19 +02:00
|
|
|
|
ri->split_horizon_default = RIP_SPLIT_HORIZON;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
ri->split_horizon = ri->split_horizon_default;
|
|
|
|
|
|
|
|
|
|
return ri;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2004-08-19 06:03:08 +02:00
|
|
|
|
rip_interface_multicast_set (int sock, struct connected *connected)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
2004-10-19 21:44:43 +02:00
|
|
|
|
struct in_addr addr;
|
2003-10-16 01:20:17 +02:00
|
|
|
|
struct prefix_ipv4 *p;
|
2004-10-22 12:27:28 +02:00
|
|
|
|
|
|
|
|
|
assert (connected != NULL);
|
|
|
|
|
|
|
|
|
|
if (if_is_pointopoint(connected->ifp) && CONNECTED_DEST_HOST(connected))
|
|
|
|
|
p = (struct prefix_ipv4 *) connected->destination;
|
|
|
|
|
else
|
|
|
|
|
p = (struct prefix_ipv4 *) connected->address;
|
|
|
|
|
|
|
|
|
|
addr = p->prefix;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2004-08-19 06:03:08 +02:00
|
|
|
|
if (setsockopt_multicast_ipv4 (sock, IP_MULTICAST_IF, addr, 0,
|
|
|
|
|
connected->ifp->ifindex) < 0)
|
2004-10-19 21:44:43 +02:00
|
|
|
|
{
|
|
|
|
|
zlog_warn ("Can't setsockopt IP_MULTICAST_IF on fd %d to "
|
|
|
|
|
"source address %s for interface %s",
|
|
|
|
|
sock, inet_ntoa(addr),
|
2004-10-22 12:27:28 +02:00
|
|
|
|
connected->ifp->name);
|
2004-10-19 21:44:43 +02:00
|
|
|
|
}
|
2005-08-16 17:22:14 +02:00
|
|
|
|
|
2004-10-19 21:44:43 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
/* Send RIP request packet to specified interface. */
|
|
|
|
|
void
|
|
|
|
|
rip_request_interface_send (struct interface *ifp, u_char version)
|
|
|
|
|
{
|
|
|
|
|
struct sockaddr_in to;
|
|
|
|
|
|
|
|
|
|
/* RIPv2 support multicast. */
|
|
|
|
|
if (version == RIPv2 && if_is_multicast (ifp))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (IS_RIP_DEBUG_EVENT)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("multicast request on %s", ifp->name);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2004-01-23 16:31:42 +01:00
|
|
|
|
rip_request_send (NULL, ifp, version, NULL);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* RIPv1 and non multicast interface. */
|
|
|
|
|
if (if_is_pointopoint (ifp) || if_is_broadcast (ifp))
|
|
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
struct listnode *cnode, *cnnode;
|
|
|
|
|
struct connected *connected;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
if (IS_RIP_DEBUG_EVENT)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("broadcast request to %s", ifp->name);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS (ifp->connected, cnode, cnnode, connected))
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
2004-10-19 21:44:43 +02:00
|
|
|
|
if (connected->address->family == AF_INET)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
|
|
|
|
memset (&to, 0, sizeof (struct sockaddr_in));
|
|
|
|
|
to.sin_port = htons (RIP_PORT_DEFAULT);
|
2004-10-19 21:44:43 +02:00
|
|
|
|
if (connected->destination)
|
|
|
|
|
/* use specified broadcast or point-to-point destination addr */
|
|
|
|
|
to.sin_addr = connected->destination->u.prefix4;
|
|
|
|
|
else
|
|
|
|
|
/* calculate the appropriate broadcast address */
|
|
|
|
|
to.sin_addr.s_addr =
|
|
|
|
|
ipv4_broadcast_addr(connected->address->u.prefix4.s_addr,
|
|
|
|
|
connected->address->prefixlen);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
if (IS_RIP_DEBUG_EVENT)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("SEND request to %s", inet_ntoa (to.sin_addr));
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2004-01-23 16:31:42 +01:00
|
|
|
|
rip_request_send (&to, ifp, version, connected);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This will be executed when interface goes up. */
|
|
|
|
|
void
|
|
|
|
|
rip_request_interface (struct interface *ifp)
|
|
|
|
|
{
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
/* In default ripd doesn't send RIP_REQUEST to the loopback interface. */
|
|
|
|
|
if (if_is_loopback (ifp))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* If interface is down, don't send RIP packet. */
|
2002-12-13 22:03:13 +01:00
|
|
|
|
if (! if_is_operative (ifp))
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Fetch RIP interface information. */
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* If there is no version configuration in the interface,
|
|
|
|
|
use rip's version setting. */
|
2003-06-07 03:10:00 +02:00
|
|
|
|
{
|
|
|
|
|
int vsend = ((ri->ri_send == RI_RIP_UNSPEC) ?
|
|
|
|
|
rip->version_send : ri->ri_send);
|
|
|
|
|
if (vsend & RIPv1)
|
|
|
|
|
rip_request_interface_send (ifp, RIPv1);
|
|
|
|
|
if (vsend & RIPv2)
|
|
|
|
|
rip_request_interface_send (ifp, RIPv2);
|
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Send RIP request to the neighbor. */
|
|
|
|
|
void
|
|
|
|
|
rip_request_neighbor (struct in_addr addr)
|
|
|
|
|
{
|
|
|
|
|
struct sockaddr_in to;
|
|
|
|
|
|
|
|
|
|
memset (&to, 0, sizeof (struct sockaddr_in));
|
|
|
|
|
to.sin_port = htons (RIP_PORT_DEFAULT);
|
|
|
|
|
to.sin_addr = addr;
|
|
|
|
|
|
2004-01-23 16:31:42 +01:00
|
|
|
|
rip_request_send (&to, NULL, rip->version_send, NULL);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Request routes at all interfaces. */
|
|
|
|
|
void
|
|
|
|
|
rip_request_neighbor_all ()
|
|
|
|
|
{
|
|
|
|
|
struct route_node *rp;
|
|
|
|
|
|
|
|
|
|
if (! rip)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (IS_RIP_DEBUG_EVENT)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("request to the all neighbor");
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
/* Send request to all neighbor. */
|
|
|
|
|
for (rp = route_top (rip->neighbor); rp; rp = route_next (rp))
|
|
|
|
|
if (rp->info)
|
|
|
|
|
rip_request_neighbor (rp->p.u.prefix4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Multicast packet receive socket. */
|
|
|
|
|
int
|
|
|
|
|
rip_multicast_join (struct interface *ifp, int sock)
|
|
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
|
struct listnode *cnode;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
struct connected *ifc;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2002-12-13 22:03:13 +01:00
|
|
|
|
if (if_is_operative (ifp) && if_is_multicast (ifp))
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
|
|
|
|
if (IS_RIP_DEBUG_EVENT)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("multicast join at %s", ifp->name);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, ifc))
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
|
|
|
|
struct prefix_ipv4 *p;
|
|
|
|
|
struct in_addr group;
|
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
p = (struct prefix_ipv4 *) ifc->address;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
if (p->family != AF_INET)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
group.s_addr = htonl (INADDR_RIP_GROUP);
|
|
|
|
|
if (ipv4_multicast_join (sock, group, p->prefix, ifp->ifindex) < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Leave from multicast group. */
|
|
|
|
|
void
|
|
|
|
|
rip_multicast_leave (struct interface *ifp, int sock)
|
|
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
|
struct listnode *cnode;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
struct connected *connected;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
if (if_is_up (ifp) && if_is_multicast (ifp))
|
|
|
|
|
{
|
|
|
|
|
if (IS_RIP_DEBUG_EVENT)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("multicast leave from %s", ifp->name);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, connected))
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
|
|
|
|
struct prefix_ipv4 *p;
|
|
|
|
|
struct in_addr group;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
p = (struct prefix_ipv4 *) connected->address;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
if (p->family != AF_INET)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
group.s_addr = htonl (INADDR_RIP_GROUP);
|
|
|
|
|
if (ipv4_multicast_leave (sock, group, p->prefix, ifp->ifindex) == 0)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Is there and address on interface that I could use ? */
|
|
|
|
|
int
|
|
|
|
|
rip_if_ipv4_address_check (struct interface *ifp)
|
|
|
|
|
{
|
|
|
|
|
struct listnode *nn;
|
|
|
|
|
struct connected *connected;
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS_RO (ifp->connected, nn, connected))
|
|
|
|
|
{
|
|
|
|
|
struct prefix *p;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
p = connected->address;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
if (p->family == AF_INET)
|
|
|
|
|
count++;
|
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
2003-09-29 21:54:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Does this address belongs to me ? */
|
|
|
|
|
int
|
|
|
|
|
if_check_address (struct in_addr addr)
|
|
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
|
struct listnode *node;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
struct interface *ifp;
|
|
|
|
|
|
|
|
|
|
for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
|
2003-09-29 21:54:53 +02:00
|
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
|
struct listnode *cnode;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
struct connected *connected;
|
2003-09-29 21:54:53 +02:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, connected))
|
2003-09-29 21:54:53 +02:00
|
|
|
|
{
|
|
|
|
|
struct prefix_ipv4 *p;
|
|
|
|
|
|
|
|
|
|
p = (struct prefix_ipv4 *) connected->address;
|
|
|
|
|
|
|
|
|
|
if (p->family != AF_INET)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (IPV4_ADDR_CMP (&p->prefix, &addr) == 0)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* is this address from a valid neighbor? (RFC2453 - Sec. 3.9.2) */
|
|
|
|
|
int
|
|
|
|
|
if_valid_neighbor (struct in_addr addr)
|
|
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
|
struct listnode *node;
|
2003-09-29 21:54:53 +02:00
|
|
|
|
struct connected *connected = NULL;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
struct interface *ifp;
|
2003-09-29 21:54:53 +02:00
|
|
|
|
struct prefix_ipv4 *p;
|
2004-10-19 21:44:43 +02:00
|
|
|
|
struct prefix_ipv4 pa;
|
|
|
|
|
|
|
|
|
|
pa.family = AF_INET;
|
|
|
|
|
pa.prefix = addr;
|
|
|
|
|
pa.prefixlen = IPV4_MAX_PREFIXLEN;
|
2003-09-29 21:54:53 +02:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
|
2003-09-29 21:54:53 +02:00
|
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
|
struct listnode *cnode;
|
2003-09-29 21:54:53 +02:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, connected))
|
2003-09-29 21:54:53 +02:00
|
|
|
|
{
|
|
|
|
|
if (if_is_pointopoint (ifp))
|
|
|
|
|
{
|
|
|
|
|
p = (struct prefix_ipv4 *) connected->address;
|
|
|
|
|
|
|
|
|
|
if (p && p->family == AF_INET)
|
|
|
|
|
{
|
|
|
|
|
if (IPV4_ADDR_SAME (&p->prefix, &addr))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
p = (struct prefix_ipv4 *) connected->destination;
|
2004-10-19 21:44:43 +02:00
|
|
|
|
if (p)
|
|
|
|
|
{
|
|
|
|
|
if (IPV4_ADDR_SAME (&p->prefix, &addr))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (prefix_match(connected->address,(struct prefix *)&pa))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2003-09-29 21:54:53 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2004-10-19 21:44:43 +02:00
|
|
|
|
if ((connected->address->family == AF_INET) &&
|
|
|
|
|
prefix_match(connected->address,(struct prefix *)&pa))
|
|
|
|
|
return 1;
|
2003-09-29 21:54:53 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
/* Inteface link down message processing. */
|
|
|
|
|
int
|
|
|
|
|
rip_interface_down (int command, struct zclient *zclient, zebra_size_t length)
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct stream *s;
|
|
|
|
|
|
|
|
|
|
s = zclient->ibuf;
|
|
|
|
|
|
|
|
|
|
/* zebra_interface_state_read() updates interface structure in
|
|
|
|
|
iflist. */
|
|
|
|
|
ifp = zebra_interface_state_read(s);
|
|
|
|
|
|
|
|
|
|
if (ifp == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
rip_if_down(ifp);
|
|
|
|
|
|
|
|
|
|
if (IS_RIP_DEBUG_ZEBRA)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("interface %s index %d flags %ld metric %d mtu %d is down",
|
2002-12-13 21:15:29 +01:00
|
|
|
|
ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Inteface link up message processing */
|
|
|
|
|
int
|
|
|
|
|
rip_interface_up (int command, struct zclient *zclient, zebra_size_t length)
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
|
|
|
|
|
/* zebra_interface_state_read () updates interface structure in
|
|
|
|
|
iflist. */
|
|
|
|
|
ifp = zebra_interface_state_read (zclient->ibuf);
|
|
|
|
|
|
|
|
|
|
if (ifp == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (IS_RIP_DEBUG_ZEBRA)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("interface %s index %d flags %ld metric %d mtu %d is up",
|
2002-12-13 21:15:29 +01:00
|
|
|
|
ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu);
|
|
|
|
|
|
|
|
|
|
/* Check if this interface is RIP enabled or not.*/
|
|
|
|
|
rip_enable_apply (ifp);
|
|
|
|
|
|
|
|
|
|
/* Check for a passive interface */
|
|
|
|
|
rip_passive_interface_apply (ifp);
|
|
|
|
|
|
|
|
|
|
/* Apply distribute list to the all interface. */
|
|
|
|
|
rip_distribute_update_interface (ifp);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Inteface addition message from zebra. */
|
|
|
|
|
int
|
|
|
|
|
rip_interface_add (int command, struct zclient *zclient, zebra_size_t length)
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
|
|
|
|
|
ifp = zebra_interface_add_read (zclient->ibuf);
|
|
|
|
|
|
|
|
|
|
if (IS_RIP_DEBUG_ZEBRA)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("interface add %s index %d flags %ld metric %d mtu %d",
|
2002-12-13 21:15:29 +01:00
|
|
|
|
ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu);
|
|
|
|
|
|
|
|
|
|
/* Check if this interface is RIP enabled or not.*/
|
|
|
|
|
rip_enable_apply (ifp);
|
2005-05-11 17:56:21 +02:00
|
|
|
|
|
|
|
|
|
/* Check for a passive interface */
|
|
|
|
|
rip_passive_interface_apply (ifp);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
/* Apply distribute list to the all interface. */
|
|
|
|
|
rip_distribute_update_interface (ifp);
|
|
|
|
|
|
|
|
|
|
/* rip_request_neighbor_all (); */
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
/* Check interface routemap. */
|
|
|
|
|
rip_if_rmap_update_interface (ifp);
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
rip_interface_delete (int command, struct zclient *zclient,
|
|
|
|
|
zebra_size_t length)
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct stream *s;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s = zclient->ibuf;
|
|
|
|
|
/* zebra_interface_state_read() updates interface structure in iflist */
|
|
|
|
|
ifp = zebra_interface_state_read(s);
|
|
|
|
|
|
|
|
|
|
if (ifp == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (if_is_up (ifp)) {
|
|
|
|
|
rip_if_down(ifp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
zlog_info("interface delete %s index %d flags %ld metric %d mtu %d",
|
|
|
|
|
ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu);
|
|
|
|
|
|
|
|
|
|
/* To support pseudo interface do not free interface structure. */
|
|
|
|
|
/* if_delete(ifp); */
|
2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
Fix problems when netlink interfaces are renamed (same ifindex used
for a new interface). Start cleaning up some problems with the way
interface names are handled.
* interface.c: (if_new_intern_ifindex) Remove obsolete function.
(if_delete_update) After distributing the interface deletion message,
set ifp->ifindex to IFINDEX_INTERNAL.
(if_dump_vty) Detect pseudo interface by checking if ifp->ifindex is
IFINDEX_INTERNAL.
(zebra_interface) Check return code from interface_cmd.func.
Do not set internal ifindex values to if_new_intern_ifindex(),
since we now use IFINDEX_INTERNAL for all pseudo interfaces.
* kernel_socket.c: (ifm_read) Fix code and comments to reflect that
all internal interfaces now have ifp->ifindex set to IFINDEX_INTERNAL.
* rt_netlink.c: (set_ifindex) New function used to update ifp->ifindex.
Detects interface rename events by checking if that ifindex is already
being used. If it is, delete the old interface before assigning
the ifindex to the new interface.
(netlink_interface, netlink_link_change) Call set_ifindex to update
the ifindex.
* if.h: Remove define for IFINDEX_INTERNBASE and add define
IFINDEX_INTERNAL 0, since all internal (i.e. non-kernel) pseudo-
interfaces should have ifindex set to 0.
(if_new) Remove function.
(if_delete_retain) New function to delete an interface without
removing from iflist and freeing the structure.
(ifname2ifindex) New function.
* if.c: (if_new) Remove function (absorb into if_create).
(if_create) Replace function if_new with call to calloc.
Set ifp->ifindex to IFINDEX_INTERNAL. Fix off-by-one error
in assert to check length of interface name. Add error message
if interface with this name already exists.
(if_delete_retain) New function to delete an interface without
removing from iflist and freeing the structure.
(if_delete) Implement with help of if_delete_retain.
(ifindex2ifname) Reimplement using if_lookup_by_index.
(ifname2ifindex) New function to complement ifindex2ifname.
(interface) The interface command should check the name length
and fail with a warning message if it is too long.
(no_interface) Fix spelling in warning message.
(if_nametoindex) Reimplement using if_lookup_by_name.
(if_indextoname, ifaddr_ipv4_lookup) Reimplement using
if_lookup_by_index.
* bgp_zebra.c: (bgp_interface_delete) After deleting, set ifp->ifindex
to IFINDEX_INTERNAL.
* isis_zebra.c: (isis_zebra_if_del) Call if_delete_retain instead
of if_delete, since it is generally not safe to remove interface
structures. After deleting, set ifp->ifindex to IFINDEX_INTERNAL.
(zebra_interface_if_lookup) Tighten up code.
* ospf6_zebra.c: (ospf6_zebra_if_del) Previously, this whole function
was commented out. But this is not safe: we should at least update
the ifindex when the interface is deleted. So the new version
updates the interface status and sets ifp->ifindex to
IFINDEX_INTERNAL.
(ospf6_zebra_route_update) Use if_indextoname properly.
* ospf_vty.c: (show_ip_ospf_interface_sub) Show ifindex and interface
flags to help with debugging.
* ospf_zebra.c: (ospf_interface_delete) After deleting, set ifp->ifindex
to IFINDEX_INTERNAL.
(zebra_interface_if_lookup) Make function static. Tighten up code.
* rip_interface.c: (rip_interface_delete) After deleting, set
ifp->ifindex to IFINDEX_INTERNAL.
* ripng_interface.c: (ripng_interface_delete) After deleting, set
ifp->ifindex to IFINDEX_INTERNAL.
2005-04-02 20:38:43 +02:00
|
|
|
|
ifp->ifindex = IFINDEX_INTERNAL;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
rip_interface_clean ()
|
|
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
ri->enable_network = 0;
|
|
|
|
|
ri->enable_interface = 0;
|
|
|
|
|
ri->running = 0;
|
|
|
|
|
|
|
|
|
|
if (ri->t_wakeup)
|
|
|
|
|
{
|
|
|
|
|
thread_cancel (ri->t_wakeup);
|
|
|
|
|
ri->t_wakeup = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
rip_interface_reset ()
|
|
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
ri->enable_network = 0;
|
|
|
|
|
ri->enable_interface = 0;
|
|
|
|
|
ri->running = 0;
|
|
|
|
|
|
|
|
|
|
ri->ri_send = RI_RIP_UNSPEC;
|
|
|
|
|
ri->ri_receive = RI_RIP_UNSPEC;
|
|
|
|
|
|
2005-06-02 10:20:53 +02:00
|
|
|
|
ri->auth_type = RIP_NO_AUTH;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
if (ri->auth_str)
|
|
|
|
|
{
|
|
|
|
|
free (ri->auth_str);
|
|
|
|
|
ri->auth_str = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (ri->key_chain)
|
|
|
|
|
{
|
|
|
|
|
free (ri->key_chain);
|
|
|
|
|
ri->key_chain = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
ri->split_horizon = RIP_NO_SPLIT_HORIZON;
|
|
|
|
|
ri->split_horizon_default = RIP_NO_SPLIT_HORIZON;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
ri->list[RIP_FILTER_IN] = NULL;
|
|
|
|
|
ri->list[RIP_FILTER_OUT] = NULL;
|
|
|
|
|
|
|
|
|
|
ri->prefix[RIP_FILTER_IN] = NULL;
|
|
|
|
|
ri->prefix[RIP_FILTER_OUT] = NULL;
|
|
|
|
|
|
|
|
|
|
if (ri->t_wakeup)
|
|
|
|
|
{
|
|
|
|
|
thread_cancel (ri->t_wakeup);
|
|
|
|
|
ri->t_wakeup = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ri->recv_badpackets = 0;
|
|
|
|
|
ri->recv_badroutes = 0;
|
|
|
|
|
ri->sent_updates = 0;
|
|
|
|
|
|
|
|
|
|
ri->passive = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
rip_if_down(struct interface *ifp)
|
|
|
|
|
{
|
|
|
|
|
struct route_node *rp;
|
|
|
|
|
struct rip_info *rinfo;
|
|
|
|
|
struct rip_interface *ri = NULL;
|
|
|
|
|
if (rip)
|
|
|
|
|
{
|
|
|
|
|
for (rp = route_top (rip->table); rp; rp = route_next (rp))
|
|
|
|
|
if ((rinfo = rp->info) != NULL)
|
|
|
|
|
{
|
|
|
|
|
/* Routes got through this interface. */
|
|
|
|
|
if (rinfo->ifindex == ifp->ifindex &&
|
|
|
|
|
rinfo->type == ZEBRA_ROUTE_RIP &&
|
|
|
|
|
rinfo->sub_type == RIP_ROUTE_RTE)
|
|
|
|
|
{
|
|
|
|
|
rip_zebra_ipv4_delete ((struct prefix_ipv4 *) &rp->p,
|
|
|
|
|
&rinfo->nexthop,
|
|
|
|
|
rinfo->ifindex);
|
|
|
|
|
|
|
|
|
|
rip_redistribute_delete (rinfo->type,rinfo->sub_type,
|
|
|
|
|
(struct prefix_ipv4 *)&rp->p,
|
|
|
|
|
rinfo->ifindex);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* All redistributed routes but static and system */
|
|
|
|
|
if ((rinfo->ifindex == ifp->ifindex) &&
|
2002-12-13 22:03:13 +01:00
|
|
|
|
/* (rinfo->type != ZEBRA_ROUTE_STATIC) && */
|
2002-12-13 21:15:29 +01:00
|
|
|
|
(rinfo->type != ZEBRA_ROUTE_SYSTEM))
|
|
|
|
|
rip_redistribute_delete (rinfo->type,rinfo->sub_type,
|
|
|
|
|
(struct prefix_ipv4 *)&rp->p,
|
|
|
|
|
rinfo->ifindex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
if (ri->running)
|
|
|
|
|
{
|
|
|
|
|
if (IS_RIP_DEBUG_EVENT)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("turn off %s", ifp->name);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
/* Leave from multicast group. */
|
|
|
|
|
rip_multicast_leave (ifp, rip->sock);
|
|
|
|
|
|
|
|
|
|
ri->running = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Needed for stop RIP process. */
|
|
|
|
|
void
|
|
|
|
|
rip_if_down_all ()
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
|
|
|
|
|
rip_if_down (ifp);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
static void
|
|
|
|
|
rip_apply_address_add (struct connected *ifc) {
|
|
|
|
|
struct prefix_ipv4 address;
|
|
|
|
|
struct prefix *p;
|
|
|
|
|
|
|
|
|
|
if (!rip)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (! if_is_up(ifc->ifp))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
p = ifc->address;
|
|
|
|
|
|
|
|
|
|
memset (&address, 0, sizeof (address));
|
|
|
|
|
address.family = p->family;
|
|
|
|
|
address.prefix = p->u.prefix4;
|
|
|
|
|
address.prefixlen = p->prefixlen;
|
|
|
|
|
apply_mask_ipv4(&address);
|
|
|
|
|
|
|
|
|
|
/* Check if this interface is RIP enabled or not
|
|
|
|
|
or Check if this address's prefix is RIP enabled */
|
|
|
|
|
if ((rip_enable_if_lookup(ifc->ifp->name) >= 0) ||
|
|
|
|
|
(rip_enable_network_lookup2(ifc) >= 0))
|
|
|
|
|
rip_redistribute_add(ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE,
|
2005-09-29 13:25:50 +02:00
|
|
|
|
&address, ifc->ifp->ifindex, NULL, 0, 0);
|
2003-05-25 16:49:19 +02:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
int
|
|
|
|
|
rip_interface_address_add (int command, struct zclient *zclient,
|
|
|
|
|
zebra_size_t length)
|
|
|
|
|
{
|
|
|
|
|
struct connected *ifc;
|
|
|
|
|
struct prefix *p;
|
|
|
|
|
|
2004-05-08 13:48:26 +02:00
|
|
|
|
ifc = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD,
|
|
|
|
|
zclient->ibuf);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
if (ifc == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
p = ifc->address;
|
|
|
|
|
|
|
|
|
|
if (p->family == AF_INET)
|
|
|
|
|
{
|
|
|
|
|
if (IS_RIP_DEBUG_ZEBRA)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("connected address %s/%d is added",
|
2002-12-13 21:15:29 +01:00
|
|
|
|
inet_ntoa (p->u.prefix4), p->prefixlen);
|
2003-05-25 16:49:19 +02:00
|
|
|
|
|
2003-09-24 01:41:50 +02:00
|
|
|
|
rip_enable_apply(ifc->ifp);
|
2003-05-25 16:49:19 +02:00
|
|
|
|
/* Check if this prefix needs to be redistributed */
|
|
|
|
|
rip_apply_address_add(ifc);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SNMP
|
|
|
|
|
rip_ifaddr_add (ifc->ifp, ifc);
|
|
|
|
|
#endif /* HAVE_SNMP */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
static void
|
|
|
|
|
rip_apply_address_del (struct connected *ifc) {
|
|
|
|
|
struct prefix_ipv4 address;
|
|
|
|
|
struct prefix *p;
|
|
|
|
|
|
|
|
|
|
if (!rip)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (! if_is_up(ifc->ifp))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
p = ifc->address;
|
|
|
|
|
|
|
|
|
|
memset (&address, 0, sizeof (address));
|
|
|
|
|
address.family = p->family;
|
|
|
|
|
address.prefix = p->u.prefix4;
|
|
|
|
|
address.prefixlen = p->prefixlen;
|
|
|
|
|
apply_mask_ipv4(&address);
|
|
|
|
|
|
|
|
|
|
rip_redistribute_delete(ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE,
|
|
|
|
|
&address, ifc->ifp->ifindex);
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
int
|
|
|
|
|
rip_interface_address_delete (int command, struct zclient *zclient,
|
|
|
|
|
zebra_size_t length)
|
|
|
|
|
{
|
|
|
|
|
struct connected *ifc;
|
|
|
|
|
struct prefix *p;
|
|
|
|
|
|
2004-05-08 13:48:26 +02:00
|
|
|
|
ifc = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE,
|
|
|
|
|
zclient->ibuf);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
if (ifc)
|
|
|
|
|
{
|
|
|
|
|
p = ifc->address;
|
|
|
|
|
if (p->family == AF_INET)
|
|
|
|
|
{
|
|
|
|
|
if (IS_RIP_DEBUG_ZEBRA)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("connected address %s/%d is deleted",
|
2002-12-13 21:15:29 +01:00
|
|
|
|
inet_ntoa (p->u.prefix4), p->prefixlen);
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SNMP
|
|
|
|
|
rip_ifaddr_delete (ifc->ifp, ifc);
|
|
|
|
|
#endif /* HAVE_SNMP */
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
/* Chech wether this prefix needs to be removed */
|
|
|
|
|
rip_apply_address_del(ifc);
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connected_free (ifc);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check interface is enabled by network statement. */
|
2003-05-25 16:49:19 +02:00
|
|
|
|
/* Check wether the interface has at least a connected prefix that
|
|
|
|
|
* is within the ripng_enable_network table. */
|
2002-12-13 21:15:29 +01:00
|
|
|
|
int
|
2003-05-25 16:49:19 +02:00
|
|
|
|
rip_enable_network_lookup_if (struct interface *ifp)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
struct connected *connected;
|
|
|
|
|
struct prefix_ipv4 address;
|
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, connected))
|
|
|
|
|
{
|
|
|
|
|
struct prefix *p;
|
|
|
|
|
struct route_node *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
p = connected->address;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
if (p->family == AF_INET)
|
|
|
|
|
{
|
|
|
|
|
address.family = AF_INET;
|
|
|
|
|
address.prefix = p->u.prefix4;
|
|
|
|
|
address.prefixlen = IPV4_MAX_BITLEN;
|
|
|
|
|
|
|
|
|
|
node = route_node_match (rip_enable_network,
|
|
|
|
|
(struct prefix *)&address);
|
|
|
|
|
if (node)
|
|
|
|
|
{
|
|
|
|
|
route_unlock_node (node);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
/* Check wether connected is within the ripng_enable_network table. */
|
|
|
|
|
int
|
|
|
|
|
rip_enable_network_lookup2 (struct connected *connected)
|
|
|
|
|
{
|
|
|
|
|
struct prefix_ipv4 address;
|
|
|
|
|
struct prefix *p;
|
|
|
|
|
|
|
|
|
|
p = connected->address;
|
|
|
|
|
|
|
|
|
|
if (p->family == AF_INET) {
|
|
|
|
|
struct route_node *node;
|
|
|
|
|
|
|
|
|
|
address.family = p->family;
|
|
|
|
|
address.prefix = p->u.prefix4;
|
|
|
|
|
address.prefixlen = IPV4_MAX_BITLEN;
|
|
|
|
|
|
|
|
|
|
/* LPM on p->family, p->u.prefix4/IPV4_MAX_BITLEN within rip_enable_network */
|
|
|
|
|
node = route_node_match (rip_enable_network,
|
|
|
|
|
(struct prefix *)&address);
|
|
|
|
|
|
|
|
|
|
if (node) {
|
|
|
|
|
route_unlock_node (node);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
/* Add RIP enable network. */
|
|
|
|
|
int
|
|
|
|
|
rip_enable_network_add (struct prefix *p)
|
|
|
|
|
{
|
|
|
|
|
struct route_node *node;
|
|
|
|
|
|
|
|
|
|
node = route_node_get (rip_enable_network, p);
|
|
|
|
|
|
|
|
|
|
if (node->info)
|
|
|
|
|
{
|
|
|
|
|
route_unlock_node (node);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
else
|
2004-10-08 08:36:38 +02:00
|
|
|
|
node->info = (char *) "enabled";
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
/* XXX: One should find a better solution than a generic one */
|
|
|
|
|
rip_enable_apply_all();
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Delete RIP enable network. */
|
|
|
|
|
int
|
|
|
|
|
rip_enable_network_delete (struct prefix *p)
|
|
|
|
|
{
|
|
|
|
|
struct route_node *node;
|
|
|
|
|
|
|
|
|
|
node = route_node_lookup (rip_enable_network, p);
|
|
|
|
|
if (node)
|
|
|
|
|
{
|
|
|
|
|
node->info = NULL;
|
|
|
|
|
|
|
|
|
|
/* Unlock info lock. */
|
|
|
|
|
route_unlock_node (node);
|
|
|
|
|
|
|
|
|
|
/* Unlock lookup lock. */
|
|
|
|
|
route_unlock_node (node);
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
/* XXX: One should find a better solution than a generic one */
|
|
|
|
|
rip_enable_apply_all ();
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check interface is enabled by ifname statement. */
|
|
|
|
|
int
|
2004-10-11 14:57:57 +02:00
|
|
|
|
rip_enable_if_lookup (const char *ifname)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
2004-10-08 08:36:38 +02:00
|
|
|
|
unsigned int i;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
char *str;
|
|
|
|
|
|
2005-03-14 21:19:01 +01:00
|
|
|
|
for (i = 0; i < vector_active (rip_enable_interface); i++)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
if ((str = vector_slot (rip_enable_interface, i)) != NULL)
|
|
|
|
|
if (strcmp (str, ifname) == 0)
|
|
|
|
|
return i;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add interface to rip_enable_if. */
|
|
|
|
|
int
|
2004-10-11 14:57:57 +02:00
|
|
|
|
rip_enable_if_add (const char *ifname)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
ret = rip_enable_if_lookup (ifname);
|
|
|
|
|
if (ret >= 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
vector_set (rip_enable_interface, strdup (ifname));
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
rip_enable_apply_all(); /* TODOVJ */
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Delete interface from rip_enable_if. */
|
|
|
|
|
int
|
2004-10-11 14:57:57 +02:00
|
|
|
|
rip_enable_if_delete (const char *ifname)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
|
|
|
|
int index;
|
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
|
|
index = rip_enable_if_lookup (ifname);
|
|
|
|
|
if (index < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
str = vector_slot (rip_enable_interface, index);
|
|
|
|
|
free (str);
|
|
|
|
|
vector_unset (rip_enable_interface, index);
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
rip_enable_apply_all(); /* TODOVJ */
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Join to multicast group and send request to the interface. */
|
|
|
|
|
int
|
|
|
|
|
rip_interface_wakeup (struct thread *t)
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
/* Get interface. */
|
|
|
|
|
ifp = THREAD_ARG (t);
|
|
|
|
|
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
ri->t_wakeup = NULL;
|
|
|
|
|
|
|
|
|
|
/* Join to multicast group. */
|
|
|
|
|
if (rip_multicast_join (ifp, rip->sock) < 0)
|
|
|
|
|
{
|
|
|
|
|
zlog_err ("multicast join failed, interface %s not running", ifp->name);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set running flag. */
|
|
|
|
|
ri->running = 1;
|
|
|
|
|
|
|
|
|
|
/* Send RIP request to the interface. */
|
|
|
|
|
rip_request_interface (ifp);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int rip_redistribute_check (int);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
rip_connect_set (struct interface *ifp, int set)
|
|
|
|
|
{
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
struct connected *connected;
|
|
|
|
|
struct prefix_ipv4 address;
|
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, connected))
|
|
|
|
|
{
|
|
|
|
|
struct prefix *p;
|
|
|
|
|
p = connected->address;
|
|
|
|
|
|
|
|
|
|
if (p->family != AF_INET)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
address.family = AF_INET;
|
|
|
|
|
address.prefix = p->u.prefix4;
|
|
|
|
|
address.prefixlen = p->prefixlen;
|
|
|
|
|
apply_mask_ipv4 (&address);
|
|
|
|
|
|
|
|
|
|
if (set) {
|
|
|
|
|
/* Check once more wether this prefix is within a "network IF_OR_PREF" one */
|
|
|
|
|
if ((rip_enable_if_lookup(connected->ifp->name) >= 0) ||
|
|
|
|
|
(rip_enable_network_lookup2(connected) >= 0))
|
|
|
|
|
rip_redistribute_add (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE,
|
2005-09-29 13:25:50 +02:00
|
|
|
|
&address, connected->ifp->ifindex,
|
|
|
|
|
NULL, 0, 0);
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
rip_redistribute_delete (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE,
|
|
|
|
|
&address, connected->ifp->ifindex);
|
|
|
|
|
if (rip_redistribute_check (ZEBRA_ROUTE_CONNECT))
|
|
|
|
|
rip_redistribute_add (ZEBRA_ROUTE_CONNECT, RIP_ROUTE_REDISTRIBUTE,
|
2005-09-29 13:25:50 +02:00
|
|
|
|
&address, connected->ifp->ifindex,
|
|
|
|
|
NULL, 0, 0);
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Update interface status. */
|
|
|
|
|
void
|
|
|
|
|
rip_enable_apply (struct interface *ifp)
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
struct rip_interface *ri = NULL;
|
|
|
|
|
|
|
|
|
|
/* Check interface. */
|
2002-12-13 22:03:13 +01:00
|
|
|
|
if (! if_is_operative (ifp))
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
/* Check network configuration. */
|
2003-05-25 16:49:19 +02:00
|
|
|
|
ret = rip_enable_network_lookup_if (ifp);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
/* If the interface is matched. */
|
|
|
|
|
if (ret > 0)
|
|
|
|
|
ri->enable_network = 1;
|
|
|
|
|
else
|
|
|
|
|
ri->enable_network = 0;
|
|
|
|
|
|
|
|
|
|
/* Check interface name configuration. */
|
|
|
|
|
ret = rip_enable_if_lookup (ifp->name);
|
|
|
|
|
if (ret >= 0)
|
|
|
|
|
ri->enable_interface = 1;
|
|
|
|
|
else
|
|
|
|
|
ri->enable_interface = 0;
|
|
|
|
|
|
|
|
|
|
/* any interface MUST have an IPv4 address */
|
|
|
|
|
if ( ! rip_if_ipv4_address_check (ifp) )
|
|
|
|
|
{
|
|
|
|
|
ri->enable_network = 0;
|
|
|
|
|
ri->enable_interface = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Update running status of the interface. */
|
|
|
|
|
if (ri->enable_network || ri->enable_interface)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
if (IS_RIP_DEBUG_EVENT)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("turn on %s", ifp->name);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
/* Add interface wake up thread. */
|
|
|
|
|
if (! ri->t_wakeup)
|
|
|
|
|
ri->t_wakeup = thread_add_timer (master, rip_interface_wakeup,
|
|
|
|
|
ifp, 1);
|
|
|
|
|
rip_connect_set (ifp, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (ri->running)
|
|
|
|
|
{
|
2003-05-25 16:49:19 +02:00
|
|
|
|
/* Might as well clean up the route table as well
|
|
|
|
|
* rip_if_down sets to 0 ri->running, and displays "turn off %s"
|
|
|
|
|
**/
|
2002-12-13 21:15:29 +01:00
|
|
|
|
rip_if_down(ifp);
|
|
|
|
|
|
|
|
|
|
rip_connect_set (ifp, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Apply network configuration to all interface. */
|
|
|
|
|
void
|
|
|
|
|
rip_enable_apply_all ()
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
/* Check each interface. */
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
|
|
|
|
|
rip_enable_apply (ifp);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
rip_neighbor_lookup (struct sockaddr_in *from)
|
|
|
|
|
{
|
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
|
struct route_node *node;
|
|
|
|
|
|
|
|
|
|
memset (&p, 0, sizeof (struct prefix_ipv4));
|
|
|
|
|
p.family = AF_INET;
|
|
|
|
|
p.prefix = from->sin_addr;
|
|
|
|
|
p.prefixlen = IPV4_MAX_BITLEN;
|
|
|
|
|
|
|
|
|
|
node = route_node_lookup (rip->neighbor, (struct prefix *) &p);
|
|
|
|
|
if (node)
|
|
|
|
|
{
|
|
|
|
|
route_unlock_node (node);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add new RIP neighbor to the neighbor tree. */
|
|
|
|
|
int
|
|
|
|
|
rip_neighbor_add (struct prefix_ipv4 *p)
|
|
|
|
|
{
|
|
|
|
|
struct route_node *node;
|
|
|
|
|
|
|
|
|
|
node = route_node_get (rip->neighbor, (struct prefix *) p);
|
|
|
|
|
|
|
|
|
|
if (node->info)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
node->info = rip->neighbor;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Delete RIP neighbor from the neighbor tree. */
|
|
|
|
|
int
|
|
|
|
|
rip_neighbor_delete (struct prefix_ipv4 *p)
|
|
|
|
|
{
|
|
|
|
|
struct route_node *node;
|
|
|
|
|
|
|
|
|
|
/* Lock for look up. */
|
|
|
|
|
node = route_node_lookup (rip->neighbor, (struct prefix *) p);
|
|
|
|
|
if (! node)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
node->info = NULL;
|
|
|
|
|
|
|
|
|
|
/* Unlock lookup lock. */
|
|
|
|
|
route_unlock_node (node);
|
|
|
|
|
|
|
|
|
|
/* Unlock real neighbor information lock. */
|
|
|
|
|
route_unlock_node (node);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Clear all network and neighbor configuration. */
|
|
|
|
|
void
|
|
|
|
|
rip_clean_network ()
|
|
|
|
|
{
|
2004-10-08 08:36:38 +02:00
|
|
|
|
unsigned int i;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
char *str;
|
|
|
|
|
struct route_node *rn;
|
|
|
|
|
|
|
|
|
|
/* rip_enable_network. */
|
|
|
|
|
for (rn = route_top (rip_enable_network); rn; rn = route_next (rn))
|
|
|
|
|
if (rn->info)
|
|
|
|
|
{
|
|
|
|
|
rn->info = NULL;
|
|
|
|
|
route_unlock_node (rn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* rip_enable_interface. */
|
2005-03-14 21:19:01 +01:00
|
|
|
|
for (i = 0; i < vector_active (rip_enable_interface); i++)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
if ((str = vector_slot (rip_enable_interface, i)) != NULL)
|
|
|
|
|
{
|
|
|
|
|
free (str);
|
|
|
|
|
vector_slot (rip_enable_interface, i) = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Utility function for looking up passive interface settings. */
|
|
|
|
|
int
|
2004-10-11 14:57:57 +02:00
|
|
|
|
rip_passive_nondefault_lookup (const char *ifname)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
2004-10-08 08:36:38 +02:00
|
|
|
|
unsigned int i;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
char *str;
|
|
|
|
|
|
2005-03-14 21:19:01 +01:00
|
|
|
|
for (i = 0; i < vector_active (Vrip_passive_nondefault); i++)
|
2003-06-07 03:04:45 +02:00
|
|
|
|
if ((str = vector_slot (Vrip_passive_nondefault, i)) != NULL)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
if (strcmp (str, ifname) == 0)
|
|
|
|
|
return i;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
rip_passive_interface_apply (struct interface *ifp)
|
|
|
|
|
{
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
2003-06-07 03:04:45 +02:00
|
|
|
|
ri->passive = ((rip_passive_nondefault_lookup (ifp->name) < 0) ?
|
|
|
|
|
passive_default : !passive_default);
|
|
|
|
|
|
|
|
|
|
if (IS_RIP_DEBUG_ZEBRA)
|
2004-12-08 20:24:06 +01:00
|
|
|
|
zlog_debug ("interface %s: passive = %d",ifp->name,ri->passive);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
rip_passive_interface_apply_all ()
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
struct listnode *node, *nnode;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
|
|
|
|
|
rip_passive_interface_apply (ifp);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Passive interface. */
|
|
|
|
|
int
|
2004-10-11 14:57:57 +02:00
|
|
|
|
rip_passive_nondefault_set (struct vty *vty, const char *ifname)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
2003-06-07 03:04:45 +02:00
|
|
|
|
if (rip_passive_nondefault_lookup (ifname) >= 0)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
|
2003-06-07 03:04:45 +02:00
|
|
|
|
vector_set (Vrip_passive_nondefault, strdup (ifname));
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
rip_passive_interface_apply_all ();
|
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2004-10-11 14:57:57 +02:00
|
|
|
|
rip_passive_nondefault_unset (struct vty *vty, const char *ifname)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
char *str;
|
|
|
|
|
|
2003-06-07 03:04:45 +02:00
|
|
|
|
i = rip_passive_nondefault_lookup (ifname);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
if (i < 0)
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
|
2003-06-07 03:04:45 +02:00
|
|
|
|
str = vector_slot (Vrip_passive_nondefault, i);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
free (str);
|
2003-06-07 03:04:45 +02:00
|
|
|
|
vector_unset (Vrip_passive_nondefault, i);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
rip_passive_interface_apply_all ();
|
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Free all configured RIP passive-interface settings. */
|
|
|
|
|
void
|
2003-06-07 03:04:45 +02:00
|
|
|
|
rip_passive_nondefault_clean ()
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
2004-10-08 08:36:38 +02:00
|
|
|
|
unsigned int i;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
char *str;
|
|
|
|
|
|
2005-03-14 21:19:01 +01:00
|
|
|
|
for (i = 0; i < vector_active (Vrip_passive_nondefault); i++)
|
2003-06-07 03:04:45 +02:00
|
|
|
|
if ((str = vector_slot (Vrip_passive_nondefault, i)) != NULL)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
|
|
|
|
free (str);
|
2003-06-07 03:04:45 +02:00
|
|
|
|
vector_slot (Vrip_passive_nondefault, i) = NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
rip_passive_interface_apply_all ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* RIP enable network or interface configuration. */
|
|
|
|
|
DEFUN (rip_network,
|
|
|
|
|
rip_network_cmd,
|
|
|
|
|
"network (A.B.C.D/M|WORD)",
|
|
|
|
|
"Enable routing on an IP network\n"
|
|
|
|
|
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
|
|
|
|
|
"Interface name\n")
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
|
|
|
|
|
|
ret = str2prefix_ipv4 (argv[0], &p);
|
|
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
|
ret = rip_enable_network_add ((struct prefix *) &p);
|
|
|
|
|
else
|
|
|
|
|
ret = rip_enable_if_add (argv[0]);
|
|
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
|
{
|
|
|
|
|
vty_out (vty, "There is a same network configuration %s%s", argv[0],
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* RIP enable network or interface configuration. */
|
|
|
|
|
DEFUN (no_rip_network,
|
|
|
|
|
no_rip_network_cmd,
|
|
|
|
|
"no network (A.B.C.D/M|WORD)",
|
|
|
|
|
NO_STR
|
|
|
|
|
"Enable routing on an IP network\n"
|
|
|
|
|
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
|
|
|
|
|
"Interface name\n")
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
|
|
|
|
|
|
ret = str2prefix_ipv4 (argv[0], &p);
|
|
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
|
ret = rip_enable_network_delete ((struct prefix *) &p);
|
|
|
|
|
else
|
|
|
|
|
ret = rip_enable_if_delete (argv[0]);
|
|
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
|
{
|
|
|
|
|
vty_out (vty, "Can't find network configuration %s%s", argv[0],
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* RIP neighbor configuration set. */
|
|
|
|
|
DEFUN (rip_neighbor,
|
|
|
|
|
rip_neighbor_cmd,
|
|
|
|
|
"neighbor A.B.C.D",
|
|
|
|
|
"Specify a neighbor router\n"
|
|
|
|
|
"Neighbor address\n")
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
|
|
|
|
|
|
ret = str2prefix_ipv4 (argv[0], &p);
|
|
|
|
|
|
|
|
|
|
if (ret <= 0)
|
|
|
|
|
{
|
|
|
|
|
vty_out (vty, "Please specify address by A.B.C.D%s", VTY_NEWLINE);
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rip_neighbor_add (&p);
|
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* RIP neighbor configuration unset. */
|
|
|
|
|
DEFUN (no_rip_neighbor,
|
|
|
|
|
no_rip_neighbor_cmd,
|
|
|
|
|
"no neighbor A.B.C.D",
|
|
|
|
|
NO_STR
|
|
|
|
|
"Specify a neighbor router\n"
|
|
|
|
|
"Neighbor address\n")
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
struct prefix_ipv4 p;
|
|
|
|
|
|
|
|
|
|
ret = str2prefix_ipv4 (argv[0], &p);
|
|
|
|
|
|
|
|
|
|
if (ret <= 0)
|
|
|
|
|
{
|
|
|
|
|
vty_out (vty, "Please specify address by A.B.C.D%s", VTY_NEWLINE);
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rip_neighbor_delete (&p);
|
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN (ip_rip_receive_version,
|
|
|
|
|
ip_rip_receive_version_cmd,
|
|
|
|
|
"ip rip receive version (1|2)",
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Advertisement reception\n"
|
|
|
|
|
"Version control\n"
|
|
|
|
|
"RIP version 1\n"
|
|
|
|
|
"RIP version 2\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
/* Version 1. */
|
|
|
|
|
if (atoi (argv[0]) == 1)
|
|
|
|
|
{
|
|
|
|
|
ri->ri_receive = RI_RIP_VERSION_1;
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
if (atoi (argv[0]) == 2)
|
|
|
|
|
{
|
|
|
|
|
ri->ri_receive = RI_RIP_VERSION_2;
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN (ip_rip_receive_version_1,
|
|
|
|
|
ip_rip_receive_version_1_cmd,
|
|
|
|
|
"ip rip receive version 1 2",
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Advertisement reception\n"
|
|
|
|
|
"Version control\n"
|
|
|
|
|
"RIP version 1\n"
|
|
|
|
|
"RIP version 2\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
/* Version 1 and 2. */
|
|
|
|
|
ri->ri_receive = RI_RIP_VERSION_1_AND_2;
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN (ip_rip_receive_version_2,
|
|
|
|
|
ip_rip_receive_version_2_cmd,
|
|
|
|
|
"ip rip receive version 2 1",
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Advertisement reception\n"
|
|
|
|
|
"Version control\n"
|
|
|
|
|
"RIP version 2\n"
|
|
|
|
|
"RIP version 1\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
/* Version 1 and 2. */
|
|
|
|
|
ri->ri_receive = RI_RIP_VERSION_1_AND_2;
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN (no_ip_rip_receive_version,
|
|
|
|
|
no_ip_rip_receive_version_cmd,
|
|
|
|
|
"no ip rip receive version",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Advertisement reception\n"
|
|
|
|
|
"Version control\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
ri->ri_receive = RI_RIP_UNSPEC;
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ALIAS (no_ip_rip_receive_version,
|
|
|
|
|
no_ip_rip_receive_version_num_cmd,
|
|
|
|
|
"no ip rip receive version (1|2)",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Advertisement reception\n"
|
|
|
|
|
"Version control\n"
|
|
|
|
|
"Version 1\n"
|
|
|
|
|
"Version 2\n")
|
|
|
|
|
|
|
|
|
|
DEFUN (ip_rip_send_version,
|
|
|
|
|
ip_rip_send_version_cmd,
|
|
|
|
|
"ip rip send version (1|2)",
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Advertisement transmission\n"
|
|
|
|
|
"Version control\n"
|
|
|
|
|
"RIP version 1\n"
|
|
|
|
|
"RIP version 2\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
/* Version 1. */
|
|
|
|
|
if (atoi (argv[0]) == 1)
|
|
|
|
|
{
|
|
|
|
|
ri->ri_send = RI_RIP_VERSION_1;
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
if (atoi (argv[0]) == 2)
|
|
|
|
|
{
|
|
|
|
|
ri->ri_send = RI_RIP_VERSION_2;
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN (ip_rip_send_version_1,
|
|
|
|
|
ip_rip_send_version_1_cmd,
|
|
|
|
|
"ip rip send version 1 2",
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Advertisement transmission\n"
|
|
|
|
|
"Version control\n"
|
|
|
|
|
"RIP version 1\n"
|
|
|
|
|
"RIP version 2\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
/* Version 1 and 2. */
|
|
|
|
|
ri->ri_send = RI_RIP_VERSION_1_AND_2;
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN (ip_rip_send_version_2,
|
|
|
|
|
ip_rip_send_version_2_cmd,
|
|
|
|
|
"ip rip send version 2 1",
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Advertisement transmission\n"
|
|
|
|
|
"Version control\n"
|
|
|
|
|
"RIP version 2\n"
|
|
|
|
|
"RIP version 1\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
/* Version 1 and 2. */
|
|
|
|
|
ri->ri_send = RI_RIP_VERSION_1_AND_2;
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN (no_ip_rip_send_version,
|
|
|
|
|
no_ip_rip_send_version_cmd,
|
|
|
|
|
"no ip rip send version",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Advertisement transmission\n"
|
|
|
|
|
"Version control\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
ri->ri_send = RI_RIP_UNSPEC;
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ALIAS (no_ip_rip_send_version,
|
|
|
|
|
no_ip_rip_send_version_num_cmd,
|
|
|
|
|
"no ip rip send version (1|2)",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Advertisement transmission\n"
|
|
|
|
|
"Version control\n"
|
|
|
|
|
"Version 1\n"
|
|
|
|
|
"Version 2\n")
|
|
|
|
|
|
|
|
|
|
DEFUN (ip_rip_authentication_mode,
|
|
|
|
|
ip_rip_authentication_mode_cmd,
|
|
|
|
|
"ip rip authentication mode (md5|text)",
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Authentication control\n"
|
|
|
|
|
"Authentication mode\n"
|
|
|
|
|
"Keyed message digest\n"
|
|
|
|
|
"Clear text authentication\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
2004-06-07 00:06:33 +02:00
|
|
|
|
if ( (argc < 1) || (argc > 2) )
|
|
|
|
|
{
|
|
|
|
|
vty_out (vty, "incorrect argument count%s", VTY_NEWLINE);
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
if (strncmp ("md5", argv[0], strlen (argv[0])) == 0)
|
|
|
|
|
ri->auth_type = RIP_AUTH_MD5;
|
|
|
|
|
else if (strncmp ("text", argv[0], strlen (argv[0])) == 0)
|
|
|
|
|
ri->auth_type = RIP_AUTH_SIMPLE_PASSWORD;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
vty_out (vty, "mode should be md5 or text%s", VTY_NEWLINE);
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-07 00:06:33 +02:00
|
|
|
|
if (argc == 1)
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
|
|
|
|
|
if ( (argc == 2) && (ri->auth_type != RIP_AUTH_MD5) )
|
|
|
|
|
{
|
|
|
|
|
vty_out (vty, "auth length argument only valid for md5%s", VTY_NEWLINE);
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strncmp ("r", argv[1], 1) == 0)
|
|
|
|
|
ri->md5_auth_len = RIP_AUTH_MD5_SIZE;
|
|
|
|
|
else if (strncmp ("o", argv[1], 1) == 0)
|
|
|
|
|
ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE;
|
|
|
|
|
else
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-07 00:06:33 +02:00
|
|
|
|
ALIAS (ip_rip_authentication_mode,
|
|
|
|
|
ip_rip_authentication_mode_authlen_cmd,
|
|
|
|
|
"ip rip authentication mode (md5|text) auth-length (rfc|old-ripd)",
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Authentication control\n"
|
|
|
|
|
"Authentication mode\n"
|
|
|
|
|
"Keyed message digest\n"
|
|
|
|
|
"Clear text authentication\n"
|
|
|
|
|
"MD5 authentication data length\n"
|
|
|
|
|
"RFC compatible\n"
|
|
|
|
|
"Old ripd compatible\n")
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
DEFUN (no_ip_rip_authentication_mode,
|
|
|
|
|
no_ip_rip_authentication_mode_cmd,
|
|
|
|
|
"no ip rip authentication mode",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Authentication control\n"
|
|
|
|
|
"Authentication mode\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
2005-06-02 10:20:53 +02:00
|
|
|
|
ri->auth_type = RIP_NO_AUTH;
|
2004-06-07 00:06:33 +02:00
|
|
|
|
ri->md5_auth_len = RIP_AUTH_MD5_COMPAT_SIZE;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ALIAS (no_ip_rip_authentication_mode,
|
|
|
|
|
no_ip_rip_authentication_mode_type_cmd,
|
|
|
|
|
"no ip rip authentication mode (md5|text)",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Authentication control\n"
|
|
|
|
|
"Authentication mode\n"
|
|
|
|
|
"Keyed message digest\n"
|
|
|
|
|
"Clear text authentication\n")
|
|
|
|
|
|
2004-06-07 00:06:33 +02:00
|
|
|
|
ALIAS (no_ip_rip_authentication_mode,
|
|
|
|
|
no_ip_rip_authentication_mode_type_authlen_cmd,
|
|
|
|
|
"no ip rip authentication mode (md5|text) auth-length (rfc|old-ripd)",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Authentication control\n"
|
|
|
|
|
"Authentication mode\n"
|
|
|
|
|
"Keyed message digest\n"
|
|
|
|
|
"Clear text authentication\n"
|
|
|
|
|
"MD5 authentication data length\n"
|
|
|
|
|
"RFC compatible\n"
|
|
|
|
|
"Old ripd compatible\n")
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
DEFUN (ip_rip_authentication_string,
|
|
|
|
|
ip_rip_authentication_string_cmd,
|
|
|
|
|
"ip rip authentication string LINE",
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Authentication control\n"
|
|
|
|
|
"Authentication string\n"
|
|
|
|
|
"Authentication string\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
if (strlen (argv[0]) > 16)
|
|
|
|
|
{
|
|
|
|
|
vty_out (vty, "%% RIPv2 authentication string must be shorter than 16%s",
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ri->key_chain)
|
|
|
|
|
{
|
|
|
|
|
vty_out (vty, "%% key-chain configuration exists%s", VTY_NEWLINE);
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ri->auth_str)
|
|
|
|
|
free (ri->auth_str);
|
|
|
|
|
|
|
|
|
|
ri->auth_str = strdup (argv[0]);
|
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN (no_ip_rip_authentication_string,
|
|
|
|
|
no_ip_rip_authentication_string_cmd,
|
|
|
|
|
"no ip rip authentication string",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Authentication control\n"
|
|
|
|
|
"Authentication string\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *)vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
if (ri->auth_str)
|
|
|
|
|
free (ri->auth_str);
|
|
|
|
|
|
|
|
|
|
ri->auth_str = NULL;
|
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ALIAS (no_ip_rip_authentication_string,
|
|
|
|
|
no_ip_rip_authentication_string2_cmd,
|
|
|
|
|
"no ip rip authentication string LINE",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Authentication control\n"
|
|
|
|
|
"Authentication string\n"
|
|
|
|
|
"Authentication string\n")
|
|
|
|
|
|
|
|
|
|
DEFUN (ip_rip_authentication_key_chain,
|
|
|
|
|
ip_rip_authentication_key_chain_cmd,
|
|
|
|
|
"ip rip authentication key-chain LINE",
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Authentication control\n"
|
|
|
|
|
"Authentication key-chain\n"
|
|
|
|
|
"name of key-chain\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *) vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
if (ri->auth_str)
|
|
|
|
|
{
|
|
|
|
|
vty_out (vty, "%% authentication string configuration exists%s",
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
return CMD_WARNING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ri->key_chain)
|
|
|
|
|
free (ri->key_chain);
|
|
|
|
|
|
|
|
|
|
ri->key_chain = strdup (argv[0]);
|
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN (no_ip_rip_authentication_key_chain,
|
|
|
|
|
no_ip_rip_authentication_key_chain_cmd,
|
|
|
|
|
"no ip rip authentication key-chain",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Authentication control\n"
|
|
|
|
|
"Authentication key-chain\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = (struct interface *) vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
if (ri->key_chain)
|
|
|
|
|
free (ri->key_chain);
|
|
|
|
|
|
|
|
|
|
ri->key_chain = NULL;
|
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ALIAS (no_ip_rip_authentication_key_chain,
|
|
|
|
|
no_ip_rip_authentication_key_chain2_cmd,
|
|
|
|
|
"no ip rip authentication key-chain LINE",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Authentication control\n"
|
|
|
|
|
"Authentication key-chain\n"
|
|
|
|
|
"name of key-chain\n")
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
/* CHANGED: ip rip split-horizon
|
|
|
|
|
Cisco and Zebra's command is
|
|
|
|
|
ip split-horizon
|
|
|
|
|
*/
|
|
|
|
|
DEFUN (ip_rip_split_horizon,
|
|
|
|
|
ip_rip_split_horizon_cmd,
|
|
|
|
|
"ip rip split-horizon",
|
2002-12-13 21:15:29 +01:00
|
|
|
|
IP_STR
|
2003-05-25 16:49:19 +02:00
|
|
|
|
"Routing Information Protocol\n"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
"Perform split horizon\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
ri->split_horizon = RIP_SPLIT_HORIZON;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
DEFUN (ip_rip_split_horizon_poisoned_reverse,
|
|
|
|
|
ip_rip_split_horizon_poisoned_reverse_cmd,
|
|
|
|
|
"ip rip split-horizon poisoned-reverse",
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Perform split horizon\n"
|
|
|
|
|
"With poisoned-reverse\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
ri->split_horizon = RIP_SPLIT_HORIZON_POISONED_REVERSE;
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* CHANGED: no ip rip split-horizon
|
|
|
|
|
Cisco and Zebra's command is
|
|
|
|
|
no ip split-horizon
|
|
|
|
|
*/
|
|
|
|
|
DEFUN (no_ip_rip_split_horizon,
|
|
|
|
|
no_ip_rip_split_horizon_cmd,
|
|
|
|
|
"no ip rip split-horizon",
|
2002-12-13 21:15:29 +01:00
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
2003-05-25 16:49:19 +02:00
|
|
|
|
"Routing Information Protocol\n"
|
2002-12-13 21:15:29 +01:00
|
|
|
|
"Perform split horizon\n")
|
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
ri->split_horizon = RIP_NO_SPLIT_HORIZON;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
2005-10-06 09:45:43 +02:00
|
|
|
|
DEFUN (no_ip_rip_split_horizon_poisoned_reverse,
|
2003-05-25 16:49:19 +02:00
|
|
|
|
no_ip_rip_split_horizon_poisoned_reverse_cmd,
|
|
|
|
|
"no ip rip split-horizon poisoned-reverse",
|
|
|
|
|
NO_STR
|
|
|
|
|
IP_STR
|
|
|
|
|
"Routing Information Protocol\n"
|
|
|
|
|
"Perform split horizon\n"
|
|
|
|
|
"With poisoned-reverse\n")
|
2005-10-06 09:45:43 +02:00
|
|
|
|
{
|
|
|
|
|
struct interface *ifp;
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ifp = vty->index;
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
|
|
|
|
switch( ri->split_horizon )
|
|
|
|
|
{
|
|
|
|
|
case RIP_SPLIT_HORIZON_POISONED_REVERSE:
|
|
|
|
|
ri->split_horizon = RIP_SPLIT_HORIZON;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
2003-05-25 16:49:19 +02:00
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
DEFUN (rip_passive_interface,
|
|
|
|
|
rip_passive_interface_cmd,
|
2003-06-20 02:23:27 +02:00
|
|
|
|
"passive-interface (IFNAME|default)",
|
2002-12-13 21:15:29 +01:00
|
|
|
|
"Suppress routing updates on an interface\n"
|
2003-06-20 02:23:27 +02:00
|
|
|
|
"Interface name\n"
|
|
|
|
|
"default for all interfaces\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
2004-10-11 14:57:57 +02:00
|
|
|
|
const char *ifname = argv[0];
|
2003-06-07 03:04:45 +02:00
|
|
|
|
|
|
|
|
|
if (!strcmp(ifname,"default")) {
|
|
|
|
|
passive_default = 1;
|
|
|
|
|
rip_passive_nondefault_clean();
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
if (passive_default)
|
|
|
|
|
return rip_passive_nondefault_unset (vty, ifname);
|
|
|
|
|
else
|
|
|
|
|
return rip_passive_nondefault_set (vty, ifname);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DEFUN (no_rip_passive_interface,
|
|
|
|
|
no_rip_passive_interface_cmd,
|
2003-06-20 02:23:27 +02:00
|
|
|
|
"no passive-interface (IFNAME|default)",
|
2002-12-13 21:15:29 +01:00
|
|
|
|
NO_STR
|
|
|
|
|
"Suppress routing updates on an interface\n"
|
2003-06-20 02:23:27 +02:00
|
|
|
|
"Interface name\n"
|
|
|
|
|
"default for all interfaces\n")
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
2004-10-11 14:57:57 +02:00
|
|
|
|
const char *ifname = argv[0];
|
2003-06-07 03:04:45 +02:00
|
|
|
|
|
|
|
|
|
if (!strcmp(ifname,"default")) {
|
|
|
|
|
passive_default = 0;
|
|
|
|
|
rip_passive_nondefault_clean();
|
|
|
|
|
return CMD_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
if (passive_default)
|
|
|
|
|
return rip_passive_nondefault_set (vty, ifname);
|
|
|
|
|
else
|
|
|
|
|
return rip_passive_nondefault_unset (vty, ifname);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write rip configuration of each interface. */
|
|
|
|
|
int
|
|
|
|
|
rip_interface_config_write (struct vty *vty)
|
|
|
|
|
{
|
2004-09-23 21:18:23 +02:00
|
|
|
|
struct listnode *node;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
struct interface *ifp;
|
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
|
for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
|
2002-12-13 21:15:29 +01:00
|
|
|
|
{
|
|
|
|
|
struct rip_interface *ri;
|
|
|
|
|
|
|
|
|
|
ri = ifp->info;
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
/* Do not display the interface if there is no
|
|
|
|
|
* configuration about it.
|
|
|
|
|
**/
|
|
|
|
|
if ((!ifp->desc) &&
|
|
|
|
|
(ri->split_horizon == ri->split_horizon_default) &&
|
|
|
|
|
(ri->ri_send == RI_RIP_UNSPEC) &&
|
|
|
|
|
(ri->ri_receive == RI_RIP_UNSPEC) &&
|
|
|
|
|
(ri->auth_type != RIP_AUTH_MD5) &&
|
2004-06-07 00:06:33 +02:00
|
|
|
|
(ri->md5_auth_len != RIP_AUTH_MD5_SIZE) &&
|
2003-05-25 16:49:19 +02:00
|
|
|
|
(!ri->auth_str) &&
|
|
|
|
|
(!ri->key_chain) )
|
|
|
|
|
continue;
|
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
vty_out (vty, "interface %s%s", ifp->name,
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
|
|
|
|
|
if (ifp->desc)
|
|
|
|
|
vty_out (vty, " description %s%s", ifp->desc,
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
|
|
|
|
|
/* Split horizon. */
|
|
|
|
|
if (ri->split_horizon != ri->split_horizon_default)
|
|
|
|
|
{
|
2003-05-25 16:49:19 +02:00
|
|
|
|
switch (ri->split_horizon) {
|
|
|
|
|
case RIP_SPLIT_HORIZON:
|
|
|
|
|
vty_out (vty, " ip rip split-horizon%s", VTY_NEWLINE);
|
|
|
|
|
break;
|
|
|
|
|
case RIP_SPLIT_HORIZON_POISONED_REVERSE:
|
|
|
|
|
vty_out (vty, " ip rip split-horizon poisoned-reverse%s",
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
break;
|
|
|
|
|
case RIP_NO_SPLIT_HORIZON:
|
|
|
|
|
default:
|
|
|
|
|
vty_out (vty, " no ip rip split-horizon%s", VTY_NEWLINE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* RIP version setting. */
|
|
|
|
|
if (ri->ri_send != RI_RIP_UNSPEC)
|
|
|
|
|
vty_out (vty, " ip rip send version %s%s",
|
|
|
|
|
lookup (ri_version_msg, ri->ri_send),
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
|
|
|
|
|
if (ri->ri_receive != RI_RIP_UNSPEC)
|
|
|
|
|
vty_out (vty, " ip rip receive version %s%s",
|
|
|
|
|
lookup (ri_version_msg, ri->ri_receive),
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
|
|
|
|
|
/* RIP authentication. */
|
|
|
|
|
if (ri->auth_type == RIP_AUTH_SIMPLE_PASSWORD)
|
|
|
|
|
vty_out (vty, " ip rip authentication mode text%s", VTY_NEWLINE);
|
2004-06-07 00:06:33 +02:00
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
|
if (ri->auth_type == RIP_AUTH_MD5)
|
2004-06-07 00:06:33 +02:00
|
|
|
|
{
|
|
|
|
|
vty_out (vty, " ip rip authentication mode md5");
|
|
|
|
|
if (ri->md5_auth_len == RIP_AUTH_MD5_COMPAT_SIZE)
|
|
|
|
|
vty_out (vty, " auth-length old-ripd");
|
|
|
|
|
else
|
|
|
|
|
vty_out (vty, " auth-length rfc");
|
|
|
|
|
vty_out (vty, "%s", VTY_NEWLINE);
|
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
if (ri->auth_str)
|
|
|
|
|
vty_out (vty, " ip rip authentication string %s%s",
|
|
|
|
|
ri->auth_str, VTY_NEWLINE);
|
|
|
|
|
|
|
|
|
|
if (ri->key_chain)
|
|
|
|
|
vty_out (vty, " ip rip authentication key-chain %s%s",
|
|
|
|
|
ri->key_chain, VTY_NEWLINE);
|
|
|
|
|
|
|
|
|
|
vty_out (vty, "!%s", VTY_NEWLINE);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
config_write_rip_network (struct vty *vty, int config_mode)
|
|
|
|
|
{
|
2004-10-08 08:36:38 +02:00
|
|
|
|
unsigned int i;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
char *ifname;
|
|
|
|
|
struct route_node *node;
|
|
|
|
|
|
|
|
|
|
/* Network type RIP enable interface statement. */
|
|
|
|
|
for (node = route_top (rip_enable_network); node; node = route_next (node))
|
|
|
|
|
if (node->info)
|
|
|
|
|
vty_out (vty, "%s%s/%d%s",
|
|
|
|
|
config_mode ? " network " : " ",
|
|
|
|
|
inet_ntoa (node->p.u.prefix4),
|
|
|
|
|
node->p.prefixlen,
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
|
|
|
|
|
/* Interface name RIP enable statement. */
|
2005-03-14 21:19:01 +01:00
|
|
|
|
for (i = 0; i < vector_active (rip_enable_interface); i++)
|
2002-12-13 21:15:29 +01:00
|
|
|
|
if ((ifname = vector_slot (rip_enable_interface, i)) != NULL)
|
|
|
|
|
vty_out (vty, "%s%s%s",
|
|
|
|
|
config_mode ? " network " : " ",
|
|
|
|
|
ifname,
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
|
|
|
|
|
/* RIP neighbors listing. */
|
|
|
|
|
for (node = route_top (rip->neighbor); node; node = route_next (node))
|
|
|
|
|
if (node->info)
|
|
|
|
|
vty_out (vty, "%s%s%s",
|
|
|
|
|
config_mode ? " neighbor " : " ",
|
|
|
|
|
inet_ntoa (node->p.u.prefix4),
|
|
|
|
|
VTY_NEWLINE);
|
|
|
|
|
|
|
|
|
|
/* RIP passive interface listing. */
|
2003-06-07 03:04:45 +02:00
|
|
|
|
if (config_mode) {
|
|
|
|
|
if (passive_default)
|
2003-06-08 23:22:18 +02:00
|
|
|
|
vty_out (vty, " passive-interface default%s", VTY_NEWLINE);
|
2005-03-14 21:19:01 +01:00
|
|
|
|
for (i = 0; i < vector_active (Vrip_passive_nondefault); i++)
|
2003-06-07 03:04:45 +02:00
|
|
|
|
if ((ifname = vector_slot (Vrip_passive_nondefault, i)) != NULL)
|
|
|
|
|
vty_out (vty, " %spassive-interface %s%s",
|
|
|
|
|
(passive_default ? "no " : ""), ifname, VTY_NEWLINE);
|
|
|
|
|
}
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct cmd_node interface_node =
|
|
|
|
|
{
|
|
|
|
|
INTERFACE_NODE,
|
|
|
|
|
"%s(config-if)# ",
|
|
|
|
|
1,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Called when interface structure allocated. */
|
|
|
|
|
int
|
|
|
|
|
rip_interface_new_hook (struct interface *ifp)
|
|
|
|
|
{
|
|
|
|
|
ifp->info = rip_interface_new ();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Called when interface structure deleted. */
|
|
|
|
|
int
|
|
|
|
|
rip_interface_delete_hook (struct interface *ifp)
|
|
|
|
|
{
|
|
|
|
|
XFREE (MTYPE_RIP_INTERFACE, ifp->info);
|
2003-05-25 16:49:19 +02:00
|
|
|
|
ifp->info = NULL;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Allocate and initialize interface vector. */
|
|
|
|
|
void
|
|
|
|
|
rip_if_init ()
|
|
|
|
|
{
|
|
|
|
|
/* Default initial size of interface vector. */
|
|
|
|
|
if_init();
|
|
|
|
|
if_add_hook (IF_NEW_HOOK, rip_interface_new_hook);
|
|
|
|
|
if_add_hook (IF_DELETE_HOOK, rip_interface_delete_hook);
|
|
|
|
|
|
|
|
|
|
/* RIP network init. */
|
|
|
|
|
rip_enable_interface = vector_init (1);
|
|
|
|
|
rip_enable_network = route_table_init ();
|
|
|
|
|
|
|
|
|
|
/* RIP passive interface. */
|
2003-06-07 03:04:45 +02:00
|
|
|
|
Vrip_passive_nondefault = vector_init (1);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
/* Install interface node. */
|
|
|
|
|
install_node (&interface_node, rip_interface_config_write);
|
|
|
|
|
|
|
|
|
|
/* Install commands. */
|
|
|
|
|
install_element (CONFIG_NODE, &interface_cmd);
|
2003-05-24 09:59:25 +02:00
|
|
|
|
install_element (CONFIG_NODE, &no_interface_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
install_default (INTERFACE_NODE);
|
|
|
|
|
install_element (INTERFACE_NODE, &interface_desc_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_interface_desc_cmd);
|
|
|
|
|
install_element (RIP_NODE, &rip_network_cmd);
|
|
|
|
|
install_element (RIP_NODE, &no_rip_network_cmd);
|
|
|
|
|
install_element (RIP_NODE, &rip_neighbor_cmd);
|
|
|
|
|
install_element (RIP_NODE, &no_rip_neighbor_cmd);
|
|
|
|
|
|
|
|
|
|
install_element (RIP_NODE, &rip_passive_interface_cmd);
|
|
|
|
|
install_element (RIP_NODE, &no_rip_passive_interface_cmd);
|
|
|
|
|
|
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_send_version_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_send_version_1_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_send_version_2_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_send_version_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_send_version_num_cmd);
|
|
|
|
|
|
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_receive_version_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_receive_version_1_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_receive_version_2_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_receive_version_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_receive_version_num_cmd);
|
|
|
|
|
|
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_authentication_mode_cmd);
|
2004-06-07 00:06:33 +02:00
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_authentication_mode_authlen_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_authentication_mode_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_authentication_mode_type_cmd);
|
2004-06-07 00:06:33 +02:00
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_authentication_mode_type_authlen_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_authentication_key_chain_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_authentication_key_chain_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_authentication_key_chain2_cmd);
|
|
|
|
|
|
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_authentication_string_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_authentication_string_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_authentication_string2_cmd);
|
|
|
|
|
|
2003-05-25 16:49:19 +02:00
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_split_horizon_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &ip_rip_split_horizon_poisoned_reverse_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_split_horizon_cmd);
|
|
|
|
|
install_element (INTERFACE_NODE, &no_ip_rip_split_horizon_poisoned_reverse_cmd);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
}
|