summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Slice <dslice@cumulusnetworks.com>2017-01-05 10:49:23 -0800
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-01-30 13:40:53 -0500
commit3b69fd51184da846df41c40e8ebbbdc356f3aa8a (patch)
tree236a9e9fafae1ed01dc292572a15294855cd94e6
parenta27647f946b1eb3b83c824942e36762038bf79f5 (diff)
bgpd: do not allow prefix length on update-source
A common misconfiguration that was silently accepted but wouldn't work was including the prefix length on the update-source; i.e. 10.1.1.1/32. This commit rejects this config and notifies the user. Ticket: CM-13485 Signed-off-by: Don Slice <dslice@cumulusnetworks.com. Reviewed-by: Donald Sharp
-rw-r--r--bgpd/bgp_vty.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index a27a5f6b26..52ce1273c3 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -4714,6 +4714,7 @@ peer_update_source_vty (struct vty *vty, const char *peer_str,
const char *source_str)
{
struct peer *peer;
+ struct prefix p;
peer = peer_and_group_lookup_vty (vty, peer_str);
if (! peer)
@@ -4730,7 +4731,16 @@ peer_update_source_vty (struct vty *vty, const char *peer_str,
if (ret == 0)
peer_update_source_addr_set (peer, &su);
else
- peer_update_source_if_set (peer, source_str);
+ {
+ if (str2prefix (source_str, &p))
+ {
+ vty_out (vty, "%% Invalid update-source, remove prefix length %s",
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ else
+ peer_update_source_if_set (peer, source_str);
+ }
}
else
peer_update_source_unset (peer);