Skip to content

Commit

Permalink
bgpd: Extend RFC 5549 metaphor a bit more
Browse files Browse the repository at this point in the history
Currently we only support RFC 5549 in bgp via
using the `neighbor swp1 interface remote-as ...`
command.  This causes the extended capability
data to be traded as part of the open message.
Additionally at that point in time we notify
zebra to turn on the RA code for that interface
so that the zebra trick of turning the v6 nexthop
into a 169.254.0.1 nexthop and adding a neighbor
entry works.

This code change does 2 things:

1) Modify bgp to pass the extended capability
if we are attempting to establish a v4/unicast
session over a v6 peer.  In the past we limited
this to just the LL based peer.

2) Modify the nexthop tracking code to notice
when it receives nexthop data about the global v6
peer to turn on RA code on those interfaces we will
be using.  This will allow the v4 route with a v6
nexthop received in zebra to auto translate this
correctly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
  • Loading branch information
donaldsharp committed Sep 19, 2018
1 parent dc790ba commit 6137a77
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 18 additions & 0 deletions bgpd/bgp_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
bnc->change_flags |= BGP_NEXTHOP_CHANGED;

if (nhr.nexthop_num) {
struct peer *peer = bnc->nht_info;

/* notify bgp fsm if nbr ip goes from invalid->valid */
if (!bnc->nexthop_num)
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED);
Expand All @@ -416,6 +418,22 @@ void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)

nexthop = nexthop_from_zapi_nexthop(&nhr.nexthops[i]);

/*
* Turn on RA for the v6 nexthops
* we receive from bgp. This is to allow us
* to work with v4 routing over v6 nexthops
*/
if (peer &&
CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_ENHE)
&& nhr.prefix.family == AF_INET6) {
struct interface *ifp;

ifp = if_lookup_by_index(nexthop->ifindex,
nexthop->vrf_id);
zclient_send_interface_radv_req(
zclient, nexthop->vrf_id, ifp, true,
BGP_UNNUM_DEFAULT_RA_INTERVAL);
}
/* There is at least one label-switched path */
if (nexthop->nh_label &&
nexthop->nh_label->num_labels) {
Expand Down
1 change: 0 additions & 1 deletion bgpd/bgp_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,6 @@ void bgp_open_capability(struct stream *s, struct peer *peer)
*/
if (CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_ENHE)
&& peer->su.sa.sa_family == AF_INET6
&& IN6_IS_ADDR_LINKLOCAL(&peer->su.sin6.sin6_addr)
&& afi == AFI_IP
&& (safi == SAFI_UNICAST
|| safi == SAFI_LABELED_UNICAST)) {
Expand Down

0 comments on commit 6137a77

Please sign in to comment.