]> git.puffer.fish Git - mirror/frr.git/commitdiff
bpgd: resolve more neighbor peer-group issues 3898/head
authorDon Slice <dslice@cumulusnetworks.com>
Sat, 2 Mar 2019 19:40:17 +0000 (19:40 +0000)
committerDon Slice <dslice@cumulusnetworks.com>
Sat, 2 Mar 2019 19:44:10 +0000 (19:44 +0000)
Found in testing that in a certain sequence, a neighbor's peer-group
membership would be lost.  This fix resolves that issue. Additionally
found that "no neighbor swp1 remote-as 2" would sometimes leave the
config with "neighbor swp1 remote-as 0" rather than removing from the
config. That one is also resolved.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
bgpd/bgp_vty.c
bgpd/bgpd.c

index 93d22087bbc7009f4d22e14f93c53fb78ce11b8a..8cb20c5e7f7483577a263628cce950fe1d01907b 100644 (file)
@@ -2841,18 +2841,23 @@ static int peer_remote_as_vty(struct vty *vty, const char *peer_str,
                as = strtoul(as_str, NULL, 10);
        }
 
-       /* If peer is peer group, call proper function.  */
+       /* If peer is peer group or interface peer, call proper function. */
        ret = str2sockunion(peer_str, &su);
        if (ret < 0) {
-               /* Check for peer by interface */
+               struct peer *peer;
+
+               /* Check if existing interface peer */
+               peer = peer_lookup_by_conf_if(bgp, peer_str);
+
                ret = peer_remote_as(bgp, NULL, peer_str, &as, as_type, afi,
                                     safi);
-               if (ret < 0) {
+
+               /* if not interface peer, check peer-group settings */
+               if (ret < 0 && !peer) {
                        ret = peer_group_remote_as(bgp, peer_str, &as, as_type);
                        if (ret < 0) {
                                vty_out(vty,
-                                       "%% Create the peer-group or interface first or specify \"interface\" keyword\n");
-                               vty_out(vty, "%% if using an unnumbered interface neighbor\n");
+                                       "%% Create the peer-group or interface first\n");
                                return CMD_WARNING_CONFIG_FAILED;
                        }
                        return CMD_SUCCESS;
@@ -3251,7 +3256,7 @@ DEFUN (no_neighbor_interface_peer_group_remote_as,
        /* look up for neighbor by interface name config. */
        peer = peer_lookup_by_conf_if(bgp, argv[idx_word]->arg);
        if (peer) {
-               peer_as_change(peer, 0, AS_SPECIFIED);
+               peer_as_change(peer, 0, AS_UNSPECIFIED);
                return CMD_SUCCESS;
        }
 
index a920cfeeec14524ad55789fb4028a18cd21a424c..1a73301e433c3256b1c3aead4ae9dabeba313d3b 100644 (file)
@@ -2722,7 +2722,7 @@ int peer_group_bind(struct bgp *bgp, union sockunion *su, struct peer *peer,
                        peer->sort = group->conf->sort;
                }
 
-               if (!group->conf->as) {
+               if (!group->conf->as && peer_sort(peer)) {
                        if (peer_sort(group->conf) != BGP_PEER_INTERNAL
                            && peer_sort(group->conf) != peer_sort(peer)) {
                                if (as)