Router advertisement cleanup. Removed compatibility command because it's

very annoying to have both obsolete "prefix-advertisement" and "prefix" in
completion. We will break configuration anyway with secondary cleanup, so
just remember mention it in release notes.
This commit is contained in:
hasso 2004-05-18 11:58:59 +00:00
parent 4134ceb7f4
commit 3e31cded7f
3 changed files with 291 additions and 83 deletions

View File

@ -4,7 +4,7 @@
Quagga fully supports IPv6 routing. As described so far, Quagga supports
RIPng, OSPFv3 and BGP-4+. You can give IPv6 addresses to an interface
and configure static IPv6 routing information. Quagga-IPv6 also provides
and configure static IPv6 routing information. Quagga IPv6 also provides
automatic address configuration via a feature called @code{address
auto configuration}. To do it, the router must send router advertisement
messages to the all nodes that exist on the network.
@ -17,16 +17,102 @@ messages to the all nodes that exist on the network.
@comment node-name, next, previous, up
@section Router Advertisement
@deffn {Interface Command} {ipv6 nd send-ra} {}
@deffn {Interface Command} {no ipv6 nd supress-ra} {}
Send router advertisment messages.
@end deffn
@deffn {Interface Command} {ipv6 nd prefix-advertisement @var{ipv6prefix}} {}
@deffn {Interface Command} {ipv6 nd supress-ra} {}
Don't send router advertisment messages.
@end deffn
@deffn {Interface Command} {ipv6 nd prefix @var{ipv6prefix} [@var{valid-lifetime}] [@var{preferred-lifetime}] [off-link] [no-autconfig]} {}
Configuring the IPv6 prefix to include in router advertisements. Several prefix
specific optional parameters and flags may follow:
@itemize @bullet
@item
@var{valid-lifetime} - the length of time in seconds during what the prefix is
valid for the purpose of on-link determination. Value @var{infinite} represents
infinity (i.e. a value of all one bits (@code{0xffffffff})).
Range: @code{<0-4294967295>} Default: @code{2592000}
@item
@var{preferred-lifetime} - the length of time in seconds during what addresses
generated from the prefix remain preferred. Value @var{infinite} represents
infinity.
Range: @code{<0-4294967295>} Default: @code{604800}
@item
@var{off-link} - indicates that advertisement makes no statement about on-link or
off-link properties of the prefix.
Default: not set, i.e. this prefix can be used for on-link determination.
@item
@var{no-autoconfig} - indicates to hosts on the local link that the specified prefix
cannot be used for IPv6 autoconfiguration.
Default: not set, i.e. prefix can be used for autoconfiguration.
@end itemize
@end deffn
@deffn {Interface Command} {ipv6 nd ra-interval SECONDS} {}
@deffnx {Interface Command} {no ipv6 nd ra-interval} {}
The maximum time allowed between sending unsolicited multicast router
advertisements from the interface, in seconds. Must be no less than 3 seconds.
Default: @code{600}
@end deffn
@deffn {Interface Command} {ipv6 nd ra-lifetime SECONDS} {}
@deffnx {Interface Command} {no ipv6 nd ra-lifetime} {}
The value to be placed in the Router Lifetime field of router advertisements
sent from the interface, in seconds. Indicates the usefulness of the router
as a default router on this interface. Setting the value to zero indicates
that the router should not be considered a default router on this interface.
Must be either zero or between value specified with @var{ipv6 nd ra-interval}
(or default) and 9000 seconds.
Default: @code{1800}
@end deffn
@deffn {Interface Command} {ipv6 nd reachable-time MILLISECONDS} {}
@deffnx {Interface Command} {no ipv6 nd reachable-time} {}
The value to be placed in the Reachable Time field in the Router Advertisement
messages sent by the router, in milliseconds. The configured time enables the
router to detect unavailable neighbors. The value zero means unspecified (by
this router). Must be no greater than @code{3,600,000} milliseconds (1 hour).
Default: @code{0}
@end deffn
@deffn {Interface Command} {ipv6 nd managed-config-flag} {}
@deffnx {Interface Command} {no ipv6 nd managed-config-flag} {}
Set/unset flag in IPv6 router advertisements which indicates to hosts that they
should use managed (stateful) protocol for addresses autoconfiguration in
addition to any addresses autoconfigured using stateless address
autoconfiguration.
Default: not set
@end deffn
@deffn {Interface Command} {ipv6 nd other-config-flag} {}
@deffnx {Interface Command} {no ipv6 nd other-config-flag} {}
Set/unset flag in IPv6 router advertisements which indicates to hosts that
they should use administered (stateful) protocol to obtain autoconfiguration
information other than addresses.
Default: not set
@end deffn
@example
@group
interface eth0
ipv6 nd send-ra
ipv6 nd prefix-advertisement 3ffe:506:5009::/64
no ipv6 nd supress-ra
ipv6 nd prefix 2001:0DB8:5009::/64
@end group
@end example
For more information see @cite{RFC2462 (IPv6 Stateless Address Autoconfiguration)}
and @cite{RFC2461 (Neighbor Discovery for IP Version 6 (IPv6))}.

