]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Fix neighbor coming up without an as specified
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 3 Sep 2015 13:50:16 +0000 (06:50 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 3 Sep 2015 13:50:16 +0000 (06:50 -0700)
Ticket: CM-7012
Reviwed by: CCR-3451
Testing: See bug

When you specify a neighbor <interface> <something>
and don't specify a remote-as the neighbor relationship
will still come up with ipv6 unnumbered if you have
RA configured on the interface.

bgpd/bgp_packet.c
bgpd/bgp_vty.c
bgpd/bgpd.c

index 6bc0ef5c063b687371a5b858b72775453ffd55a7..8531f37d786cdd8613b5b6be6970855a46840e05 100644 (file)
@@ -1011,7 +1011,17 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
     }
 
   /* Check neighbor as number. */
-  if (peer->as_type == AS_INTERNAL)
+  if (peer->as_type == AS_UNSPECIFIED)
+    {
+      if (bgp_debug_neighbor_events(peer))
+       zlog_debug("%s bad OPEN, remote AS is unspecified currently", peer->host);
+      bgp_notify_send_with_data(peer,
+                               BGP_NOTIFY_OPEN_ERR,
+                               BGP_NOTIFY_OPEN_BAD_PEER_AS,
+                               notify_data_remote_as, 2);
+      return -1;
+    }
+  else if (peer->as_type == AS_INTERNAL)
     {
       if (remote_as != peer->bgp->as)
        {
index 3a7b82b4468001624ed4afdce6a84606d6da282e..58b8f14919bc0b327d834b373f4c583369e9e7e8 100644 (file)
@@ -9498,7 +9498,12 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js
     }
   else
     {
-      vty_out (vty, "remote AS %u, ", p->as);
+      if ((p->as_type == AS_SPECIFIED) ||
+         (p->as_type == AS_EXTERNAL) ||
+         (p->as_type == AS_INTERNAL))
+       vty_out (vty, "remote AS %u, ", p->as);
+      else
+       vty_out (vty, "remote AS Unspecified, ");
       vty_out (vty, "local AS %u%s%s, ",
               p->change_local_as ? p->change_local_as : p->local_as,
               CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
index 8b5211ed5a475254352dd40fe1028011def384de..9bb95c51761528e2263c932009d31f8b49257ca6 100644 (file)
@@ -1371,9 +1371,9 @@ peer_conf_interface_get(struct bgp *bgp, const char *conf_if, afi_t afi,
     {
       if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4)
           && afi == AFI_IP && safi == SAFI_UNICAST)
-        peer = peer_create (NULL, conf_if, bgp, bgp->as, AS_SPECIFIED, 0, 0, 0);
+        peer = peer_create (NULL, conf_if, bgp, bgp->as, 0, AS_UNSPECIFIED, 0, 0);
       else
-        peer = peer_create (NULL, conf_if, bgp, bgp->as, AS_SPECIFIED, 0, afi, safi);
+        peer = peer_create (NULL, conf_if, bgp, bgp->as, 0, AS_UNSPECIFIED, afi, safi);
 
       if (peer && v6only)
        SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY);