Skip to content

dv: ignore advertised routes whose cost overflows into reachability - #221

Open
Harsh23Kashyap wants to merge 1 commit into
named-data:mainfrom
Harsh23Kashyap:fix/dv-advert-cost-overflow
Open

Harsh23Kashyap wants to merge 1 commit into
named-data:mainfrom
Harsh23Kashyap:fix/dv-advert-cost-overflow

Conversation

@Harsh23Kashyap

Copy link
Copy Markdown

Fixes #220

What

  • In updateRib, only add the local link cost when the advertised cost has headroom below CostInfinity; otherwise the route stays unreachable. Applies to both the normal and poison-reverse (OtherCost) paths.
  • Regression test: a MaxUint64-cost advertisement no longer produces a cost-0 route.
  • Behavior for all non-overflowing costs is unchanged (14 -> 15 reachable; 15 -> 16 unreachable; >= 16 unreachable, same as before).

Evidence

Before (on main):

--- FAIL: TestUpdateRibOverflowAdvertisedCost (0.00s)
   log: Update next hop ... name=/ndn/evil hop1=/ndn/router2 cost1=0   (advertised MaxUint64 -> cost 0)

After (this branch):

--- PASS: TestUpdateRibOverflowAdvertisedCost (0.00s)
ok  	github.com/named-data/ndnd/dv/dv

Full go test ./... green.

updateRib adds the local link cost to the advertised cost without
checking for overflow. A neighbor advertising Cost = MaxUint64 wraps to
0 after the addition, and the route is accepted with the best possible
cost instead of being treated as unreachable.

Only accept advertised costs with enough headroom below CostInfinity for
the local link cost; anything else is unreachable.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dv: advertised route cost overflows into reachability (MaxUint64 wraps to cost 0)

1 participant