mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-30 00:33:34 +00:00
lib: Make distribute.c accepts both v4 and v6.
distribute.c doesn't allow to manage both v4 and v6 distribute lists. This patch fix this problem by having 4 DISTRIBUTE* values in the enumeration instead of two. The code in all daemons using distribute.c is adapted.
This commit is contained in:
parent
644ed6c5de
commit
fb23cf4abe
379
lib/distribute.c
379
lib/distribute.c
@ -266,9 +266,9 @@ DEFUN (distribute_list_all,
|
|||||||
|
|
||||||
/* Check of distribute list type. */
|
/* Check of distribute list type. */
|
||||||
if (strncmp (argv[1], "i", 1) == 0)
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
type = DISTRIBUTE_IN;
|
type = DISTRIBUTE_V4_IN;
|
||||||
else if (strncmp (argv[1], "o", 1) == 0)
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
type = DISTRIBUTE_OUT;
|
type = DISTRIBUTE_V4_OUT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vty_out (vty, "distribute list direction must be [in|out]%s",
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
@ -282,8 +282,36 @@ DEFUN (distribute_list_all,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (distribute_list_all,
|
DEFUN (ipv6_distribute_list_all,
|
||||||
ipv6_distribute_list_all_cmd,
|
ipv6_distribute_list_all_cmd,
|
||||||
|
"ipv6 distribute-list WORD (in|out)",
|
||||||
|
"Filter networks in routing updates\n"
|
||||||
|
"Access-list name\n"
|
||||||
|
"Filter incoming routing updates\n"
|
||||||
|
"Filter outgoing routing updates\n")
|
||||||
|
{
|
||||||
|
enum distribute_type type;
|
||||||
|
|
||||||
|
/* Check of distribute list type. */
|
||||||
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_IN;
|
||||||
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_OUT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
|
VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get interface name corresponding distribute list. */
|
||||||
|
distribute_list_set (NULL, type, argv[0]);
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALIAS (ipv6_distribute_list_all,
|
||||||
|
ipv6_as_v4_distribute_list_all_cmd,
|
||||||
"distribute-list WORD (in|out)",
|
"distribute-list WORD (in|out)",
|
||||||
"Filter networks in routing updates\n"
|
"Filter networks in routing updates\n"
|
||||||
"Access-list name\n"
|
"Access-list name\n"
|
||||||
@ -304,9 +332,9 @@ DEFUN (no_distribute_list_all,
|
|||||||
|
|
||||||
/* Check of distribute list type. */
|
/* Check of distribute list type. */
|
||||||
if (strncmp (argv[1], "i", 1) == 0)
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
type = DISTRIBUTE_IN;
|
type = DISTRIBUTE_V4_IN;
|
||||||
else if (strncmp (argv[1], "o", 1) == 0)
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
type = DISTRIBUTE_OUT;
|
type = DISTRIBUTE_V4_OUT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vty_out (vty, "distribute list direction must be [in|out]%s",
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
@ -323,8 +351,41 @@ DEFUN (no_distribute_list_all,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (no_distribute_list_all,
|
DEFUN (no_ipv6_distribute_list_all,
|
||||||
no_ipv6_distribute_list_all_cmd,
|
no_ipv6_distribute_list_all_cmd,
|
||||||
|
"no ipv6 distribute-list WORD (in|out)",
|
||||||
|
NO_STR
|
||||||
|
"Filter networks in routing updates\n"
|
||||||
|
"Access-list name\n"
|
||||||
|
"Filter incoming routing updates\n"
|
||||||
|
"Filter outgoing routing updates\n")
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
enum distribute_type type;
|
||||||
|
|
||||||
|
/* Check of distribute list type. */
|
||||||
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_IN;
|
||||||
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_OUT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
|
VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = distribute_list_unset (NULL, type, argv[0]);
|
||||||
|
if (! ret)
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALIAS (no_ipv6_distribute_list_all,
|
||||||
|
no_ipv6_as_v4_distribute_list_all_cmd,
|
||||||
"no distribute-list WORD (in|out)",
|
"no distribute-list WORD (in|out)",
|
||||||
NO_STR
|
NO_STR
|
||||||
"Filter networks in routing updates\n"
|
"Filter networks in routing updates\n"
|
||||||
@ -345,9 +406,9 @@ DEFUN (distribute_list,
|
|||||||
|
|
||||||
/* Check of distribute list type. */
|
/* Check of distribute list type. */
|
||||||
if (strncmp (argv[1], "i", 1) == 0)
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
type = DISTRIBUTE_IN;
|
type = DISTRIBUTE_V4_IN;
|
||||||
else if (strncmp (argv[1], "o", 1) == 0)
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
type = DISTRIBUTE_OUT;
|
type = DISTRIBUTE_V4_OUT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE);
|
vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE);
|
||||||
@ -360,8 +421,36 @@ DEFUN (distribute_list,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (distribute_list,
|
DEFUN (ipv6_distribute_list,
|
||||||
ipv6_distribute_list_cmd,
|
ipv6_distribute_list_cmd,
|
||||||
|
"ipv6 distribute-list WORD (in|out) WORD",
|
||||||
|
"Filter networks in routing updates\n"
|
||||||
|
"Access-list name\n"
|
||||||
|
"Filter incoming routing updates\n"
|
||||||
|
"Filter outgoing routing updates\n"
|
||||||
|
"Interface name\n")
|
||||||
|
{
|
||||||
|
enum distribute_type type;
|
||||||
|
|
||||||
|
/* Check of distribute list type. */
|
||||||
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_IN;
|
||||||
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_OUT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get interface name corresponding distribute list. */
|
||||||
|
distribute_list_set (argv[2], type, argv[0]);
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALIAS (ipv6_distribute_list,
|
||||||
|
ipv6_as_v4_distribute_list_cmd,
|
||||||
"distribute-list WORD (in|out) WORD",
|
"distribute-list WORD (in|out) WORD",
|
||||||
"Filter networks in routing updates\n"
|
"Filter networks in routing updates\n"
|
||||||
"Access-list name\n"
|
"Access-list name\n"
|
||||||
@ -383,9 +472,9 @@ DEFUN (no_distribute_list, no_distribute_list_cmd,
|
|||||||
|
|
||||||
/* Check of distribute list type. */
|
/* Check of distribute list type. */
|
||||||
if (strncmp (argv[1], "i", 1) == 0)
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
type = DISTRIBUTE_IN;
|
type = DISTRIBUTE_V4_IN;
|
||||||
else if (strncmp (argv[1], "o", 1) == 0)
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
type = DISTRIBUTE_OUT;
|
type = DISTRIBUTE_V4_OUT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE);
|
vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE);
|
||||||
@ -401,7 +490,41 @@ DEFUN (no_distribute_list, no_distribute_list_cmd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (no_distribute_list, no_ipv6_distribute_list_cmd,
|
DEFUN (no_ipv6_distribute_list,
|
||||||
|
no_ipv6_distribute_list_cmd,
|
||||||
|
"no ipv6 distribute-list WORD (in|out) WORD",
|
||||||
|
NO_STR
|
||||||
|
"Filter networks in routing updates\n"
|
||||||
|
"Access-list name\n"
|
||||||
|
"Filter incoming routing updates\n"
|
||||||
|
"Filter outgoing routing updates\n"
|
||||||
|
"Interface name\n")
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
enum distribute_type type;
|
||||||
|
|
||||||
|
/* Check of distribute list type. */
|
||||||
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_IN;
|
||||||
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_OUT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list direction must be [in|out]%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = distribute_list_unset (argv[2], type, argv[0]);
|
||||||
|
if (! ret)
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALIAS (no_ipv6_distribute_list,
|
||||||
|
no_ipv6_as_v4_distribute_list_cmd,
|
||||||
"no distribute-list WORD (in|out) WORD",
|
"no distribute-list WORD (in|out) WORD",
|
||||||
NO_STR
|
NO_STR
|
||||||
"Filter networks in routing updates\n"
|
"Filter networks in routing updates\n"
|
||||||
@ -423,12 +546,12 @@ DEFUN (distribute_list_prefix_all,
|
|||||||
|
|
||||||
/* Check of distribute list type. */
|
/* Check of distribute list type. */
|
||||||
if (strncmp (argv[1], "i", 1) == 0)
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
type = DISTRIBUTE_IN;
|
type = DISTRIBUTE_V4_IN;
|
||||||
else if (strncmp (argv[1], "o", 1) == 0)
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
type = DISTRIBUTE_OUT;
|
type = DISTRIBUTE_V4_OUT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vty_out (vty, "distribute list direction must be [in|out]%s",
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
@ -439,8 +562,37 @@ DEFUN (distribute_list_prefix_all,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (distribute_list_prefix_all,
|
DEFUN (ipv6_distribute_list_prefix_all,
|
||||||
ipv6_distribute_list_prefix_all_cmd,
|
ipv6_distribute_list_prefix_all_cmd,
|
||||||
|
"ipv6 distribute-list prefix WORD (in|out)",
|
||||||
|
"Filter networks in routing updates\n"
|
||||||
|
"Filter prefixes in routing updates\n"
|
||||||
|
"Name of an IP prefix-list\n"
|
||||||
|
"Filter incoming routing updates\n"
|
||||||
|
"Filter outgoing routing updates\n")
|
||||||
|
{
|
||||||
|
enum distribute_type type;
|
||||||
|
|
||||||
|
/* Check of distribute list type. */
|
||||||
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_IN;
|
||||||
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_OUT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
|
VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get interface name corresponding distribute list. */
|
||||||
|
distribute_list_prefix_set (NULL, type, argv[0]);
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALIAS (ipv6_distribute_list_prefix_all,
|
||||||
|
ipv6_as_v4_distribute_list_prefix_all_cmd,
|
||||||
"distribute-list prefix WORD (in|out)",
|
"distribute-list prefix WORD (in|out)",
|
||||||
"Filter networks in routing updates\n"
|
"Filter networks in routing updates\n"
|
||||||
"Filter prefixes in routing updates\n"
|
"Filter prefixes in routing updates\n"
|
||||||
@ -463,12 +615,12 @@ DEFUN (no_distribute_list_prefix_all,
|
|||||||
|
|
||||||
/* Check of distribute list type. */
|
/* Check of distribute list type. */
|
||||||
if (strncmp (argv[1], "i", 1) == 0)
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
type = DISTRIBUTE_IN;
|
type = DISTRIBUTE_V4_IN;
|
||||||
else if (strncmp (argv[1], "o", 1) == 0)
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
type = DISTRIBUTE_OUT;
|
type = DISTRIBUTE_V4_OUT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vty_out (vty, "distribute list direction must be [in|out]%s",
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
@ -482,8 +634,42 @@ DEFUN (no_distribute_list_prefix_all,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (no_distribute_list_prefix_all,
|
DEFUN (no_ipv6_distribute_list_prefix_all,
|
||||||
no_ipv6_distribute_list_prefix_all_cmd,
|
no_ipv6_distribute_list_prefix_all_cmd,
|
||||||
|
"no ipv6 distribute-list prefix WORD (in|out)",
|
||||||
|
NO_STR
|
||||||
|
"Filter networks in routing updates\n"
|
||||||
|
"Filter prefixes in routing updates\n"
|
||||||
|
"Name of an IP prefix-list\n"
|
||||||
|
"Filter incoming routing updates\n"
|
||||||
|
"Filter outgoing routing updates\n")
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
enum distribute_type type;
|
||||||
|
|
||||||
|
/* Check of distribute list type. */
|
||||||
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_IN;
|
||||||
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_OUT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
|
VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = distribute_list_prefix_unset (NULL, type, argv[0]);
|
||||||
|
if (! ret)
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALIAS (no_ipv6_distribute_list_prefix_all,
|
||||||
|
no_ipv6_as_v4_distribute_list_prefix_all_cmd,
|
||||||
"no distribute-list prefix WORD (in|out)",
|
"no distribute-list prefix WORD (in|out)",
|
||||||
NO_STR
|
NO_STR
|
||||||
"Filter networks in routing updates\n"
|
"Filter networks in routing updates\n"
|
||||||
@ -505,12 +691,12 @@ DEFUN (distribute_list_prefix, distribute_list_prefix_cmd,
|
|||||||
|
|
||||||
/* Check of distribute list type. */
|
/* Check of distribute list type. */
|
||||||
if (strncmp (argv[1], "i", 1) == 0)
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
type = DISTRIBUTE_IN;
|
type = DISTRIBUTE_V4_IN;
|
||||||
else if (strncmp (argv[1], "o", 1) == 0)
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
type = DISTRIBUTE_OUT;
|
type = DISTRIBUTE_V4_OUT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vty_out (vty, "distribute list direction must be [in|out]%s",
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
@ -521,7 +707,38 @@ DEFUN (distribute_list_prefix, distribute_list_prefix_cmd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (distribute_list_prefix, ipv6_distribute_list_prefix_cmd,
|
DEFUN (ipv6_distribute_list_prefix,
|
||||||
|
ipv6_distribute_list_prefix_cmd,
|
||||||
|
"ipv6 distribute-list prefix WORD (in|out) WORD",
|
||||||
|
"Filter networks in routing updates\n"
|
||||||
|
"Filter prefixes in routing updates\n"
|
||||||
|
"Name of an IP prefix-list\n"
|
||||||
|
"Filter incoming routing updates\n"
|
||||||
|
"Filter outgoing routing updates\n"
|
||||||
|
"Interface name\n")
|
||||||
|
{
|
||||||
|
enum distribute_type type;
|
||||||
|
|
||||||
|
/* Check of distribute list type. */
|
||||||
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_IN;
|
||||||
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_OUT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
|
VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get interface name corresponding distribute list. */
|
||||||
|
distribute_list_prefix_set (argv[2], type, argv[0]);
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALIAS (ipv6_distribute_list_prefix,
|
||||||
|
ipv6_as_v4_distribute_list_prefix_cmd,
|
||||||
"distribute-list prefix WORD (in|out) WORD",
|
"distribute-list prefix WORD (in|out) WORD",
|
||||||
"Filter networks in routing updates\n"
|
"Filter networks in routing updates\n"
|
||||||
"Filter prefixes in routing updates\n"
|
"Filter prefixes in routing updates\n"
|
||||||
@ -545,12 +762,12 @@ DEFUN (no_distribute_list_prefix, no_distribute_list_prefix_cmd,
|
|||||||
|
|
||||||
/* Check of distribute list type. */
|
/* Check of distribute list type. */
|
||||||
if (strncmp (argv[1], "i", 1) == 0)
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
type = DISTRIBUTE_IN;
|
type = DISTRIBUTE_V4_IN;
|
||||||
else if (strncmp (argv[1], "o", 1) == 0)
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
type = DISTRIBUTE_OUT;
|
type = DISTRIBUTE_V4_OUT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vty_out (vty, "distribute list direction must be [in|out]%s",
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
@ -564,7 +781,43 @@ DEFUN (no_distribute_list_prefix, no_distribute_list_prefix_cmd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIAS (no_distribute_list_prefix, no_ipv6_distribute_list_prefix_cmd,
|
DEFUN (no_ipv6_distribute_list_prefix,
|
||||||
|
no_ipv6_distribute_list_prefix_cmd,
|
||||||
|
"no ipv6 distribute-list prefix WORD (in|out) WORD",
|
||||||
|
NO_STR
|
||||||
|
"Filter networks in routing updates\n"
|
||||||
|
"Filter prefixes in routing updates\n"
|
||||||
|
"Name of an IP prefix-list\n"
|
||||||
|
"Filter incoming routing updates\n"
|
||||||
|
"Filter outgoing routing updates\n"
|
||||||
|
"Interface name\n")
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
enum distribute_type type;
|
||||||
|
|
||||||
|
/* Check of distribute list type. */
|
||||||
|
if (strncmp (argv[1], "i", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_IN;
|
||||||
|
else if (strncmp (argv[1], "o", 1) == 0)
|
||||||
|
type = DISTRIBUTE_V6_OUT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list direction must be [in|out]%s",
|
||||||
|
VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = distribute_list_prefix_unset (argv[2], type, argv[0]);
|
||||||
|
if (! ret)
|
||||||
|
{
|
||||||
|
vty_out (vty, "distribute list doesn't exist%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALIAS (no_ipv6_distribute_list_prefix,
|
||||||
|
no_ipv6_as_v4_distribute_list_prefix_cmd,
|
||||||
"no distribute-list prefix WORD (in|out) WORD",
|
"no distribute-list prefix WORD (in|out) WORD",
|
||||||
NO_STR
|
NO_STR
|
||||||
"Filter networks in routing updates\n"
|
"Filter networks in routing updates\n"
|
||||||
@ -603,9 +856,13 @@ config_show_distribute (struct vty *vty)
|
|||||||
if (dist)
|
if (dist)
|
||||||
{
|
{
|
||||||
has_print = distribute_print(vty, dist->list, 0,
|
has_print = distribute_print(vty, dist->list, 0,
|
||||||
DISTRIBUTE_OUT, has_print);
|
DISTRIBUTE_V4_OUT, has_print);
|
||||||
has_print = distribute_print(vty, dist->prefix, 1,
|
has_print = distribute_print(vty, dist->prefix, 1,
|
||||||
DISTRIBUTE_OUT, has_print);
|
DISTRIBUTE_V4_OUT, has_print);
|
||||||
|
has_print = distribute_print(vty, dist->list, 0,
|
||||||
|
DISTRIBUTE_V6_OUT, has_print);
|
||||||
|
has_print = distribute_print(vty, dist->prefix, 1,
|
||||||
|
DISTRIBUTE_V6_OUT, has_print);
|
||||||
}
|
}
|
||||||
if (has_print)
|
if (has_print)
|
||||||
vty_out (vty, "%s", VTY_NEWLINE);
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
@ -621,9 +878,13 @@ config_show_distribute (struct vty *vty)
|
|||||||
vty_out (vty, " %s filtered by", dist->ifname);
|
vty_out (vty, " %s filtered by", dist->ifname);
|
||||||
has_print = 0;
|
has_print = 0;
|
||||||
has_print = distribute_print(vty, dist->list, 0,
|
has_print = distribute_print(vty, dist->list, 0,
|
||||||
DISTRIBUTE_OUT, has_print);
|
DISTRIBUTE_V4_OUT, has_print);
|
||||||
has_print = distribute_print(vty, dist->prefix, 1,
|
has_print = distribute_print(vty, dist->prefix, 1,
|
||||||
DISTRIBUTE_OUT, has_print);
|
DISTRIBUTE_V4_OUT, has_print);
|
||||||
|
has_print = distribute_print(vty, dist->list, 0,
|
||||||
|
DISTRIBUTE_V6_OUT, has_print);
|
||||||
|
has_print = distribute_print(vty, dist->prefix, 1,
|
||||||
|
DISTRIBUTE_V6_OUT, has_print);
|
||||||
if (has_print)
|
if (has_print)
|
||||||
vty_out (vty, "%s", VTY_NEWLINE);
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
else
|
else
|
||||||
@ -639,9 +900,14 @@ config_show_distribute (struct vty *vty)
|
|||||||
if (dist)
|
if (dist)
|
||||||
{
|
{
|
||||||
has_print = distribute_print(vty, dist->list, 0,
|
has_print = distribute_print(vty, dist->list, 0,
|
||||||
DISTRIBUTE_IN, has_print);
|
DISTRIBUTE_V4_IN, has_print);
|
||||||
has_print = distribute_print(vty, dist->prefix, 1,
|
has_print = distribute_print(vty, dist->prefix, 1,
|
||||||
DISTRIBUTE_IN, has_print); }
|
DISTRIBUTE_V4_IN, has_print);
|
||||||
|
has_print = distribute_print(vty, dist->list, 0,
|
||||||
|
DISTRIBUTE_V6_IN, has_print);
|
||||||
|
has_print = distribute_print(vty, dist->prefix, 1,
|
||||||
|
DISTRIBUTE_V6_IN, has_print);
|
||||||
|
}
|
||||||
if (has_print)
|
if (has_print)
|
||||||
vty_out (vty, "%s", VTY_NEWLINE);
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
else
|
else
|
||||||
@ -656,9 +922,13 @@ config_show_distribute (struct vty *vty)
|
|||||||
vty_out (vty, " %s filtered by", dist->ifname);
|
vty_out (vty, " %s filtered by", dist->ifname);
|
||||||
has_print = 0;
|
has_print = 0;
|
||||||
has_print = distribute_print(vty, dist->list, 0,
|
has_print = distribute_print(vty, dist->list, 0,
|
||||||
DISTRIBUTE_IN, has_print);
|
DISTRIBUTE_V4_IN, has_print);
|
||||||
has_print = distribute_print(vty, dist->prefix, 1,
|
has_print = distribute_print(vty, dist->prefix, 1,
|
||||||
DISTRIBUTE_IN, has_print);
|
DISTRIBUTE_V4_IN, has_print);
|
||||||
|
has_print = distribute_print(vty, dist->list, 0,
|
||||||
|
DISTRIBUTE_V6_IN, has_print);
|
||||||
|
has_print = distribute_print(vty, dist->prefix, 1,
|
||||||
|
DISTRIBUTE_V6_IN, has_print);
|
||||||
if (has_print)
|
if (has_print)
|
||||||
vty_out (vty, "%s", VTY_NEWLINE);
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
else
|
else
|
||||||
@ -674,7 +944,7 @@ config_write_distribute (struct vty *vty)
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int j;
|
int j;
|
||||||
int output;
|
int output, v6;
|
||||||
struct hash_backet *mp;
|
struct hash_backet *mp;
|
||||||
int write = 0;
|
int write = 0;
|
||||||
|
|
||||||
@ -687,8 +957,10 @@ config_write_distribute (struct vty *vty)
|
|||||||
|
|
||||||
for (j = 0; j < DISTRIBUTE_MAX; j++)
|
for (j = 0; j < DISTRIBUTE_MAX; j++)
|
||||||
if (dist->list[j]) {
|
if (dist->list[j]) {
|
||||||
output = j == DISTRIBUTE_OUT;
|
output = j == DISTRIBUTE_V4_OUT || j == DISTRIBUTE_V6_OUT;
|
||||||
vty_out (vty, " distribute-list %s %s %s%s",
|
v6 = j == DISTRIBUTE_V6_IN || j == DISTRIBUTE_V6_OUT;
|
||||||
|
vty_out (vty, " %sdistribute-list %s %s %s%s",
|
||||||
|
v6 ? "ipv6 " : "",
|
||||||
dist->list[j],
|
dist->list[j],
|
||||||
output ? "out" : "in",
|
output ? "out" : "in",
|
||||||
dist->ifname ? dist->ifname : "",
|
dist->ifname ? dist->ifname : "",
|
||||||
@ -698,8 +970,10 @@ config_write_distribute (struct vty *vty)
|
|||||||
|
|
||||||
for (j = 0; j < DISTRIBUTE_MAX; j++)
|
for (j = 0; j < DISTRIBUTE_MAX; j++)
|
||||||
if (dist->prefix[j]) {
|
if (dist->prefix[j]) {
|
||||||
output = j == DISTRIBUTE_OUT;
|
output = j == DISTRIBUTE_V4_OUT || j == DISTRIBUTE_V6_OUT;
|
||||||
vty_out (vty, " distribute-list prefix %s %s %s%s",
|
v6 = j == DISTRIBUTE_V6_IN || j == DISTRIBUTE_V6_OUT;
|
||||||
|
vty_out (vty, " %sdistribute-list prefix %s %s %s%s",
|
||||||
|
v6 ? "ipv6 " : "",
|
||||||
dist->prefix[j],
|
dist->prefix[j],
|
||||||
output ? "out" : "in",
|
output ? "out" : "in",
|
||||||
dist->ifname ? dist->ifname : "",
|
dist->ifname ? dist->ifname : "",
|
||||||
@ -723,8 +997,8 @@ distribute_list_init (int node)
|
|||||||
{
|
{
|
||||||
disthash = hash_create (distribute_hash_make,
|
disthash = hash_create (distribute_hash_make,
|
||||||
(int (*) (const void *, const void *)) distribute_cmp);
|
(int (*) (const void *, const void *)) distribute_cmp);
|
||||||
|
/* install v4 */
|
||||||
if(node==RIP_NODE) {
|
if (node == RIP_NODE) {
|
||||||
install_element (node, &distribute_list_all_cmd);
|
install_element (node, &distribute_list_all_cmd);
|
||||||
install_element (node, &no_distribute_list_all_cmd);
|
install_element (node, &no_distribute_list_all_cmd);
|
||||||
install_element (node, &distribute_list_cmd);
|
install_element (node, &distribute_list_cmd);
|
||||||
@ -733,9 +1007,10 @@ distribute_list_init (int node)
|
|||||||
install_element (node, &no_distribute_list_prefix_all_cmd);
|
install_element (node, &no_distribute_list_prefix_all_cmd);
|
||||||
install_element (node, &distribute_list_prefix_cmd);
|
install_element (node, &distribute_list_prefix_cmd);
|
||||||
install_element (node, &no_distribute_list_prefix_cmd);
|
install_element (node, &no_distribute_list_prefix_cmd);
|
||||||
} else if (node == RIPNG_NODE) {
|
}
|
||||||
/* WARNING: two identical commands installed do a crash, so be worry with
|
|
||||||
* aliases */
|
/* install v6 */
|
||||||
|
if (node == RIPNG_NODE) {
|
||||||
install_element (node, &ipv6_distribute_list_all_cmd);
|
install_element (node, &ipv6_distribute_list_all_cmd);
|
||||||
install_element (node, &no_ipv6_distribute_list_all_cmd);
|
install_element (node, &no_ipv6_distribute_list_all_cmd);
|
||||||
install_element (node, &ipv6_distribute_list_cmd);
|
install_element (node, &ipv6_distribute_list_cmd);
|
||||||
@ -745,4 +1020,16 @@ distribute_list_init (int node)
|
|||||||
install_element (node, &ipv6_distribute_list_prefix_cmd);
|
install_element (node, &ipv6_distribute_list_prefix_cmd);
|
||||||
install_element (node, &no_ipv6_distribute_list_prefix_cmd);
|
install_element (node, &no_ipv6_distribute_list_prefix_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* install v4 syntax command for v6 only protocols. */
|
||||||
|
if (node == RIPNG_NODE) {
|
||||||
|
install_element (node, &ipv6_as_v4_distribute_list_all_cmd);
|
||||||
|
install_element (node, &no_ipv6_as_v4_distribute_list_all_cmd);
|
||||||
|
install_element (node, &ipv6_as_v4_distribute_list_cmd);
|
||||||
|
install_element (node, &no_ipv6_as_v4_distribute_list_cmd);
|
||||||
|
install_element (node, &ipv6_as_v4_distribute_list_prefix_all_cmd);
|
||||||
|
install_element (node, &no_ipv6_as_v4_distribute_list_prefix_all_cmd);
|
||||||
|
install_element (node, &ipv6_as_v4_distribute_list_prefix_cmd);
|
||||||
|
install_element (node, &no_ipv6_as_v4_distribute_list_prefix_cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,10 @@
|
|||||||
/* Disctirubte list types. */
|
/* Disctirubte list types. */
|
||||||
enum distribute_type
|
enum distribute_type
|
||||||
{
|
{
|
||||||
DISTRIBUTE_IN,
|
DISTRIBUTE_V4_IN,
|
||||||
DISTRIBUTE_OUT,
|
DISTRIBUTE_V6_IN,
|
||||||
|
DISTRIBUTE_V4_OUT,
|
||||||
|
DISTRIBUTE_V6_OUT,
|
||||||
DISTRIBUTE_MAX
|
DISTRIBUTE_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
18
ripd/ripd.c
18
ripd/ripd.c
@ -322,7 +322,7 @@ rip_filter (int rip_distribute, struct prefix_ipv4 *p, struct rip_interface *ri)
|
|||||||
struct access_list *alist;
|
struct access_list *alist;
|
||||||
struct prefix_list *plist;
|
struct prefix_list *plist;
|
||||||
int distribute = rip_distribute == RIP_FILTER_OUT ?
|
int distribute = rip_distribute == RIP_FILTER_OUT ?
|
||||||
DISTRIBUTE_OUT : DISTRIBUTE_IN;
|
DISTRIBUTE_V4_OUT : DISTRIBUTE_V4_IN;
|
||||||
const char *inout = rip_distribute == RIP_FILTER_OUT ? "out" : "in";
|
const char *inout = rip_distribute == RIP_FILTER_OUT ? "out" : "in";
|
||||||
|
|
||||||
/* Input distribute-list filtering. */
|
/* Input distribute-list filtering. */
|
||||||
@ -3804,9 +3804,9 @@ rip_distribute_update (struct distribute *dist)
|
|||||||
|
|
||||||
ri = ifp->info;
|
ri = ifp->info;
|
||||||
|
|
||||||
if (dist->list[DISTRIBUTE_IN])
|
if (dist->list[DISTRIBUTE_V4_IN])
|
||||||
{
|
{
|
||||||
alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_IN]);
|
alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_IN]);
|
||||||
if (alist)
|
if (alist)
|
||||||
ri->list[RIP_FILTER_IN] = alist;
|
ri->list[RIP_FILTER_IN] = alist;
|
||||||
else
|
else
|
||||||
@ -3815,9 +3815,9 @@ rip_distribute_update (struct distribute *dist)
|
|||||||
else
|
else
|
||||||
ri->list[RIP_FILTER_IN] = NULL;
|
ri->list[RIP_FILTER_IN] = NULL;
|
||||||
|
|
||||||
if (dist->list[DISTRIBUTE_OUT])
|
if (dist->list[DISTRIBUTE_V4_OUT])
|
||||||
{
|
{
|
||||||
alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_OUT]);
|
alist = access_list_lookup (AFI_IP, dist->list[DISTRIBUTE_V4_OUT]);
|
||||||
if (alist)
|
if (alist)
|
||||||
ri->list[RIP_FILTER_OUT] = alist;
|
ri->list[RIP_FILTER_OUT] = alist;
|
||||||
else
|
else
|
||||||
@ -3826,9 +3826,9 @@ rip_distribute_update (struct distribute *dist)
|
|||||||
else
|
else
|
||||||
ri->list[RIP_FILTER_OUT] = NULL;
|
ri->list[RIP_FILTER_OUT] = NULL;
|
||||||
|
|
||||||
if (dist->prefix[DISTRIBUTE_IN])
|
if (dist->prefix[DISTRIBUTE_V4_IN])
|
||||||
{
|
{
|
||||||
plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_IN]);
|
plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_IN]);
|
||||||
if (plist)
|
if (plist)
|
||||||
ri->prefix[RIP_FILTER_IN] = plist;
|
ri->prefix[RIP_FILTER_IN] = plist;
|
||||||
else
|
else
|
||||||
@ -3837,9 +3837,9 @@ rip_distribute_update (struct distribute *dist)
|
|||||||
else
|
else
|
||||||
ri->prefix[RIP_FILTER_IN] = NULL;
|
ri->prefix[RIP_FILTER_IN] = NULL;
|
||||||
|
|
||||||
if (dist->prefix[DISTRIBUTE_OUT])
|
if (dist->prefix[DISTRIBUTE_V4_OUT])
|
||||||
{
|
{
|
||||||
plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_OUT]);
|
plist = prefix_list_lookup (AFI_IP, dist->prefix[DISTRIBUTE_V4_OUT]);
|
||||||
if (plist)
|
if (plist)
|
||||||
ri->prefix[RIP_FILTER_OUT] = plist;
|
ri->prefix[RIP_FILTER_OUT] = plist;
|
||||||
else
|
else
|
||||||
|
@ -617,7 +617,7 @@ ripng_filter (int ripng_distribute, struct prefix_ipv6 *p,
|
|||||||
struct access_list *alist;
|
struct access_list *alist;
|
||||||
struct prefix_list *plist;
|
struct prefix_list *plist;
|
||||||
int distribute = ripng_distribute == RIPNG_FILTER_OUT ?
|
int distribute = ripng_distribute == RIPNG_FILTER_OUT ?
|
||||||
DISTRIBUTE_OUT : DISTRIBUTE_IN;
|
DISTRIBUTE_V6_OUT : DISTRIBUTE_V6_IN;
|
||||||
const char *inout = ripng_distribute == RIPNG_FILTER_OUT ? "out" : "in";
|
const char *inout = ripng_distribute == RIPNG_FILTER_OUT ? "out" : "in";
|
||||||
|
|
||||||
/* Input distribute-list filtering. */
|
/* Input distribute-list filtering. */
|
||||||
@ -2759,9 +2759,9 @@ ripng_distribute_update (struct distribute *dist)
|
|||||||
|
|
||||||
ri = ifp->info;
|
ri = ifp->info;
|
||||||
|
|
||||||
if (dist->list[DISTRIBUTE_IN])
|
if (dist->list[DISTRIBUTE_V6_IN])
|
||||||
{
|
{
|
||||||
alist = access_list_lookup (AFI_IP6, dist->list[DISTRIBUTE_IN]);
|
alist = access_list_lookup (AFI_IP6, dist->list[DISTRIBUTE_V6_IN]);
|
||||||
if (alist)
|
if (alist)
|
||||||
ri->list[RIPNG_FILTER_IN] = alist;
|
ri->list[RIPNG_FILTER_IN] = alist;
|
||||||
else
|
else
|
||||||
@ -2770,9 +2770,9 @@ ripng_distribute_update (struct distribute *dist)
|
|||||||
else
|
else
|
||||||
ri->list[RIPNG_FILTER_IN] = NULL;
|
ri->list[RIPNG_FILTER_IN] = NULL;
|
||||||
|
|
||||||
if (dist->list[DISTRIBUTE_OUT])
|
if (dist->list[DISTRIBUTE_V6_OUT])
|
||||||
{
|
{
|
||||||
alist = access_list_lookup (AFI_IP6, dist->list[DISTRIBUTE_OUT]);
|
alist = access_list_lookup (AFI_IP6, dist->list[DISTRIBUTE_V6_OUT]);
|
||||||
if (alist)
|
if (alist)
|
||||||
ri->list[RIPNG_FILTER_OUT] = alist;
|
ri->list[RIPNG_FILTER_OUT] = alist;
|
||||||
else
|
else
|
||||||
@ -2781,9 +2781,9 @@ ripng_distribute_update (struct distribute *dist)
|
|||||||
else
|
else
|
||||||
ri->list[RIPNG_FILTER_OUT] = NULL;
|
ri->list[RIPNG_FILTER_OUT] = NULL;
|
||||||
|
|
||||||
if (dist->prefix[DISTRIBUTE_IN])
|
if (dist->prefix[DISTRIBUTE_V6_IN])
|
||||||
{
|
{
|
||||||
plist = prefix_list_lookup (AFI_IP6, dist->prefix[DISTRIBUTE_IN]);
|
plist = prefix_list_lookup (AFI_IP6, dist->prefix[DISTRIBUTE_V6_IN]);
|
||||||
if (plist)
|
if (plist)
|
||||||
ri->prefix[RIPNG_FILTER_IN] = plist;
|
ri->prefix[RIPNG_FILTER_IN] = plist;
|
||||||
else
|
else
|
||||||
@ -2792,9 +2792,9 @@ ripng_distribute_update (struct distribute *dist)
|
|||||||
else
|
else
|
||||||
ri->prefix[RIPNG_FILTER_IN] = NULL;
|
ri->prefix[RIPNG_FILTER_IN] = NULL;
|
||||||
|
|
||||||
if (dist->prefix[DISTRIBUTE_OUT])
|
if (dist->prefix[DISTRIBUTE_V6_OUT])
|
||||||
{
|
{
|
||||||
plist = prefix_list_lookup (AFI_IP6, dist->prefix[DISTRIBUTE_OUT]);
|
plist = prefix_list_lookup (AFI_IP6, dist->prefix[DISTRIBUTE_V6_OUT]);
|
||||||
if (plist)
|
if (plist)
|
||||||
ri->prefix[RIPNG_FILTER_OUT] = plist;
|
ri->prefix[RIPNG_FILTER_OUT] = plist;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user