Skip to content

Commit

Permalink
fw: add bounds check for nexthops
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed Dec 25, 2024
1 parent 021049e commit b227f3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fw/fw/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
const StrategyPrefix = "/localhost/nfd/strategy"

// Maximum number of possible next hops (i.e. router links) for optimization
const MaxNextHops = 64
const MaxNextHops = 32

// Strategy represents a forwarding strategy.
type Strategy interface {
Expand Down
3 changes: 3 additions & 0 deletions fw/fw/thread.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ func (t *Thread) processIncomingInterest(packet *defn.Pkt) {
allowedNexthops[allowedNexthopsCount] = nexthop
allowedNexthopsCount++
}
if allowedNexthopsCount >= MaxNextHops {
break // limit reached
}
}

// Pass to strategy AfterReceiveInterest pipeline
Expand Down

0 comments on commit b227f3f

Please sign in to comment.