]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Display the BGP ipv4 unicast configuration under "address-family ipv4 unicast".
authorDaniel Walton <dwalton@cumulusnetworks.com>
Tue, 20 Oct 2015 22:00:40 +0000 (22:00 +0000)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Tue, 20 Oct 2015 22:00:40 +0000 (22:00 +0000)
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Ticket: CM-6739

Before
router bgp 10
 bgp router-id 10.1.1.1
 bgp log-neighbor-changes
 no bgp default ipv4-unicast
 network 9.9.9.9/32
 neighbor 10.1.1.2 remote-as 10
 neighbor 10.1.1.2 shutdown
 neighbor 10.1.1.2 update-source lo
 neighbor 10.1.1.2 advertisement-interval 1
 neighbor 10.1.1.2 timers connect 10
 neighbor 10.1.1.2 activate
 neighbor 10.1.1.2 next-hop-self
 neighbor 10.1.1.2 route-map BAR in
 neighbor 10.1.1.2 route-map FOO out
 neighbor 20.1.2.2 remote-as 20
 neighbor 20.1.2.2 shutdown
 neighbor 20.1.2.2 advertisement-interval 1
 neighbor 20.1.2.2 timers connect 10
 neighbor 20.1.2.2 activate
 neighbor 20.1.2.2 route-map HAA in
 neighbor 20.1.2.2 route-map BOO out
!
 address-family ipv6
 network 2001:1:1:1::/64
 exit-address-family
!

After
!
router bgp 10
 bgp router-id 10.1.1.1
 bgp log-neighbor-changes
 no bgp default ipv4-unicast
 no bgp network import-check
 neighbor 10.1.1.2 remote-as 10
 neighbor 10.1.1.2 shutdown
 neighbor 10.1.1.2 update-source lo
 neighbor 10.1.1.2 advertisement-interval 1
 neighbor 10.1.1.2 timers connect 10
 neighbor 20.1.2.2 remote-as 20
 neighbor 20.1.2.2 shutdown
 neighbor 20.1.2.2 advertisement-interval 1
 neighbor 20.1.2.2 timers connect 10
!
 address-family ipv4 unicast
  network 9.9.9.9/32
  neighbor 10.1.1.2 activate
  neighbor 10.1.1.2 next-hop-self
  neighbor 10.1.1.2 route-map BAR in
  neighbor 10.1.1.2 route-map FOO out
  neighbor 20.1.2.2 activate
  neighbor 20.1.2.2 route-map HAA in
  neighbor 20.1.2.2 route-map BOO out
 exit-address-family
!
 address-family ipv6 unicast
  network 2001:1:1:1::/64
 exit-address-family
!

bgpd/bgp_route.c
bgpd/bgp_vty.c
bgpd/bgpd.c
tools/quagga-reload.py
vtysh/vtysh_config.c

