From nobody Mon Sep 28 23:55:27 2026 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78B4D38B7D1 for ; Fri, 14 Aug 2026 19:29:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735767; cv=none; b=IrgIIYhetR+/s4yZ0JhSjLYvhC7B7iQcc6QvaOhzKluHufmbwB+lSwgxdDkE72+tzmD5W0usGTdYmmB67DpE4ZuABZn7Sf+7a/mmQ2+aGptoaPj9ZYHCiIpqPJ2ylmyP5TMJ18oV2SVv/dwF2VER32rAx+HHk+srF9gt8Va0mqE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735767; c=relaxed/simple; bh=rtw1I6+ZQwIhsJ1KAJ7coYMuQ5TqGSxTCkqUoPJfohw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=narjmO/S3LSp5s3tKPJfm/y3dWtYlkXzz3RMq0M+wGjYeyKO9Jf7IKwtALN0d1hO5jLLvTJtJGcT5CoczidXgSm3MZ8jZ/GR4HyttcNmsHkSyseJnUJBcYLWxaYqOWTwq2XkkFDB/Z0ivSEe6jG6cgASUKKTCRRTHzhqsjAjMfI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=h7xeKATe; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h7xeKATe" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4954b3c5cbeso897145e9.1 for ; Fri, 14 Aug 2026 12:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786735762; x=1787340562; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=pPlwGzMzreFTOH2oIaycDj0Xnl8STIJ81ul4wFBoks0=; b=h7xeKATeduxjxa8W2gweEPuq3pMFlG9BxUDMfX0sUlvjmDtNFCN18BsIoA72bX8kKw pM8wDLMk7wwCtXYWEL9BU5Z9YQ0Ka2oP64jUSGaggt/7AxZClS/KdD5R3NyPR9h6Y9LQ My0KQWuP9RGHXiqQGlkqsBF0uZdCgmIJm7ahHFgXsVDmrG5LxXBAunl4DFbRkcWWSBXp AKcssnYaEYpXNkVtDOdpmdyLqV8ta8q4lpMo5RMW5c+UjXMeE0KTZY6mmdpJX7ucYbcE q4Nwde21YOkGHzFBrGGchSTgK/0Xj/wvkE8ORUUbADmyV2CNRHdWPCvK/QQYpzAlopv0 WV/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786735762; x=1787340562; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=pPlwGzMzreFTOH2oIaycDj0Xnl8STIJ81ul4wFBoks0=; b=Ugs9gsmAAi3hqx71RUtjCJs1GUqu88WsaD/w9O20A5Od9u0XxArRah+0pQeMaTrnav 3HcUMqk7JugdcJKFAM6LkWRWgEFJsnPf09H28YrDg4kWNmLchCp5N652TIQcWDeTnAmF yjWoRuut5TFYVBSuDhJAvFtgABJv5iBsJT4bes8xXcRIY5YITI4vLxEPvViJ76cgeVcH djALIleBMaz72z+1BdsQnlCtiX38c2XnI2sNl+BqsDiWKW2ZJk9nk1gxlN6TZOIItmSa QMyXdI0eAL1UI3Wci3gaZU4OrGLMtlD3wbqZZ8TKLUyFECTSgdTcWTRlcLSuA8EYVdCY i7kg== X-Forwarded-Encrypted: i=1; AHgh+RqWiEfJV+wop0cUhUB/5PJiPq7Zd9ZdwvVfLjLuUjHGi/6s9M7yKqpuoQfMRXI5r3/Fa07lN4dZt72ki7M=@vger.kernel.org X-Gm-Message-State: AOJu0YypoQaSZHI3KfLqGJHoARMqhLfKm58sqo/zigKYqOFddsw9HBPO 34dsaG/2YzhfbqToWkCi2ZVrEyQq+BSuCNLiA39Fab+zPx3cey1BDS11 X-Gm-Gg: AR+sD11h8Nt3xUalfodtoTFkuiUDLZM/CKbLq8zi/ASmBTQ7OCUv5QzJTn5QbCYPFxs c5iOQIW2KkohqtRGXo+Voe0VfWYyLFL+MW6wCOZ6XSY6akGiEikXcEJGGB3CAA+A5S8A/sJwTP9 gFBIHm8hVApavtTrJgIpVa7XqwaqL6sGECaDYMJIrN4wNE4E28WiC01fh1tkialIgXStwarUzX3 9IePoQFX2iWuuabxhSHCmmXIwD/SzuZqU/y5Jpp8pYojnJZfAQwziBDLI/PBeVKRfiYrv0YcILk ygL1umtIT+EG4wTD/1jVGq6R1r5wSff46t6sdurUHAmcNJ8x/7HshZjnQSgbzWltVBKTOL2iGeL asz7Ur2E4YTe8YIxZI7Mv/kEJrjM60mece+VFctQ9nb7rMZw7avtK8P6dyejOCV6xkZS2DCTDjB CWkAsql4ORVaJ0O14zOdOvWffcyl7uTSYDYSaWeP3fBQG8RzrGWoL2uQ== X-Received: by 2002:a05:600c:1395:b0:499:77de:78ba with SMTP id 5b1f17b1804b1-499879826b2mr57167795e9.2.1786735761874; Fri, 14 Aug 2026 12:29:21 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::4:391e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49988b2a87dsm67293475e9.15.2026.08.14.12.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2026 12:29:21 -0700 (PDT) From: Gustavo Luiz Duarte Date: Fri, 14 Aug 2026 20:28:52 +0100 Subject: [PATCH net-next v3 1/7] netconsole: add an address family to struct inet_addr Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-netcons_ipv6-v3-1-bc0915e8c75f@gmail.com> References: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> In-Reply-To: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> To: Breno Leitao , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan Cc: Gustavo Luiz Duarte , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org X-Mailer: b4 0.15.2 netconsole_target stores a single 'bool ipv6' to denote the target's address family. This makes it hard to detect conditions like "no address set" or ipv4/ipv6 mixup between local_ip and remote_ip. Add a 'family' field to inet_addr so each address stores its own address family: AF_UNSPEC while unset, else AF_INET or AF_INET6. Nothing reads the new field yet. The next patch switches the users over and removes the bool. No functional change. Reviewed-by: Breno Leitao Signed-off-by: Gustavo Luiz Duarte --- drivers/net/netconsole.c | 24 +++++++++++++++--------- include/linux/netpoll.h | 10 +++++++--- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index b358e5c36735..432b66cf111a 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -225,7 +225,7 @@ struct netconsole_target { bool extended; bool release; struct netpoll np; - union inet_addr local_ip, remote_ip; + struct inet_addr local_ip, remote_ip; bool ipv6; u16 local_port, remote_port; u8 remote_mac[ETH_ALEN]; @@ -428,6 +428,7 @@ static int netcons_take_ipv6(struct netconsole_target *= nt, continue; /* Got the IP, let's return */ nt->local_ip.in6 =3D ifp->addr; + nt->local_ip.family =3D AF_INET6; err =3D 0; break; } @@ -469,6 +470,7 @@ static int netcons_take_ipv4(struct netconsole_target *= nt, } =20 nt->local_ip.ip =3D ifa->ifa_local; + nt->local_ip.family =3D AF_INET; np_info(np, "local IP %pI4\n", &nt->local_ip.ip); =20 return 0; @@ -741,10 +743,10 @@ static void netconsole_print_banner(struct netconsole= _target *nt) np_info(np, "remote ethernet address %pM\n", nt->remote_mac); } =20 -/* Parse the string and populate the `inet_addr` union. Return 0 if IPv4 is +/* Parse the string and populate the `inet_addr` struct. Return 0 if IPv4 = is * populated, 1 if IPv6 is populated, and -1 upon failure. */ -static int netpoll_parse_ip_addr(const char *str, union inet_addr *addr) +static int netpoll_parse_ip_addr(const char *str, struct inet_addr *addr) { const char *end =3D NULL; int len; @@ -756,14 +758,18 @@ static int netpoll_parse_ip_addr(const char *str, uni= on inet_addr *addr) if (str[len - 1] =3D=3D '\n') len -=3D 1; =20 - if (in4_pton(str, len, (void *)addr, -1, &end) > 0 && - (!end || *end =3D=3D 0 || *end =3D=3D '\n')) + if (in4_pton(str, len, (void *)&addr->ip, -1, &end) > 0 && + (!end || *end =3D=3D 0 || *end =3D=3D '\n')) { + addr->family =3D AF_INET; return 0; + } =20 if (IS_ENABLED(CONFIG_IPV6) && - in6_pton(str, len, (void *)addr, -1, &end) > 0 && - (!end || *end =3D=3D 0 || *end =3D=3D '\n')) + in6_pton(str, len, (void *)&addr->in6, -1, &end) > 0 && + (!end || *end =3D=3D 0 || *end =3D=3D '\n')) { + addr->family =3D AF_INET6; return 1; + } =20 return -1; } @@ -871,7 +877,7 @@ static ssize_t local_ip_show(struct config_item *item, = char *buf) if (nt->ipv6) return sysfs_emit(buf, "%pI6c\n", &nt->local_ip.in6); else - return sysfs_emit(buf, "%pI4\n", &nt->local_ip); + return sysfs_emit(buf, "%pI4\n", &nt->local_ip.ip); } =20 static ssize_t remote_ip_show(struct config_item *item, char *buf) @@ -881,7 +887,7 @@ static ssize_t remote_ip_show(struct config_item *item,= char *buf) if (nt->ipv6) return sysfs_emit(buf, "%pI6c\n", &nt->remote_ip.in6); else - return sysfs_emit(buf, "%pI4\n", &nt->remote_ip); + return sysfs_emit(buf, "%pI4\n", &nt->remote_ip.ip); } =20 static ssize_t local_mac_show(struct config_item *item, char *buf) diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 1c6b1eec5efd..de97f001a0f9 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -16,9 +16,13 @@ #include #include =20 -union inet_addr { - __be32 ip; - struct in6_addr in6; +struct inet_addr { + /* Address family: AF_UNSPEC when unset, else AF_INET or AF_INET6 */ + u8 family; + union { + __be32 ip; + struct in6_addr in6; + }; }; =20 struct netpoll { --=20 2.55.0 From nobody Mon Sep 28 23:55:27 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3D7D3B0ACD for ; Fri, 14 Aug 2026 19:29:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735771; cv=none; b=fDGreQ9CYZFhMcQOE09E4tL64kvyktMmUI0/3dR3D8DoTgu5zuwqPSvJqRCQ2zEy01fabkBfBFWEoDlQnCWzbxgPic1zGJtFEHhsw6d0hQMVOHDuNoieEQLpLy04PNlt3y/vDKL25WPX/LCOrDKfr+9gzLzGoyteDSCub/1+ISA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735771; c=relaxed/simple; bh=GhZD17cuw5gYUVnyHmaSI6jBf22mSnRirzc/2LtRvPA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=czkOrkVD4YULJYZytka9h5dmZJPiW0CXRt4wCPhkbQsb/740NIQSmcz+jtKvy68dF6FQ8rWdRcrxM33Yj4jZ5G7+y6QuEmDkbvurV/DEaIjryuDhfJQ0jH7+pSGtGYZjJXisq4K1WOt9RVukzmAlubEkRYNWMFh89STEGR0a69I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QOPsqEvR; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QOPsqEvR" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-49987367394so596035e9.0 for ; Fri, 14 Aug 2026 12:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786735763; x=1787340563; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ECtMwAmDF1K5nODesCePL78MgfJUPMGWesJDcm6OOPY=; b=QOPsqEvRJFzQUX9vjFED9pbpo1XrEuAIvh0I+Nz/3aduc2wa6PzhB/ncpoHNXXgLGv 5W2KAnz8/XunoXxScZQmfVGRKqXukI463JdBNhTVMdzB0X/gp52r/YlM8DjNXki+8Egk dBA5pwn9/1wsrG4vUQ9LjZkvEv06+IUdAfgxlQlzCuzVRGbTzR6HGAYE5VdwAgKL8Yl8 844B5Fw58gCetE3bW6863HtZnXh7VCPrpZjf6FTIbYwQmnmvcZbbabGNNRLKSXlvThAi jG/wrn8qt8x84l7RE+YpsC9HlTHP7OZYqVBTmfMt0lA2xDE8v21O3N+mSnamROnSIY84 zwCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786735763; x=1787340563; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ECtMwAmDF1K5nODesCePL78MgfJUPMGWesJDcm6OOPY=; b=BqAcB9bi96lIonR2dVfvYoM+5pkkHz4fo1T4A2sT+N2S8qutuKc/tlIRfB4WRYzZi1 epYMk181EKkR1ggxswGqHa8y+EXsLFFaE3yr0vvWg1ljQIelk3yMQSyxYmWQOo8ARiLt dRwzo38Xb6BWRvUJ9wE/PSe+ymXTLqXE/7oUlWfDXn3VbzVZw1vtSm6yE1HRDPf+okmX xKludDL1RNxHRutXX+jL6HOEYr9IbH9JtlFNt+mtBTdebKaxAYmnPGZp7I1rvROQ9vSq P9DctQaDVqLMCMhzLNh0JTPK/6CmiWZxildGWuNsfEJXPP8MxkokjpeQcGSbavYH9vPG spEw== X-Forwarded-Encrypted: i=1; AHgh+RqAuIozUvSdmXSwhd0k9S07ZOIx/2K1oFWPisxd95UVB3I6vMw7oPhc5PtzqhNTj7cTyi5XrtuntnB0B9Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yz3ASJIopGxK6Ol53nblPAvQP/3xR2YXzkuXIGe+b8gtVIA3CAs vIM2ezxFHc+lpkd2OlogHuSl2qN2FV5RxMSlDV2q31XuIva82Ug/aenZ X-Gm-Gg: AR+sD10izBKnDoiTI17D8sHO97p61UZlXEoxih7zl6pCC0c+qp6eKRblIrpWTQ2ndrv A8GF+I1LlwYR82gta/lmOfDl/yQkFsRsDYL5i8fq2/dE/2mvfa39MPqhfwB0etx781fw3Nb3S+k m4Ganho0QDhDYEt02gOhKrL6tn4ddGINS60DbPnUnWr1tHAApiax5rxKUjVMR3gtW/YwKDGmYIr uwYSgkQsb0fKHqyj5G1bupNf8WsBVSAbgDAgxVGVgvC8I9zbkIACrxedppU1Qs/tTPOS/qUTBlo Cm9M8KnBebbQssK/Dz3R64xUDkdNBXIGafm4BWPQ8z1yEEMfFMhblP3blopvsZLOCQjQrfIdfcB lYa1jXqoA5+pBQJZbeuctL7rtwvowufHboTh6JTcoltbxiw+Oj0xOUqXRydAePuNq4kr2nSUPdX w8fDz8BYK4a+QCacWXUt/Z4w0UE13gqDkGOvpVa6zLd2w= X-Received: by 2002:a05:600c:3b1f:b0:490:ec79:3046 with SMTP id 5b1f17b1804b1-499878d463cmr57282875e9.0.1786735763094; Fri, 14 Aug 2026 12:29:23 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::4:391e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49988b2a509sm73702315e9.14.2026.08.14.12.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2026 12:29:22 -0700 (PDT) From: Gustavo Luiz Duarte Date: Fri, 14 Aug 2026 20:28:53 +0100 Subject: [PATCH net-next v3 2/7] netconsole: use the address family instead of the ipv6 flag Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-netcons_ipv6-v3-2-bc0915e8c75f@gmail.com> References: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> In-Reply-To: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> To: Breno Leitao , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan Cc: Gustavo Luiz Duarte , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org X-Mailer: b4 0.15.2 Now that we have the address family in inet_addr, use that and remove nt->ipv6. We no longer need netcons_local_ip_unset() to check that all bytes are zeroes, as that is now denoted by (family =3D=3D AF_UNSPEC). Reviewed-by: Breno Leitao Signed-off-by: Gustavo Luiz Duarte --- drivers/net/netconsole.c | 82 ++++++++++++++------------------------------= ---- 1 file changed, 23 insertions(+), 59 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 432b66cf111a..351754d53cf9 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -195,7 +195,6 @@ struct netcons_userdata { * local_mac (read-only) * @local_ip: Source IP address of the target (read-write). * @remote_ip: Destination IP address of the target (read-write). - * @ipv6: Whether the target addresses are IPv6 (read-write). * @local_port: Source UDP port of the target (read-write). * @remote_port: Destination UDP port of the target (read-write). * @remote_mac: Destination ethernet address of the target (read-write). @@ -226,7 +225,6 @@ struct netconsole_target { bool release; struct netpoll np; struct inet_addr local_ip, remote_ip; - bool ipv6; u16 local_port, remote_port; u8 remote_mac[ETH_ALEN]; /* protected by target_list_lock; +1 gives scnprintf() room for its @@ -476,23 +474,6 @@ static int netcons_take_ipv4(struct netconsole_target = *nt, return 0; } =20 -/* - * Test whether the caller left nt->local_ip unset, so that - * netcons_netpoll_setup() should auto-populate it from the egress device. - * - * nt->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 =E2=80= =94 - * 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 netconsole_target *nt) -{ - if (nt->ipv6) - return ipv6_addr_any(&nt->local_ip.in6); - return !nt->local_ip.ip; -} - static int netcons_netpoll_setup(struct netconsole_target *nt) { struct net *net =3D current->nsproxy->net_ns; @@ -538,16 +519,13 @@ static int netcons_netpoll_setup(struct netconsole_ta= rget *nt) rtnl_lock(); } =20 - if (netcons_local_ip_unset(nt)) { - if (!nt->ipv6) { - err =3D netcons_take_ipv4(nt, ndev); - if (err) - goto put; - } else { + if (nt->local_ip.family =3D=3D AF_UNSPEC) { + if (nt->remote_ip.family =3D=3D AF_INET6) err =3D netcons_take_ipv6(nt, ndev); - if (err) - goto put; - } + else + err =3D netcons_take_ipv4(nt, ndev); + if (err) + goto put; ip_overwritten =3D true; } =20 @@ -729,22 +707,22 @@ static void netconsole_print_banner(struct netconsole= _target *nt) struct netpoll *np =3D &nt->np; =20 np_info(np, "local port %d\n", nt->local_port); - if (nt->ipv6) + if (nt->local_ip.family =3D=3D AF_INET6) np_info(np, "local IPv6 address %pI6c\n", &nt->local_ip.in6); else np_info(np, "local IPv4 address %pI4\n", &nt->local_ip.ip); np_info(np, "interface name '%s'\n", np->dev_name); np_info(np, "local ethernet address '%pM'\n", np->dev_mac); np_info(np, "remote port %d\n", nt->remote_port); - if (nt->ipv6) + if (nt->remote_ip.family =3D=3D AF_INET6) np_info(np, "remote IPv6 address %pI6c\n", &nt->remote_ip.in6); else np_info(np, "remote IPv4 address %pI4\n", &nt->remote_ip.ip); np_info(np, "remote ethernet address %pM\n", nt->remote_mac); } =20 -/* Parse the string and populate the `inet_addr` struct. Return 0 if IPv4 = is - * populated, 1 if IPv6 is populated, and -1 upon failure. +/* Parse the string and populate the `inet_addr` struct. Return 0 on succe= ss + * and -1 upon failure. */ static int netpoll_parse_ip_addr(const char *str, struct inet_addr *addr) { @@ -768,7 +746,7 @@ static int netpoll_parse_ip_addr(const char *str, struc= t inet_addr *addr) in6_pton(str, len, (void *)&addr->in6, -1, &end) > 0 && (!end || *end =3D=3D 0 || *end =3D=3D '\n')) { addr->family =3D AF_INET6; - return 1; + return 0; } =20 return -1; @@ -874,7 +852,7 @@ static ssize_t local_ip_show(struct config_item *item, = char *buf) { struct netconsole_target *nt =3D to_target(item); =20 - if (nt->ipv6) + if (nt->local_ip.family =3D=3D AF_INET6) return sysfs_emit(buf, "%pI6c\n", &nt->local_ip.in6); else return sysfs_emit(buf, "%pI4\n", &nt->local_ip.ip); @@ -884,7 +862,7 @@ static ssize_t remote_ip_show(struct config_item *item,= char *buf) { struct netconsole_target *nt =3D to_target(item); =20 - if (nt->ipv6) + if (nt->remote_ip.family =3D=3D AF_INET6) return sysfs_emit(buf, "%pI6c\n", &nt->remote_ip.in6); else return sysfs_emit(buf, "%pI4\n", &nt->remote_ip.ip); @@ -1232,7 +1210,6 @@ static ssize_t local_ip_store(struct config_item *ite= m, const char *buf, { struct netconsole_target *nt =3D to_target(item); ssize_t ret =3D -EINVAL; - int ipv6; =20 dynamic_netconsole_mutex_lock(); if (nt->state =3D=3D STATE_ENABLED) { @@ -1241,10 +1218,8 @@ static ssize_t local_ip_store(struct config_item *it= em, const char *buf, goto out_unlock; } =20 - ipv6 =3D netpoll_parse_ip_addr(buf, &nt->local_ip); - if (ipv6 =3D=3D -1) + if (netpoll_parse_ip_addr(buf, &nt->local_ip) < 0) goto out_unlock; - nt->ipv6 =3D !!ipv6; =20 ret =3D count; out_unlock: @@ -1257,7 +1232,6 @@ static ssize_t remote_ip_store(struct config_item *it= em, const char *buf, { struct netconsole_target *nt =3D to_target(item); ssize_t ret =3D -EINVAL; - int ipv6; =20 dynamic_netconsole_mutex_lock(); if (nt->state =3D=3D STATE_ENABLED) { @@ -1266,10 +1240,8 @@ static ssize_t remote_ip_store(struct config_item *i= tem, const char *buf, goto out_unlock; } =20 - ipv6 =3D netpoll_parse_ip_addr(buf, &nt->remote_ip); - if (ipv6 =3D=3D -1) + if (netpoll_parse_ip_addr(buf, &nt->remote_ip) < 0) goto out_unlock; - nt->ipv6 =3D !!ipv6; =20 ret =3D count; out_unlock: @@ -2078,7 +2050,7 @@ static void netpoll_udp_checksum(struct netconsole_ta= rget *nt, =20 /* check needs to be set, since it will be consumed in csum_partial */ udph->check =3D 0; - if (nt->ipv6) + if (nt->remote_ip.family =3D=3D AF_INET6) udph->check =3D csum_ipv6_magic(&nt->local_ip.in6, &nt->remote_ip.in6, udp_len, IPPROTO_UDP, @@ -2119,7 +2091,7 @@ static void push_eth(struct netconsole_target *nt, st= ruct sk_buff *skb) skb_reset_mac_header(skb); ether_addr_copy(eth->h_source, np->dev->dev_addr); ether_addr_copy(eth->h_dest, nt->remote_mac); - if (nt->ipv6) + if (nt->remote_ip.family =3D=3D AF_INET6) eth->h_proto =3D htons(ETH_P_IPV6); else eth->h_proto =3D htons(ETH_P_IP); @@ -2188,7 +2160,7 @@ static int netpoll_send_udp(struct netconsole_target = *nt, const char *msg, WARN_ON_ONCE(!irqs_disabled()); =20 udp_len =3D len + sizeof(struct udphdr); - if (nt->ipv6) + if (nt->remote_ip.family =3D=3D AF_INET6) ip_len =3D udp_len + sizeof(struct ipv6hdr); else ip_len =3D udp_len + sizeof(struct iphdr); @@ -2204,7 +2176,7 @@ static int netpoll_send_udp(struct netconsole_target = *nt, const char *msg, skb_put(skb, len); =20 push_udp(nt, skb, len); - if (nt->ipv6) + if (nt->remote_ip.family =3D=3D AF_INET6) push_ipv6(nt, skb, len); else push_ipv4(nt, skb, len); @@ -2533,10 +2505,8 @@ __releases(&target_list_lock) static int netconsole_parser_cmdline(struct netconsole_target *nt, char *o= pt) { struct netpoll *np =3D &nt->np; - bool ipversion_set =3D false; char *cur =3D opt; char *delim; - int ipv6; =20 if (*cur !=3D '@') { delim =3D strchr(cur, '@'); @@ -2550,16 +2520,12 @@ static int netconsole_parser_cmdline(struct netcons= ole_target *nt, char *opt) cur++; =20 if (*cur !=3D '/') { - ipversion_set =3D true; delim =3D strchr(cur, '/'); if (!delim) goto parse_failed; *delim =3D 0; - ipv6 =3D netpoll_parse_ip_addr(cur, &nt->local_ip); - if (ipv6 < 0) + if (netpoll_parse_ip_addr(cur, &nt->local_ip) < 0) goto parse_failed; - else - nt->ipv6 =3D (bool)ipv6; cur =3D delim; } cur++; @@ -2601,13 +2567,11 @@ static int netconsole_parser_cmdline(struct netcons= ole_target *nt, char *opt) if (!delim) goto parse_failed; *delim =3D 0; - ipv6 =3D netpoll_parse_ip_addr(cur, &nt->remote_ip); - if (ipv6 < 0) + if (netpoll_parse_ip_addr(cur, &nt->remote_ip) < 0) goto parse_failed; - else if (ipversion_set && nt->ipv6 !=3D (bool)ipv6) + if (nt->local_ip.family !=3D AF_UNSPEC && + nt->local_ip.family !=3D nt->remote_ip.family) goto parse_failed; - else - nt->ipv6 =3D (bool)ipv6; cur =3D delim + 1; =20 if (*cur !=3D 0) { --=20 2.55.0 From nobody Mon Sep 28 23:55:27 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFA653B774B for ; Fri, 14 Aug 2026 19:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735770; cv=none; b=BzfB6Qh+w+xqwK62ZWJN1458yMuFNAXJuy6Ob9Khx3IE+sGd8rFcJ3b69dd5jZlLJzXvqIydsJFBoYmu0jRf9+EiswGZzNP/6J/pbHkzRb5lr2//LUt9Ly1sb6jOCZdpFuG3Rlzdg6Fx9QfFVqlbphiITHo5X1dytVzuVIv6q38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735770; c=relaxed/simple; bh=DYUlMEbqUsURMwexmCD/xyIYznB1QWbXqfysKMihGio=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BRlUrcFiRzMO0yx6yQkUtMH5Z44GgIuPxJGmUrBjkjd9MNfvrnqycV9kxXnoFC/M9NmaczuPtHDpPCp0Zrh1+/bKNVAIInxA3oTqhn1YHFQEQChz1RcRfqqkRqBQ1dzGpeX3ntj1AfqdXbC5bbAAyOQuyB0QI2A6hGWpspiuyzg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MGDXX0wg; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MGDXX0wg" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4954b3c5cbeso897265e9.1 for ; Fri, 14 Aug 2026 12:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786735764; x=1787340564; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Ij1m4fx/1NIyn8kVtLRSbyCjXHfqmQiafcPU+9XENi0=; b=MGDXX0wgAf//EJdXVzwlXyJqMxKnFX3cHS/XKU9uD7QtS+929IleUVoFpFKuBJMQ+B VejVuMpUSDtGkH8/qN+LNAsZTmNJYAoq33TYv5R5xbpuGQuFKJbQZT/Sc9YJhM5UsT5n lcZh3nK4KBrzyRBD5NIoNg/vdBjOuaic1M6ABakbHsCfAuVdMxUJzrptR0nuKHvW6FqT N5uqwA3sUmf58y/9htGo34scab1PGUs2C0LqP0amzKdlWzPlKqOkXkQh6sNYfcJm4nPh Xhkv5XvIJMc1Ic+eSlynyxm+51NxyswDOFLlw0tAfFfjBlKWN8G+3szwinHo+wp5FP2A Dv9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786735764; x=1787340564; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Ij1m4fx/1NIyn8kVtLRSbyCjXHfqmQiafcPU+9XENi0=; b=jXhFHShCgoP8P2ajNSTakvgrPr4tFvEEB774lGbp73TWAN5YsSaMUtrY1AKg5LZNTk vx7FJ03xZjYoJe34R7VaXXGlNvCW0Pbz3h8lDBsQ3Mf0HQ2Cmr4/4cSN0UA/VvgIsafq xyCmmUk9Wot8x97vbaEYinPD7EUdIQpt3YB2+RqzQd6oorQ8mdQ/cgEMnH2k6wvFJoK5 rUD4DYAYIIHfimOX9nX9b8fQ5e0bcIa18fM7mHLuSfqp5BsyWDnpo59To4FPYa+Sbcdh ZthjdpSUDHlfyizOyON29f5kJJO7EvpjoWi+bJZ/Y08lf0PVrfFwRQC4QpusxGSOLN61 ka0Q== X-Forwarded-Encrypted: i=1; AHgh+Rro7Zv9Be2LkYpH8NFglspJhaL1r82qD5OwU2y0YcFuJysIs3bWbs0Fn293zKo8xQ5EmVYNwzLgr1/rPMU=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/VXs+o5SxBB78wESxLkn98izgE1fQn6jV9RKCtyoneCu2SHj3 1vt17VRXxYK8rao1hTrPLoapbA+XH0SUvxQu5hBFEmU6bcF57LZY0V92 X-Gm-Gg: AR+sD125yye4DBZnKyKU4nyKnII23rvEC7NGE3BlsktBaIpuHACkTG7nX8ynys/PVWM 6SwDPiJCwv1NiWmH+blJO1EVpWJFg1bNLJg3UEO257mzf7ssu1wx5Kyf4MCmiQaFmvI8KRzvo2Q v+jPHrGLnxGbMprbD+vw/wNis4yWWOYpkayBOdN4KwBzGHEFm+dT3hzGOg86oj4CSsIQc81EXJO rRZgBZ5z1hkpjCh38WGOo5Vi12rSZ41vCTsKduJXg+i7VYfs7p0yTqqKSr6zsCEhm3wc3m9RvvQ ldpYROd7FiH7fASx71lD95n1k5txPvNp9Su/9dXsg9el+49pjREX/QL73qXDI7TThFRfxer5ORS wlU+qg+T8LTgB97m0SOJ0g0H3ACy+MwNGIm3+d7PJzcHT5GRJuBLBj8w+qBEcQU8EkoW4tKSjrE gwYbfWTIIvLdH/4h3oYPfC1viihQwmx09tgQ/LuQgX+tQ= X-Received: by 2002:a05:6000:2c06:b0:47f:dfc1:6907 with SMTP id ffacd0b85a97d-48160751b75mr4934421f8f.3.1786735764379; Fri, 14 Aug 2026 12:29:24 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::4:391e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4815f2005bcsm10625829f8f.6.2026.08.14.12.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2026 12:29:23 -0700 (PDT) From: Gustavo Luiz Duarte Date: Fri, 14 Aug 2026 20:28:54 +0100 Subject: [PATCH net-next v3 3/7] netconsole: reject enabling a target with no remote IP address Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-netcons_ipv6-v3-3-bc0915e8c75f@gmail.com> References: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> In-Reply-To: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> To: Breno Leitao , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan Cc: Gustavo Luiz Duarte , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org X-Mailer: b4 0.15.2 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. Reviewed-by: Breno Leitao Signed-off-by: Gustavo Luiz Duarte --- drivers/net/netconsole.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 351754d53cf9..4af4f3039d4c 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -483,6 +483,11 @@ static int netcons_netpoll_setup(struct netconsole_tar= get *nt) bool ip_overwritten =3D false; int err; =20 + if (nt->remote_ip.family =3D=3D AF_UNSPEC) { + np_err(np, "remote IP address not configured, aborting\n"); + return -EDESTADDRREQ; + } + rtnl_lock(); if (np->dev_name[0]) ndev =3D __dev_get_by_name(net, np->dev_name); --=20 2.55.0 From nobody Mon Sep 28 23:55:27 2026 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD6F53AD52D for ; Fri, 14 Aug 2026 19:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735774; cv=none; b=jMXiBxQM4Sm6TMgkJDRrYp46RtN12rVBk3/yl4Y9mtX7rY808CFOqpzBu+8zv5KEs2rX4c5kJPgjIvgVAlA+OjzDGEQ2ocdinGPr8pcKBmwZW6fwTrpwNI9lgl7EXySnnYFNz4wMLPEf17XXRYo6Y2nnW8apY8FqcdOI40PAQ70= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735774; c=relaxed/simple; bh=kBJzSyEmLjLakSZnZLouxVwEm6diqgBCu9rGJL6ISg8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N3qHh4IUQxAewMADowhm65DS2LQNMLYKxU3UqQS5HRMEVtJwv1Wh6WU4xpy4nLLpGxQgBtmcKZ0pkn5YeqA2r1FVTe+HuZCELuKFhiJIZ+H3H7DkLEzzRrMXR4RDBCbrWRTAMZTSP1ihZwnGR2uW4qxBw5fHgtZOnVNUtJVwZNE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nQhQxQAj; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nQhQxQAj" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-495773ee3edso1077235e9.3 for ; Fri, 14 Aug 2026 12:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786735765; x=1787340565; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VtsNoDHPNAuzZJbO+idLSbliILF62YDBTYT8M6gLpDM=; b=nQhQxQAj50QDlXwfugOusoaVSejLKu6fNoRQzRtgxmd5GBBAK0FsIVgRETaqN/zLWK 7oqRAwe/gvQ4OkYBTTtykW0aLKWg0p/N7amG6BQ/nWfT8Zg7du0/5Jnw2P5HE9kW6HUQ O7VUnIdniG5AAF07J+sIUvBcFrCJzUUMDmGz6QgRKErtfPuoKb0cLqxzEtrtN5NBmcjV 5MveECq/tFUyEqL9lvlr5xBcNPS1Wpy6b3u9ya3He8GfZu75E/pR1zcXuD0iWLz7OR7H maq2jbbbGdxdW5BW+AAsaSdswVk96kF5KDoHd8mOCXjjLVLjYogrnPxQXBYrtkzEiIvf uD8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786735765; x=1787340565; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=VtsNoDHPNAuzZJbO+idLSbliILF62YDBTYT8M6gLpDM=; b=qAAyM8Ch+sha79az32LxtHNO0W44drW+nVGFNdXR1XMvwLVbLpOnT2qBpCxQRbJYmu AHdrZvAmCQjHjCHZyIszaVYaTPm6r3RKSr96JTHnY9wwwW6MzO5OSQt1Kc7v0cGUV1oK WdiXcE8tr0tqCtITluJHzpvJP2oJu6E8CToEUMQ8YoYB1uo4rhqTREdJqgZv3LbfMfoY Gu6ka/JyK6+LDA0IKkXginfzheK/WjdevKMiEb2WJLh88JtEZE9HB/vLASJi0EYCT4UJ WpqF2xqp6gtvGS93sEmva4qPqESOrsmcxYXHluwG8j1KRW3qTH2kpFui2jqX3Kc4PMPp NPGw== X-Forwarded-Encrypted: i=1; AHgh+Rpv4vbk9DK5eku63zX6f36+CNs1RSE0quQtoBDbYgXcP6nhaCETLsaasjARCoGAOEyesH+nYmnjdL//r9w=@vger.kernel.org X-Gm-Message-State: AOJu0YxJX1pwFTKQVReH40SKsGrzjQtdGWlnq1+2Q6lf/MumOWQOBKkP ++ZHfCtoCvCiNOj54otG36cwozU74oXGTCjEBMwfwNtdVGVPKbGQ6AcI X-Gm-Gg: AR+sD11/W7+udBD0ETKsQduJ2EclLgmLM9Xywy3BqougfaixFek4/2GCk0QPt2So0Le 0TMSBmFBTqV8zQL/pAV8GQgf5kkXSaTm/ENEvG/KEe+TPLEgAMzHm5gr40OMMNzxAanLtqPMmw8 orWQGp4uMrOu7ed41VbBzhj2sIcbLvcLFKSUT309t4VdcMUcoUg5aCnBp2A20gfSOP+h7BeHlT6 RGKrEUqeWkM2lhXtrGwguIEsQ8jTCHPBRXbXXezrtlJhAjN7M5BdVF9woFW5KkdUVjDMSFd8UwS DKAERQs9/kt+yjLGM54anBa0NSVL/zwEQu/oAWXvPrcacAhUDCxlEplscx4c5T6p0eImdfBBx0C ZdSbhY/8Uo5ajNPl07rH8zjnKSfs6n07VYqLqCmaoUJJ5NNK3HPG6edgnNcAB6fP/rRe7urrQUQ r3znESKdLhOZYDCE+rW/kGzslamlC+B77/DM6eYwJDazI= X-Received: by 2002:a05:600c:6206:b0:495:4126:1e55 with SMTP id 5b1f17b1804b1-499879543c7mr54501795e9.2.1786735765464; Fri, 14 Aug 2026 12:29:25 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::4:391e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49988b1d9fasm81666015e9.9.2026.08.14.12.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2026 12:29:25 -0700 (PDT) From: Gustavo Luiz Duarte Date: Fri, 14 Aug 2026 20:28:55 +0100 Subject: [PATCH net-next v3 4/7] netconsole: reject a target mixing IPv4 and IPv6 addresses Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-netcons_ipv6-v3-4-bc0915e8c75f@gmail.com> References: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> In-Reply-To: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> To: Breno Leitao , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan Cc: Gustavo Luiz Duarte , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org X-Mailer: b4 0.15.2 The local_ip and remote_ip configfs attributes are written independently and nothing stops a user from mixing ipv4 and ipv6. This leads to an ipv4 address being zero-extended into an ipv6 header or an ipv6 address being truncated to its first 4 bytes for an ipv4 header. The command-line parser already refuses such a mismatch. This adds a similar check when a dynamic target is being enabled. Reviewed-by: Breno Leitao Signed-off-by: Gustavo Luiz Duarte --- drivers/net/netconsole.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 4af4f3039d4c..abcc8515ddd2 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -488,6 +488,12 @@ static int netcons_netpoll_setup(struct netconsole_tar= get *nt) return -EDESTADDRREQ; } =20 + if (nt->local_ip.family !=3D AF_UNSPEC && + nt->local_ip.family !=3D nt->remote_ip.family) { + np_err(np, "local and remote IP address families differ, aborting\n"); + return -EINVAL; + } + rtnl_lock(); if (np->dev_name[0]) ndev =3D __dev_get_by_name(net, np->dev_name); --=20 2.55.0 From nobody Mon Sep 28 23:55:27 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61AB93BB13F for ; Fri, 14 Aug 2026 19:29:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735773; cv=none; b=s5IRhQSukLno2J7RWFRfOAwyCbC/ZdhqeHr+no9jDM+mspkBOcbUmZziqs1wYCTkce+OBhZiApBrMLOnojGK+f0BUfaSRbI9WZS3+m3Yj3TIm/73sTl9RXpJfgIKr90Dnbx3zc4Pr/S0Rcrg2sneDBH4NCoCmFAbDVp5MAwMXOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735773; c=relaxed/simple; bh=evoNCG15G6WzqrwbqEvAz0ljT6c3gDzGnnAZfhprhjI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F7Fu1GUOC3gWysmjj/YYapz6gyK6nlfOX4tFnDW3cy7ksXsC6wJWnN/OsQARJo8g64fT5cCmsszTmGkc38bnuZ5k8tUFICs65ugiGtNxTUHl6PNe05LICtV6Gm/JEVQ6ILFqFqGPD1WMZiarDxUIFI0zNxJYG1kvJnioJ1ppiAY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Rh/8GNMw; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Rh/8GNMw" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4954a2dba6cso1055805e9.1 for ; Fri, 14 Aug 2026 12:29:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786735767; x=1787340567; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9WsLtkV3HpWQM29hlh8OFg5JwIeyXX1Q1ZnZhfhuQco=; b=Rh/8GNMwTeGKZnluGyJdrLcmeOmei1Ra5kbhVi2rpAzg+wzIMIP/RRtfGsxnJ0N0Kr VWk8BMDwkBJUFjv8Bx3wxZh2BslRcXwSmQHSddxme7ewLREYWBpvM3g19UF+u8bgV5JR G8kl3W/afCqeDSEHNXurNECvVvdcdaYc7571HCoXFtcGZtoFJqbPtjfNjFxiQ6kuwKMh vTDGttRGX1tvVNUS8rsXTezVM52Lux6AQWgDHRBgjjI7N96PuBnWtjT30M9bEbZaB0zR 7xCriOMrhdQOhcFxgnSbc7neL+iy0ICGSQaSEChX2cbP5e8LN0Goa8euwYPCp6KzzwYa K5WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786735767; x=1787340567; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=9WsLtkV3HpWQM29hlh8OFg5JwIeyXX1Q1ZnZhfhuQco=; b=kIcBkNxKnVEMIkyjAPETqFaSNwitMVNyTd9k/LAELU3VlVfWzHHyA6DpO9HASJWqPy Wz2SbK64STKppYxdy5rHXWQoN64r7VcZuwy4klNNFh4QDYSnMGpbce0JPUeruIp/1gX2 dCcNJj5skG6T/I6YC0aJkD09CPWJO52gFxgQvCrLGvzQgX9Uh7FRKzyH2t10+mQuYfTM vrToJ/y2aS/u9HBwUaaMTbu/RvAVYlp4kQVSIiMD30tGFRE/UVhQ/IPS/ZX/zqTWr0O4 EMNKTC4Hl+rVD9l6jODgl4YDIWOCl0uOg8FYSWR6q8NVFHusholVsk4C3F0x+3bbRmwv tDDA== X-Forwarded-Encrypted: i=1; AHgh+RqSvkS79hUcZQx3ljZRgr0/gtogJV8qG9BxocHYrytp21PP/GcBENNqAtr4gx3Xsl6cvPvW+68gZNtcciM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+YVM/g36GqhMUiaaz2svlEJpXvgZK6cIVETTLnGOsRK91RSUd O+27XNyQd9RPHTMpEpPGclW3pndnT3hVuBYPlgxyAvK6v+BCRupjzeq9 X-Gm-Gg: AR+sD1258Pkql/XwLgluw2O/5diD1SpE3UVAUzf6yN+jvuaPpyv05Kusc8Q+JCKcS5i Tq94cLEiOXWqAt50u9ulaNwZFG9i670PGg5F4DkeTeCgwMSib3w/SRNZzZeITvl8/qe+IHH8+wr a07m2mnZeNf0/l0zxQPDqXdicTt5sn1HzrUCI0Q7VaS0WtO1J2y42tmEO8WbXnTVjzgFmZ9weQp ylT7aVcZ6TnjVkwl5MsWjYIWOe9KRnTPd2HZtbztWFPS+oBkKeamE5dLO5jF3nBXJVF5/4ld7VD FxJAnwnzXj+QxdG1tWKLqWxab6D0dprOC2LgTMNN7mdA5RMH4LGfcdBMMCrgoUDFYOjO5YRu3RR Le4iX+te95nhXLCkDTEPxV5KbCOuiVs8EqihFMBIynO4KWfPmdUrxj1OEhN2E03NEsgzlIFXwSQ 0BTy2WASm/7PiLmtnt2W53Lj4mIfI+2Hem2wH1q2a1a9Q= X-Received: by 2002:a05:6000:288e:b0:47f:921f:397f with SMTP id ffacd0b85a97d-4816078a831mr5570171f8f.4.1786735766602; Fri, 14 Aug 2026 12:29:26 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::4:391e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4815f219e12sm9464228f8f.10.2026.08.14.12.29.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2026 12:29:26 -0700 (PDT) From: Gustavo Luiz Duarte Date: Fri, 14 Aug 2026 20:28:56 +0100 Subject: [PATCH net-next v3 5/7] netconsole: show empty string for an unset IP address Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-netcons_ipv6-v3-5-bc0915e8c75f@gmail.com> References: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> In-Reply-To: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> To: Breno Leitao , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan Cc: Gustavo Luiz Duarte , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org X-Mailer: b4 0.15.2 An unset address (local_ip/remote_ip), now denoted by AF_UNSPEC, currently shows "0.0.0.0" in configfs. Print an empty string instead, which is more clear. In netconsole_print_banner() we can be even more explicit about it, as we don't have the risk of userspace trying to parse it. Reviewed-by: Breno Leitao Signed-off-by: Gustavo Luiz Duarte --- drivers/net/netconsole.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index abcc8515ddd2..1f18d0a7d2dd 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -718,14 +718,18 @@ static void netconsole_print_banner(struct netconsole= _target *nt) struct netpoll *np =3D &nt->np; =20 np_info(np, "local port %d\n", nt->local_port); - if (nt->local_ip.family =3D=3D AF_INET6) + if (nt->local_ip.family =3D=3D AF_UNSPEC) + np_info(np, "local IP unset\n"); + else if (nt->local_ip.family =3D=3D AF_INET6) np_info(np, "local IPv6 address %pI6c\n", &nt->local_ip.in6); else np_info(np, "local IPv4 address %pI4\n", &nt->local_ip.ip); np_info(np, "interface name '%s'\n", np->dev_name); np_info(np, "local ethernet address '%pM'\n", np->dev_mac); np_info(np, "remote port %d\n", nt->remote_port); - if (nt->remote_ip.family =3D=3D AF_INET6) + if (nt->remote_ip.family =3D=3D AF_UNSPEC) + np_info(np, "remote IP unset\n"); + else if (nt->remote_ip.family =3D=3D AF_INET6) np_info(np, "remote IPv6 address %pI6c\n", &nt->remote_ip.in6); else np_info(np, "remote IPv4 address %pI4\n", &nt->remote_ip.ip); @@ -863,6 +867,8 @@ static ssize_t local_ip_show(struct config_item *item, = char *buf) { struct netconsole_target *nt =3D to_target(item); =20 + if (nt->local_ip.family =3D=3D AF_UNSPEC) + return sysfs_emit(buf, "\n"); if (nt->local_ip.family =3D=3D AF_INET6) return sysfs_emit(buf, "%pI6c\n", &nt->local_ip.in6); else @@ -873,6 +879,8 @@ static ssize_t remote_ip_show(struct config_item *item,= char *buf) { struct netconsole_target *nt =3D to_target(item); =20 + if (nt->remote_ip.family =3D=3D AF_UNSPEC) + return sysfs_emit(buf, "\n"); if (nt->remote_ip.family =3D=3D AF_INET6) return sysfs_emit(buf, "%pI6c\n", &nt->remote_ip.in6); else --=20 2.55.0 From nobody Mon Sep 28 23:55:27 2026 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1841639CD13 for ; Fri, 14 Aug 2026 19:29:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735773; cv=none; b=IkT8XK7Nob9KTWhDsQ8BP/HW2WfKBnGTX2RgDtBz3PwXVeQdmKMN8lOWqgTInVAZ18yIoD+KOYIwMgPOy+BO2xaPmNDLzf3ZY1CaGhrBxJQb0GIZxV+nfKG0MHI+ituH9yDKmOADMe+UbcsSQEggcS2kp0fhthaKsyAktMRrH1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735773; c=relaxed/simple; bh=9YHOe5z+ssvaM23jtJhGeLvjomXezj8HIDuK2w3BBE4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gtCV3IhpIJ/5BxFmJbxqbRSpslJCab+i7i11WuHvH+QYDU5sNKaCG7IjRcli2T7FUgBLGzaDvUb9efG+hpxQMK+cHUWtggH0rH8bOiHPVxXs40FQtBAE4fsLT8avk2L/+4Si+P4gQPC05DtVl41QFHcQ6vn/meD/GGh29+yte2M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VLHc3i+w; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VLHc3i+w" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-495773ee3edso1077315e9.3 for ; Fri, 14 Aug 2026 12:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786735768; x=1787340568; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SznL2xfveGEa7B/Oh0KOrdfcfg8AH0BShY6f4yHqRwo=; b=VLHc3i+w6NJiqacf5goLpgq1+cCY/8CeUcOKIrSxWFKiZ/Jxe1C0x1d/bpVclsJN6E En1h6CdPIK+Xh4X1fV6yBW3g6Kkg/zlUEX4aAO9FpxWFVA0J9/UhjgOIOPL8w2hwgfA9 NvagfUIcKdJT9vJQQL/pLDoCD+uvqlgMM7FpsCcvDt4LpVz+tZstYPTCoriTQYy2Ohnm 5kxkxQyyfVa7qZJ4ToHIUOJVgm51JCpgsqmVLiwMReVKz42orah/QP3jGltyWYJlyQUq JHRFNQxryco1rX5vG4RWuhjLIGwyQEgU9+NgSRT4FDhPsTbQYcgG41kNOKT0qvqjdJQi f1vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786735768; x=1787340568; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=SznL2xfveGEa7B/Oh0KOrdfcfg8AH0BShY6f4yHqRwo=; b=Jb1vkaN3HeFInQ4GjRexD+B7+qnbpZ/Lo+g/1WmjfNdZl2rTw+kxAy+0yxIK7LsmGc MSw2xloeehLGY5oTV357GKzwIJuxHoqxL5879qWbTZKDOsQS43ImnKVAJOq4fhu4beFL piPJTfF9l1Hdtzs0C9SRfntYzMeT9LkrI609No8ojaihPK/mcC679NzMPEWP0Z13EGRG RhC4dnpg7xdPwrzktx8TX4dXDmNz0NNwxl1yE+FCS/gkfXzj6m6hVQK2eI8f15eM2Pab IqGQ3KTMCf0fWizsr9krkdc3xXmdjYAdS2jXrJVZoylPP4NDYg0wC67lRYnBAyUgdjLx x+zQ== X-Forwarded-Encrypted: i=1; AHgh+RpcjHw8mb3lvKW/0zIlxhQZuArO5VUNyT1JD3k1Ij2vPNAVt2e0jx5qZy4xqgiP2txIWQ+YpM/dmzxX8XI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+cmX5x1qywnwK9OpkUyWFGCHHQ1hJ3dr8Lp0paj5drAvots/T RlFj0vQwxKT/OlB6BY0cRyDJPlX/CZ3RKtyBUWkICTwte+xNKM8mHdUu X-Gm-Gg: AR+sD11XPNMDk7FIJo6KSPlPYkoqHVMGbKecaFTusKXETYE6GGKy3pI0mLXJ9o9jlRB X29ZzxorvyXyeX3vezztyL2yKphzQLFaMCYjUw7h1IgQAEfoeuyraBcBTWrKikPrC5y4tauZV6m eSDQEPoMcNVAeYi9n1D4GHkfLGRxkZy78hgvddJTxawos96socKo7clzualgvLfggZKK1mlgZRu lwkUfba2VaFL9zS/sNLZiPk9sToZt+12CtyrA0xA75UFV0IgRCfwMdlN7v4U+vVxGBqmqkSuMhs 2pEIWdNfxiuUE7Is3ZMpFGXYlPvNbGyXnLGAWoK7wjqTYXEbvxhFuNI8eUeKHARZDegXMuVvbiW 77yxCJSNS57vvB9UErCIsi0HUY5u+fokU6WsIntxZKpMmjQZgA5RBYcDPl94MT2NPYwb6+ZflXk wtiPAnAxXr7I6En5h+uNCW2oKmizqi5rdn+pdK2zFswRB6ddUDswtW3g== X-Received: by 2002:a05:600c:6206:b0:495:4126:1e55 with SMTP id 5b1f17b1804b1-499879543c7mr54502765e9.2.1786735767744; Fri, 14 Aug 2026 12:29:27 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::4:391e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49987b203cfsm68508525e9.3.2026.08.14.12.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2026 12:29:27 -0700 (PDT) From: Gustavo Luiz Duarte Date: Fri, 14 Aug 2026 20:28:57 +0100 Subject: [PATCH net-next v3 6/7] netconsole: move struct inet_addr into netconsole.c Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-netcons_ipv6-v3-6-bc0915e8c75f@gmail.com> References: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> In-Reply-To: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> To: Breno Leitao , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan Cc: Gustavo Luiz Duarte , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org X-Mailer: b4 0.15.2 The struct inet_addr lives in netpoll.h, but since commit a1116396476f ("netconsole: move local_ip/remote_ip/ipv6 to netconsole_target") the only user is netconsole. Move the definition into netconsole.c Suggested-by: Breno Leitao Reviewed-by: Breno Leitao Signed-off-by: Gustavo Luiz Duarte --- drivers/net/netconsole.c | 9 +++++++++ include/linux/netpoll.h | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 1f18d0a7d2dd..267254f046de 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -151,6 +151,15 @@ enum target_state { STATE_DEACTIVATED, }; =20 +struct inet_addr { + /* Address family: AF_UNSPEC when unset, else AF_INET or AF_INET6 */ + u8 family; + union { + __be32 ip; + struct in6_addr in6; + }; +}; + /** * struct netcons_userdata - Formatted userdata payload of a target. * @rcu: Used to free the payload after a grace period. diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index de97f001a0f9..ec0821a5b02d 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -16,15 +16,6 @@ #include #include =20 -struct inet_addr { - /* Address family: AF_UNSPEC when unset, else AF_INET or AF_INET6 */ - u8 family; - union { - __be32 ip; - struct in6_addr in6; - }; -}; - struct netpoll { struct net_device *dev; netdevice_tracker dev_tracker; --=20 2.55.0 From nobody Mon Sep 28 23:55:27 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 015573A7586 for ; Fri, 14 Aug 2026 19:29:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735774; cv=none; b=Kh9ILXNmP+s6hLVrZk+wej80h5C7ggn+fhOxWvSCN2XVPzONtlZ94WBv9KNlfTaSmri77etKEKHERynKACbbeJbceagr7PuefXZiqd+TS5dhKi/s2uvezc/sVK/4URjLICQ/41LbuzbjCfkAYXJUg4ekbl2bi48072KaoYfY+JI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786735774; c=relaxed/simple; bh=EnBn/4jGc6fz/BczIiYdHjSaoMWGvEFwgnzOS2Bp7kg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dkRQ2fSTYdrpZ9yMQ3EnVV+BxNZmGvGZE8YynRd7BDOfIXOWCFjlcogM2bT7BTi/w2Psce4EzXieCCcUCY2eIXyw3ZVvVwOVmSh1sCgS/8+lVxFWWZiRboNDY2B9HsxMhvLYJywC9S9+BPj5xwGsguXhsj5AYEME4FX+yjuBvMI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UEHeMVEa; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UEHeMVEa" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4996c452e95so1109015e9.0 for ; Fri, 14 Aug 2026 12:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786735769; x=1787340569; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=REPk3sv6pnIpoq+hx39FYxJfdGolBo9DSKR94k2Jioc=; b=UEHeMVEa0QQ9/VnQ7o6LCb6zu23AUblHtBgbdbhlmSnFcgsPnOy5Yq8pXwcsV/+fN0 yEBpKxKwkU1rhIVhpLUrnRvIXotoVnIewNi3yE579lcgNxJZT1xtihluEEN4oM50m+n4 6eBTmYn/hCmyY9D6zPc44ZvwkoJJ87N5vnRNhfEwyywDq8/KzoWd5ThHDK38snbR/O/v A0Ou4TCsOg0om6G6b8FvhNfVZcvAGiQKpcc++AvwWBNkFfsMhF6JByWZ4gF6Gx8BL9Ki Urge6pBL/4p8V54VJhHRTvKw00C/cwpQpnVH+KMGplLu6MOYZy4WCPCFnb1tWuFZfe96 9GGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786735769; x=1787340569; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=REPk3sv6pnIpoq+hx39FYxJfdGolBo9DSKR94k2Jioc=; b=UHTXZrctxxscAxpT5tddf7l2s7Q85LI8qUIpewbzhZDCjaeYPJ5yBysy3o3kxwKnyE ubq5ncmMPivv5UWVtzQtiDcjCf8hWPB5NsYY/u4C4lgPSoMvmk1FB28V7W/QKJ7SRM08 56pmz4tMrL34+BeeysN264aNwq/q6Avd/o5n9cNaH3Ti2h3wgNoaLvflAfP3YBqvoQcc 45dvNFWFp1hD3bXaXEqTYXDB6TI3v2xvBrg1WUE1S1/wquhmAX261N+cAMavp3VFZbrW LwRZPyZcbuamfRSzR8tw7hL9YkuH+13csL/T0EMtwqgMlSwT0ARGxI9zXSSgcsVDf3NH Ix8w== X-Forwarded-Encrypted: i=1; AHgh+RpcbyBjfVIA8waWVmRsj9I0e/bWfAix0mym8fMEuXHaC4hx6E3RA7tTFoEtqusWF7VJEyGapuWYjo6q5rA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8CBae7s4XsVR6pNKdbvhCVnnzy6aCjq4rLsBJZOEGinBE8kt1 JFnVc062cCTVu15rHPu/g1QIUEhH1c2PKX6AmWfOL7ExD1Qh6SKVhWOU X-Gm-Gg: AR+sD10q4jfZaM7zVce9oR04XBam9skNEzPLWqmnpDpvMUbhTJNx7DB5KR59YNhe45N BNr7kcf9b84E3cOgOc2vTw3KjN9apRBaUcJa+g16Omy0LH3SkdyHpaAWgF9Mw/HnJDMpCj3BTNz 7N4zsD8chmUQhXpDub/EmAaH10nfD5j2lx0QTZ56xoOHaRWKcfGoXka0GMCzGrsmN6trM4vzxlG zzgsgOOQU8GYNfT4C9WoxQmJtqCT8AOXbexQLH1YXRtBqgnOWQN4WMg0v2H5xV9p7/OIbd9GbX+ vtQh3YGIeyasveGaAWkAucWxFxQsBcqSxaeKANx1hkgYZ8StNPMuFU/XzKK8ybFgxyF8ky1Ax2e /Dv4I63GRZGuOgl/ay00EA9vSsfNxxxeSmT02ACEIPOYvwxlMiBhjiVAxew780L9+5q/hyTyJjS 5FKhl5nRNmQyLUMlBzF080RW3uubBZiGzfPVv8f/FDF08= X-Received: by 2002:a05:600c:4fd2:b0:499:73ca:c419 with SMTP id 5b1f17b1804b1-4998796a152mr54134925e9.4.1786735768844; Fri, 14 Aug 2026 12:29:28 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::4:391e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49987b36370sm63708695e9.4.2026.08.14.12.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2026 12:29:28 -0700 (PDT) From: Gustavo Luiz Duarte Date: Fri, 14 Aug 2026 20:28:58 +0100 Subject: [PATCH net-next v3 7/7] docs: netconsole: document local_ip auto-selection Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260814-netcons_ipv6-v3-7-bc0915e8c75f@gmail.com> References: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> In-Reply-To: <20260814-netcons_ipv6-v3-0-bc0915e8c75f@gmail.com> To: Breno Leitao , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jonathan Corbet , Shuah Khan Cc: Gustavo Luiz Duarte , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org X-Mailer: b4 0.15.2 An unset local_ip is auto-populated from the egress interface at enable time, but any value the user writes, including 0.0.0.0, is used as-is. This deviates from the behavior prior to "netconsole: use the address family instead of the ipv6 flag", which interpreted 0.0.0.0 as unset. Document this so the distinction between "unset" and "set to 0.0.0.0" is clear. Signed-off-by: Gustavo Luiz Duarte --- Documentation/networking/netconsole.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/networking/netconsole.rst b/Documentation/networ= king/netconsole.rst index 4ab5d7b05cf1..694bca4803d5 100644 --- a/Documentation/networking/netconsole.rst +++ b/Documentation/networking/netconsole.rst @@ -141,6 +141,11 @@ The interface exposes these parameters of a netconsole= target to userspace: transmit_errors Number of packet send errors (read-only) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 +local_ip is optional: if it is left unset, netconsole derives a source +address from the egress interface when the target is enabled. Writing any +value to it, including 0.0.0.0, uses that value verbatim and disables the +automatic selection. + The "enabled" attribute is also used to control whether the parameters of a target can be updated or not -- you can modify the parameters of only disabled targets (i.e. if "enabled" is 0). --=20 2.55.0