Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly handle on-link routes #373

Merged
merged 5 commits into from
Mar 9, 2022
Merged

Conversation

KanjiMonster
Copy link
Contributor

@KanjiMonster KanjiMonster commented Mar 3, 2022

Handle on-link routes like normal routes and don't add them as a side effect of handling ip addresses on interfaces.

Description

Currently on-link routes are added indirectly when adding ip addresses with a non all-1 netmask. But the kernel notifies us about these routes as well, and we try to handle them, but due to special handling they always stay as unresolved.

So fix this by allowing on-link routes (without any ip next hops) to be added and removed, and drop the special handling for ip addresses.

As a side effect includes a fix for routes on vlan interfaces on ports.

Motivation and Context

This is a preparation for tackling the non-routed L3 neighbor handling (#364). We need to know about on-link routes being added or going away, so we can determine if a neighbor is routable or not, and add/remove their flows.

How Has This Been Tested?

Running a full pipeline on ag5648 (currently in progress)

Depends on bisdn/meta-switch#54

When adding routes over vlan interface on port or bond interfaces, their
port id will be 0, but they won't be a bridge interface either, so they
get rejected.

Fix this by using the function cnetlink::is_switch_interface(), which
will also simplify the check a bit.

Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
Do not rely on the nl_l3::get_neighbors_of_route() including the
destination of the route as a nexthop, and instead do a test if we have
a via or gw, and if not, use the remote directly as the next hop.

Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
On-link routes will have a next hop with just the interface. In this
case rtnl_route_nh_get_via will return a nullptr. In this case, just
ignore the nexthop, and don't add it to unresolved_nexthops.

This then allows dropping the special handling of LINK_SCOPE later on,
since unresolved_nhs won't contain the route itself anymore.

Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
On-link routes have no via, so they will never have a reachable nexthop.
Demote the ERROR log to a debug log.

Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
Now that we properly handle the on-link route in {add,del}_l3_route, we
do not manually need to add it in {add,del}_l3_addr anymore.

Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
@rubensfig rubensfig merged commit 2b59d88 into master Mar 9, 2022
@rubensfig rubensfig deleted the jogo_handle_on_link_routes branch March 9, 2022 08:46
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.

None yet

2 participants