From nobody Sat Sep 26 07:15:21 2026 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 ED3B94EBAFA for ; Thu, 3 Sep 2026 16:26:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452799; cv=none; b=pn7rYqZc2kDKfIgY1Mj63JyeIfICN6yvvxYGPpswJ4Dxu44lXc8Rw+h0iWfeGEVoZ7Pb5fo2uc4OwM2QQvcU70rN4mZ4UpxdZJj4nuJ5Pmd3ZpyBHbdBuu1JovoIMxE7cSYjoS8t3vj35sBxPjqONqz6I3ZdgXRPgM+X2VBtYLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452799; c=relaxed/simple; bh=rtw1I6+ZQwIhsJ1KAJ7coYMuQ5TqGSxTCkqUoPJfohw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WIMxlZoM6D2xyQpKGPGAhaF+m1EE1N/qg0Y+mpfZWrx+Q+94Ms6/B7A7YOgau2+4Ezv9V/T/tZ6IErFWE0vVXPOvRb5i3Q8KGw3dLvh8zIYIT3jiGI5tEJ79R8KwW2rwqKuLRHGkILaKCNI1rmKyHREq1JHq792rPjZkrIosVZg= 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=D+Ep61cm; arc=none smtp.client-ip=209.85.221.53 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="D+Ep61cm" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-481595afa73so6899f8f.0 for ; Thu, 03 Sep 2026 09:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788452796; x=1789057596; 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=D+Ep61cmzJUumCFXw7Lcih6t/1RBe1Aa5mWBdc+m6MuOr4WcUgRF38Lnaa1dPqreKM bmrHFUeJXS+uAgU1GkeB/MsUwbd5xHPZ6st0XN6jsiw5bxAJqjS2Mmu6rORhodQlu4e2 q6RQQYL5wsBGM4fML3gE8Jzq3ahowJlT98cmJv/IwuJvxVYecPvJDxX+19ImxHWcMeEz tla9NkJgxlW6q1zqKwwi6XIuAI4myEzTde13e7Uui4cRNd+f6tdoIS79cLxIOboDuqgk ONvcgJzvpX8JVkDwmSBhLWY3TXYcuPlkhEUOWOkzoqT9egrRb1NXnhsYXRMAb5egi0jU YtOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788452796; x=1789057596; 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=oL+zJ2rvCvrwHM9ItQPDI2P30LSL0oEjiuNclzoLsWGwHL/jD4dB5pI7WbRUzW43uE 80qR+/1tDCN3CWCKT0BLXuiINBdCKZKQfRmeLcDdCrbH/UAFHYdd/PxAnHnmKLEImATP H+TdrHS7190Xehf2CWKzfGgIzizhMLugViY3yaVoHPbKZ8LMiKm0IAHcQVa/pWKqlQT4 Qwe4JpDMTsv9dfdWBd6Icgi9LTAheKfpZbQM2vEZ9RWbF7F0toPBnjuGtg8QgsrmQwip iENTn5+rz/1+4LIWXpiF6GXNEP2VNaNY+PD4EqXIuJh4PFlg8lEl5bRm6/Zdph5iYwPX 02Uw== X-Forwarded-Encrypted: i=1; AKwUvBwBmAls2plmBPy575v5p8thf5E0ySp1Xb4H8djd69dbYZrZE9qPrg5x6SgcRgOyv4uGUloc2yH3VYwOkso=@vger.kernel.org X-Gm-Message-State: AFuF++lPgxb2ylAg7qmShJ+2391WCqxZidspGcNdzbv9w80GFkJwU8Et R4BrPqu0I8Z9e9B6ujiSbgaT8zcSlah07uhjW/NB4ZG6QAkCrYLSNzob X-Gm-Gg: AYBFou2FFQKir6JY9Pod5OizYMBSIEuNwzZ+4NRAY2KaA8lSgxW0RCd7ZSRwnrz+7ko KPp1MDUr72jnqG4TaNHsGIaelGDU6dWzG2nUsus4kDgVztnu9NDdOLVJuG50tKD+2o5HIl4Soo/ rj3dLbnX8ftX9zotvtVKUVKiQtUlNAwOhlIXKwRMBQesKXXsG74pj0kcPUWu66l4gLxeUvx3REm tn6+d0jGyA5s2gOeBMy9Hvs+yZLCCn878HStxQvjXdUXR1L4GxTEkxgVbEMbB28aDXykRea0EHb GPIadrV5voFunKbD5C4nR5EpcM1aPPRITbyQJ/G5TUlHq5Z5mA4iFZgJ09Ko07PfCEms7w2k1WS tzxKKR5ouOVESl2a+tc8rhp34iZcBWjUqwn/U66+I3iAaxF490U9eVgDO5qjAOlqLeoHtI6dpqe Sm5I3SCp8Q8I/BYlOoYPrYZajzFQpI3lzAbQy5Ix5FGyQ= X-Received: by 2002:a05:6000:4a11:b0:484:3310:f393 with SMTP id ffacd0b85a97d-485872e4232mr88305f8f.5.1788452795980; Thu, 03 Sep 2026 09:26:35 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::6:124b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48448e72c28sm16058322f8f.6.2026.09.03.09.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 09:26:34 -0700 (PDT) From: Gustavo Luiz Duarte Date: Thu, 03 Sep 2026 17:26:00 +0100 Subject: [PATCH net-next v4 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: <20260903-netcons_ipv6-v4-1-bdd183c844d3@gmail.com> References: <20260903-netcons_ipv6-v4-0-bdd183c844d3@gmail.com> In-Reply-To: <20260903-netcons_ipv6-v4-0-bdd183c844d3@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 Sat Sep 26 07:15:21 2026 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 C279C4EC666 for ; Thu, 3 Sep 2026 16:26:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452802; cv=none; b=hzmiyG+QIM9k2b9MlSrESwVHTfcP9xLqDnQan4SVNYQ+1O3PGWsoF1j0Lk+1GMDyP5qH4PcV0BAHOy+7aAhWhHQ1njvQ5aKntzmQXzs+PQid/w/3rO2MizRvZD0vzTpFuRp99Spqzyi7lf3/Ibkd9nNNaKNxZzQq5+tbVDvCo5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452802; c=relaxed/simple; bh=GhZD17cuw5gYUVnyHmaSI6jBf22mSnRirzc/2LtRvPA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FFn8QZ440/i7MdE84sp2spEihPrDmPWL38cS9l2N3S9N3xMcdZDE+8akOU7lvQbncsiHqSl3mx/6bEgSlF4roE2X48gv3lV8004QuQ3T1hvJsEZq5XfzKDsOrVMDBPRKKsWm++iHAuoYwy4cDy91MlVvPD5N2N4jitEvEr5x1I8= 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=TkQK1+Zq; arc=none smtp.client-ip=209.85.128.44 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="TkQK1+Zq" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-499dd4900dfso72805e9.1 for ; Thu, 03 Sep 2026 09:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788452798; x=1789057598; 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=TkQK1+ZqfzFRRNtxW8CGQGXmQqaP82imfiuOZFqb01U5rpf4293/IZ/KDwGt4mNONH qlNouAGBH7aj4VTjNax19/TkwL1swfFxZCJxA/l5+h+JpgR8rEollXl3cnhxhKbivsaF nKaAgFiOSrz6qUpQ7wTf6Y84XOkz5lIwcnGlHZupKiM4KjMBo1GE/f8WOb63dNTWsMM+ 8WiO4+YFvymkFdMAkgkk99oZ+aQb04V87g1eua82R5w1OgCAtF8yHAmyQcOVMz5yiJCK ijskx22e70psnKcldPU+Nb75XFF8dkJ7E7COeANCUbP1PJQDHC5sS74nftY+2VWKIFKf tcNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788452798; x=1789057598; 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=nWaPTh372mLXlPs9PF8UESNtIoI3gnbYriKspcuiP9prWfpon7HEhkUjSnJHgyMF65 w3YYO9RtumFJs4FFgPkH1bdpKzXO86xYELArVafU/uYQaxvdgdxu8lB21zbd0aiJiqp7 rYyjIdQhlTx1VG4zuWLeLY/jrAadRfi/moPEr1KkZtbu6Q/reK/AoeyeRaHHZaS18rIp CuMsPTVUVakwq60hPXpTUIvb5ts9QyKREmGY6rMPIOU4uOcWNg6UCUgTOBnMAlWPepky XgMrqHmlq5QqH5o13DMcowQk5AcQC9LDy5jHTMs9nL3+Y1RUoGKwGaUSpMAu0QTaiMew 9Uow== X-Forwarded-Encrypted: i=1; AKwUvBwKZsIq9SoeiW5uLjCOJG7dWTOzmjOvxf/s8HgW5h2SoyYvr2HBBnb/T+0PdkEzcbQBdg0UIzk4gfMh8Uc=@vger.kernel.org X-Gm-Message-State: AFuF++k6227buIokRsLVvKAT+5DWwnHyHGlY9eO2gGqUJqCmqXua8oKl uk7kVQP3xxSxFZKQT9QK6jbCFOuieuNedQQP+AYCkZIZPitqNZr/b3WJ X-Gm-Gg: AYBFou3ZJyBSwb9PUvq6rRenX6L07RA196oNeGR/mKEeQGFCi3GZofXoUu2fppd4rEC oVU2OpJCu/f4NSStwstC+34816AkAh3GbZov/hgDDppVyRoCLiBzHGMbmHWxA2iK//uuh/bJLe8 43wPIRVXZHUaID0RCSIR1ui0WNKHyeipbDHOCSDMi+MSciJEdB0zGnTTgHFxIEraZcZth2d+pOE +pca/ErIedfLJFT1zoa1sRtrj1YNlkzeBJ6mQJaVUJVfgeKAHHf7Pp9/m7IJZC4MiYQ1BChU2jx xeqUkyXGmSuKhh1kdOM3rjFecWuxaA+alwbbQ3C59OqjjsYWxn2kAyO5SO7yXNBFXgRPDpKsG0Z z7KteACZiw6crcJhzXqKcd+L3JoPVelJ15yebs1nSn0Cyc1j7t/AeAlgiAs7bS0NghXM3wZIl9k GglZKl6A1ryupFkM89cvFG8A0XX0IWVeScw3wd39Y0Wq0= X-Received: by 2002:a05:600c:3496:b0:499:5b0f:72b with SMTP id 5b1f17b1804b1-49ce581acb5mr107851965e9.1.1788452797521; Thu, 03 Sep 2026 09:26:37 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::6:124b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49cee5d9db2sm86260845e9.8.2026.09.03.09.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 09:26:36 -0700 (PDT) From: Gustavo Luiz Duarte Date: Thu, 03 Sep 2026 17:26:01 +0100 Subject: [PATCH net-next v4 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: <20260903-netcons_ipv6-v4-2-bdd183c844d3@gmail.com> References: <20260903-netcons_ipv6-v4-0-bdd183c844d3@gmail.com> In-Reply-To: <20260903-netcons_ipv6-v4-0-bdd183c844d3@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 Sat Sep 26 07:15:21 2026 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 29B544EBAF7 for ; Thu, 3 Sep 2026 16:26:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452803; cv=none; b=pPZNDao+lQFxhg9eOXqrhojuyghj6wVE1ykRlfWKOkmg1ifWfjhOtWrRWBqTO+gNo76MrozUGaMtR29qPdHfsBF0gwuo56jqcObEVVyCBj7GbSXUx2m44cJCo3YliaMU/koPUshrY+agfsWeIbsyoTr1PrvUCdEeD6ak9sjT2q8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452803; c=relaxed/simple; bh=DYUlMEbqUsURMwexmCD/xyIYznB1QWbXqfysKMihGio=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C89uIFqjVo7qIIewsM06u4nwHdbPFcIOVgOyGEU6L5p/IFCWxlIjK54RigNl1muP6wG5S3S+OPwIdLdciNnWzHHvIeV0U+T1JQfaf0cRmUDf0n83glYCDLGlM+4jlznGCyX6IIgfCo7Mh2Z5fhyY8SFkh2MVHpiavp5Sdo4/fKc= 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=X1eDp+c9; arc=none smtp.client-ip=209.85.221.42 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="X1eDp+c9" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-4839fa1517cso8037f8f.1 for ; Thu, 03 Sep 2026 09:26:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788452799; x=1789057599; 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=X1eDp+c9LpDb+C4jG83P/0woUIRxrOoJ9wSMOy+kTPzIJu8/cXVJ84N1znE1xOs1ks WSMuA+YFAkcGI+jI8LXj/L44QLwE2cM5kHygRL6nS2VQLqA6k4zftwT54E5PAVUoFitU YGAt5YNIoUuS6Rd9zQN2BYMzN9pw+yyTfLGjae7xEN/hPMQRjxCbn9kq6mhwLhClU6lX qZMW1FHf1SJvfi1ZZwuLWXGmckXWLs1btW359NYOWnt72zxudytk8YeAhrJrwUf2A9H4 W5HDE1D1bSIynoYTj5ftph2jxpetrTbl3p8NmX+iT+HP25YxS6MCmoSXDVc/FVrQQnMs GMFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788452799; x=1789057599; 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=XJuVhQxaMnxlR4pLL3kCUPk1J8r7Ls7ZkgJZTm8tHfV5tYdfl/ODND4EbLXRIgXpmb +8UPlikRl0Cth7/Idyb8egd6WFt6Ut6BI1ZZE+IrqHxbMCtTQG3rJVrk1tMIb3JZFOlp Xbjroj0RQR9ejzJqkfaqEvNfAxwDmXi/f7LrwesxMWIkfMqJJrPOojEJAPYdXQqtSPc+ p6VZ1dIuXUr/kL+Wx7ZhRD84hxae4dqs/IzShNi7nGfeW2spaE0EiF1Cqajc6ZpibW42 6zjtZz9Vv/kZ7PV0mg0vqMU//zpQA0H05/MacGbHbyw6St6wjtvHGVGEFgQVJyXhHuJ5 g10Q== X-Forwarded-Encrypted: i=1; AKwUvBwyKeY2lbk9KMDyNLh1Y8EFdR1dheHbSARkrpO4pliTGGjW05fO7YVi64kIs1WV5hmGxng5JOdI3kY1t2c=@vger.kernel.org X-Gm-Message-State: AFuF++m0WOuK0tBfo11NUzvLtVamL6WkXXrx5XK7g9Fdjw+np3dvBNWV zOE9k+au+qukeiMcoJgszKthzhLL/GaWXCIpSktq8PBPe2U0A8y08A8i X-Gm-Gg: AYBFou0eOhOUs7Ghn9zd/g9nqHKQPcpdmd4Kn3DJ4XDb+MD5svA7W3Dk8+IB23PtKRx YMEw+0NXfXnF4jRXl8pALgvas8GGjDzn1HwnHoPqPvcEaSQ/a0itv2v8EyLar/6QI4UI1z9Sx7S lhDqYdZCyblI8uiZlpcwRcxV6ZycqTm3BWuB35a5JYq39txeu8RGT3TZgxJwqbXabaqLZb/Gdj5 /QbF9jyY1m6Gjl6EVbmnz3DSuyUAv+vHZeEpeZ4jNjXXCWIKliAZpdXYF3j8NBPLjYaY+jo/Dmi dU/V1oNfUoduh4kMbfS9if+ZRuXKafqmk0/8fWHOUeBq2q4qyj4ztNqwOfb28M/9mh5vAq3q4/E WF5AeeSbCx0/skq2PMMf3ZhipropzkvMF4FIXAt65FLR67gIYRS45ID/gv5hsh/hPMKXfd+hDIX WuHf5mN81tz4sQbDdSqmkTR1LdelCxAmmh+iIrG9v2nczIukE3Ym2aOg== X-Received: by 2002:a05:6000:41c7:b0:46d:ff8a:c8e6 with SMTP id ffacd0b85a97d-4858707c531mr165606f8f.1.1788452798868; Thu, 03 Sep 2026 09:26:38 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::6:124b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48448e81718sm14672574f8f.16.2026.09.03.09.26.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 09:26:38 -0700 (PDT) From: Gustavo Luiz Duarte Date: Thu, 03 Sep 2026 17:26:02 +0100 Subject: [PATCH net-next v4 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: <20260903-netcons_ipv6-v4-3-bdd183c844d3@gmail.com> References: <20260903-netcons_ipv6-v4-0-bdd183c844d3@gmail.com> In-Reply-To: <20260903-netcons_ipv6-v4-0-bdd183c844d3@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 Sat Sep 26 07:15:21 2026 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 589C34EE85A for ; Thu, 3 Sep 2026 16:26:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452805; cv=none; b=N4hantk09iQ/khYrz93Ac1FzvJ5LUNo0LpdtZMaV3aWhBcO5YEOkIYNnBQZ/50h/a/GsqCMBmN+dSgtS4nRmwis5dArbaPNp7n41DRa+dMtjbvsTvjMUqyyW+BzgTxDwZCO8EOqkEpEHdSKMOKOBiqZURJQ1SrHUryrT5wtHjPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452805; c=relaxed/simple; bh=kBJzSyEmLjLakSZnZLouxVwEm6diqgBCu9rGJL6ISg8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a5B2pyhYkVzqqM0sFfED3hoheJYCDtoyLJpvscZruFHMVYAQwLMTsAnxdBO/gSF1YK07qe88AiFRa8jfImaVbtPn/kZpgQ4sW4zNB8R9Jw/5O95bBZ4oSYdMf3XtEILspeYy/0XdH9pX+CmSY6VoQFyMjTm/L6Uzrx3Hi2eQHjI= 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=oc7f/p4y; arc=none smtp.client-ip=209.85.128.54 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="oc7f/p4y" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4994d41ceb9so59715e9.2 for ; Thu, 03 Sep 2026 09:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788452801; x=1789057601; 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=oc7f/p4ycYSeJZq/ApumBgE94t7ct3L0XjrCjVMppIHcm89knibG5pK0VWGDJ1a1WD MPshdCY++DaqNmWPA2EeizgXe4g+DGOeuTZovng2txpZbwNVtu0/sPkZjCr1c44wy5km dzuCR7U8+w87ioiFRromnGegYQZRFoLFTMA01loem4IGUh6RqI1UnhZ9+xl8P5f5i0jW nJ0AfUANKGm7tle/3Glct18N6uffOo03ZnIQG8SRsQFv4OVsVqn2kxOcg1WCyOGBMbwW a9xcAM9P+zKvYNNP0uk7kmalu/Z9lcmlXr6l/uUcbF4TIobO4n1TvEQU7Borev6drPAx LS1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788452801; x=1789057601; 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=NJbW/2mGTqf7zVqXHW2C7V2+8QlZA+SunaNS+Ms2qaUV2os5rovS3o4+qdiIqf7r8U WbFCPu/XJYQedVMU85Wc7DuoZ5HwkVVbdxM48tJevDfhBMF1tLkbnHi+pvCI6KFpG8DZ +wkAvEB4Q12Ajdyie9J5g7GIhbvzcN05j8kMQUZ8jHEqGm7dCFAtIV3+wq8/T/h3K9J6 X0oFzBGsN7mx2B7CJZUMQBvijq+Xjqy9z+sZoYkk3hM6GSDXIYbT6BUk3AKnmseZ13K3 FFEqPyYxarQnIABNsZfvlRwZSrIQA2SHadZSoEhbcUwUdd2dlVoE/g1NlsxINHOv5n7I 12AA== X-Forwarded-Encrypted: i=1; AKwUvBwRv6RbqcQB7ImhuYnSMUvP7DQhiXV883qYVOcBIT3hc7vWzhw+LXmeR1loC8eWVm4lwka0/pSuDWpmSQI=@vger.kernel.org X-Gm-Message-State: AFuF++m7kPjD3sNxfo3JQJy1kRdpuw89tvmZ1KhojZ6QgqDx3lvo7O6P pJLnO3yP+uUJ77nQXpZZ0qaidffbYzL97oadkwPwVFcnwDeq9/eN77SD X-Gm-Gg: AYBFou1f77IGIQcarPvJWYpOAgwp7UR+U14XEMculTfuyBULKv4vXeb/8PkRGyUKsky 5RJLEdDV/ZjB7Rk+/xa4S4g27kme1pSEJ2jGLTxzKuchWKv58zz58Kic/4vZIhV41mBYwUs9GUS ADdG4lVUFjuuft/6+JVIlMZ6Hq40yGFx6xHDP8+qwAzC6AEe9nYIwblFBL5oWQTLUxuzKJziVca m0XtkUf+Q9wvhdI3AJ1xpf+qPEllufOABtqq/AeNZzn9PCJIAtNhG/RM29BuXYe+DowD7wjUbX8 YxHYUioYI27dGMENRS2YhWAzCGe+oSzMpJPJVl5laG8z+4dh6GHErngSluCQ+YkE3AzbzzFBbkH E1eAv+/tkkb22T6Unk3cWwiXBCSnnIUMwpZT8t0GWkYlUHFFxUXGxKzLUxqENZMo+3fa817icgI ZzK/rRt5iAp30sa0ypsLUKjrbJEv8RkhkEZXfx9kBjv/A= X-Received: by 2002:a05:600c:83c4:b0:49c:e363:c66e with SMTP id 5b1f17b1804b1-49ce580365emr108669425e9.1.1788452800655; Thu, 03 Sep 2026 09:26:40 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::6:124b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49cf2531232sm57273715e9.7.2026.09.03.09.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 09:26:39 -0700 (PDT) From: Gustavo Luiz Duarte Date: Thu, 03 Sep 2026 17:26:03 +0100 Subject: [PATCH net-next v4 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: <20260903-netcons_ipv6-v4-4-bdd183c844d3@gmail.com> References: <20260903-netcons_ipv6-v4-0-bdd183c844d3@gmail.com> In-Reply-To: <20260903-netcons_ipv6-v4-0-bdd183c844d3@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 Sat Sep 26 07:15:21 2026 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 833AB4EE86D for ; Thu, 3 Sep 2026 16:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452806; cv=none; b=nR7Rprw7orKt3IVeJOXq8bxwz7nBS1lczGv4SXzUKFl8eAi083GFyY/0c2PRa6s8+ftzetKd0VafcdumAlEgh4U3nlt807Rhqy8YLJDqksV6AcHMSt4uGZTuO2cGsMxLZvxyAaOchbrHjTXv636VWlzIcsiaj7/EaEqLATINLKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452806; c=relaxed/simple; bh=evoNCG15G6WzqrwbqEvAz0ljT6c3gDzGnnAZfhprhjI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tAEcsqKyOuEzdbzemPKdziNpvOEIecaIgTUrQ6Y46oDOXAaPvDupApZyW6Z5hkI7+4bkXabOp5CpK1eZbNntLeQzCXLJCknI48UtHqjB13kgGGONWXlOXRJtaYRasIsNSHwvX4UmcEELKUZV7iWVw/k7/SWQhZPwhznDFb+1+M4= 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=LQJoh5ae; arc=none smtp.client-ip=209.85.221.47 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="LQJoh5ae" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-4843751b694so4396f8f.2 for ; Thu, 03 Sep 2026 09:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788452802; x=1789057602; 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=LQJoh5ae4uPmZpT/U62CJ/7VQoJp4z5793rl66WQ4cuOzV4sOu0/BKIenLyZqGFHJ4 gsGrfUme9f7BSYM/GHRjocyr/vW8Oa9Ql96elyUb3DfhlQC1VjvCOgJ7o6+c9Lgz0iKv q7S+ubR9gkmB14cQfFyx9GUgYshpNEzENaiIBpe57KjsISBWTECUYVsd7NedBTF39gRk OYNa8WTN1LRGPAwLrRmdUViB1hBORkBoAhD81kpw0d0ie/BEp3zP53ZyfecsdjwtVcK3 t9WM2bmLzhi8VDzk6wllfOl+04PKjtMAF6WUWhBkY/9muSZoOhgpCHIhsJ5gNjtd0hYM Jxaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788452802; x=1789057602; 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=d4PQNmAIIXWNSSsrtxh+9+6PjmluOlOltgL7bNeICLK/myTxdlqDIJTaQ5cUkYXW2V LhWFZU8IKhg76ECjFTgh68ah7BdZClRavXPcKBUNj8TylCHS509/782xDzS6KXSitPF0 EgVTOBDcqhKSr2MuJairwIN1u9bIuFpLl24KtPHjOygRf1YIFypiyyVtchjvtjBSityx KFXcOW72Jik6cr9cXa93cC93W0EAbwdl5gDNGe9B4pabCtZK9DbqeXFTfB5p7O6uxd+R O1d3DeosdiaAAbJWW2sh0q78LWh+zUXkH1OWD73beIxFxp39Sws6BwhlgUE6xjLSN2RD I2Fg== X-Forwarded-Encrypted: i=1; AKwUvBy3xtymcmoMk5mSSjnw+ruoOFvJ/4nTsomcQ3QyxDyWh+PD/ryMmW2trR7To51kyAp9igJ2jkV4u6zoRPM=@vger.kernel.org X-Gm-Message-State: AFuF++lgcmOSNg1iPqmurnvkEkS0E2EYJG60JkiOqgJL03Ga08mjjkJ6 8p1YRY9qIoE8/GMQAZPc5JtO3KYy9dvH8SRRxL3Smcy8+M49FAkkv/Nur+3xONUfJVrE9w== X-Gm-Gg: AYBFou1C545g+/Ba9+r1qt9yHjPTOoGH8n3Pb31r8Xjt1cG4stKBUlYamu12Q9hg+nu hmKGBxNAYluCbScxy1zKNN4QwG+mfB+jyXUHXgposeNLxSCa7MnT71v8JYXC9SUE+J0+Q7cs0fw 9BD+Ooi3tzpDUWKI5BYcbOplrgvHnsgw85pvzEYlIoG8nZ6yv0f1jr9bEuyW+kRzmApAqeEfy8X A0FDzspipDCYxPFTnOzY86kV1LSdCbQwDW4mMa8ae+XEmHO/BlY4Pt5ifNipYT59EoTgpAtLet2 SzRurM0AFgo1aq5YY/eM2lPuU5N72R7wtZNAR+VaNX9aZoiqGCs908FbHuNQPSFmGt8hETC18oy taH9Ac8FWehEIg9AbvVGGUhzbZie4PQVcm4uFolooGWY4QXWNr+Ngt01MXPAze9SJy63Bsv5zYe k3IwiGfg1nR7rNOZXh+tf3bKhki8Ih/Yd3nZcovQTT2A== X-Received: by 2002:a05:6000:2dca:b0:485:847f:fd8f with SMTP id ffacd0b85a97d-48587084cd8mr212759f8f.2.1788452801985; Thu, 03 Sep 2026 09:26:41 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::6:124b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48448e6f604sm14930575f8f.2.2026.09.03.09.26.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 09:26:41 -0700 (PDT) From: Gustavo Luiz Duarte Date: Thu, 03 Sep 2026 17:26:04 +0100 Subject: [PATCH net-next v4 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: <20260903-netcons_ipv6-v4-5-bdd183c844d3@gmail.com> References: <20260903-netcons_ipv6-v4-0-bdd183c844d3@gmail.com> In-Reply-To: <20260903-netcons_ipv6-v4-0-bdd183c844d3@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 Sat Sep 26 07:15:21 2026 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 538734F0522 for ; Thu, 3 Sep 2026 16:26:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452807; cv=none; b=UTC9V7kFx5frhSWjEOT4o7I7z1oMXWTU/gk25/kQYxNFVE4GLNTwcINmrm9Q62A8oyN08/WfX18+Ypely03p4xZCiYA7RU0047u7tkAqkUTVb6ZHo4Yo4asCuET2a+w0OQvXiRW8TyHss9BLsMXblGg9kVoDy0c5f78cqswkUUA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452807; c=relaxed/simple; bh=9YHOe5z+ssvaM23jtJhGeLvjomXezj8HIDuK2w3BBE4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ojMFlIStJEpRQX+2ad70e69px2ZLJI/wK37X0D8UiTzimheCtmfb3kywfldTfHYAfGVaNWEESVjqJ7rC0cNRFwfTR4ueKN/w7ZcCQKH9/pU482fKLuiYYACtQ8y0bya/MAmOJ8uttIyrmkfKpiBqbR42miWzqK+Cw0o0Yw1TKHM= 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=f/rGdOkk; arc=none smtp.client-ip=209.85.221.45 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="f/rGdOkk" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-48431632951so9698f8f.0 for ; Thu, 03 Sep 2026 09:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788452803; x=1789057603; 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=f/rGdOkkJE5xPRH9WyfY/hdBsMIpjcaU5sYKDsMCHazNuGzeiZe9G6NgBbm36z+lTD duH1JOmr/Dej5Hmhy1g1FIbBPKTBVliSffTLuwgpXxc3WxJ6Jds0hHbUX+hwSFRG72c1 QYVP5SfHHax5kFSUW7plBqK9Lbidl1UC1D/2z9XzMtkxlqLyMJt35v8ACl/IwZdfU1DT rJn1pvKeGuxrJVBk/+280sWhaCtjUnT6UVEeNjecnnkfSOXMEvFipCusMitFp5rQ8w2R cX7LRTErfZLPWz+RdYjbJhMMV/LBHvDy0BYEltEaucOzr0GcHma0LcdxEFjYrknpPfTd md/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788452803; x=1789057603; 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=eMsZcDXpx/UnhIon5QlHmvXz50sUyQe4p6WAnXSS3sKXbFy0m7YvYyR9Evww4EziS9 A3QmRg4d3ABHtcC2MWolC4bBfr4tPjyoM1qz+79sz/99/oF+g4KVbNxzw/k/8g17wyB6 3uP8kHzgi7h+uIctoIB/ee0YsXLDWed6dO2z6XTmgRnj40lWf2AfpZym0/g9SNUhAATG dvY/I45rfvXgJHyZ04sW1pF1iQgNCWMcSh3/uD98OZLxgiOZy4F77J37WIoX4mqW9jse ZUewPaCBIHLw9w6Al+6r25Wq9GIHkM4Y/+CQ885xVnotlpmVF6Ljzy8zWXfxvM/rThsy nSxg== X-Forwarded-Encrypted: i=1; AKwUvBwd1LJmFiCkEfyVLnoiRfifjTKYINiw+dONdUVh1mb3imlUBN/hDAftVUZK45uKYVx06TZk2qp2DEVbwY0=@vger.kernel.org X-Gm-Message-State: AFuF++kM8eFDhLFx6vAiOjtPtDMgf0lcSqRKD4VLB6/vTWzIX4trvcaW UKjFqM3lsivbEsleiyA9xRL56bvdWEXEfw5cDR/xqYUBbTsruCsP94md X-Gm-Gg: AYBFou2KK6qIQy5gM3DGr6PimnzPTY2kdaCwDwzLrbn9mr/Lj5vJPBRmrw54Hl8m215 skrtBhPiLGac60HA1h4ssyTUXZ+xqtEQAYvbvf28Y6LKYVKOedKkKMNBUVczGCMDrQrArpQ7AFq V8OGbkOxwZdZRdgS3YE238wQyidJRsGffSNl07tFrNSzvQlr7PtiEHUrNaThEGaYWtBnk2/iX1A Nb/xJ1NqeUM1ww89z5JNAc96VidzeL/J9UlwxAHFemfZmUUss6K1kZoXMCmHQCxnxe2QrgfIR7O 1JXG455TKjvXNqtRgQOX0CTt+323glW4XOor72CsM3dNSvSX7nU0+G3yC25nuxLnJT+aDSB1wQV Vrmfck5oA371f77/M8gbLhCZwRgeGikT9AZrukNlSxYp2CCZkd0amoSX1lsdRHM6WP1ngztSXCn bANegWWm5qtKTNlY1roFQN+Rad1RJjOqxSE3cFZf5V8CSm8moziD1muw== X-Received: by 2002:a05:6000:4555:b0:482:f1fc:d9ae with SMTP id ffacd0b85a97d-485872a4164mr103615f8f.3.1788452803391; Thu, 03 Sep 2026 09:26:43 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::6:124b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-484492ce236sm17593166f8f.35.2026.09.03.09.26.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 09:26:42 -0700 (PDT) From: Gustavo Luiz Duarte Date: Thu, 03 Sep 2026 17:26:05 +0100 Subject: [PATCH net-next v4 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: <20260903-netcons_ipv6-v4-6-bdd183c844d3@gmail.com> References: <20260903-netcons_ipv6-v4-0-bdd183c844d3@gmail.com> In-Reply-To: <20260903-netcons_ipv6-v4-0-bdd183c844d3@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 Sat Sep 26 07:15:21 2026 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 38A084F053E for ; Thu, 3 Sep 2026 16:26:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452809; cv=none; b=Dg2NiSIakEKyaNVx5sEVwdNOFgsJDAcHNKCzx2YuXaKbwQaJPyUoRGavxXn3lWoG44VKpNu+UoC1dC6kTlaMecye3gazlqWX/gg67J5JgdxNgx57tgDBxf0oaUOQwtiVH5/uaIG7++EDlSH1O56zThFKUh0XHKnEpMximBXSh6M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788452809; c=relaxed/simple; bh=nOO/E6lZobnxas+CjEmlQQqFvaYHZtCUk+zEXJi39rY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gZy8LiYNHPsE7IN7Vg30ECjqo6KNxsOu/Gp+UgE5tLr9SYWIQPCpoPh+Dwallm3vJaLGgX08PSE/K1i3/Rmg/5d8j23UWkgYrQQLuUCC+cEvK31DpLIWxgDFqNsff8+3xm3gejdeCdhvbvYKajWmSU+QdTzBL6igjWAGAZz7XZ8= 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=e0RL6Tbd; arc=none smtp.client-ip=209.85.128.53 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="e0RL6Tbd" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-499c0879d51so44655e9.2 for ; Thu, 03 Sep 2026 09:26:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788452805; x=1789057605; 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=Naf/s4dAV3WmHAfnOCKQz+YEIomyzUmgkSw+k6SbsTg=; b=e0RL6TbdWqMV7jJ0hskdOfI4JYNw43vDNCpkik9dmM6xYdgcQOudJoIDNDtein+si2 ssVuSGXP7ivsIcJJUikSfShas1g81y2/QmXwit+hUi2WM0QTNBH3pZ/ipxyIAzLlLYt+ awyEzJ6ldWKHfgpyCjYPskmXwnXU1XS5k2p67ZmkmO8hCOTRuYTiGir8x8+CfTbutHfS YV4gjCuWTkE9UXZtH6Iw3STi5JiHcn3evzE4y6wJ5CaO4PZCqkBKUzcJ30Bj12xcewc6 36PCNZvIUcnVEcQdtnXbPPmIOEJPTgNmVQNWaNh3qvbzSp4JGTrWiXhhr/nvICYCGd5/ kh0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788452805; x=1789057605; 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=Naf/s4dAV3WmHAfnOCKQz+YEIomyzUmgkSw+k6SbsTg=; b=FxWKl+mRMZEEXUlV8UQNlCyXF3gF+R5n1WQR0yMaLqG2OXiVDMNHBzaeLqFZpz7EAH KSLTkV/qGIW89MJo7FdGfLVmAuTvbjh5KPbwZcTsTVJwbBEBGLPXjSppAaUouSUBG6Ok hsSZFluqIVzudatHTrjaGGAZX9bxBs3lwIecBCzhbclsLVYyu8VUeOKDPend0rOnDLjP AsUIBFiWIP6axNhkJDZP3mQm7d9xA9xtc5Y1SxnUpp3TrmYZskqWAJ/cpw7b4rc0JzIS zeDvaHcZG8yIxE94U+oMY9lJSFo5W1IaMuLRTfg1jSvs+UfHhhnTGqHNMqEm4J9A6H0a a2aw== X-Forwarded-Encrypted: i=1; AKwUvBwblJg/cr/OwXy4gkvwHA4hORbGmangC5Cm5xHaTmvm1vr8kbEFXiK5lqvFFN3SYZ+GwWbYdFLWpvPgFzQ=@vger.kernel.org X-Gm-Message-State: AFuF++mQoQ/zqm7NZHD0z1/4RHMvkBxl3FJDcrmXQ/mK0RLO+rYtX0TP iwPDqPkdr2j3N2lX/VNxhdYYVRErbUrAM767nvQfDz0tZiPjWZjTAavF X-Gm-Gg: AYBFou0LEKJQTHItSjaDB1PYnQ36gZ3ZYiahB968PoU1JPpOiElWH3sgN2xgProFPty JuLAjn9B9AQobyIw7voGBEAz7AxmOva2TukI/0jt0xiI3omr4wpauTYxhCkDQj5OomWTS3f8ESH AwVdnhGz1/8EI4wktc8KHvQ6lRB3BmfbXDvarrObMXzq4glWC0qcoF5xPiY9Ftb8KZ9NjTTy9+b yQDmvBelOSCP2VgxSdaeNIVXhhoycw2mtR2qXcehNi0mKzwLV4HgY+SnViPhknuFAXVLo8EpXG1 E3BuueGzkBmE2HcbPIm5cPT0N0vlyTkvTxMDIg1Js3D/8pY5s6y0hfagzwaxXTr//hY5O61XXyC 0dx6YASOgh/i0yZ+N+V6qworD1Jl0u22iUtjxucRkvCZChzsKcWXEfCB5+Bp9xKBb8xQi99BoJZ Za03RwNG561WCWv0dgcMPGMwIBg8YS51Ne+mYCIvxMaMM= X-Received: by 2002:a05:600c:3b03:b0:49b:910c:76fb with SMTP id 5b1f17b1804b1-49ce58252e3mr115661705e9.2.1788452804766; Thu, 03 Sep 2026 09:26:44 -0700 (PDT) Received: from localhost ([2620:10d:c092:500::6:124b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49cee5dadddsm101965955e9.9.2026.09.03.09.26.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 09:26:44 -0700 (PDT) From: Gustavo Luiz Duarte Date: Thu, 03 Sep 2026 17:26:06 +0100 Subject: [PATCH net-next v4 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: <20260903-netcons_ipv6-v4-7-bdd183c844d3@gmail.com> References: <20260903-netcons_ipv6-v4-0-bdd183c844d3@gmail.com> In-Reply-To: <20260903-netcons_ipv6-v4-0-bdd183c844d3@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. Reviewed-by: Breno Leitao 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