<feed xmlns='http://www.w3.org/2005/Atom'>
<title>passt/test/pasta_options/multipath_gateway, branch master</title>
<subtitle>Plug A Simple Socket Transport</subtitle>
<link rel='alternate' type='text/html' href='https://passt.top/passt/'/>
<entry>
<title>netlink: Fix gateway selection for multipath default routes</title>
<updated>2026-12-02T21:36:25+00:00</updated>
<author>
<name>Benjamin Schubert</name>
<email>bschubert15@bloomberg.net</email>
</author>
<published>2026-12-01T14:07:58+00:00</published>
<link rel='alternate' type='text/html' href='https://passt.top/passt/commit/?id=05d3780b82d858041f982a276db0de7167f8b661'/>
<id>05d3780b82d858041f982a276db0de7167f8b661</id>
<content type='text'>
The documentation of `--gateway` in `passt.1` states that
for a multipath default route, the first nexthop router returned
by the kernel with the highest weight is selected.

`nl_route_get_def_multipath()` however allowed a subsequent route with
the same weight to override the nexthop, so it was the last gateway
with a nexthop that would actually be chosen.

This aligns the code with the documentation, by fixing the code to
only select a new gateway if it has strictly a higher weight.

Also update the selected weight only after finding a gateway.
Since a device-only nexthop is not a gateway candidate, it must
not prevent a subsequent gateway from being selected.

Add 7 tests for various ipv4 and ipv6 scenarios with multipath
gateways. Note that ipv6 with no default gateway is not accepted by
the kernel, and thus ipv6 has one less test.
All 7 tests fail before this change.

Link: https://bugs.passt.top/show_bug.cgi?id=230
Signed-off-by: Benjamin Schubert &lt;bschubert15@bloomberg.net&gt;
[sbrivio: Fix typos in commit message]
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The documentation of `--gateway` in `passt.1` states that
for a multipath default route, the first nexthop router returned
by the kernel with the highest weight is selected.

`nl_route_get_def_multipath()` however allowed a subsequent route with
the same weight to override the nexthop, so it was the last gateway
with a nexthop that would actually be chosen.

This aligns the code with the documentation, by fixing the code to
only select a new gateway if it has strictly a higher weight.

Also update the selected weight only after finding a gateway.
Since a device-only nexthop is not a gateway candidate, it must
not prevent a subsequent gateway from being selected.

Add 7 tests for various ipv4 and ipv6 scenarios with multipath
gateways. Note that ipv6 with no default gateway is not accepted by
the kernel, and thus ipv6 has one less test.
All 7 tests fail before this change.

Link: https://bugs.passt.top/show_bug.cgi?id=230
Signed-off-by: Benjamin Schubert &lt;bschubert15@bloomberg.net&gt;
[sbrivio: Fix typos in commit message]
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
