Skip to content

Commit

Permalink
Introduce a new flag to identify "self" neighbors attached to local i…
Browse files Browse the repository at this point in the history
…nterfaces.
  • Loading branch information
rwestphal committed Oct 27, 2015
1 parent 04f948d commit dda887f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion neighbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ nbr_init(struct nbr *nbr)
memcpy(&rnbr.addr, &nbr->addr, sizeof(rnbr.addr));
rnbr.ifaceid = nbr->ei->ifaceid;
if (nbr->flags & F_EIGRP_NBR_SELF)
rnbr.flags = F_RDE_NBR_SELF;
rnbr.flags = F_RDE_NBR_SELF|F_RDE_NBR_LOCAL;

/* rde is not aware of pending nbrs */
eigrpe_imsg_compose_rde(IMSG_NEIGHBOR_UP, nbr->peerid, 0, &rnbr,
Expand Down
5 changes: 3 additions & 2 deletions rde.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ struct rde_nbr {
* routes.
*/
#define F_RDE_NBR_SELF 0x01
#define F_RDE_NBR_REDIST 0x02
#define F_RDE_NBR_SUMMARY 0x04
#define F_RDE_NBR_LOCAL 0x02
#define F_RDE_NBR_REDIST 0x04
#define F_RDE_NBR_SUMMARY 0x08

struct reply_node {
TAILQ_ENTRY(reply_node) rn_entry;
Expand Down
20 changes: 9 additions & 11 deletions rde_dual.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,28 +565,26 @@ rinfo_fill_infinite(struct rt_node *rn, enum route_type type, struct rinfo *ri)
void
rt_update_fib(struct rt_node *rn)
{
uint8_t maximum_paths = rn->eigrp->maximum_paths;
uint8_t variance = rn->eigrp->variance;
struct eigrp *eigrp = rn->eigrp;
uint8_t maximum_paths = eigrp->maximum_paths;
uint8_t variance = eigrp->variance;
int installed = 0;
struct eigrp_route *route;

if (rn->state == DUAL_STA_PASSIVE) {
TAILQ_FOREACH(route, &rn->routes, entry) {
if (route->nbr->flags & F_RDE_NBR_SELF)
continue;
/* no multipath for attached networks. */
if (rn->successor.nbr &&
(rn->successor.nbr->flags & F_RDE_NBR_LOCAL))
return;

TAILQ_FOREACH(route, &rn->routes, entry) {
/*
* only feasible successors and the successor itself
* are elegible to be installed.
*/
if (route->rdistance > rn->successor.fdistance)
goto uninstall;

/* no multipath for attached networks. */
if (rn->successor.rdistance == 0 &&
route->distance > 0)
goto uninstall;

if (route->distance >
(rn->successor.fdistance * variance))
goto uninstall;
Expand Down Expand Up @@ -661,7 +659,7 @@ rt_get_successor_fc(struct rt_node *rn)
* connected routes should always be prefered over
* received routes independent of the metric.
*/
if (route->rdistance == 0)
if (route->nbr->flags & F_RDE_NBR_LOCAL)
return (route);

external_only = 0;
Expand Down

0 comments on commit dda887f

Please sign in to comment.