[PATCH net-next 3/4] netconsole: reject enabling a target with no remote IP address

From: Gustavo Luiz Duarte

Date: Wed Aug 05 2026 - 17:38:53 EST


The command-line path already requires a remote address, but if a user
creates a dynamic target and enables it without setting a remote
address, we currently try sending netconsole traffic to "0.0.0.0".

Refuse to enable a target if the remote address is unset.

Signed-off-by: Gustavo Luiz Duarte <gustavold@xxxxxxxxx>
---
drivers/net/netconsole.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 070bae7b4fd7..a41b0a5ce64f 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -471,6 +471,12 @@ static int netcons_netpoll_setup(struct netconsole_target *nt)
int err;

rtnl_lock();
+ if (nt->remote_ip.family == AF_UNSPEC) {
+ np_err(np, "remote IP address not configured, aborting\n");
+ err = -EDESTADDRREQ;
+ goto unlock;
+ }
+
if (np->dev_name[0])
ndev = __dev_get_by_name(net, np->dev_name);
else if (is_valid_ether_addr(np->dev_mac))

--
2.55.0