index 42613d49b58030f340ea4827f8cabc225eb64275..08262535197fc458d35fa921aa6df6865323ba6a 100644 (file)
@@ -4849,7 +4849,7 @@ bgp_config_write_table_map (struct vty *vty, struct bgp *bgp, afi_t afi,
   if (bgp->table_map[afi][safi].name)
     {
       bgp_config_write_family_header (vty, afi, safi, write);
-      vty_out (vty, " table-map %s%s",
+      vty_out (vty, "  table-map %s%s",
               bgp->table_map[afi][safi].name, VTY_NEWLINE);
     }
 
@@ -15141,7 +15141,7 @@ bgp_config_write_network_vpnv4 (struct vty *vty, struct bgp *bgp,
            prefix_rd2str (prd, rdbuf, RD_ADDRSTRLEN);
            label = decode_label (bgp_static->tag);
 
-           vty_out (vty, " network %s/%d rd %s tag %d",
+           vty_out (vty, "  network %s/%d rd %s tag %d",
                     inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), 
                     p->prefixlen,
                     rdbuf, label);
@@ -15182,7 +15182,7 @@ bgp_config_write_network (struct vty *vty, struct bgp *bgp,
 
            destination = ntohl (p->u.prefix4.s_addr);
            masklen2ip (p->prefixlen, &netmask);
-           vty_out (vty, " network %s",
+           vty_out (vty, "  network %s",
                     inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN));
 
            if ((IN_CLASSC (destination) && p->prefixlen == 24)
@@ -15197,7 +15197,7 @@ bgp_config_write_network (struct vty *vty, struct bgp *bgp,
          }
        else
          {
-           vty_out (vty, " network %s/%d",
+           vty_out (vty, "  network %s/%d",
                     inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN), 
                     p->prefixlen);
          }
@@ -15227,13 +15227,13 @@ bgp_config_write_network (struct vty *vty, struct bgp *bgp,
            struct in_addr netmask;
 
            masklen2ip (p->prefixlen, &netmask);
-           vty_out (vty, " aggregate-address %s %s",
+           vty_out (vty, "  aggregate-address %s %s",
                     inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
                     inet_ntoa (netmask));
          }
        else
          {
-           vty_out (vty, " aggregate-address %s/%d",
+           vty_out (vty, "  aggregate-address %s/%d",
                     inet_ntop (p->family, &p->u.prefix, buf, SU_ADDRSTRLEN),
                     p->prefixlen);
          }
index 8c5a1762c98fc3fd0b8272fbf11e67bf5fdbcaa3..bd124aa7837dca49efab8a4e03f9071d955b2f3f 100644 (file)
@@ -1466,14 +1466,14 @@ bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
   if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
     {
       bgp_config_write_family_header (vty, afi, safi, write);
-      vty_out (vty, " maximum-paths %d%s",
+      vty_out (vty, "  maximum-paths %d%s",
               bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
     }
 
   if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
     {
       bgp_config_write_family_header (vty, afi, safi, write);
-      vty_out (vty, " maximum-paths ibgp %d",
+      vty_out (vty, "  maximum-paths ibgp %d",
               bgp->maxpaths[afi][safi].maxpaths_ibgp);
       if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags,
                      BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN))
@@ -12440,7 +12440,7 @@ bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
               bgp_config_write_family_header (vty, afi, safi, write);
 
               /* "redistribute" configuration.  */
-              vty_out (vty, " redistribute %s", zebra_route_string(i));
+              vty_out (vty, "  redistribute %s", zebra_route_string(i));
               if (red->instance)
                 vty_out (vty, " %d", red->instance);
               if (red->redist_metric_flag)
index 4d9c614d27a3630310b575ecb1fd2fa880fc8f14..ee77082cff5f488331a221d9ab4a59ffe9f6b159 100644 (file)
@@ -6060,61 +6060,61 @@ bgp_config_write_filter (struct vty *vty, struct peer *peer,
   if (filter->dlist[in].name)
     if (! gfilter || ! gfilter->dlist[in].name
        || strcmp (filter->dlist[in].name, gfilter->dlist[in].name) != 0)
-    vty_out (vty, " neighbor %s distribute-list %s in%s", addr, 
+    vty_out (vty, "  neighbor %s distribute-list %s in%s", addr,
             filter->dlist[in].name, VTY_NEWLINE);
   if (filter->dlist[out].name && ! gfilter)
-    vty_out (vty, " neighbor %s distribute-list %s out%s", addr, 
+    vty_out (vty, "  neighbor %s distribute-list %s out%s", addr,
             filter->dlist[out].name, VTY_NEWLINE);
 
   /* prefix-list. */
   if (filter->plist[in].name)
     if (! gfilter || ! gfilter->plist[in].name
        || strcmp (filter->plist[in].name, gfilter->plist[in].name) != 0)
-    vty_out (vty, " neighbor %s prefix-list %s in%s", addr, 
+    vty_out (vty, "  neighbor %s prefix-list %s in%s", addr,
             filter->plist[in].name, VTY_NEWLINE);
   if (filter->plist[out].name && ! gfilter)
-    vty_out (vty, " neighbor %s prefix-list %s out%s", addr, 
+    vty_out (vty, "  neighbor %s prefix-list %s out%s", addr,
             filter->plist[out].name, VTY_NEWLINE);
 
   /* route-map. */
   if (filter->map[RMAP_IN].name)
     if (! gfilter || ! gfilter->map[RMAP_IN].name
        || strcmp (filter->map[RMAP_IN].name, gfilter->map[RMAP_IN].name) != 0)
-      vty_out (vty, " neighbor %s route-map %s in%s", addr, 
+      vty_out (vty, "  neighbor %s route-map %s in%s", addr,
               filter->map[RMAP_IN].name, VTY_NEWLINE);
   if (filter->map[RMAP_OUT].name && ! gfilter)
-    vty_out (vty, " neighbor %s route-map %s out%s", addr, 
+    vty_out (vty, "  neighbor %s route-map %s out%s", addr,
             filter->map[RMAP_OUT].name, VTY_NEWLINE);
   if (filter->map[RMAP_IMPORT].name && ! gfilter)
-    vty_out (vty, " neighbor %s route-map %s import%s", addr,
+    vty_out (vty, "  neighbor %s route-map %s import%s", addr,
         filter->map[RMAP_IMPORT].name, VTY_NEWLINE);
   if (filter->map[RMAP_EXPORT].name)
     if (! gfilter || ! gfilter->map[RMAP_EXPORT].name
     || strcmp (filter->map[RMAP_EXPORT].name,
                     gfilter->map[RMAP_EXPORT].name) != 0)
-    vty_out (vty, " neighbor %s route-map %s export%s", addr,
+    vty_out (vty, "  neighbor %s route-map %s export%s", addr,
         filter->map[RMAP_EXPORT].name, VTY_NEWLINE);
 
   /* unsuppress-map */
   if (filter->usmap.name && ! gfilter)
-    vty_out (vty, " neighbor %s unsuppress-map %s%s", addr,
+    vty_out (vty, "  neighbor %s unsuppress-map %s%s", addr,
             filter->usmap.name, VTY_NEWLINE);
 
   /* filter-list. */
   if (filter->aslist[in].name)
     if (! gfilter || ! gfilter->aslist[in].name
        || strcmp (filter->aslist[in].name, gfilter->aslist[in].name) != 0)
-      vty_out (vty, " neighbor %s filter-list %s in%s", addr, 
+      vty_out (vty, "  neighbor %s filter-list %s in%s", addr,
               filter->aslist[in].name, VTY_NEWLINE);
   if (filter->aslist[out].name && ! gfilter)
-    vty_out (vty, " neighbor %s filter-list %s out%s", addr, 
+    vty_out (vty, "  neighbor %s filter-list %s out%s", addr,
             filter->aslist[out].name, VTY_NEWLINE);
 }
 
 /* BGP peer configuration display function. */
 static void
-bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
-                      struct peer *peer, afi_t afi, safi_t safi)
+bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp,
+                             struct peer *peer)
 {
   struct peer *g_peer = NULL;
   char buf[SU_ADDRSTRLEN];
@@ -6135,244 +6135,325 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
   /************************************
    ****** Global to the neighbor ******
    ************************************/
-  if (afi == AFI_IP && safi == SAFI_UNICAST)
+  if (peer->conf_if)
     {
-      if (peer->conf_if)
-       {
-         if (CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))
-             vty_out (vty, " neighbor %s interface v6only %s", addr, VTY_NEWLINE);
-         else
-           vty_out (vty, " neighbor %s interface%s", addr, VTY_NEWLINE);
-       }
+      if (CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))
+        vty_out (vty, " neighbor %s interface v6only %s", addr, VTY_NEWLINE);
+      else
+        vty_out (vty, " neighbor %s interface%s", addr, VTY_NEWLINE);
+    }
 
-      /* remote-as. */
-      if (! peer_group_active (peer))
+  /* remote-as */
+  if (! peer_group_active (peer))
+    {
+      if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
+        {
+          vty_out (vty, " neighbor %s peer-group%s", addr,
+                   VTY_NEWLINE);
+        }
+
+      if (peer->as_type == AS_SPECIFIED)
        {
-         if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
-           vty_out (vty, " neighbor %s peer-group%s", addr,
-                    VTY_NEWLINE);
-         if (peer->as_type == AS_SPECIFIED)
-           {
              vty_out (vty, " neighbor %s remote-as %u%s", addr, peer->as,
                       VTY_NEWLINE);
-           }
-         else if (peer->as_type == AS_INTERNAL)
-           {
+       }
+      else if (peer->as_type == AS_INTERNAL)
+       {
              vty_out (vty, " neighbor %s remote-as internal%s", addr, VTY_NEWLINE);
-           }
-         else if (peer->as_type == AS_EXTERNAL)
-           {
-             vty_out (vty, " neighbor %s remote-as external%s", addr, VTY_NEWLINE);
-           }
        }
-      else
+      else if (peer->as_type == AS_EXTERNAL)
        {
-         if (! g_peer->as)
-           {
-             if (peer->as_type == AS_SPECIFIED)
-               {
-                 vty_out (vty, " neighbor %s remote-as %u%s", addr, peer->as,
-                          VTY_NEWLINE);
-               }
-             else if (peer->as_type == AS_INTERNAL)
-               {
-                 vty_out (vty, " neighbor %s remote-as internal%s", addr, VTY_NEWLINE);
-               }
-             else if (peer->as_type == AS_EXTERNAL)
-               {
-                 vty_out (vty, " neighbor %s remote-as external%s", addr, VTY_NEWLINE);
-               }
-           }
-         if (peer->af_group[AFI_IP][SAFI_UNICAST])
-           vty_out (vty, " neighbor %s peer-group %s%s", addr,
-                    peer->group->name, VTY_NEWLINE);
+             vty_out (vty, " neighbor %s remote-as external%s", addr, VTY_NEWLINE);
        }
+    }
+  else
+    {
+      if (! g_peer->as)
+        {
+          if (peer->as_type == AS_SPECIFIED)
+            {
+              vty_out (vty, " neighbor %s remote-as %u%s", addr, peer->as,
+                       VTY_NEWLINE);
+            }
+          else if (peer->as_type == AS_INTERNAL)
+            {
+              vty_out (vty, " neighbor %s remote-as internal%s", addr, VTY_NEWLINE);
+            }
+          else if (peer->as_type == AS_EXTERNAL)
+            {
+              vty_out (vty, " neighbor %s remote-as external%s", addr, VTY_NEWLINE);
+            }
+        }
+      if (peer->af_group[AFI_IP][SAFI_UNICAST])
+        {
+          vty_out (vty, " neighbor %s peer-group %s%s", addr,
+                   peer->group->name, VTY_NEWLINE);
+        }
+    }
 
-      /* local-as. */
-      if (peer->change_local_as)
-       if (! peer_group_active (peer))
-         vty_out (vty, " neighbor %s local-as %u%s%s%s", addr,
-                  peer->change_local_as,
-                  CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
-                  " no-prepend" : "",
-                  CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
-                  " replace-as" : "", VTY_NEWLINE);
-
-      /* Description. */
-      if (peer->desc)
-       vty_out (vty, " neighbor %s description %s%s", addr, peer->desc,
-                VTY_NEWLINE);
+  /* local-as */
+  if (peer->change_local_as)
+    {
+      if (! peer_group_active (peer))
+        {
+          vty_out (vty, " neighbor %s local-as %u%s%s%s", addr,
+                   peer->change_local_as,
+                   CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
+                   " no-prepend" : "",
+                   CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
+                   " replace-as" : "", VTY_NEWLINE);
+        }
+    }
 
-      /* Shutdown. */
-      if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
-        if (! peer_group_active (peer) ||
-           ! CHECK_FLAG (g_peer->flags, PEER_FLAG_SHUTDOWN))
-         vty_out (vty, " neighbor %s shutdown%s", addr, VTY_NEWLINE);
+  /* description */
+  if (peer->desc)
+    {
+      vty_out (vty, " neighbor %s description %s%s", addr, peer->desc,
+               VTY_NEWLINE);
+    }
 
-      /* bfd. */
-      if (peer->bfd_info)
-        if (! peer_group_active (peer) || ! g_peer->bfd_info)
-          {
-            bgp_bfd_peer_config_write(vty, peer, addr);
-          }
+  /* shutdown */
+  if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
+    {
+      if (! peer_group_active (peer) ||
+          ! CHECK_FLAG (g_peer->flags, PEER_FLAG_SHUTDOWN))
+        {
+          vty_out (vty, " neighbor %s shutdown%s", addr, VTY_NEWLINE);
+        }
+    }
 
-      /* Password. */
-      if (peer->password)
-       if (!peer_group_active (peer)
-           || ! g_peer->password
-           || strcmp (peer->password, g_peer->password) != 0)
-         vty_out (vty, " neighbor %s password %s%s", addr, peer->password,
-                  VTY_NEWLINE);
-
-      /* neighbor solo */
-      if (CHECK_FLAG(peer->flags, PEER_FLAG_LONESOUL))
-       if (!peer_group_active (peer))
-         vty_out (vty, " neighbor %s solo%s", addr, VTY_NEWLINE);
-
-      /* BGP port. */
-      if (peer->port != BGP_PORT_DEFAULT)
-       vty_out (vty, " neighbor %s port %d%s", addr, peer->port,
-                VTY_NEWLINE);
+  /* bfd */
+  if (peer->bfd_info)
+    {
+      if (! peer_group_active (peer) || ! g_peer->bfd_info)
+        {
+          bgp_bfd_peer_config_write(vty, peer, addr);
+        }
+    }
 
-      /* Local interface name. */
-      if (peer->ifname)
-       vty_out (vty, " neighbor %s interface %s%s", addr, peer->ifname,
-                VTY_NEWLINE);
-  
-      /* Passive. */
-      if (CHECK_FLAG (peer->flags, PEER_FLAG_PASSIVE))
-        if (! peer_group_active (peer) ||
-           ! CHECK_FLAG (g_peer->flags, PEER_FLAG_PASSIVE))
-         vty_out (vty, " neighbor %s passive%s", addr, VTY_NEWLINE);
-
-      /* EBGP multihop.  */
-      if (peer->sort != BGP_PEER_IBGP && peer->ttl != 1 &&
-                   !(peer->gtsm_hops != 0 && peer->ttl == MAXTTL))
-        if (! peer_group_active (peer) ||
-           g_peer->ttl != peer->ttl)
-         vty_out (vty, " neighbor %s ebgp-multihop %d%s", addr, peer->ttl,
-                  VTY_NEWLINE);
-
-     /* ttl-security hops */
-      if (peer->gtsm_hops != 0)
-        if (! peer_group_active (peer) || g_peer->gtsm_hops != peer->gtsm_hops)
+  /* password */
+  if (peer->password)
+    {
+      if (!peer_group_active (peer)
+          || ! g_peer->password
+          || strcmp (peer->password, g_peer->password) != 0)
+        {
+          vty_out (vty, " neighbor %s password %s%s", addr, peer->password,
+                   VTY_NEWLINE);
+        }
+    }
+
+  /* neighbor solo */
+  if (CHECK_FLAG(peer->flags, PEER_FLAG_LONESOUL))
+    {
+      if (!peer_group_active (peer))
+        {
+          vty_out (vty, " neighbor %s solo%s", addr, VTY_NEWLINE);
+        }
+    }
+
+  /* BGP port */
+  if (peer->port != BGP_PORT_DEFAULT)
+    {
+      vty_out (vty, " neighbor %s port %d%s", addr, peer->port,
+               VTY_NEWLINE);
+    }
+
+  /* Local interface name */
+  if (peer->ifname)
+    {
+      vty_out (vty, " neighbor %s interface %s%s", addr, peer->ifname,
+               VTY_NEWLINE);
+    }
+
+  /* passive */
+  if (CHECK_FLAG (peer->flags, PEER_FLAG_PASSIVE))
+    {
+      if (! peer_group_active (peer) ||
+          ! CHECK_FLAG (g_peer->flags, PEER_FLAG_PASSIVE))
+        {
+          vty_out (vty, " neighbor %s passive%s", addr, VTY_NEWLINE);
+        }
+    }
+
+  /* ebgp-multihop */
+  if (peer->sort != BGP_PEER_IBGP && peer->ttl != 1 &&
+      !(peer->gtsm_hops != 0 && peer->ttl == MAXTTL))
+    {
+      if (! peer_group_active (peer) || g_peer->ttl != peer->ttl)
+        {
+          vty_out (vty, " neighbor %s ebgp-multihop %d%s", addr, peer->ttl,
+                   VTY_NEWLINE);
+        }
+    }
+
+  /* ttl-security hops */
+  if (peer->gtsm_hops != 0)
+    {
+      if (! peer_group_active (peer) || g_peer->gtsm_hops != peer->gtsm_hops)
+        {
           vty_out (vty, " neighbor %s ttl-security hops %d%s", addr,
                    peer->gtsm_hops, VTY_NEWLINE);
+        }
+    }
 
-      /* disable-connected-check.  */
-      if (CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
-       if (! peer_group_active (peer) ||
-           ! CHECK_FLAG (g_peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
-         vty_out (vty, " neighbor %s disable-connected-check%s", addr, VTY_NEWLINE);
+  /* disable-connected-check */
+  if (CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
+    {
+      if (! peer_group_active (peer) ||
+          ! CHECK_FLAG (g_peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK))
+        {
+          vty_out (vty, " neighbor %s disable-connected-check%s", addr, VTY_NEWLINE);
+        }
+    }
 
-      /* Update-source. */
-      if (peer->update_if)
-       if (! peer_group_active (peer) || ! g_peer->update_if
-           || strcmp (g_peer->update_if, peer->update_if) != 0)
-         vty_out (vty, " neighbor %s update-source %s%s", addr,
-                  peer->update_if, VTY_NEWLINE);
-      if (peer->update_source)
-       if (! peer_group_active (peer) || ! g_peer->update_source
-           || sockunion_cmp (g_peer->update_source,
-                             peer->update_source) != 0)
-         vty_out (vty, " neighbor %s update-source %s%s", addr,
-                  sockunion2str (peer->update_source, buf, SU_ADDRSTRLEN),
-                  VTY_NEWLINE);
-
-      /* advertisement-interval */
-      if (CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV) &&
-          ! peer_group_active (peer))
-       vty_out (vty, " neighbor %s advertisement-interval %d%s",
-                addr, peer->v_routeadv, VTY_NEWLINE); 
-
-      /* timers. */
-      if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER)
-         && ! peer_group_active (peer))
-         vty_out (vty, " neighbor %s timers %d %d%s", addr, 
-         peer->keepalive, peer->holdtime, VTY_NEWLINE);
-
-      if (CHECK_FLAG (peer->config, PEER_CONFIG_CONNECT) &&
-          ! peer_group_active (peer))
-         vty_out (vty, " neighbor %s timers connect %d%s", addr, 
-         peer->connect, VTY_NEWLINE);
-
-      /* Default weight. */
-      if (CHECK_FLAG (peer->config, PEER_CONFIG_WEIGHT))
-        if (! peer_group_active (peer) ||
-           g_peer->weight != peer->weight)
-         vty_out (vty, " neighbor %s weight %d%s", addr, peer->weight,
-                  VTY_NEWLINE);
-
-      /* Dynamic capability.  */
-      if (CHECK_FLAG (peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY))
-        if (! peer_group_active (peer) ||
-           ! CHECK_FLAG (g_peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY))
-       vty_out (vty, " neighbor %s capability dynamic%s", addr,
-            VTY_NEWLINE);
+  /* update-source */
+  if (peer->update_if)
+    {
+      if (! peer_group_active (peer) || ! g_peer->update_if
+          || strcmp (g_peer->update_if, peer->update_if) != 0)
+        {
+          vty_out (vty, " neighbor %s update-source %s%s", addr,
+                   peer->update_if, VTY_NEWLINE);
+        }
+    }
+  if (peer->update_source)
+    {
+      if (! peer_group_active (peer) || ! g_peer->update_source
+          || sockunion_cmp (g_peer->update_source,
+                            peer->update_source) != 0)
+        {
+          vty_out (vty, " neighbor %s update-source %s%s", addr,
+                   sockunion2str (peer->update_source, buf, SU_ADDRSTRLEN),
+                   VTY_NEWLINE);
+        }
+    }
 
-      /* Extended next-hop capability.  */
-      if (CHECK_FLAG (peer->flags, PEER_FLAG_CAPABILITY_ENHE))
-        if (! peer_group_active (peer) ||
-           ! CHECK_FLAG (g_peer->flags, PEER_FLAG_CAPABILITY_ENHE))
-       vty_out (vty, " neighbor %s capability extended-nexthop%s", addr,
-            VTY_NEWLINE);
+  /* advertisement-interval */
+  if (CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV) &&
+      ! peer_group_active (peer))
+    {
+      vty_out (vty, " neighbor %s advertisement-interval %d%s",
+               addr, peer->v_routeadv, VTY_NEWLINE);
+    }
 
-      /* dont capability negotiation. */
-      if (CHECK_FLAG (peer->flags, PEER_FLAG_DONT_CAPABILITY))
-        if (! peer_group_active (peer) ||
-           ! CHECK_FLAG (g_peer->flags, PEER_FLAG_DONT_CAPABILITY))
-       vty_out (vty, " neighbor %s dont-capability-negotiate%s", addr,
-                VTY_NEWLINE);
+  /* timers */
+  if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER)
+      && ! peer_group_active (peer))
+    {
+      vty_out (vty, " neighbor %s timers %d %d%s", addr,
+               peer->keepalive, peer->holdtime, VTY_NEWLINE);
+    }
 
-      /* override capability negotiation. */
-      if (CHECK_FLAG (peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
-        if (! peer_group_active (peer) ||
-           ! CHECK_FLAG (g_peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
-       vty_out (vty, " neighbor %s override-capability%s", addr,
-                VTY_NEWLINE);
+  if (CHECK_FLAG (peer->config, PEER_CONFIG_CONNECT) &&
+      ! peer_group_active (peer))
+    {
+      vty_out (vty, " neighbor %s timers connect %d%s", addr,
+               peer->connect, VTY_NEWLINE);
+    }
 
-      /* strict capability negotiation. */
-      if (CHECK_FLAG (peer->flags, PEER_FLAG_STRICT_CAP_MATCH))
-        if (! peer_group_active (peer) ||
-           ! CHECK_FLAG (g_peer->flags, PEER_FLAG_STRICT_CAP_MATCH))
-       vty_out (vty, " neighbor %s strict-capability-match%s", addr,
-            VTY_NEWLINE);
+  /* weight */
+  if (CHECK_FLAG (peer->config, PEER_CONFIG_WEIGHT))
+    {
+      if (! peer_group_active (peer) || g_peer->weight != peer->weight)
+        {
+          vty_out (vty, " neighbor %s weight %d%s", addr, peer->weight,
+                   VTY_NEWLINE);
+        }
+    }
 
-      if (! peer->af_group[AFI_IP][SAFI_UNICAST])
-       {
-         if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4))
-           {
-             if (peer->afc[AFI_IP][SAFI_UNICAST])
-               vty_out (vty, " neighbor %s activate%s", addr, VTY_NEWLINE);
-           }
-          else
-           {
-             if (! peer->afc[AFI_IP][SAFI_UNICAST])
-               vty_out (vty, " no neighbor %s activate%s", addr, VTY_NEWLINE);
-           }
-       }
+  /* capability dynamic */
+  if (CHECK_FLAG (peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY))
+    {
+      if (! peer_group_active (peer) ||
+          ! CHECK_FLAG (g_peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY))
+        {
+          vty_out (vty, " neighbor %s capability dynamic%s", addr,
+                   VTY_NEWLINE);
+        }
+    }
+
+  /* capability extended-nexthop */
+  if (CHECK_FLAG (peer->flags, PEER_FLAG_CAPABILITY_ENHE))
+    {
+      if (! peer_group_active (peer) ||
+          ! CHECK_FLAG (g_peer->flags, PEER_FLAG_CAPABILITY_ENHE))
+        {
+          vty_out (vty, " neighbor %s capability extended-nexthop%s", addr,
+                   VTY_NEWLINE);
+        }
     }
 
+  /* dont-capability-negotiation */
+  if (CHECK_FLAG (peer->flags, PEER_FLAG_DONT_CAPABILITY))
+    {
+      if (! peer_group_active (peer) ||
+          ! CHECK_FLAG (g_peer->flags, PEER_FLAG_DONT_CAPABILITY))
+        {
+          vty_out (vty, " neighbor %s dont-capability-negotiate%s", addr,
+                   VTY_NEWLINE);
+        }
+    }
 
-  /************************************
-   ****** Per AF to the neighbor ******
-   ************************************/
+  /* override-capability */
+  if (CHECK_FLAG (peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
+    {
+      if (! peer_group_active (peer) ||
+          ! CHECK_FLAG (g_peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY))
+        {
+          vty_out (vty, " neighbor %s override-capability%s", addr,
+                   VTY_NEWLINE);
+        }
+    }
 
-  if (! (afi == AFI_IP && safi == SAFI_UNICAST))
+  /* strict-capability-match */
+  if (CHECK_FLAG (peer->flags, PEER_FLAG_STRICT_CAP_MATCH))
     {
-      if (peer->af_group[afi][safi])
-       vty_out (vty, " neighbor %s peer-group %s%s", addr,
-                peer->group->name, VTY_NEWLINE);
-      else
-       vty_out (vty, " neighbor %s activate%s", addr, VTY_NEWLINE);
+      if (! peer_group_active (peer) ||
+          ! CHECK_FLAG (g_peer->flags, PEER_FLAG_STRICT_CAP_MATCH))
+        {
+          vty_out (vty, " neighbor %s strict-capability-match%s", addr,
+                   VTY_NEWLINE);
+        }
     }
+}
+
+
+/* BGP peer configuration display function. */
+static void
+bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp,
+                         struct peer *peer, afi_t afi, safi_t safi)
+{
+  struct peer *g_peer = NULL;
+  char *addr;
+
+  /* Skip dynamic neighbors. */
+  if (peer_dynamic_neighbor (peer))
+    return;
+
+  if (peer->conf_if)
+    addr = peer->conf_if;
+  else
+    addr = peer->host;
+
+  if (peer_group_active (peer))
+    g_peer = peer->group->conf;
+
+  /************************************
+   ****** Per AF to the neighbor ******
+   ************************************/
+  if (peer->af_group[afi][safi])
+    vty_out (vty, "  neighbor %s peer-group %s%s", addr,
+             peer->group->name, VTY_NEWLINE);
+  else
+    vty_out (vty, "  neighbor %s activate%s", addr, VTY_NEWLINE);
 
   /* ORF capability.  */
   if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_SM)
       || CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_RM))
     if (! peer->af_group[afi][safi])
     {
-      vty_out (vty, " neighbor %s capability orf prefix-list", addr);
+      vty_out (vty, "  neighbor %s capability orf prefix-list", addr);
 
       if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_SM)
          && CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_RM))
@@ -6387,39 +6468,39 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
   /* Route reflector client. */
   if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REFLECTOR_CLIENT)
       && ! peer->af_group[afi][safi])
-    vty_out (vty, " neighbor %s route-reflector-client%s", addr, 
+    vty_out (vty, "  neighbor %s route-reflector-client%s", addr,
             VTY_NEWLINE);
 
   /* Nexthop self. */
   if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_FORCE_NEXTHOP_SELF)
       && ! peer->af_group[afi][safi])
-    vty_out (vty, " neighbor %s next-hop-self force%s",
+    vty_out (vty, "  neighbor %s next-hop-self force%s",
             addr, VTY_NEWLINE);
   else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_NEXTHOP_SELF)
       && ! peer->af_group[afi][safi])
-    vty_out (vty, " neighbor %s next-hop-self%s", addr, VTY_NEWLINE);
+    vty_out (vty, "  neighbor %s next-hop-self%s", addr, VTY_NEWLINE);
 
   /* remove-private-AS */
   if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS) && !peer->af_group[afi][safi])
     {
       if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_ALL) &&
           peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
-        vty_out (vty, " neighbor %s remove-private-AS all replace-AS%s", addr, VTY_NEWLINE);
+        vty_out (vty, "  neighbor %s remove-private-AS all replace-AS%s", addr, VTY_NEWLINE);
 
       else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE))
-        vty_out (vty, " neighbor %s remove-private-AS replace-AS%s", addr, VTY_NEWLINE);
+        vty_out (vty, "  neighbor %s remove-private-AS replace-AS%s", addr, VTY_NEWLINE);
 
       else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS_ALL))
-        vty_out (vty, " neighbor %s remove-private-AS all%s", addr, VTY_NEWLINE);
+        vty_out (vty, "  neighbor %s remove-private-AS all%s", addr, VTY_NEWLINE);
 
       else
-        vty_out (vty, " neighbor %s remove-private-AS%s", addr, VTY_NEWLINE);
+        vty_out (vty, "  neighbor %s remove-private-AS%s", addr, VTY_NEWLINE);
     }
 
   /* as-override */
   if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_AS_OVERRIDE) &&
       !peer->af_group[afi][safi])
