]> git.proxmox.com Git - mirror_frr.git/commit - bgpd/bgpd.c
Here we have an unsual confederations config, "router bgp X" and
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 12 Jun 2015 14:59:10 +0000 (07:59 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 12 Jun 2015 14:59:10 +0000 (07:59 -0700)
commit66b199b2ff2a8b39064f913489fe331cbbec4383
tree4cacc0cd8b45e0417ff0263eb7e183292232fe8d
parent1ec4e1e78fd686c4d76f52b83abcce8d1690fc58
Here we have an unsual confederations config, "router bgp X" and
"bgp confederation id X" are the same value.

router bgp 1
 bgp router-id 10.1.1.1
 bgp confederation identifier 1
 bgp confederation peers 24 35
 neighbor 10.1.1.2 remote-as 24
 neighbor 10.1.1.2 update-source lo
 neighbor 10.1.1.3 remote-as 1
 neighbor 10.1.1.3 update-source lo

The customer does this because they want to peer to 10.1.1.2 as a
confed-external peer but peer with 10.1.1.3 as a normal iBGP peer.

The bug was that we thought 10.1.1.3 was an EBGP peer so we did not send him
LOCALPREF which caused the Juniper to send us a NOTIFICATION. I confirmed
that quagga also sends a NOTIFICATION in this scenario.

The fix is to add a check to see if router bgp X and bgp confederation
identifier X are equal because that is a factor in determining if a peer is
EBGP or IBGP

Additional issues fixed in the this patch:

  We were not properly removing all AS_CONFED_SEQUENCEs/SETs from the aspath
  when advertising a route to an ebgp peer. This was due to two issues:

    We only called aspath_delete_confed_seq() if confederations were
    configured.  We can RX as aspath with CONFED segments even if
    confederations are not configured.

    aspath_delete_confed_seq() was implemented based on the original confed
    RFC 3065 which basically said "remove all of the leading
    AS_CONFED_SEQUENCEs/SETs" where the new confed RFC 5065 says "remove ALL
    of the AS_CONFED_SEQUENCEs/SETs"

  peer-groups did not work for confed-external peers. peer_calc_sort() always
  returned BGP_PEER_EBGP for a confederations where the remote-as was not
  specified. The reason was the peer->as_type was AS_UNSPECIFIED but we checked

    if (peer->as_type != AS_SPECIFIED)
       return (peer->as_type == AS_INTERNAL ? BGP_PEER_IBGP : BGP_PEER_EBGP);

    After fixing that I found that when we got to the else where we checked for
    peer1 we could only possibly return BGP_PEER_IBGP or BGP_PEER_EBGP, we need
    to also be able to return BGP_PEER_CONFED. I changed this to return
    peer1->sort.

  "show ip bgp x.x.x.x" would always display "Local" for the aspath. This is
  because we were calling aspath_counts_hop() to determine if the aspath was
  empty. This is wrong though because CONFED segments do not count towards
  aspath hopcount. The fix is to null check aspath->segments to determine if
  the aspath is actually empty.

  "show ip bgp x.x.x.x" and "show ip bgp neighbor" always displayed
  "internal" or "external" and never "confed-internal" or "confed-external".
  This made troubleshooting difficult because I couldn't tell exactly what
  kind of peer I was dealing with. I added the confed-internal and
  confed-external output...also added a "peer-type" field in the json output
  for 'show ip bgp x.x.x.x'

  "show ip bgp peer-group" did not list the peer-group name if we hadn't
  determined the "type" (internal, external, etc) for the peer-group
bgpd/bgp_aspath.c
bgpd/bgp_attr.c
bgpd/bgp_route.c
bgpd/bgp_vty.c
bgpd/bgpd.c