Degrade link score to zero within 20 seconds

This commit is contained in:
Jeremy Lakeman 2012-11-16 15:54:01 +10:30
parent 1df18ae43d
commit 3dc831481e
2 changed files with 31 additions and 28 deletions

View File

@ -168,38 +168,41 @@ int subscriber_is_reachable(struct subscriber *subscriber){
if (!subscriber) if (!subscriber)
return REACHABLE_NONE; return REACHABLE_NONE;
// is there a default route? int ret = subscriber->reachable;
if (subscriber->reachable==REACHABLE_NONE &&
if (ret==REACHABLE_INDIRECT){
if (!subscriber->next_hop)
ret = REACHABLE_NONE;
// avoid infinite recursion...
else if (subscriber->next_hop->reachable!=REACHABLE_DIRECT &&
subscriber->next_hop->reachable!=REACHABLE_UNICAST)
ret = REACHABLE_NONE;
else{
int r = subscriber_is_reachable(subscriber->next_hop);
if (r!=REACHABLE_DIRECT && r!= REACHABLE_UNICAST)
ret = REACHABLE_NONE;
}
}
if (ret==REACHABLE_DIRECT ||
ret==REACHABLE_UNICAST){
// make sure the interface is still up
if (!subscriber->interface)
ret=REACHABLE_NONE;
else if (subscriber->interface->state!=INTERFACE_STATE_UP)
ret=REACHABLE_NONE;
}
// after all of that, should we use a default route?
if (ret==REACHABLE_NONE &&
directory_service && directory_service &&
subscriber!=directory_service && subscriber!=directory_service &&
subscriber_is_reachable(directory_service)!=REACHABLE_NONE){ subscriber_is_reachable(directory_service)!=REACHABLE_NONE){
return REACHABLE_DEFAULT_ROUTE; ret = REACHABLE_DEFAULT_ROUTE;
} }
if (subscriber->reachable==REACHABLE_INDIRECT){ return ret;
if (!subscriber->next_hop)
return REACHABLE_NONE;
// avoid infinite recursion...
if (subscriber->next_hop->reachable!=REACHABLE_DIRECT &&
subscriber->next_hop->reachable!=REACHABLE_UNICAST)
return REACHABLE_NONE;
int r = subscriber_is_reachable(subscriber->next_hop);
if (r!=REACHABLE_DIRECT && r!= REACHABLE_UNICAST)
return REACHABLE_NONE;
}
if (subscriber->reachable==REACHABLE_DIRECT ||
subscriber->reachable==REACHABLE_UNICAST){
// make sure the interface is still up
if (!subscriber->interface)
return REACHABLE_NONE;
if (subscriber->interface->state!=INTERFACE_STATE_UP)
return REACHABLE_NONE;
}
return subscriber->reachable;
} }
int set_reachable(struct subscriber *subscriber, int reachable){ int set_reachable(struct subscriber *subscriber, int reachable){

View File

@ -625,7 +625,7 @@ int overlay_route_recalc_neighbour_metrics(struct overlay_neighbour *n, time_ms_
50KB per 12 hours, which is the minimum traffic charge rate 50KB per 12 hours, which is the minimum traffic charge rate
on an expensive BGAN satellite link. on an expensive BGAN satellite link.
*/ */
if (interval>=3600000 || obs_age>200000) if (interval>=3600000 || obs_age>20000)
continue; continue;
if (debug&DEBUG_OVERLAYROUTING) if (debug&DEBUG_OVERLAYROUTING)