mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 20:18:54 +00:00
From: Andrew J. Schorr <aschorr@telemetry-investments.com>
Subject: [zebra 12403] patch for ripd to accept any version of RIP by default The default Cisco IOS behavior is to send RIP version 1 packets and receive version 1 and version 2 packets. But zebra version 0.92a sends and receives only version 2 packets by default. I have patched the code to change zebra's default behavior to sending version 2 packets (same as before) but receiving both versions. While this is still not identical to Cisco's behavior, it does now accept packets of both versions and retains backwards compatibility with zebra configurations.
This commit is contained in:
parent
4aaff3f8d5
commit
f38a471c6f
@ -1,6 +1,11 @@
|
||||
2003-06-07 Andrew J. Schorr <aschorr@telemetry-investments.com>
|
||||
|
||||
* Allow ripd to receive RIPv1
|
||||
* add default as valid param to passive-interface command
|
||||
|
||||
2003-05-25 Vincent Jardin <vjardin@wanadoo.fr>
|
||||
|
||||
* 6Wind patch merge.
|
||||
* 6Wind patch merge.
|
||||
|
||||
2003-04-19 Hasso Tepper <hasso@estpak.ee>
|
||||
|
||||
|
@ -269,21 +269,14 @@ rip_request_interface (struct interface *ifp)
|
||||
|
||||
/* If there is no version configuration in the interface,
|
||||
use rip's version setting. */
|
||||
if (ri->ri_send == RI_RIP_UNSPEC)
|
||||
{
|
||||
if (rip->version == RIPv1)
|
||||
rip_request_interface_send (ifp, RIPv1);
|
||||
else
|
||||
rip_request_interface_send (ifp, RIPv2);
|
||||
}
|
||||
/* If interface has RIP version configuration use it. */
|
||||
else
|
||||
{
|
||||
if (ri->ri_send & RIPv1)
|
||||
rip_request_interface_send (ifp, RIPv1);
|
||||
if (ri->ri_send & RIPv2)
|
||||
rip_request_interface_send (ifp, RIPv2);
|
||||
}
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send RIP request to the neighbor. */
|
||||
@ -296,7 +289,7 @@ rip_request_neighbor (struct in_addr addr)
|
||||
to.sin_port = htons (RIP_PORT_DEFAULT);
|
||||
to.sin_addr = addr;
|
||||
|
||||
rip_request_send (&to, NULL, rip->version);
|
||||
rip_request_send (&to, NULL, rip->version_send);
|
||||
}
|
||||
|
||||
/* Request routes at all interfaces. */
|
||||
|
69
ripd/ripd.c
69
ripd/ripd.c
@ -1687,21 +1687,10 @@ rip_read (struct thread *t)
|
||||
/* RIP Version check. */
|
||||
if (packet->command == RIP_RESPONSE)
|
||||
{
|
||||
if (ri->ri_receive == RI_RIP_UNSPEC)
|
||||
{
|
||||
if (packet->version != rip->version)
|
||||
{
|
||||
if (IS_RIP_DEBUG_PACKET)
|
||||
zlog_warn (" packet's v%d doesn't fit to my version %d",
|
||||
packet->version, rip->version);
|
||||
rip_peer_bad_packet (&from);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int vrecv = ((ri->ri_receive == RI_RIP_UNSPEC) ?
|
||||
rip->version_recv : ri->ri_receive);
|
||||
if (packet->version == RIPv1)
|
||||
if (! (ri->ri_receive & RIPv1))
|
||||
if (! (vrecv & RIPv1))
|
||||
{
|
||||
if (IS_RIP_DEBUG_PACKET)
|
||||
zlog_warn (" packet's v%d doesn't fit to if version spec",
|
||||
@ -1710,7 +1699,7 @@ rip_read (struct thread *t)
|
||||
return -1;
|
||||
}
|
||||
if (packet->version == RIPv2)
|
||||
if (! (ri->ri_receive & RIPv2))
|
||||
if (! (vrecv & RIPv2))
|
||||
{
|
||||
if (IS_RIP_DEBUG_PACKET)
|
||||
zlog_warn (" packet's v%d doesn't fit to if version spec",
|
||||
@ -1718,7 +1707,6 @@ rip_read (struct thread *t)
|
||||
rip_peer_bad_packet (&from);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* RFC2453 5.2 If the router is not configured to authenticate RIP-2
|
||||
@ -2300,7 +2288,7 @@ rip_update_interface (struct interface *ifp, u_char version, int route_type)
|
||||
inet_ntoa (to.sin_addr), ifp->name);
|
||||
|
||||
rip_output_process (ifp, connected->address, &to, route_type,
|
||||
version);
|
||||
version_send);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2350,21 +2338,14 @@ rip_update_process (int route_type)
|
||||
|
||||
/* If there is no version configuration in the interface,
|
||||
use rip's version setting. */
|
||||
if (ri->ri_send == RI_RIP_UNSPEC)
|
||||
{
|
||||
if (rip->version == RIPv1)
|
||||
{
|
||||
int vsend = ((ri->ri_send == RI_RIP_UNSPEC) ?
|
||||
rip->version_send : ri->ri_send);
|
||||
if (vsend & RIPv1)
|
||||
rip_update_interface (ifp, RIPv1, route_type);
|
||||
else
|
||||
if (vsend & RIPv2)
|
||||
rip_update_interface (ifp, RIPv2, route_type);
|
||||
}
|
||||
/* If interface has RIP version configuration use it. */
|
||||
else
|
||||
{
|
||||
if (ri->ri_send & RIPv1)
|
||||
rip_update_interface (ifp, RIPv1, route_type);
|
||||
if (ri->ri_send & RIPv2)
|
||||
rip_update_interface (ifp, RIPv2, route_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2534,7 +2515,8 @@ rip_create ()
|
||||
memset (rip, 0, sizeof (struct rip));
|
||||
|
||||
/* Set initial value. */
|
||||
rip->version = RIPv2;
|
||||
rip->version_send = RI_RIP_VERSION_2;
|
||||
rip->version_recv = RI_RIP_VERSION_1_AND_2;
|
||||
rip->update_time = RIP_UPDATE_TIMER_DEFAULT;
|
||||
rip->timeout_time = RIP_TIMEOUT_TIMER_DEFAULT;
|
||||
rip->garbage_time = RIP_GARBAGE_TIMER_DEFAULT;
|
||||
@ -2668,7 +2650,8 @@ DEFUN (rip_version,
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
rip->version = version;
|
||||
rip->version_send = version;
|
||||
rip->version_recv = version;
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -2680,7 +2663,8 @@ DEFUN (no_rip_version,
|
||||
"Set routing protocol version\n")
|
||||
{
|
||||
/* Set RIP version to the default. */
|
||||
rip->version = RIPv2;
|
||||
rip->version_send = RI_RIP_VERSION_2;
|
||||
rip->version_recv = RI_RIP_VERSION_1_AND_2;
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -3328,9 +3312,13 @@ DEFUN (show_ip_rip_status,
|
||||
config_write_rip_redistribute (vty, 0);
|
||||
vty_out (vty, "%s", VTY_NEWLINE);
|
||||
|
||||
vty_out (vty, " Default version control: send version %d,", rip->version);
|
||||
vty_out (vty, " receive version %d %s", rip->version,
|
||||
VTY_NEWLINE);
|
||||
vty_out (vty, " Default version control: send version %s,",
|
||||
lookup(ri_version_msg,rip->version_send));
|
||||
if (rip->version_recv == RI_RIP_VERSION_1_AND_2)
|
||||
vty_out (vty, " receive any version %s", VTY_NEWLINE);
|
||||
else
|
||||
vty_out (vty, " receive version %s %s",
|
||||
lookup(ri_version_msg,rip->version_recv), VTY_NEWLINE);
|
||||
|
||||
vty_out (vty, " Interface Send Recv Key-chain%s", VTY_NEWLINE);
|
||||
|
||||
@ -3342,12 +3330,12 @@ DEFUN (show_ip_rip_status,
|
||||
if (ri->enable_network || ri->enable_interface)
|
||||
{
|
||||
if (ri->ri_send == RI_RIP_UNSPEC)
|
||||
send_version = lookup (ri_version_msg, rip->version);
|
||||
send_version = lookup (ri_version_msg, rip->version_send);
|
||||
else
|
||||
send_version = lookup (ri_version_msg, ri->ri_send);
|
||||
|
||||
if (ri->ri_receive == RI_RIP_UNSPEC)
|
||||
receive_version = lookup (ri_version_msg, rip->version);
|
||||
receive_version = lookup (ri_version_msg, rip->version_recv);
|
||||
else
|
||||
receive_version = lookup (ri_version_msg, ri->ri_receive);
|
||||
|
||||
@ -3405,8 +3393,9 @@ config_write_rip (struct vty *vty)
|
||||
write++;
|
||||
|
||||
/* RIP version statement. Default is RIP version 2. */
|
||||
if (rip->version != RIPv2)
|
||||
vty_out (vty, " version %d%s", rip->version,
|
||||
if (rip->version_send != RI_RIP_VERSION_2
|
||||
|| rip->version_recv != RI_RIP_VERSION_1_AND_2)
|
||||
vty_out (vty, " version %d%s", rip->version_send,
|
||||
VTY_NEWLINE);
|
||||
|
||||
/* RIP timer configuration. */
|
||||
|
@ -25,6 +25,9 @@
|
||||
/* RIP version number. */
|
||||
#define RIPv1 1
|
||||
#define RIPv2 2
|
||||
/* N.B. stuff will break if
|
||||
(RIPv1 != RI_RIP_VERSION_1) || (RIPv2 != RI_RIP_VERSION_2) */
|
||||
|
||||
|
||||
/* RIP command list. */
|
||||
#define RIP_REQUEST 1
|
||||
@ -85,7 +88,8 @@ struct rip
|
||||
int sock;
|
||||
|
||||
/* Default version of rip instance. */
|
||||
u_char version;
|
||||
int version_send; /* version 1 or 2 (but not both) */
|
||||
int version_recv; /* version 1 or 2 or both */
|
||||
|
||||
/* Output buffer of RIP. */
|
||||
struct stream *obuf;
|
||||
@ -322,6 +326,8 @@ struct rip_md5_data
|
||||
#define RI_RIP_VERSION_1 1
|
||||
#define RI_RIP_VERSION_2 2
|
||||
#define RI_RIP_VERSION_1_AND_2 3
|
||||
/* N.B. stuff will break if
|
||||
(RIPv1 != RI_RIP_VERSION_1) || (RIPv2 != RI_RIP_VERSION_2) */
|
||||
|
||||
/* Default value for "default-metric" command. */
|
||||
#define RIP_DEFAULT_METRIC_DEFAULT 1
|
||||
|
Loading…
Reference in New Issue
Block a user