-    vty_out (vty, " neighbor %s as-override%s", addr, VTY_NEWLINE);
+    vty_out (vty, "  neighbor %s as-override%s", addr, VTY_NEWLINE);
 
   /* send-community print. */
   if (! peer->af_group[afi][safi])
@@ -6428,24 +6509,24 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
        {
          if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY)
              && peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY))
-           vty_out (vty, " neighbor %s send-community both%s", addr, VTY_NEWLINE);
+           vty_out (vty, "  neighbor %s send-community both%s", addr, VTY_NEWLINE);
          else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY))  
-           vty_out (vty, " neighbor %s send-community extended%s",
+           vty_out (vty, "  neighbor %s send-community extended%s",
                     addr, VTY_NEWLINE);
          else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY))
-           vty_out (vty, " neighbor %s send-community%s", addr, VTY_NEWLINE);
+           vty_out (vty, "  neighbor %s send-community%s", addr, VTY_NEWLINE);
        }
       else
        {
          if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY)
              && ! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY))
-           vty_out (vty, " no neighbor %s send-community both%s",
+           vty_out (vty, "  no neighbor %s send-community both%s",
                     addr, VTY_NEWLINE);
          else if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY))
-           vty_out (vty, " no neighbor %s send-community extended%s",
+           vty_out (vty, "  no neighbor %s send-community extended%s",
                     addr, VTY_NEWLINE);
          else if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY))