View File

@ -1,3 +1,12 @@
2004-05-18 Hasso Tepper <hasso@estpak.ee>
* rtadv.c: Removed "[no] ipv6 nd send-ra" command. Replaced "ipv6 nd
prefix-advertisement" with "ipv6 nd prefix". Rewrite syntax of
"ipv6 nd prefix" command to allow various combinations of parameters
and flags. No defaults in configuration. Replaced on-link and
autoconfig with off-link and no-autoconfig flags in command syntax.
Cosmetic fixes in all commands. Documentation to reflect all changes.
2004-05-11 Paul Jakma <paul@dishone.st>
* Makefile.am: support for IOCTL_METHOD, as per Sowmini's patch.

View File

@ -232,7 +232,8 @@ rtadv_send_packet (int sock, struct interface *ifp)
{
u_char buf[INET6_ADDRSTRLEN];
zlog_info ("DEBUG %s", inet_ntop (AF_INET6, &pinfo->nd_opt_pi_prefix, buf, INET6_ADDRSTRLEN));
zlog_info ("DEBUG %s", inet_ntop (AF_INET6, &pinfo->nd_opt_pi_prefix,
buf, INET6_ADDRSTRLEN));
}
#endif /* DEBUG */
@ -550,7 +551,7 @@ rtadv_prefix_reset (struct zebra_if *zif, struct rtadv_prefix *rp)
DEFUN (ipv6_nd_suppress_ra,
ipv6_nd_suppress_ra_cmd,
"ipv6 nd suppress-ra",
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Suppress Router Advertisement\n")
{
@ -581,19 +582,11 @@ DEFUN (ipv6_nd_suppress_ra,
return CMD_SUCCESS;
}
ALIAS (ipv6_nd_suppress_ra,
no_ipv6_nd_send_ra_cmd,
"no ipv6 nd send-ra",
NO_STR
IP_STR
"Neighbor discovery\n"
"Send Router Advertisement\n")
DEFUN (no_ipv6_nd_suppress_ra,
no_ipv6_nd_suppress_ra_cmd,
"no ipv6 nd suppress-ra",
NO_STR
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Suppress Router Advertisement\n")
{
@ -624,17 +617,10 @@ DEFUN (no_ipv6_nd_suppress_ra,
return CMD_SUCCESS;
}
ALIAS (no_ipv6_nd_suppress_ra,
ipv6_nd_send_ra_cmd,
"ipv6 nd send-ra",
IP_STR
"Neighbor discovery\n"
"Send Router Advertisement\n")
DEFUN (ipv6_nd_ra_interval,
ipv6_nd_ra_interval_cmd,
"ipv6 nd ra-interval SECONDS",
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Router Advertisement interval\n"
"Router Advertisement interval in seconds\n")
@ -665,7 +651,7 @@ DEFUN (no_ipv6_nd_ra_interval,
no_ipv6_nd_ra_interval_cmd,
"no ipv6 nd ra-interval",
NO_STR
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Router Advertisement interval\n")
{
@ -685,7 +671,7 @@ DEFUN (no_ipv6_nd_ra_interval,
DEFUN (ipv6_nd_ra_lifetime,
ipv6_nd_ra_lifetime_cmd,
"ipv6 nd ra-lifetime SECONDS",
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Router lifetime\n"
"Router lifetime in seconds\n")
@ -714,7 +700,7 @@ DEFUN (no_ipv6_nd_ra_lifetime,
no_ipv6_nd_ra_lifetime_cmd,
"no ipv6 nd ra-lifetime",
NO_STR
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Router lifetime\n")
{
@ -732,7 +718,7 @@ DEFUN (no_ipv6_nd_ra_lifetime,
DEFUN (ipv6_nd_reachable_time,
ipv6_nd_reachable_time_cmd,
"ipv6 nd reachable-time MILLISECONDS",
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Reachable time\n"
"Reachable time in milliseconds\n")
@ -761,7 +747,7 @@ DEFUN (no_ipv6_nd_reachable_time,
no_ipv6_nd_reachable_time_cmd,
"no ipv6 nd reachable-time",
NO_STR
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Reachable time\n")
{
@ -779,7 +765,7 @@ DEFUN (no_ipv6_nd_reachable_time,
DEFUN (ipv6_nd_managed_config_flag,
ipv6_nd_managed_config_flag_cmd,
"ipv6 nd managed-config-flag",
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Managed address configuration flag\n")
{
@ -798,7 +784,7 @@ DEFUN (no_ipv6_nd_managed_config_flag,
no_ipv6_nd_managed_config_flag_cmd,
"no ipv6 nd managed-config-flag",
NO_STR
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Managed address configuration flag\n")
{
@ -816,7 +802,7 @@ DEFUN (no_ipv6_nd_managed_config_flag,
DEFUN (ipv6_nd_other_config_flag,
ipv6_nd_other_config_flag_cmd,
"ipv6 nd other-config-flag",
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Other statefull configuration flag\n")
{
@ -835,7 +821,7 @@ DEFUN (no_ipv6_nd_other_config_flag,
no_ipv6_nd_other_config_flag_cmd,
"no ipv6 nd other-config-flag",
NO_STR
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Other statefull configuration flag\n")
{
@ -850,20 +836,24 @@ DEFUN (no_ipv6_nd_other_config_flag,
return CMD_SUCCESS;
}
DEFUN (ipv6_nd_prefix_advertisement,
ipv6_nd_prefix_advertisement_cmd,
"ipv6 nd prefix-advertisement IPV6PREFIX VALID PREFERRED [onlink] [autoconfig]",
IP_STR
DEFUN (ipv6_nd_prefix,
ipv6_nd_prefix_cmd,
"ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
"(<0-4294967295>|infinite) (off-link|) (no-autoconfig|)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
"IPv6 prefix\n"
"Valid lifetime in seconds\n"
"Infinite valid lifetime\n"
"Preferred lifetime in seconds\n"
"On link flag\n"
"Autonomous address-configuration flag\n")
"Infinite preferred lifetime\n"
"Do not use prefix for onlink determination\n"
"Do not use prefix for autoconfiguration\n")
{
int i;
int ret;
int cursor = 1;
struct interface *ifp;
struct zebra_if *zebra_if;
struct rtadv_prefix rp;
@ -877,32 +867,43 @@ DEFUN (ipv6_nd_prefix_advertisement,
vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
return CMD_WARNING;
}
rp.AdvOnLinkFlag = 1;
rp.AdvAutonomousFlag = 1;
rp.AdvValidLifetime = RTADV_VALID_LIFETIME;
rp.AdvPreferredLifetime = RTADV_PREFERRED_LIFETIME;
if (argc == 1)
if (argc > 1)
{
rp.AdvValidLifetime = RTADV_VALID_LIFETIME;
rp.AdvPreferredLifetime = RTADV_PREFERRED_LIFETIME;
rp.AdvOnLinkFlag = 1;
rp.AdvAutonomousFlag = 1;
}
else
{
rp.AdvValidLifetime = (u_int32_t) atol (argv[1]);
rp.AdvPreferredLifetime = (u_int32_t) atol (argv[2]);
if (rp.AdvPreferredLifetime > rp.AdvValidLifetime)
if ((isdigit(argv[1][0])) || strncmp (argv[1], "i", 1) == 0)
{
vty_out (vty, "Invalid preferred lifetime%s", VTY_NEWLINE);
return CMD_WARNING;
if ( strncmp (argv[1], "i", 1) == 0)
rp.AdvValidLifetime = UINT32_MAX;
else
rp.AdvValidLifetime = (u_int32_t) strtoll (argv[1],
(char **)NULL, 10);
if ( strncmp (argv[2], "i", 1) == 0)
rp.AdvPreferredLifetime = UINT32_MAX;
else
rp.AdvPreferredLifetime = (u_int32_t) strtoll (argv[2],
(char **)NULL, 10);
if (rp.AdvPreferredLifetime > rp.AdvValidLifetime)
{
vty_out (vty, "Invalid preferred lifetime%s", VTY_NEWLINE);
return CMD_WARNING;
}
cursor = cursor + 2;
}
rp.AdvOnLinkFlag = 0;
rp.AdvAutonomousFlag = 0;
for (i = 3; i < argc; i++)
if (argc > cursor)
{
if (! strcmp (argv[i], "onlink"))
rp.AdvOnLinkFlag = 1;
else if (! strcmp (argv[i], "autoconfig"))
rp.AdvAutonomousFlag = 1;
for (i = cursor; i < argc; i++)
{
if (strncmp (argv[i], "of", 2) == 0)
rp.AdvOnLinkFlag = 0;
if (strncmp (argv[i], "no", 2) == 0)
rp.AdvAutonomousFlag = 0;
}
}
}
@ -911,19 +912,113 @@ DEFUN (ipv6_nd_prefix_advertisement,
return CMD_SUCCESS;
}
ALIAS (ipv6_nd_prefix_advertisement,
ipv6_nd_prefix_advertisement_no_val_cmd,
"ipv6 nd prefix-advertisement IPV6PREFIX",
IP_STR
ALIAS (ipv6_nd_prefix,
ipv6_nd_prefix_val_rev_cmd,
"ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
"(<0-4294967295>|infinite) (no-autoconfig|) (off-link|)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
"IPv6 prefix\n"
"Valid lifetime in seconds\n"
"Infinite valid lifetime\n"
"Preferred lifetime in seconds\n"
"Infinite preferred lifetime\n"
"Do not use prefix for autoconfiguration\n"
"Do not use prefix for onlink determination\n")
ALIAS (ipv6_nd_prefix,
ipv6_nd_prefix_val_noauto_cmd,
"ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
"(<0-4294967295>|infinite) (no-autoconfig|)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
"IPv6 prefix\n"
"Valid lifetime in seconds\n"
"Infinite valid lifetime\n"
"Preferred lifetime in seconds\n"
"Infinite preferred lifetime\n"
"Do not use prefix for autoconfigurationn")
ALIAS (ipv6_nd_prefix,
ipv6_nd_prefix_val_offlink_cmd,
"ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
"(<0-4294967295>|infinite) (off-link|)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
"IPv6 prefix\n"
"Valid lifetime in seconds\n"
"Infinite valid lifetime\n"
"Preferred lifetime in seconds\n"
"Infinite preferred lifetime\n"
"Do not use prefix for onlink determination\n")
ALIAS (ipv6_nd_prefix,
ipv6_nd_prefix_val_cmd,
"ipv6 nd prefix X:X::X:X/M (<0-4294967295>|infinite) "
"(<0-4294967295>|infinite)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
"IPv6 prefix\n"
"Valid lifetime in seconds\n"
"Infinite valid lifetime\n"
"Preferred lifetime in seconds\n"
"Infinite preferred lifetime\n")
ALIAS (ipv6_nd_prefix,
ipv6_nd_prefix_noval_cmd,
"ipv6 nd prefix X:X::X:X/M (no-autoconfig|) (off-link|)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
"IPv6 prefix\n"
"Do not use prefix for autoconfiguration\n"
"Do not use prefix for onlink determination\n")
ALIAS (ipv6_nd_prefix,
ipv6_nd_prefix_noval_rev_cmd,
"ipv6 nd prefix X:X::X:X/M (off-link|) (no-autoconfig|)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
"IPv6 prefix\n"
"Do not use prefix for onlink determination\n"
"Do not use prefix for autoconfiguration\n")
ALIAS (ipv6_nd_prefix,
ipv6_nd_prefix_noval_noauto_cmd,
"ipv6 nd prefix X:X::X:X/M (no-autoconfig|)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
"IPv6 prefix\n"
"Do not use prefix for autoconfiguration\n")
ALIAS (ipv6_nd_prefix,
ipv6_nd_prefix_noval_offlink_cmd,
"ipv6 nd prefix X:X::X:X/M (off-link|)",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
"IPv6 prefix\n"
"Do not use prefix for onlink determination\n")
ALIAS (ipv6_nd_prefix,
ipv6_nd_prefix_prefix_cmd,
"ipv6 nd prefix X:X::X:X/M",
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
"IPv6 prefix\n")
DEFUN (no_ipv6_nd_prefix_advertisement,
no_ipv6_nd_prefix_advertisement_cmd,
"no ipv6 nd prefix-advertisement IPV6PREFIX",
DEFUN (no_ipv6_nd_prefix,
no_ipv6_nd_prefix_cmd,
"no ipv6 nd prefix IPV6PREFIX",
NO_STR
IP_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Prefix information\n"
"IPv6 prefix\n")
@ -996,16 +1091,26 @@ rtadv_config_write (struct vty *vty, struct interface *ifp)
for (node = listhead(zif->rtadv.AdvPrefixList); node; node = nextnode (node))
{
rprefix = getdata (node);
vty_out (vty, " ipv6 nd prefix-advertisement %s/%d %d %d",
vty_out (vty, " ipv6 nd prefix %s/%d",
inet_ntop (AF_INET6, &rprefix->prefix.u.prefix6,
buf, INET6_ADDRSTRLEN),
rprefix->prefix.prefixlen,
rprefix->AdvValidLifetime,
rprefix->AdvPreferredLifetime);
if (rprefix->AdvOnLinkFlag)
vty_out (vty, " onlink");
if (rprefix->AdvAutonomousFlag)
vty_out (vty, " autoconfig");
rprefix->prefix.prefixlen);
if ((rprefix->AdvValidLifetime != RTADV_VALID_LIFETIME) ||
(rprefix->AdvPreferredLifetime != RTADV_PREFERRED_LIFETIME))
{
if (rprefix->AdvValidLifetime == UINT32_MAX)
vty_out (vty, " infinite");
else
vty_out (vty, " %u", rprefix->AdvValidLifetime);
if (rprefix->AdvPreferredLifetime == UINT32_MAX)
vty_out (vty, " infinite");
else
vty_out (vty, " %u", rprefix->AdvPreferredLifetime);
}
if (!rprefix->AdvOnLinkFlag)
vty_out (vty, " off-link");
if (!rprefix->AdvAutonomousFlag)
vty_out (vty, " no-autoconfig");
vty_out (vty, "%s", VTY_NEWLINE);
}
}
@ -1020,7 +1125,8 @@ rtadv_event (enum rtadv_event event, int val)
if (! rtadv->ra_read)
rtadv->ra_read = thread_add_read (zebrad.master, rtadv_read, NULL, val);
if (! rtadv->ra_timer)
rtadv->ra_timer = thread_add_event (zebrad.master, rtadv_timer, NULL, 0);
rtadv->ra_timer = thread_add_event (zebrad.master, rtadv_timer,
NULL, 0);
break;
case RTADV_STOP:
if (rtadv->ra_timer)
@ -1036,7 +1142,8 @@ rtadv_event (enum rtadv_event event, int val)
break;
case RTADV_TIMER:
if (! rtadv->ra_timer)
rtadv->ra_timer = thread_add_timer (zebrad.master, rtadv_timer, NULL, val);
rtadv->ra_timer = thread_add_timer (zebrad.master, rtadv_timer, NULL,
val);
break;
case RTADV_READ:
if (! rtadv->ra_read)
@ -1062,8 +1169,6 @@ rtadv_init ()
install_element (INTERFACE_NODE, &ipv6_nd_suppress_ra_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_suppress_ra_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_send_ra_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_send_ra_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_ra_interval_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_ra_interval_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_ra_lifetime_cmd);
@ -1074,9 +1179,17 @@ rtadv_init ()
install_element (INTERFACE_NODE, &no_ipv6_nd_managed_config_flag_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_other_config_flag_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_other_config_flag_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_advertisement_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_advertisement_no_val_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_advertisement_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_rev_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_noauto_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_offlink_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_val_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_rev_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_noauto_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_noval_offlink_cmd);
install_element (INTERFACE_NODE, &ipv6_nd_prefix_prefix_cmd);
install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_cmd);
}
int