From: Breno Leitao <leitao@debian.org>
To: Gustavo Luiz Duarte <gustavold@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
asantostc@gmail.com, kernel-team@meta.com
Subject: Re: [PATCH net-next 4/9] netconsole: move netpoll_local_ip_unset() as netcons_local_ip_unset()
Date: Wed, 29 Jul 2026 03:23:28 -0700 [thread overview]
Message-ID: <amnSAs8Ot4fR3lhc@gmail.com> (raw)
In-Reply-To: <CAGSyskW6iqoWk8DpLZbi=8xoME1J8LaSnjBNvAbAg6+b8kszBg@mail.gmail.com>
On Tue, Jul 28, 2026 at 12:49:46AM +0100, Gustavo Luiz Duarte wrote:
> On Fri, Jul 24, 2026 at 4:05 PM Breno Leitao <leitao@debian.org> wrote:
> >
> > Move netpoll_local_ip_unset() from netpoll to netconsole and rename it
> > to netcons_local_ip_unset();
> >
> > The body is otherwise unchanged, only the comment's setup-function
> > reference is updated.
> >
> > Signed-off-by: Breno Leitao <leitao@debian.org>
> > ---
> > drivers/net/netconsole.c | 19 ++++++++++++++++++-
> > include/linux/netpoll.h | 1 -
> > net/core/netpoll.c | 18 ------------------
> > 3 files changed, 18 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
> > index 3a7a2cafc6276..70f9c5bfb3720 100644
> > --- a/drivers/net/netconsole.c
> > +++ b/drivers/net/netconsole.c
> > @@ -351,6 +351,23 @@ static void netconsole_skb_pool_flush(struct netconsole_target *nt)
> > skb_queue_purge_reason(&nt->skb_pool, SKB_CONSUMED);
> > }
> >
> > +/*
> > + * Test whether the caller left np->local_ip unset, so that
> > + * netcons_netpoll_setup() should auto-populate it from the egress device.
> > + *
> > + * np->local_ip is a union of __be32 (IPv4) and struct in6_addr (IPv6),
> > + * so an IPv6 address whose first 4 bytes are zero (e.g. ::1, ::2,
> > + * IPv4-mapped ::ffff:a.b.c.d) must not be tested via the IPv4 arm —
> > + * doing so would misclassify a caller-supplied address as unset and
> > + * silently overwrite it with whatever address the device exposes.
> > + */
> > +static bool netcons_local_ip_unset(const struct netpoll *np)
> > +{
> > + if (np->ipv6)
> > + return ipv6_addr_any(&np->local_ip.in6);
> > + return !np->local_ip.ip;
> > +}
>
>
> This whole checking if it is all zeroes in netcons_local_ip_unset()
> looks very cumbersome.
> Perhaps instead of storing 'bool ipv6' we could have something like
> 'u8 family', which would contain AF_INET for ipv4, AF_INET6 for ipv6,
> or AF_UNSPEC if unset.
Agree, an explicit state machine would clarify the three cases: IPv4,
IPv6, or unspecified (with netconsole deriving it from the device).
Now that the helper lives in netconsole, the awkwardness is more visible.
> But that would be another patch separate from this refactoring, so for
> this patch:
Thanks for the review. Would you be interested in pursuing that change
once this lands?
next prev parent reply other threads:[~2026-07-29 10:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 15:04 [PATCH net-next 0/9] netpoll: finish untangling netconsole from netpoll Breno Leitao
2026-07-24 15:04 ` [PATCH net-next 1/9] netpoll: export carrier_timeout via netpoll_get_carrier_timeout() Breno Leitao
2026-07-27 23:24 ` Gustavo Luiz Duarte
2026-07-24 15:04 ` [PATCH net-next 2/9] netpoll: export the netpoll_setup() helpers for netconsole Breno Leitao
2026-07-27 23:25 ` Gustavo Luiz Duarte
2026-07-24 15:04 ` [PATCH net-next 3/9] netconsole: take over netpoll_setup() from netpoll Breno Leitao
2026-07-27 23:38 ` Gustavo Luiz Duarte
2026-07-24 15:04 ` [PATCH net-next 4/9] netconsole: move netpoll_local_ip_unset() as netcons_local_ip_unset() Breno Leitao
2026-07-27 23:49 ` Gustavo Luiz Duarte
2026-07-29 10:23 ` Breno Leitao [this message]
2026-07-29 14:05 ` Gustavo Luiz Duarte
2026-07-24 15:04 ` [PATCH net-next 5/9] netconsole: move netpoll_take_ipv4() as netcons_take_ipv4() Breno Leitao
2026-07-29 14:06 ` Gustavo Luiz Duarte
2026-07-24 15:04 ` [PATCH net-next 6/9] netconsole: move netpoll_take_ipv6() as netcons_take_ipv6() Breno Leitao
2026-07-29 14:07 ` Gustavo Luiz Duarte
2026-07-24 15:04 ` [PATCH net-next 7/9] netconsole: move egress_dev() as netcons_egress_dev() Breno Leitao
2026-07-29 14:07 ` Gustavo Luiz Duarte
2026-07-24 15:04 ` [PATCH net-next 8/9] netconsole: move local_ip/remote_ip/ipv6 to netconsole_target Breno Leitao
2026-07-29 14:08 ` Gustavo Luiz Duarte
2026-07-24 15:04 ` [PATCH net-next 9/9] netconsole: move netpoll_wait_carrier() as netcons_wait_carrier() Breno Leitao
2026-07-29 14:09 ` Gustavo Luiz Duarte
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=amnSAs8Ot4fR3lhc@gmail.com \
--to=leitao@debian.org \
--cc=andrew+netdev@lunn.ch \
--cc=asantostc@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gustavold@gmail.com \
--cc=horms@kernel.org \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox