neigh: Install neighbor entries only on devices where routes exist #28782
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the issue that neighbor entries can be installed on devices where no route to the destination host exists.
netlink.RouteGetWithOptions
(equivalent toip route get
) with oif returns a route even if the destination is unreachable from the specified interface. The neighbor entries can be installed on all devices because of this.netlink.RouteGetWithOptions
withFIBMatch
option (equivalent tofibmatch
flag) returns full fib lookup matched route. It returnsNo route to host
if the destination is non-routable from the specified device. This PR addsFIBMatch
option to avoid installing the unnecessary entries.Note:
Network is unreachable
if the destination is unreachable with or without fibmatch.FIBMatch
option,netlink.RouteGetWithOptions
returnsMultiPath
field if there are multiple paths to the dest. It returnsGW
field withoutFIBMatch
. See examples below.ip route get
examplesPlease ensure your pull request adheres to the following guidelines:
description and a
Fixes: #XXX
line if the commit addresses a particularGitHub issue.
Fixes: <commit-id>
tag, thenplease add the commit author[s] as reviewer[s] to this issue.
Fixes: #28660