summaryrefslogtreecommitdiff
path: root/bgpd/bgp_debug.c
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2017-09-19 13:38:35 +0000
committerDaniel Walton <dwalton@cumulusnetworks.com>2017-09-19 13:38:35 +0000
commit0be4b77cda0a8c16985a2a3a0186c492e095da3c (patch)
treedc1fcdad9b89a22c64158181cf3f1d3bac808012 /bgpd/bgp_debug.c
parent8ad1fe6cae1b1e4b17448b1b7a64651e53ffaa3a (diff)
bgpd: debugs on subnets need to use apply_mask()
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> You could configure something bogus like "debug bgp updates prefix 10.1.1.1/16", this needs to be converted to "10.1.0.0/16"
Diffstat (limited to 'bgpd/bgp_debug.c')
-rw-r--r--bgpd/bgp_debug.c53
1 files changed, 17 insertions, 36 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index c1c4f2b39c..e4ebb6af2f 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -879,6 +879,13 @@ DEFPY (debug_bgp_bestpath_prefix,
"IPv4 prefix\n"
"IPv6 prefix\n")
{
+ struct prefix *argv_p;
+ int idx_ipv4_ipv6_prefixlen = 3;
+
+ argv_p = prefix_new();
+ str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
+
if (!bgp_debug_bestpath_prefixes)
bgp_debug_bestpath_prefixes = list_new();
@@ -916,15 +923,10 @@ DEFUN (no_debug_bgp_bestpath_prefix,
int idx_ipv4_ipv6_prefixlen = 4;
struct prefix *argv_p;
int found_prefix = 0;
- int ret;
argv_p = prefix_new();
- ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- if (!ret) {
- prefix_free(argv_p);
- vty_out(vty, "%% Malformed Prefix\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
+ str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
if (bgp_debug_bestpath_prefixes
&& !list_isempty(bgp_debug_bestpath_prefixes)) {
@@ -1267,16 +1269,10 @@ DEFUN (debug_bgp_update_prefix,
{
int idx_ipv4_ipv6_prefixlen = 4;
struct prefix *argv_p;
- int ret;
argv_p = prefix_new();
- ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- if (!ret) {
- prefix_free(argv_p);
- vty_out(vty, "%% Malformed Prefix\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
+ str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
if (!bgp_debug_update_prefixes)
bgp_debug_update_prefixes = list_new();
@@ -1315,15 +1311,10 @@ DEFUN (no_debug_bgp_update_prefix,
int idx_ipv4_ipv6_prefixlen = 5;
struct prefix *argv_p;
int found_prefix = 0;
- int ret;
argv_p = prefix_new();
- ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- if (!ret) {
- prefix_free(argv_p);
- vty_out(vty, "%% Malformed Prefix\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
+ str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
if (bgp_debug_update_prefixes
&& !list_isempty(bgp_debug_update_prefixes)) {
@@ -1411,15 +1402,10 @@ DEFUN (debug_bgp_zebra_prefix,
{
int idx_ipv4_ipv6_prefixlen = 4;
struct prefix *argv_p;
- int ret;
argv_p = prefix_new();
- ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- if (!ret) {
- prefix_free(argv_p);
- vty_out(vty, "%% Malformed Prefix\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
+ str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
if (!bgp_debug_zebra_prefixes)
bgp_debug_zebra_prefixes = list_new();
@@ -1476,15 +1462,10 @@ DEFUN (no_debug_bgp_zebra_prefix,
int idx_ipv4_ipv6_prefixlen = 5;
struct prefix *argv_p;
int found_prefix = 0;
- int ret;
argv_p = prefix_new();
- ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- if (!ret) {
- prefix_free(argv_p);
- vty_out(vty, "%% Malformed Prefix\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
+ str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
+ apply_mask(argv_p);
if (bgp_debug_zebra_prefixes
&& !list_isempty(bgp_debug_zebra_prefixes)) {