mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Merged multipath and single-path data structures.
Dropped struct mpnh and mpnh_*() Now struct nexthop exists, nexthop_*(), and also included struct nexthop into struct rta. Also converted RTD_DEVICE and RTD_ROUTER to RTD_UNICAST. If it is needed to distinguish between these two cases, RTD_DEVICE is equivalent to IPA_ZERO(a->nh.gw), RTD_ROUTER is then IPA_NONZERO(a->nh.gw). From now on, we also explicitely want C99 compatible compiler. We assume that this 20-year norm should be known almost everywhere.
This commit is contained in:
@@ -699,9 +699,10 @@ bgp_apply_next_hop(struct bgp_parse_state *s, rta *a, ip_addr gw, ip_addr ll)
|
||||
if (!nbr || (nbr->scope == SCOPE_HOST))
|
||||
WITHDRAW(BAD_NEXT_HOP);
|
||||
|
||||
a->dest = RTD_ROUTER;
|
||||
a->gw = nbr->addr;
|
||||
a->iface = nbr->iface;
|
||||
a->dest = RTD_UNICAST;
|
||||
a->nh.gw = nbr->addr;
|
||||
a->nh.iface = nbr->iface;
|
||||
a->nh.next = NULL;
|
||||
a->hostentry = NULL;
|
||||
a->igp_metric = 0;
|
||||
}
|
||||
@@ -749,7 +750,7 @@ bgp_use_gateway(struct bgp_export_state *s)
|
||||
return 0;
|
||||
|
||||
/* We need valid global gateway */
|
||||
if ((ra->dest != RTD_ROUTER) || ipa_zero(ra->gw) || ipa_is_link_local(ra->gw))
|
||||
if ((ra->dest != RTD_UNICAST) || (ra->nh.next) || ipa_zero(ra->nh.gw) || ipa_is_link_local(ra->nh.gw))
|
||||
return 0;
|
||||
|
||||
/* Use it when exported to internal peers */
|
||||
@@ -757,7 +758,7 @@ bgp_use_gateway(struct bgp_export_state *s)
|
||||
return 1;
|
||||
|
||||
/* Use it when forwarded to single-hop BGP peer on on the same iface */
|
||||
return p->neigh && (p->neigh->iface == ra->iface);
|
||||
return p->neigh && (p->neigh->iface == ra->nh.iface);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -767,7 +768,7 @@ bgp_update_next_hop_ip(struct bgp_export_state *s, eattr *a, ea_list **to)
|
||||
{
|
||||
if (bgp_use_gateway(s))
|
||||
{
|
||||
ip_addr nh[1] = { s->route->attrs->gw };
|
||||
ip_addr nh[1] = { s->route->attrs->nh.gw };
|
||||
bgp_set_attr_data(to, s->pool, BA_NEXT_HOP, 0, nh, 16);
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user