-           vty_out (vty, " no neighbor %s send-community%s",
+           vty_out (vty, "  no neighbor %s send-community%s",
                     addr, VTY_NEWLINE);
        }
     }
@@ -6454,9 +6535,9 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
   if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_DEFAULT_ORIGINATE)
       && ! peer->af_group[afi][safi])
     {
-      vty_out (vty, " neighbor %s default-originate", addr);
+      vty_out (vty, "  neighbor %s default-originate", addr);
       if (peer->default_rmap[afi][safi].name)
-       vty_out (vty, " route-map %s", peer->default_rmap[afi][safi].name);
+       vty_out (vty, "  route-map %s", peer->default_rmap[afi][safi].name);
       vty_out (vty, "%s", VTY_NEWLINE);
     }
 
@@ -6464,7 +6545,7 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
   if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
     if (! peer->af_group[afi][safi] ||
        ! CHECK_FLAG (g_peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
-    vty_out (vty, " neighbor %s soft-reconfiguration inbound%s", addr,
+    vty_out (vty, "  neighbor %s soft-reconfiguration inbound%s", addr,
             VTY_NEWLINE);
 
   /* maximum-prefix. */
@@ -6475,7 +6556,7 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
        || CHECK_FLAG (g_peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
           != CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
       {
-       vty_out (vty, " neighbor %s maximum-prefix %ld", addr, peer->pmax[afi][safi]);
+       vty_out (vty, "  neighbor %s maximum-prefix %ld", addr, peer->pmax[afi][safi]);
        if (peer->pmax_threshold[afi][safi] != MAXIMUM_PREFIX_THRESHOLD_DEFAULT)
          vty_out (vty, " %d", peer->pmax_threshold[afi][safi]);
        if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
@@ -6488,12 +6569,12 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
   /* Route server client. */
   if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)
       && ! peer->af_group[afi][safi])
-    vty_out (vty, " neighbor %s route-server-client%s", addr, VTY_NEWLINE);
+    vty_out (vty, "  neighbor %s route-server-client%s", addr, VTY_NEWLINE);
 
   /* Nexthop-local unchanged. */
   if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED)
       && ! peer->af_group[afi][safi])
-    vty_out (vty, " neighbor %s nexthop-local unchanged%s", addr, VTY_NEWLINE);
+    vty_out (vty, "  neighbor %s nexthop-local unchanged%s", addr, VTY_NEWLINE);
 
   /* Allow AS in.  */
   if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_ALLOWAS_IN))
@@ -6502,9 +6583,9 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
        || peer->allowas_in[afi][safi] != g_peer->allowas_in[afi][safi])
       {
        if (peer->allowas_in[afi][safi] == 3)
-         vty_out (vty, " neighbor %s allowas-in%s", addr, VTY_NEWLINE);
+         vty_out (vty, "  neighbor %s allowas-in%s", addr, VTY_NEWLINE);
        else
-         vty_out (vty, " neighbor %s allowas-in %d%s", addr,
+         vty_out (vty, "  neighbor %s allowas-in %d%s", addr,
                   peer->allowas_in[afi][safi], VTY_NEWLINE);
       }
 
@@ -6520,9 +6601,9 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp,
       if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)
           && CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)
           && CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
-       vty_out (vty, " neighbor %s attribute-unchanged%s", addr, VTY_NEWLINE);
+       vty_out (vty, "  neighbor %s attribute-unchanged%s", addr, VTY_NEWLINE);
       else
-       vty_out (vty, " neighbor %s attribute-unchanged%s%s%s%s", addr, 
+       vty_out (vty, "  neighbor %s attribute-unchanged%s%s%s%s", addr,
             (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) ?
             " as-path" : "",
             (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) ?
@@ -6540,24 +6621,23 @@ bgp_config_write_family_header (struct vty *vty, afi_t afi, safi_t safi,
   if (*write)
     return;
 
-  if (afi == AFI_IP && safi == SAFI_UNICAST)
-    return;
-
-  vty_out (vty, "!%s address-family ", VTY_NEWLINE);
+  vty_out (vty, " address-family ");
 
   if (afi == AFI_IP)
     {
-      if (safi == SAFI_MULTICAST)
+      if (safi == SAFI_UNICAST)
+       vty_out (vty, "ipv4 unicast");
+      else if (safi == SAFI_MULTICAST)
        vty_out (vty, "ipv4 multicast");
       else if (safi == SAFI_MPLS_VPN)
        vty_out (vty, "vpnv4 unicast");
     }
   else if (afi == AFI_IP6)
     {
-      vty_out (vty, "ipv6");
-      
-      if (safi == SAFI_MULTICAST)
-        vty_out (vty, " multicast");
+      if (safi == SAFI_UNICAST)
+       vty_out (vty, "ipv6 unicast");
+      else if (safi == SAFI_MULTICAST)
+        vty_out (vty, "ipv6 multicast");
     }
 
   vty_out (vty, "%s", VTY_NEWLINE);
@@ -6584,7 +6664,7 @@ bgp_config_write_family (struct vty *vty, struct bgp *bgp, afi_t afi,
       if (group->conf->afc[afi][safi])
        {
          bgp_config_write_family_header (vty, afi, safi, &write);
-         bgp_config_write_peer (vty, bgp, group->conf, afi, safi);
+         bgp_config_write_peer_af (vty, bgp, group->conf, afi, safi);
        }
     }
   for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
@@ -6598,7 +6678,7 @@ bgp_config_write_family (struct vty *vty, struct bgp *bgp, afi_t afi,
          if (CHECK_FLAG (peer->flags, PEER_FLAG_CONFIG_NODE))
            {
              bgp_config_write_family_header (vty, afi, safi, &write);
-             bgp_config_write_peer (vty, bgp, peer, afi, safi);
+             bgp_config_write_peer_af (vty, bgp, peer, afi, safi);
            }
        }
     }
@@ -6801,12 +6881,6 @@ bgp_config_write (struct vty *vty)
          BGP_CONFIG_DAMPENING))
        bgp_config_write_damp (vty);
 
