From: Jon Maloy <jmaloy@redhat.com>
To: Benjamin Schubert <contact@benschubert.me>,
"passt-dev@passt.top" <passt-dev@passt.top>
Subject: Re: [PATCH] netlink: Only consider gateway from the selected template interface
Date: Thu, 3 Dec 2026 14:37:10 -0500 [thread overview]
Message-ID: <8d80cd4a-5b4d-487c-9af6-1f7b25d60454@redhat.com> (raw)
In-Reply-To: <2UuogkMNAhFH_0bGAADpm7VgzMi123uydmdNZpZZ6tWdhkxB8y5S4Z4h4Ela1Vyb0QymFQg2Pe03CsvEWjLtdvbeFhbCuBJthILFuMs-JYo=@benschubert.me>
On 2026-12-03 10:12, Benjamin Schubert wrote:
> From: Benjamin Schubert <bschubert15@bloomberg.net>
>
[...]
> This considers only nexthops from the current interface instead of all
> interfaces when looking at the template interface, ensuring that the ip
> and the gateway are always aligned.
The change looks correct to me. A couple of comments:
- passt.1 still says that, for a multipath default route, "the gateway
is the first nexthop router returned by the kernel which has the
highest weight in the set of paths". With this change, it's the
highest-weight one on the template interface, so I think the man
page should be updated accordingly.
- Alternatively, nl_get_ext_if() could pick the template interface
from the highest-weight nexthop instead of the first one, which
would keep the documented behaviour. I'm fine with either, maybe
Stefano has a preference.
>
> Link: https://bugs.passt.top/show_bug.cgi?id=232
> Signed-off-by: Benjamin Schubert <bschubert15@bloomberg.net>
> ---
> netlink.c | 8 +++--
> test/pasta_options/multipath_gateway | 46 ++++++++++++++++++++++++++--
> 2 files changed, 50 insertions(+), 4 deletions(-)
>
> diff --git a/netlink.c b/netlink.c
> index 37c55cc..f7bc7ab 100644
> --- a/netlink.c
> +++ b/netlink.c
> @@ -362,26 +362,30 @@ unsigned int nl_get_ext_if(int s, sa_family_t af)
> }
>
> /**
> * nl_route_get_def_multipath() - Get first highest-weight route from nexthop list
> * @rta: Routing netlink attribute with type RTA_MULTIPATH
> + * @ifi: Interface index
> * @gw: Default gateway to fill
> *
> * Return: true if a gateway was found, false otherwise
> */
> -static bool nl_route_get_def_multipath(struct rtattr *rta, void *gw)
> +static bool nl_route_get_def_multipath(struct rtattr *rta, unsigned int ifi, void *gw)
This line exceeds 80 columns.
> {
> int nh_len = RTA_PAYLOAD(rta);
> struct rtnexthop *rtnh;
[...]
> +def ipv4_other_interface
> +ipv4
> +set OTHER_PREFIX 192.51.100.
I guess you meant 198.51.100. (TEST-NET-2, RFC 5737): 192.51.100.0/24
is regular address space.
> +set OTHER_INTERFACE_SETUP ip link add dummy1 type dummy; ip link set dummy1 up; ip -4 address add __OTHER_PREFIX__10/24 dev dummy1
> +endef
> +
[...]
> +set NEXTHOPS nexthop via __OTHER_PREFIX__1 dev dummy1 weight 3 nexthop via __PREFIX__1 dev dummy0 weight 1
> +set EXPECTED __PREFIX__1
> +check_gateway
Nit: a Fixes: tag for 6c7623d0 ("netlink: Add support to fetch default
gateway from multipath routes") would be nice, as that's where we
started picking the gateway from any nexthop, including ones on
interfaces other than the template interface.
///jon
prev parent reply other threads:[~2026-12-03 19:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 15:12 Benjamin Schubert
2026-12-03 19:37 ` Jon Maloy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8d80cd4a-5b4d-487c-9af6-1f7b25d60454@redhat.com \
--to=jmaloy@redhat.com \
--cc=contact@benschubert.me \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).