diff options
| author | Don Slice <dslice@cumulusnetworks.com> | 2019-03-02 19:40:17 +0000 |
|---|---|---|
| committer | Don Slice <dslice@cumulusnetworks.com> | 2019-03-02 19:44:10 +0000 |
| commit | 390485fdc96dbdd56c42d1db5d73c985411f8b4b (patch) | |
| tree | b0a8cd4804bc75b11d07ac87bd00ba7dcecf669d | |
| parent | 700e9faa28bbdc3460e1d7aa109b6e4acaf347b3 (diff) | |
bpgd: resolve more neighbor peer-group issues
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>
| -rw-r--r-- | bgpd/bgp_vty.c | 17 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 93d22087bb..8cb20c5e7f 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -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; } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index a920cfeeec..1a73301e43 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -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) |