-      /* BGP static route configuration. */
-      bgp_config_write_network (vty, bgp, AFI_IP, SAFI_UNICAST, &write);
-
-      /* BGP redistribute configuration. */
-      bgp_config_write_redistribute (vty, bgp, AFI_IP, SAFI_UNICAST, &write);
-
       /* BGP timers configuration. */
       if (bgp->default_keepalive != BGP_DEFAULT_KEEPALIVE
          && bgp->default_holdtime != BGP_DEFAULT_HOLDTIME)
@@ -6820,20 +6894,16 @@ bgp_config_write (struct vty *vty)
       /* peer-group */
       for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group))
        {
-         bgp_config_write_peer (vty, bgp, group->conf, AFI_IP, SAFI_UNICAST);
+         bgp_config_write_peer_global (vty, bgp, group->conf);
        }
 
       /* Normal neighbor configuration. */
       for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
        {
          if (CHECK_FLAG (peer->flags, PEER_FLAG_CONFIG_NODE))
-           bgp_config_write_peer (vty, bgp, peer, AFI_IP, SAFI_UNICAST);
+           bgp_config_write_peer_global (vty, bgp, peer);
        }
 
-      /* maximum-paths */
-      bgp_config_write_maxpaths (vty, bgp, AFI_IP, SAFI_UNICAST, &write);
-      bgp_config_write_table_map (vty, bgp, AFI_IP, SAFI_UNICAST, &write);
-
       /* Distance configuration. */
       bgp_config_write_distance (vty, bgp);
       
