]> git.puffer.fish Git - mirror/frr.git/commit
bgpd: add replace-as modifier for BGP neighbor
authorAndrew Certain <certain@amazon.com>
Wed, 7 Nov 2012 23:50:07 +0000 (23:50 +0000)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 30 Nov 2012 20:10:00 +0000 (21:10 +0100)
commit9d3f9705d8b386ccf006c106967c700141e5d049
tree9edfe2653741fa0f49ffef15bd66f5a522dcd025
parent3b96b78136d04ddb7e39d86577cad75acb25237a
bgpd: add replace-as modifier for BGP neighbor

Added replace-as modifier for BGP neighbors when using
local-as. If the replace-as modifier is specified, only the
replacement AS as specified by the local-as modifier is
prepended to the AS_PATH, not the process's AS.

In bgp_attr.c, I decided that

if (peer->change_local_as) {
  /* If replace-as is specified, we only use the change_local_as when
     advertising routes. */
  if( ! CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ) {
    aspath = aspath_add_seq (aspath, peer->local_as);
  }
  aspath = aspath_add_seq (aspath, peer->change_local_as);
} else {
  aspath = aspath_add_seq (aspath, peer->local_as);
}

was clearer than the alternative that didn't duplicate the prepending of the
process's AS:

/* First, append the process local AS unless we have an alternate local_as
 * and we're replacing it (as opposed to just prepending it). */
if (! (peer->change_local_as
       && CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ) ) {
  aspath = aspath_add_seq (aspath, peer->local_as);
}

if (peer->change_local_as)
  aspath = aspath_add_seq (aspath, peer->change_local_as);
}

But I could be convinced otherwise.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd/bgp_attr.c
bgpd/bgp_vty.c
bgpd/bgpd.c
bgpd/bgpd.h