Make "no redistribute" always remove the redistribute statement

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2015-05-19 17:40:46 -07:00
parent a0f72a9164
commit 503006bc2a
3 changed files with 8 additions and 119 deletions

View File

@ -9494,7 +9494,7 @@ DEFUN (no_bgp_redistribute_ipv4,
return bgp_redistribute_unset (vty->index, AFI_IP, type); return bgp_redistribute_unset (vty->index, AFI_IP, type);
} }
DEFUN (no_bgp_redistribute_ipv4_rmap, ALIAS (no_bgp_redistribute_ipv4,
no_bgp_redistribute_ipv4_rmap_cmd, no_bgp_redistribute_ipv4_rmap_cmd,
"no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
NO_STR NO_STR
@ -9502,21 +9502,8 @@ DEFUN (no_bgp_redistribute_ipv4_rmap,
QUAGGA_IP_REDIST_HELP_STR_BGPD QUAGGA_IP_REDIST_HELP_STR_BGPD
"Route map reference\n" "Route map reference\n"
"Pointer to route-map entries\n") "Pointer to route-map entries\n")
{
int type;
type = proto_redistnum (AFI_IP, argv[0]); ALIAS (no_bgp_redistribute_ipv4,
if (type < 0 || type == ZEBRA_ROUTE_BGP)
{
vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
return CMD_WARNING;
}
bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
return CMD_SUCCESS;
}
DEFUN (no_bgp_redistribute_ipv4_metric,
no_bgp_redistribute_ipv4_metric_cmd, no_bgp_redistribute_ipv4_metric_cmd,
"no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
NO_STR NO_STR
@ -9524,21 +9511,8 @@ DEFUN (no_bgp_redistribute_ipv4_metric,
QUAGGA_IP_REDIST_HELP_STR_BGPD QUAGGA_IP_REDIST_HELP_STR_BGPD
"Metric for redistributed routes\n" "Metric for redistributed routes\n"
"Default metric\n") "Default metric\n")
{
int type;
type = proto_redistnum (AFI_IP, argv[0]); ALIAS (no_bgp_redistribute_ipv4,
if (type < 0 || type == ZEBRA_ROUTE_BGP)
{
vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
return CMD_WARNING;
}
bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
return CMD_SUCCESS;
}
DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
no_bgp_redistribute_ipv4_rmap_metric_cmd, no_bgp_redistribute_ipv4_rmap_metric_cmd,
"no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
NO_STR NO_STR
@ -9548,22 +9522,8 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
"Pointer to route-map entries\n" "Pointer to route-map entries\n"
"Metric for redistributed routes\n" "Metric for redistributed routes\n"
"Default metric\n") "Default metric\n")
{
int type;
type = proto_redistnum (AFI_IP, argv[0]); ALIAS (no_bgp_redistribute_ipv4,
if (type < 0 || type == ZEBRA_ROUTE_BGP)
{
vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
return CMD_WARNING;
}
bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
return CMD_SUCCESS;
}
ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
no_bgp_redistribute_ipv4_metric_rmap_cmd, no_bgp_redistribute_ipv4_metric_rmap_cmd,
"no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
NO_STR NO_STR
@ -9708,7 +9668,7 @@ DEFUN (no_bgp_redistribute_ipv6,
return bgp_redistribute_unset (vty->index, AFI_IP6, type); return bgp_redistribute_unset (vty->index, AFI_IP6, type);
} }
DEFUN (no_bgp_redistribute_ipv6_rmap, ALIAS (no_bgp_redistribute_ipv6,
no_bgp_redistribute_ipv6_rmap_cmd, no_bgp_redistribute_ipv6_rmap_cmd,
"no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
NO_STR NO_STR
@ -9716,21 +9676,8 @@ DEFUN (no_bgp_redistribute_ipv6_rmap,
QUAGGA_IP6_REDIST_HELP_STR_BGPD QUAGGA_IP6_REDIST_HELP_STR_BGPD
"Route map reference\n" "Route map reference\n"
"Pointer to route-map entries\n") "Pointer to route-map entries\n")
{
int type;
type = proto_redistnum (AFI_IP6, argv[0]); ALIAS (no_bgp_redistribute_ipv6,
if (type < 0 || type == ZEBRA_ROUTE_BGP)
{
vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
return CMD_WARNING;
}
bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
return CMD_SUCCESS;
}
DEFUN (no_bgp_redistribute_ipv6_metric,
no_bgp_redistribute_ipv6_metric_cmd, no_bgp_redistribute_ipv6_metric_cmd,
"no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
NO_STR NO_STR
@ -9738,21 +9685,8 @@ DEFUN (no_bgp_redistribute_ipv6_metric,
QUAGGA_IP6_REDIST_HELP_STR_BGPD QUAGGA_IP6_REDIST_HELP_STR_BGPD
"Metric for redistributed routes\n" "Metric for redistributed routes\n"
"Default metric\n") "Default metric\n")
{
int type;
type = proto_redistnum (AFI_IP6, argv[0]); ALIAS (no_bgp_redistribute_ipv6,
if (type < 0 || type == ZEBRA_ROUTE_BGP)
{
vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
return CMD_WARNING;
}
bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
return CMD_SUCCESS;
}
DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
no_bgp_redistribute_ipv6_rmap_metric_cmd, no_bgp_redistribute_ipv6_rmap_metric_cmd,
"no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
NO_STR NO_STR
@ -9762,22 +9696,8 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
"Pointer to route-map entries\n" "Pointer to route-map entries\n"
"Metric for redistributed routes\n" "Metric for redistributed routes\n"
"Default metric\n") "Default metric\n")
{
int type;
type = proto_redistnum (AFI_IP6, argv[0]); ALIAS (no_bgp_redistribute_ipv6,
if (type < 0 || type == ZEBRA_ROUTE_BGP)
{
vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
return CMD_WARNING;
}
bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
return CMD_SUCCESS;
}
ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
no_bgp_redistribute_ipv6_metric_rmap_cmd, no_bgp_redistribute_ipv6_metric_rmap_cmd,
"no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
NO_STR NO_STR

View File

@ -1419,35 +1419,6 @@ bgp_redistribute_unset (struct bgp *bgp, afi_t afi, int type)
return CMD_SUCCESS; return CMD_SUCCESS;
} }
/* Unset redistribution route-map configuration. */
int
bgp_redistribute_routemap_unset (struct bgp *bgp, afi_t afi, int type)
{
if (! bgp->rmap[afi][type].name)
return 0;
/* Unset route-map. */
free (bgp->rmap[afi][type].name);
bgp->rmap[afi][type].name = NULL;
bgp->rmap[afi][type].map = NULL;
return 1;
}
/* Unset redistribution metric configuration. */
int
bgp_redistribute_metric_unset (struct bgp *bgp, afi_t afi, int type)
{
if (! bgp->redist_metric_flag[afi][type])
return 0;
/* Unset metric. */
bgp->redist_metric_flag[afi][type] = 0;
bgp->redist_metric[afi][type] = 0;
return 1;
}
void void
bgp_zclient_reset (void) bgp_zclient_reset (void)
{ {

View File

@ -43,8 +43,6 @@ extern int bgp_redistribute_resend (struct bgp *, afi_t, int);
extern int bgp_redistribute_rmap_set (struct bgp *, afi_t, int, const char *); extern int bgp_redistribute_rmap_set (struct bgp *, afi_t, int, const char *);
extern int bgp_redistribute_metric_set (struct bgp *, afi_t, int, u_int32_t); extern int bgp_redistribute_metric_set (struct bgp *, afi_t, int, u_int32_t);
extern int bgp_redistribute_unset (struct bgp *, afi_t, int); extern int bgp_redistribute_unset (struct bgp *, afi_t, int);
extern int bgp_redistribute_routemap_unset (struct bgp *, afi_t, int);
extern int bgp_redistribute_metric_unset (struct bgp *, afi_t, int);
extern struct interface *if_lookup_by_ipv4 (struct in_addr *); extern struct interface *if_lookup_by_ipv4 (struct in_addr *);
extern struct interface *if_lookup_by_ipv4_exact (struct in_addr *); extern struct interface *if_lookup_by_ipv4_exact (struct in_addr *);