@@ -6844,6 +6914,9 @@ bgp_config_write (struct vty *vty)
       if (bgp_option_check (BGP_OPT_CONFIG_CISCO))
        vty_out (vty, " no auto-summary%s", VTY_NEWLINE);
 
+      /* IPv4 unicast configuration.  */
+      write += bgp_config_write_family (vty, bgp, AFI_IP, SAFI_UNICAST);
+
       /* IPv4 multicast configuration.  */
       write += bgp_config_write_family (vty, bgp, AFI_IP, SAFI_MULTICAST);
 
index 343d61ae780f9f2fc9d94eaa0c154f299d69513f..11266a1a28543b47c55a0e31ab4e6d2e50f356ef 100755 (executable)
@@ -292,17 +292,18 @@ end
             elif "address-family " in line:
                 main_ctx_key = []
 
-                if line != "address-family ipv4 unicast":
-                    # Save old context first
-                    self.save_contexts(ctx_keys, current_context_lines)
-                    current_context_lines = []
-                    main_ctx_key = copy.deepcopy(ctx_keys)
-                    logger.debug('LINE %-50s: entering sub-context, append to ctx_keys', line)
+                # Save old context first
+                self.save_contexts(ctx_keys, current_context_lines)
+                current_context_lines = []
+                main_ctx_key = copy.deepcopy(ctx_keys)
+                logger.debug('LINE %-50s: entering sub-context, append to ctx_keys', line)
 
