forked from Mirror/frr
ripd: add "none" option to the "ip rip receive version" command
RFC 2453 says (section 5.1): "(...) For completeness, routers should also implement a receive control switch which would determine whether to accept, RIP-1 only, RIP-2 only, both, or none. It should also be configurable on a per-interface basis". For the "ip rip send version" command, we don't need to implement the "none" option because there's already the "passive-interface" command for that. Fixes IxANVL RIP test 16.8. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
f90310cfe8
commit
6aec4b4176
|
@ -55,6 +55,7 @@ const struct message ri_version_msg[] =
|
||||||
{RI_RIP_VERSION_1, "1"},
|
{RI_RIP_VERSION_1, "1"},
|
||||||
{RI_RIP_VERSION_2, "2"},
|
{RI_RIP_VERSION_2, "2"},
|
||||||
{RI_RIP_VERSION_1_AND_2, "1 2"},
|
{RI_RIP_VERSION_1_AND_2, "1 2"},
|
||||||
|
{RI_RIP_VERSION_NONE, "none"},
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct zebra_privs_t ripd_privs;
|
extern struct zebra_privs_t ripd_privs;
|
||||||
|
@ -1318,13 +1319,14 @@ DEFUN (no_rip_neighbor,
|
||||||
|
|
||||||
DEFUN (ip_rip_receive_version,
|
DEFUN (ip_rip_receive_version,
|
||||||
ip_rip_receive_version_cmd,
|
ip_rip_receive_version_cmd,
|
||||||
"ip rip receive version (1|2)",
|
"ip rip receive version (1|2|none)",
|
||||||
IP_STR
|
IP_STR
|
||||||
"Routing Information Protocol\n"
|
"Routing Information Protocol\n"
|
||||||
"Advertisement reception\n"
|
"Advertisement reception\n"
|
||||||
"Version control\n"
|
"Version control\n"
|
||||||
"RIP version 1\n"
|
"RIP version 1\n"
|
||||||
"RIP version 2\n")
|
"RIP version 2\n"
|
||||||
|
"None\n")
|
||||||
{
|
{
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
struct rip_interface *ri;
|
struct rip_interface *ri;
|
||||||
|
@ -1332,17 +1334,21 @@ DEFUN (ip_rip_receive_version,
|
||||||
ifp = (struct interface *)vty->index;
|
ifp = (struct interface *)vty->index;
|
||||||
ri = ifp->info;
|
ri = ifp->info;
|
||||||
|
|
||||||
/* Version 1. */
|
switch (*argv[0])
|
||||||
if (atoi (argv[0]) == 1)
|
|
||||||
{
|
{
|
||||||
|
case '1':
|
||||||
ri->ri_receive = RI_RIP_VERSION_1;
|
ri->ri_receive = RI_RIP_VERSION_1;
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
case '2':
|
||||||
if (atoi (argv[0]) == 2)
|
|
||||||
{
|
|
||||||
ri->ri_receive = RI_RIP_VERSION_2;
|
ri->ri_receive = RI_RIP_VERSION_2;
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
|
case 'n':
|
||||||
|
ri->ri_receive = RI_RIP_VERSION_NONE;
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
ripd/ripd.c
12
ripd/ripd.c
|
@ -1937,15 +1937,9 @@ rip_read (struct thread *t)
|
||||||
/* RIP Version check. RFC2453, 4.6 and 5.1 */
|
/* RIP Version check. RFC2453, 4.6 and 5.1 */
|
||||||
vrecv = ((ri->ri_receive == RI_RIP_UNSPEC) ?
|
vrecv = ((ri->ri_receive == RI_RIP_UNSPEC) ?
|
||||||
rip->version_recv : ri->ri_receive);
|
rip->version_recv : ri->ri_receive);
|
||||||
if ((packet->version == RIPv1) && !(vrecv & RIPv1))
|
if (vrecv == RI_RIP_VERSION_NONE ||
|
||||||
{
|
((packet->version == RIPv1) && !(vrecv & RIPv1)) ||
|
||||||
if (IS_RIP_DEBUG_PACKET)
|
((packet->version == RIPv2) && !(vrecv & RIPv2)))
|
||||||
zlog_debug (" packet's v%d doesn't fit to if version spec",
|
|
||||||
packet->version);
|
|
||||||
rip_peer_bad_packet (&from);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if ((packet->version == RIPv2) && !(vrecv & RIPv2))
|
|
||||||
{
|
{
|
||||||
if (IS_RIP_DEBUG_PACKET)
|
if (IS_RIP_DEBUG_PACKET)
|
||||||
zlog_debug (" packet's v%d doesn't fit to if version spec",
|
zlog_debug (" packet's v%d doesn't fit to if version spec",
|
||||||
|
|
|
@ -350,6 +350,7 @@ struct rip_md5_data
|
||||||
#define RI_RIP_VERSION_1 1
|
#define RI_RIP_VERSION_1 1
|
||||||
#define RI_RIP_VERSION_2 2
|
#define RI_RIP_VERSION_2 2
|
||||||
#define RI_RIP_VERSION_1_AND_2 3
|
#define RI_RIP_VERSION_1_AND_2 3
|
||||||
|
#define RI_RIP_VERSION_NONE 4
|
||||||
/* N.B. stuff will break if
|
/* N.B. stuff will break if
|
||||||
(RIPv1 != RI_RIP_VERSION_1) || (RIPv2 != RI_RIP_VERSION_2) */
|
(RIPv1 != RI_RIP_VERSION_1) || (RIPv2 != RI_RIP_VERSION_2) */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue