[PATCH net-next v3 0/7] netconsole: validate a target's IP address configuration

Gustavo Luiz Duarte posted 7 patches 1 month, 2 weeks ago
There is a newer version of this series
Documentation/networking/netconsole.rst |   5 ++
drivers/net/netconsole.c                | 132 ++++++++++++++++----------------
include/linux/netpoll.h                 |   5 --
3 files changed, 70 insertions(+), 72 deletions(-)
[PATCH net-next v3 0/7] netconsole: validate a target's IP address configuration
Posted by Gustavo Luiz Duarte 1 month, 2 weeks ago
This series adds two validations to the target configuration when the
user tries to enable it: first whether remote_ip was set, and second
whether local_ip and remote_ip address families match. Refuse to enable
the target if any of those validations fail.

These validations are already done for the target passed on the
command-line, so this aligns dynamic targets with the command-line
behavior.

The first two patches replace the per-target 'ipv6' flag with a
per-address 'family' field, which makes it easier to detect these error
conditions. Patches 3 and 4 implement the actual validations.

Patches 5-7 are follow-ups from previous reviews: move inet_addr from
netpoll.h into netconsole.c, show an unset address as an empty string
rather than "0.0.0.0", document local_ip auto-selection.

Signed-off-by: Gustavo Luiz Duarte <gustavold@gmail.com>
---
Changes in v3:
- Document local_ip auto-selection
- Link to v2: https://patch.msgid.link/20260810-netcons_ipv6-v2-0-3d4fc987a90f@gmail.com

Changes in v2:
- Show empty string in configfs for an unset IP address
- Moved inet_addr definition from netpoll.h to netconsole.c
- Moved address checks out of rtnl_lock()
- Link to v1: https://patch.msgid.link/20260805-netcons_ipv6-v1-0-170a35b92da1@gmail.com

To: Breno Leitao <leitao@debian.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>
To: "David S. Miller" <davem@davemloft.net>
To: Eric Dumazet <edumazet@google.com>
To: Jakub Kicinski <kuba@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>
To: Simon Horman <horms@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-doc@vger.kernel.org

---
Gustavo Luiz Duarte (7):
      netconsole: add an address family to struct inet_addr
      netconsole: use the address family instead of the ipv6 flag
      netconsole: reject enabling a target with no remote IP address
      netconsole: reject a target mixing IPv4 and IPv6 addresses
      netconsole: show empty string for an unset IP address
      netconsole: move struct inet_addr into netconsole.c
      docs: netconsole: document local_ip auto-selection

 Documentation/networking/netconsole.rst |   5 ++
 drivers/net/netconsole.c                | 132 ++++++++++++++++----------------
 include/linux/netpoll.h                 |   5 --
 3 files changed, 70 insertions(+), 72 deletions(-)
---
base-commit: 4f93b12cf7b25fbf8e73d222722805b049f0a6d3
change-id: 20260730-netcons_ipv6-565d55f55729

Best regards,
--  
Gustavo Luiz Duarte <gustavold@gmail.com>
Re: [PATCH net-next v3 0/7] netconsole: validate a target's IP address configuration
Posted by Jakub Kicinski 1 month, 1 week ago
On Fri, 14 Aug 2026 20:28:51 +0100 Gustavo Luiz Duarte wrote:
> This series adds two validations to the target configuration when the
> user tries to enable it: first whether remote_ip was set, and second
> whether local_ip and remote_ip address families match. Refuse to enable
> the target if any of those validations fail.
> 
> These validations are already done for the target passed on the
> command-line, so this aligns dynamic targets with the command-line
> behavior.
> 
> The first two patches replace the per-target 'ipv6' flag with a
> per-address 'family' field, which makes it easier to detect these error
> conditions. Patches 3 and 4 implement the actual validations.
> 
> Patches 5-7 are follow-ups from previous reviews: move inet_addr from
> netpoll.h into netconsole.c, show an unset address as an empty string
> rather than "0.0.0.0", document local_ip auto-selection.

LGTM, but feels to risky to merge during the merge window.
Since we're changing semantics we should let this sit in linux-next
for at least a week. Please repost in Sept.

BTW please carefully review clashiko feedback:
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260814-netcons_ipv6-v3-7-bc0915e8c75f@gmail.com
It marked as preexisting the problem of IP versions diverging but 
I think it's relevant (patch 2)?
Re: [PATCH net-next v3 0/7] netconsole: validate a target's IP address configuration
Posted by Gustavo Luiz Duarte 1 month, 1 week ago
On Tue, Aug 18, 2026 at 5:51 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri, 14 Aug 2026 20:28:51 +0100 Gustavo Luiz Duarte wrote:
> > This series adds two validations to the target configuration when the
> > user tries to enable it: first whether remote_ip was set, and second
> > whether local_ip and remote_ip address families match. Refuse to enable
> > the target if any of those validations fail.
> >
> > These validations are already done for the target passed on the
> > command-line, so this aligns dynamic targets with the command-line
> > behavior.
> >
> > The first two patches replace the per-target 'ipv6' flag with a
> > per-address 'family' field, which makes it easier to detect these error
> > conditions. Patches 3 and 4 implement the actual validations.
> >
> > Patches 5-7 are follow-ups from previous reviews: move inet_addr from
> > netpoll.h into netconsole.c, show an unset address as an empty string
> > rather than "0.0.0.0", document local_ip auto-selection.
>
> LGTM, but feels to risky to merge during the merge window.
> Since we're changing semantics we should let this sit in linux-next
> for at least a week. Please repost in Sept.

Sounds good.

>
> BTW please carefully review clashiko feedback:
> https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260814-netcons_ipv6-v3-7-bc0915e8c75f@gmail.com
> It marked as preexisting the problem of IP versions diverging but
> I think it's relevant (patch 2)?

The issue of IP versions diverging is indeed a preexisting bug and it
is fixed by patch 4/7.
I deliberately kept the fix separate from the refactoring for clarity.

Another preexisting bug that sashiko called out (patch 5) is the lack
of locking on local_ip_show / remote_ip_show, which can lead to
printing a partially updated address.
But worse than that is local_mac_show (sashiko missed this one), which
can lead to UAF if the user reads local_mac concurrently with target
teardown.
I will send a separate patch set to fix these *_show callbacks with
proper locking.