-                    if line == "address-family ipv6":
-                        ctx_keys.append("address-family ipv6 unicast")
-                    else:
-                        ctx_keys.append(line)
+                if line == "address-family ipv6":
+                    ctx_keys.append("address-family ipv6 unicast")
+                elif line == "address-family ipv4":
+                    ctx_keys.append("address-family ipv4 unicast")
+                else:
+                    ctx_keys.append(line)
 
             else:
                 # Continuing in an existing context, add non-commented lines to it
index 47886ea4639b528df9f1efd9b3d79c406f913d04..fc0fa351a9ff80b2d0da208ce358fdf38742c34b 100644 (file)
@@ -175,6 +175,8 @@ vtysh_config_parse_line (const char *line)
 
   switch (c)
     {
+    /* Suppress exclamation points ! and commented lines. The !s are generated
+     * dynamically in vtysh_config_dump() */
     case '!':
     case '#':
       break;
@@ -188,8 +190,11 @@ vtysh_config_parse_line (const char *line)
          else if (strncmp (line, " address-family ipv4 multicast",
                   strlen (" address-family ipv4 multicast")) == 0)
            config = config_get (BGP_IPV4M_NODE, line);
-         else if (strncmp (line, " address-family ipv6",
-                  strlen (" address-family ipv6")) == 0)
+         else if (strncmp (line, " address-family ipv4", strlen (" address-family ipv4")) == 0 ||
+                  strncmp (line, " address-family ipv4 unicast", strlen (" address-family ipv4 unicast")) == 0)
+           config = config_get (BGP_IPV4_NODE, line);
+         else if (strncmp (line, " address-family ipv6", strlen (" address-family ipv6")) == 0 ||
+                  strncmp (line, " address-family ipv6 unicast", strlen (" address-family ipv6 unicast")) == 0)
            config = config_get (BGP_IPV6_NODE, line);
          else if (config->index == RMAP_NODE ||
                   config->index == INTERFACE_NODE ||