---
bgpd/bgp_attr.c | 3 ++-
bgpd/bgp_debug.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
bgpd/bgp_debug.h | 3 +++
3 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index c4a32c9..1014fa7 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1249,7 +1249,8 @@ bgp_attr_nexthop (struct bgp_attr_parser_args *args)
gets ignored in any of these cases. */
nexthop_n = stream_get_ipv4 (peer->ibuf);
nexthop_h = ntohl (nexthop_n);
- if (IPV4_NET0 (nexthop_h) || IPV4_NET127 (nexthop_h) || IPV4_CLASS_DE
(nexthop_h))
+ if ((IPV4_NET0 (nexthop_h) || IPV4_NET127 (nexthop_h) || IPV4_CLASS_DE
(nexthop_h))
+ && !BGP_DEBUG (allow_martians, ALLOW_MARTIANS)) /* loopbacks may be used
in testing */
{
char buf[INET_ADDRSTRLEN];
inet_ntop (AF_INET, &nexthop_n, buf, INET_ADDRSTRLEN);
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index 60e2777..90a378b 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -46,6 +46,7 @@ unsigned long conf_bgp_debug_keepalive;
unsigned long conf_bgp_debug_update;
unsigned long conf_bgp_debug_normal;
unsigned long conf_bgp_debug_zebra;
+unsigned long conf_bgp_debug_allow_martians;
unsigned long term_bgp_debug_as4;
unsigned long term_bgp_debug_fsm;
@@ -56,6 +57,7 @@ unsigned long term_bgp_debug_keepalive;
unsigned long term_bgp_debug_update;
unsigned long term_bgp_debug_normal;
unsigned long term_bgp_debug_zebra;
+unsigned long term_bgp_debug_allow_martians;
/* messages for BGP-4 status */
const struct message bgp_status_msg[] =
@@ -725,6 +727,48 @@ ALIAS (no_debug_bgp_zebra,
BGP_STR
"BGP Zebra messages\n")
+DEFUN (debug_bgp_allow_martians,
+ debug_bgp_allow_martians_cmd,
+ "debug bgp allow-martians",
+ DEBUG_STR
+ BGP_STR
+ "BGP allow martian next hops\n")
+{
+ if (vty->node == CONFIG_NODE)
+ DEBUG_ON (allow_martians, ALLOW_MARTIANS);
+ else
+ {
+ TERM_DEBUG_ON (allow_martians, ALLOW_MARTIANS);
+ vty_out (vty, "BGP allow_martian next hop debugging is on%s",
VTY_NEWLINE);
+ }
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_bgp_allow_martians,
+ no_debug_bgp_allow_martians_cmd,
+ "no debug bgp allow-martians",
+ NO_STR
+ DEBUG_STR
+ BGP_STR
+ "BGP allow martian next hops\n")
+{
+ if (vty->node == CONFIG_NODE)
+ DEBUG_OFF (allow_martians, ALLOW_MARTIANS);
+ else
+ {
+ TERM_DEBUG_OFF (allow_martians, ALLOW_MARTIANS);
+ vty_out (vty, "BGP allow martian next hop debugging is off%s",
VTY_NEWLINE);
+ }
+ return CMD_SUCCESS;
+}
+
+ALIAS (no_debug_bgp_allow_martians,
+ undebug_bgp_allow_martians_cmd,
+ "undebug bgp allow-martians",
+ UNDEBUG_STR
+ BGP_STR
+ "BGP allow martian next hops\n")
+
DEFUN (no_debug_bgp_all,
no_debug_bgp_all_cmd,
"no debug all bgp",
@@ -743,6 +787,7 @@ DEFUN (no_debug_bgp_all,
TERM_DEBUG_OFF (fsm, FSM);
TERM_DEBUG_OFF (filter, FILTER);
TERM_DEBUG_OFF (zebra, ZEBRA);
+ TERM_DEBUG_OFF (allow_martians, ALLOW_MARTIANS);
vty_out (vty, "All possible debugging has been turned off%s", VTY_NEWLINE);
return CMD_SUCCESS;
@@ -786,6 +831,8 @@ DEFUN (show_debugging_bgp,
vty_out (vty, " BGP as4 debugging is on%s", VTY_NEWLINE);
if (BGP_DEBUG (as4, AS4_SEGMENT))
vty_out (vty, " BGP as4 aspath segment debugging is on%s", VTY_NEWLINE);
+ if (BGP_DEBUG (allow_martians, ALLOW_MARTIANS))
+ vty_out (vty, " BGP allow martian next hop debugging is on%s",
VTY_NEWLINE);
vty_out (vty, "%s", VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -859,6 +906,12 @@ bgp_config_write_debug (struct vty *vty)
write++;
}
+ if (CONF_BGP_DEBUG (allow_martians, ALLOW_MARTIANS))
+ {
+ vty_out (vty, "debug bgp allow-martians%s", VTY_NEWLINE);
+ write++;
+ }
+
return write;
}
@@ -897,6 +950,8 @@ bgp_debug_init (void)
install_element (CONFIG_NODE, &debug_bgp_normal_cmd);
install_element (ENABLE_NODE, &debug_bgp_zebra_cmd);
install_element (CONFIG_NODE, &debug_bgp_zebra_cmd);
+ install_element (ENABLE_NODE, &debug_bgp_allow_martians_cmd);
+ install_element (CONFIG_NODE, &debug_bgp_allow_martians_cmd);
install_element (ENABLE_NODE, &no_debug_bgp_as4_cmd);
install_element (ENABLE_NODE, &undebug_bgp_as4_cmd);
@@ -926,6 +981,9 @@ bgp_debug_init (void)
install_element (ENABLE_NODE, &no_debug_bgp_zebra_cmd);
install_element (ENABLE_NODE, &undebug_bgp_zebra_cmd);
install_element (CONFIG_NODE, &no_debug_bgp_zebra_cmd);
+ install_element (ENABLE_NODE, &no_debug_bgp_allow_martians_cmd);
+ install_element (ENABLE_NODE, &undebug_bgp_allow_martians_cmd);
+ install_element (CONFIG_NODE, &no_debug_bgp_allow_martians_cmd);
install_element (ENABLE_NODE, &no_debug_bgp_all_cmd);
install_element (ENABLE_NODE, &undebug_bgp_all_cmd);
}
diff --git a/bgpd/bgp_debug.h b/bgpd/bgp_debug.h
index ce8547b..42cbd7e 100644
--- a/bgpd/bgp_debug.h
+++ b/bgpd/bgp_debug.h
@@ -67,6 +67,7 @@ extern unsigned long conf_bgp_debug_keepalive;
extern unsigned long conf_bgp_debug_update;
extern unsigned long conf_bgp_debug_normal;
extern unsigned long conf_bgp_debug_zebra;
+extern unsigned long conf_bgp_debug_allow_martians;
extern unsigned long term_bgp_debug_as4;
extern unsigned long term_bgp_debug_fsm;
@@ -77,6 +78,7 @@ extern unsigned long term_bgp_debug_keepalive;
extern unsigned long term_bgp_debug_update;
extern unsigned long term_bgp_debug_normal;
extern unsigned long term_bgp_debug_zebra;
+extern unsigned long term_bgp_debug_allow_martians;
#define BGP_DEBUG_AS4 0x01
#define BGP_DEBUG_AS4_SEGMENT 0x02
@@ -90,6 +92,7 @@ extern unsigned long term_bgp_debug_zebra;
#define BGP_DEBUG_UPDATE_OUT 0x02
#define BGP_DEBUG_NORMAL 0x01
#define BGP_DEBUG_ZEBRA 0x01
+#define BGP_DEBUG_ALLOW_MARTIANS 0x01
#define BGP_DEBUG_PACKET_SEND 0x01
#define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
--
2.1.3
_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev