]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: do not allow prefix length on update-source
authorDon Slice <dslice@cumulusnetworks.com>
Thu, 5 Jan 2017 18:49:23 +0000 (10:49 -0800)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 30 Jan 2017 18:40:53 +0000 (13:40 -0500)
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
bgpd/bgp_vty.c

index a27a5f6b26a328c9ea997ea9707eec38d4c80cad..52ce1273c3e4e0534cc06f0aa5f7fdab4f85bdba 100644 (file)
@@ -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);