mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-06 09:05:01 +00:00
Merge pull request #1201 from dwalton76/bgpd-debug-updates-prefix
Bgpd debug updates prefix
This commit is contained in:
commit
e74339e235
@ -119,7 +119,6 @@ dist_examples_DATA = bgpd.conf.sample bgpd.conf.sample2 \
|
|||||||
bgpd.conf.vnc.sample
|
bgpd.conf.vnc.sample
|
||||||
|
|
||||||
bgp_vty.o: bgp_vty_clippy.c
|
bgp_vty.o: bgp_vty_clippy.c
|
||||||
bgp_debug.o: bgp_debug_clippy.c
|
|
||||||
|
|
||||||
EXTRA_DIST = BGP4-MIB.txt
|
EXTRA_DIST = BGP4-MIB.txt
|
||||||
|
|
||||||
|
@ -865,39 +865,42 @@ DEFUN (no_debug_bgp_keepalive_peer,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef VTYSH_EXTRACT_PL
|
|
||||||
#include "bgp_debug_clippy.c"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* debug bgp bestpath */
|
/* debug bgp bestpath */
|
||||||
DEFPY (debug_bgp_bestpath_prefix,
|
DEFUN (debug_bgp_bestpath_prefix,
|
||||||
debug_bgp_bestpath_prefix_cmd,
|
debug_bgp_bestpath_prefix_cmd,
|
||||||
"debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>$bestpath",
|
"debug bgp bestpath <A.B.C.D/M|X:X::X:X/M>",
|
||||||
DEBUG_STR
|
DEBUG_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"BGP bestpath\n"
|
"BGP bestpath\n"
|
||||||
"IPv4 prefix\n"
|
"IPv4 prefix\n"
|
||||||
"IPv6 prefix\n")
|
"IPv6 prefix\n")
|
||||||
{
|
{
|
||||||
|
struct prefix *argv_p;
|
||||||
|
int idx_ipv4_ipv6_prefixlen = 3;
|
||||||
|
|
||||||
|
argv_p = prefix_new();
|
||||||
|
(void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
|
||||||
|
apply_mask(argv_p);
|
||||||
|
|
||||||
if (!bgp_debug_bestpath_prefixes)
|
if (!bgp_debug_bestpath_prefixes)
|
||||||
bgp_debug_bestpath_prefixes = list_new();
|
bgp_debug_bestpath_prefixes = list_new();
|
||||||
|
|
||||||
if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes, NULL,
|
if (bgp_debug_list_has_entry(bgp_debug_bestpath_prefixes, NULL,
|
||||||
bestpath)) {
|
argv_p)) {
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"BGP bestpath debugging is already enabled for %s\n",
|
"BGP bestpath debugging is already enabled for %s\n",
|
||||||
bestpath_str);
|
argv[idx_ipv4_ipv6_prefixlen]->arg);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bgp_debug_list_add_entry(bgp_debug_bestpath_prefixes, NULL, bestpath);
|
bgp_debug_list_add_entry(bgp_debug_bestpath_prefixes, NULL, argv_p);
|
||||||
|
|
||||||
if (vty->node == CONFIG_NODE) {
|
if (vty->node == CONFIG_NODE) {
|
||||||
DEBUG_ON(bestpath, BESTPATH);
|
DEBUG_ON(bestpath, BESTPATH);
|
||||||
} else {
|
} else {
|
||||||
TERM_DEBUG_ON(bestpath, BESTPATH);
|
TERM_DEBUG_ON(bestpath, BESTPATH);
|
||||||
vty_out(vty, "BGP bestpath debugging is on for %s\n",
|
vty_out(vty, "BGP bestpath debugging is on for %s\n",
|
||||||
bestpath_str);
|
argv[idx_ipv4_ipv6_prefixlen]->arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
@ -916,15 +919,10 @@ DEFUN (no_debug_bgp_bestpath_prefix,
|
|||||||
int idx_ipv4_ipv6_prefixlen = 4;
|
int idx_ipv4_ipv6_prefixlen = 4;
|
||||||
struct prefix *argv_p;
|
struct prefix *argv_p;
|
||||||
int found_prefix = 0;
|
int found_prefix = 0;
|
||||||
int ret;
|
|
||||||
|
|
||||||
argv_p = prefix_new();
|
argv_p = prefix_new();
|
||||||
ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
|
(void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
|
||||||
if (!ret) {
|
apply_mask(argv_p);
|
||||||
prefix_free(argv_p);
|
|
||||||
vty_out(vty, "%% Malformed Prefix\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bgp_debug_bestpath_prefixes
|
if (bgp_debug_bestpath_prefixes
|
||||||
&& !list_isempty(bgp_debug_bestpath_prefixes)) {
|
&& !list_isempty(bgp_debug_bestpath_prefixes)) {
|
||||||
@ -1267,16 +1265,10 @@ DEFUN (debug_bgp_update_prefix,
|
|||||||
{
|
{
|
||||||
int idx_ipv4_ipv6_prefixlen = 4;
|
int idx_ipv4_ipv6_prefixlen = 4;
|
||||||
struct prefix *argv_p;
|
struct prefix *argv_p;
|
||||||
int ret;
|
|
||||||
|
|
||||||
argv_p = prefix_new();
|
argv_p = prefix_new();
|
||||||
ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
|
(void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
|
||||||
if (!ret) {
|
apply_mask(argv_p);
|
||||||
prefix_free(argv_p);
|
|
||||||
vty_out(vty, "%% Malformed Prefix\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!bgp_debug_update_prefixes)
|
if (!bgp_debug_update_prefixes)
|
||||||
bgp_debug_update_prefixes = list_new();
|
bgp_debug_update_prefixes = list_new();
|
||||||
@ -1315,15 +1307,10 @@ DEFUN (no_debug_bgp_update_prefix,
|
|||||||
int idx_ipv4_ipv6_prefixlen = 5;
|
int idx_ipv4_ipv6_prefixlen = 5;
|
||||||
struct prefix *argv_p;
|
struct prefix *argv_p;
|
||||||
int found_prefix = 0;
|
int found_prefix = 0;
|
||||||
int ret;
|
|
||||||
|
|
||||||
argv_p = prefix_new();
|
argv_p = prefix_new();
|
||||||
ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
|
(void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
|
||||||
if (!ret) {
|
apply_mask(argv_p);
|
||||||
prefix_free(argv_p);
|
|
||||||
vty_out(vty, "%% Malformed Prefix\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bgp_debug_update_prefixes
|
if (bgp_debug_update_prefixes
|
||||||
&& !list_isempty(bgp_debug_update_prefixes)) {
|
&& !list_isempty(bgp_debug_update_prefixes)) {
|
||||||
@ -1411,15 +1398,10 @@ DEFUN (debug_bgp_zebra_prefix,
|
|||||||
{
|
{
|
||||||
int idx_ipv4_ipv6_prefixlen = 4;
|
int idx_ipv4_ipv6_prefixlen = 4;
|
||||||
struct prefix *argv_p;
|
struct prefix *argv_p;
|
||||||
int ret;
|
|
||||||
|
|
||||||
argv_p = prefix_new();
|
argv_p = prefix_new();
|
||||||
ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
|
(void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
|
||||||
if (!ret) {
|
apply_mask(argv_p);
|
||||||
prefix_free(argv_p);
|
|
||||||
vty_out(vty, "%% Malformed Prefix\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bgp_debug_zebra_prefixes)
|
if (!bgp_debug_zebra_prefixes)
|
||||||
bgp_debug_zebra_prefixes = list_new();
|
bgp_debug_zebra_prefixes = list_new();
|
||||||
@ -1476,15 +1458,10 @@ DEFUN (no_debug_bgp_zebra_prefix,
|
|||||||
int idx_ipv4_ipv6_prefixlen = 5;
|
int idx_ipv4_ipv6_prefixlen = 5;
|
||||||
struct prefix *argv_p;
|
struct prefix *argv_p;
|
||||||
int found_prefix = 0;
|
int found_prefix = 0;
|
||||||
int ret;
|
|
||||||
|
|
||||||
argv_p = prefix_new();
|
argv_p = prefix_new();
|
||||||
ret = str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
|
(void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
|
||||||
if (!ret) {
|
apply_mask(argv_p);
|
||||||
prefix_free(argv_p);
|
|
||||||
vty_out(vty, "%% Malformed Prefix\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bgp_debug_zebra_prefixes
|
if (bgp_debug_zebra_prefixes
|
||||||
&& !list_isempty(bgp_debug_zebra_prefixes)) {
|
&& !list_isempty(bgp_debug_zebra_prefixes)) {
|
||||||
|
@ -357,6 +357,7 @@ struct cmd_node {
|
|||||||
#define OSPF_RI_STR "OSPF Router Information specific commands\n"
|
#define OSPF_RI_STR "OSPF Router Information specific commands\n"
|
||||||
#define PCE_STR "PCE Router Information specific commands\n"
|
#define PCE_STR "PCE Router Information specific commands\n"
|
||||||
#define MPLS_STR "MPLS information\n"
|
#define MPLS_STR "MPLS information\n"
|
||||||
|
#define WATCHFRR_STR "watchfrr information\n"
|
||||||
|
|
||||||
#define CONF_BACKUP_EXT ".sav"
|
#define CONF_BACKUP_EXT ".sav"
|
||||||
|
|
||||||
|
@ -557,7 +557,15 @@ def line_for_vtysh_file(ctx_keys, line, delete):
|
|||||||
for ctx_key in ctx_keys:
|
for ctx_key in ctx_keys:
|
||||||
cmd.append(ctx_key)
|
cmd.append(ctx_key)
|
||||||
|
|
||||||
return '\n' + '\n'.join(cmd)
|
cmd = '\n' + '\n'.join(cmd)
|
||||||
|
|
||||||
|
# There are some commands that are on by default so their "no" form will be
|
||||||
|
# displayed in the config. "no bgp default ipv4-unicast" is one of these.
|
||||||
|
# If we need to remove this line we do so by adding "bgp default ipv4-unicast",
|
||||||
|
# not by doing a "no no bgp default ipv4-unicast"
|
||||||
|
cmd = cmd.replace('no no ', '')
|
||||||
|
|
||||||
|
return cmd
|
||||||
|
|
||||||
|
|
||||||
def get_normalized_ipv6_line(line):
|
def get_normalized_ipv6_line(line):
|
||||||
@ -931,6 +939,7 @@ def compare_context_objects(newconf, running):
|
|||||||
|
|
||||||
return (lines_to_add, lines_to_del)
|
return (lines_to_add, lines_to_del)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Command line options
|
# Command line options
|
||||||
parser = argparse.ArgumentParser(description='Dynamically apply diff in frr configs')
|
parser = argparse.ArgumentParser(description='Dynamically apply diff in frr configs')
|
||||||
@ -1143,7 +1152,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
_ = subprocess.check_output(cmd)
|
_ = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
|
|
||||||
@ -1188,7 +1197,7 @@ if __name__ == '__main__':
|
|||||||
fh.write(line + '\n')
|
fh.write(line + '\n')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.check_output(['/usr/bin/vtysh', '-f', filename])
|
subprocess.check_output(['/usr/bin/vtysh', '-f', filename], stderr=subprocess.STDOUT)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
log.warning("frr-reload.py failed due to\n%s" % e.output)
|
log.warning("frr-reload.py failed due to\n%s" % e.output)
|
||||||
reload_ok = False
|
reload_ok = False
|
||||||
|
@ -31,16 +31,6 @@
|
|||||||
pid_t integrated_write_pid;
|
pid_t integrated_write_pid;
|
||||||
static int integrated_result_fd;
|
static int integrated_result_fd;
|
||||||
|
|
||||||
DEFUN_NOSH(show_watchfrr_debugging,
|
|
||||||
show_watchfrr_debugging_cmd,
|
|
||||||
"show debugging [watchfrr]",
|
|
||||||
SHOW_STR
|
|
||||||
DEBUG_STR
|
|
||||||
"WatchFRR\n")
|
|
||||||
{
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN(config_write_integrated,
|
DEFUN(config_write_integrated,
|
||||||
config_write_integrated_cmd,
|
config_write_integrated_cmd,
|
||||||
"write integrated",
|
"write integrated",
|
||||||
@ -111,6 +101,16 @@ DEFUN(config_write_integrated,
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN_NOSH (show_debugging_watchfrr,
|
||||||
|
show_debugging_watchfrr_cmd,
|
||||||
|
"show debugging [watchfrr]",
|
||||||
|
SHOW_STR
|
||||||
|
DEBUG_STR
|
||||||
|
WATCHFRR_STR)
|
||||||
|
{
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
void integrated_write_sigchld(int status)
|
void integrated_write_sigchld(int status)
|
||||||
{
|
{
|
||||||
uint8_t reply[4] = {0, 0, 0, CMD_WARNING};
|
uint8_t reply[4] = {0, 0, 0, CMD_WARNING};
|
||||||
@ -144,5 +144,6 @@ void watchfrr_vty_init(void)
|
|||||||
{
|
{
|
||||||
integrated_write_pid = -1;
|
integrated_write_pid = -1;
|
||||||
install_element(ENABLE_NODE, &config_write_integrated_cmd);
|
install_element(ENABLE_NODE, &config_write_integrated_cmd);
|
||||||
install_element(ENABLE_NODE, &show_watchfrr_debugging_cmd);
|
install_element(ENABLE_NODE, &show_debugging_watchfrr_cmd);
|
||||||
|
install_element(CONFIG_NODE, &show_debugging_watchfrr_cmd);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ DEFUN (debug_zebra_events,
|
|||||||
"Debug option set for zebra events\n")
|
"Debug option set for zebra events\n")
|
||||||
{
|
{
|
||||||
zebra_debug_event = ZEBRA_DEBUG_EVENT;
|
zebra_debug_event = ZEBRA_DEBUG_EVENT;
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (debug_zebra_nht,
|
DEFUN (debug_zebra_nht,
|
||||||
@ -110,7 +110,7 @@ DEFUN (debug_zebra_nht,
|
|||||||
"Debug option set for zebra next hop tracking\n")
|
"Debug option set for zebra next hop tracking\n")
|
||||||
{
|
{
|
||||||
zebra_debug_nht = ZEBRA_DEBUG_NHT;
|
zebra_debug_nht = ZEBRA_DEBUG_NHT;
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (debug_zebra_mpls,
|
DEFUN (debug_zebra_mpls,
|
||||||
@ -121,7 +121,7 @@ DEFUN (debug_zebra_mpls,
|
|||||||
"Debug option set for zebra MPLS LSPs\n")
|
"Debug option set for zebra MPLS LSPs\n")
|
||||||
{
|
{
|
||||||
zebra_debug_mpls = ZEBRA_DEBUG_MPLS;
|
zebra_debug_mpls = ZEBRA_DEBUG_MPLS;
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (debug_zebra_vxlan,
|
DEFUN (debug_zebra_vxlan,
|
||||||
@ -132,7 +132,7 @@ DEFUN (debug_zebra_vxlan,
|
|||||||
"Debug option set for zebra VxLAN (EVPN)\n")
|
"Debug option set for zebra VxLAN (EVPN)\n")
|
||||||
{
|
{
|
||||||
zebra_debug_vxlan = ZEBRA_DEBUG_VXLAN;
|
zebra_debug_vxlan = ZEBRA_DEBUG_VXLAN;
|
||||||
return CMD_WARNING;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (debug_zebra_pw,
|
DEFUN (debug_zebra_pw,
|
||||||
@ -147,7 +147,7 @@ DEFUN (debug_zebra_pw,
|
|||||||
UNSET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW);
|
UNSET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW);
|
||||||
else
|
else
|
||||||
SET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW);
|
SET_FLAG(zebra_debug_pw, ZEBRA_DEBUG_PW);
|
||||||
return CMD_WARNING;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (debug_zebra_packet,
|
DEFUN (debug_zebra_packet,
|
||||||
|
Loading…
Reference in New Issue
Block a user