Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 113E7C433F5 for ; Sat, 18 Dec 2021 18:28:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0CC5D830BE; Sat, 18 Dec 2021 19:28:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="UZ2iiaZV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 82952830BE; Sat, 18 Dec 2021 19:28:10 +0100 (CET) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4B3B3830B4 for ; Sat, 18 Dec 2021 19:27:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd32.google.com with SMTP id z18so7685596iof.5 for ; Sat, 18 Dec 2021 10:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xMAUuNbQh+19k3k2hhgu0b2uv14pTK7rZ40waPBf4uM=; b=UZ2iiaZV5Zpnet8w0pSo6NPrks5MXgygMibHIvtw+HVrDEtArcoy7bYmJMHKC4SA2D ubBTLnszgc/dCeuf6gkbdkyu+mhU09PlsW6iL3QDuVYPOZIxIV13Tcz2JqpE9xbUD3ul yGGwWbEjX15+b63h7btUCF4H4FTeVtpNqOgPg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xMAUuNbQh+19k3k2hhgu0b2uv14pTK7rZ40waPBf4uM=; b=dtaXeWF3Qe3DihLNIbupuqIX/9ZDufMO+laMXu08JwKgensEiJB6Q34kT40s4S/rjX Oh99UrIe4hh0vfESstBww2J/+0p6ORZsXEJ1NvUn4g50Yq3ANIpnKGMePJJJ2LQ1mT4o 38/TRZSFuTgd6t/iR6iP7jRt2CEpvZHNyWOaEaQCPtzlOCAX9qj596l6GKEML07KbgwK c+d8ls5nhg3HNUevGfTj808TicN0YprgEUHpIr0niKgBXDwyycIbH9jNZWCDmobmmYM8 NtV8sZq+urQi6YBJlYxfJLKax2kv5Hr7qzSOApxgrTlJhAvd1fUteuUR1l/IMFZb4OnO E92g== X-Gm-Message-State: AOAM532dOzKcyVHQBynvnW858ZmxbVSSq83g4VXDDBTj+umgn/FZ0JLF 9js3trN9NIVEzsGnHD70Iiw0n58/2CXvLA== X-Google-Smtp-Source: ABdhPJzWpYI4jiTcn6AEIURKYuoRLhmkYflXb3FLnLbLJe8tCtjtcz5tWSA34LEwJIa7KAJoRkuiww== X-Received: by 2002:a05:6638:2257:: with SMTP id m23mr5187379jas.17.1639852077814; Sat, 18 Dec 2021 10:27:57 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id k13sm8369628iow.45.2021.12.18.10.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Dec 2021 10:27:57 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Joe Hershberger , Tom Rini , Simon Glass , Daniel Schwierzeck , Heiko Schocher , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Mario Six , Patrick Delaunay , Priyanka Jain , Ramon Fried , Rick Chen , Sean Anderson , Stefan Roese , TsiChung Liew Subject: [PATCH v2 2/5] Convert CONFIG_UDP_CHECKSUM to Kconfig Date: Sat, 18 Dec 2021 11:27:49 -0700 Message-Id: <20211218182752.1121322-2-sjg@chromium.org> X-Mailer: git-send-email 2.34.1.173.g76aa8bc2d0-goog In-Reply-To: <20211218182752.1121322-1-sjg@chromium.org> References: <20211218182752.1121322-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean This converts the following to Kconfig: CONFIG_UDP_CHECKSUM Signed-off-by: Simon Glass --- (no changes since v1) configs/M5208EVBE_defconfig | 1 + configs/M53017EVB_defconfig | 1 + configs/M5329AFEE_defconfig | 1 + configs/M5329BFEE_defconfig | 1 + configs/M5373EVB_defconfig | 1 + include/configs/M5208EVBE.h | 2 -- include/configs/M53017EVB.h | 2 -- include/configs/M5329EVB.h | 2 -- include/configs/M5373EVB.h | 2 -- include/configs/sandbox.h | 1 - net/Kconfig | 7 +++++++ net/net.c | 4 +--- scripts/config_whitelist.txt | 1 - 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/configs/M5208EVBE_defconfig b/configs/M5208EVBE_defconfig index cc307ce43b2..e79791cdfd0 100644 --- a/configs/M5208EVBE_defconfig +++ b/configs/M5208EVBE_defconfig @@ -19,6 +19,7 @@ CONFIG_CMD_CACHE=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0x2000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M53017EVB_defconfig b/configs/M53017EVB_defconfig index 1cd48d6c4ae..b8292fdccff 100644 --- a/configs/M53017EVB_defconfig +++ b/configs/M53017EVB_defconfig @@ -21,6 +21,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_ENV_ADDR=0x40000 +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M5329AFEE_defconfig b/configs/M5329AFEE_defconfig index 8a7a2d64f54..a6896650b19 100644 --- a/configs/M5329AFEE_defconfig +++ b/configs/M5329AFEE_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_ADDR=0x4000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M5329BFEE_defconfig b/configs/M5329BFEE_defconfig index f40e86ff222..c640a3c38e8 100644 --- a/configs/M5329BFEE_defconfig +++ b/configs/M5329BFEE_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_ADDR=0x4000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/configs/M5373EVB_defconfig b/configs/M5373EVB_defconfig index 8e61b72887d..c5aa3fd5e46 100644 --- a/configs/M5373EVB_defconfig +++ b/configs/M5373EVB_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_DATE=y CONFIG_ENV_ADDR=0x4000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_UDP_CHECKSUM=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_FSL=y CONFIG_SYS_FSL_I2C_OFFSET=0x58000 diff --git a/include/configs/M5208EVBE.h b/include/configs/M5208EVBE.h index 6a69ac45aee..a9febe47a4c 100644 --- a/include/configs/M5208EVBE.h +++ b/include/configs/M5208EVBE.h @@ -41,8 +41,6 @@ /* I2C */ #define CONFIG_SYS_IMMR CONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR 192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/M53017EVB.h b/include/configs/M53017EVB.h index 7b33677c551..cda6cbf14e9 100644 --- a/include/configs/M53017EVB.h +++ b/include/configs/M53017EVB.h @@ -56,8 +56,6 @@ /* I2C */ #define CONFIG_SYS_IMMR CONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR 192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/M5329EVB.h b/include/configs/M5329EVB.h index 19d8cfe3217..f12edcc32f2 100644 --- a/include/configs/M5329EVB.h +++ b/include/configs/M5329EVB.h @@ -50,8 +50,6 @@ /* I2C */ #define CONFIG_SYS_IMMR CONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR 192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/M5373EVB.h b/include/configs/M5373EVB.h index e2ddc4893e7..c6a3f71ec63 100644 --- a/include/configs/M5373EVB.h +++ b/include/configs/M5373EVB.h @@ -52,8 +52,6 @@ /* I2C */ #define CONFIG_SYS_IMMR CONFIG_SYS_MBAR -#define CONFIG_UDP_CHECKSUM - #ifdef CONFIG_MCFFEC # define CONFIG_IPADDR 192.162.1.2 # define CONFIG_NETMASK 255.255.255.0 diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 1dd21d5e925..2cb8a90f5ea 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -25,7 +25,6 @@ #define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ 115200} -#define CONFIG_UDP_CHECKSUM #define CONFIG_TIMESTAMP #define CONFIG_BOOTP_SERVERIP diff --git a/net/Kconfig b/net/Kconfig index fb6420f9bbe..3d3329912da 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -107,4 +107,11 @@ config KEEP_SERVERADDR enabled, when an ARP reply is received, the server's IP address is written there. +config UDP_CHECKSUM + bool "Check the UDP checksum" + help + Enable this to verify the checksum on UDP packets. If the checksum + is wrong then the packet is discussed and an error is shown, like + "UDP wrong checksum 29374a23 30ff3826" + endif # if NET diff --git a/net/net.c b/net/net.c index c2992a0908b..43e230aeb92 100644 --- a/net/net.c +++ b/net/net.c @@ -1264,8 +1264,7 @@ void net_process_received_packet(uchar *in_packet, int len) "received UDP (to=%pI4, from=%pI4, len=%d)\n", &dst_ip, &src_ip, len); -#ifdef CONFIG_UDP_CHECKSUM - if (ip->udp_xsum != 0) { + if (IS_ENABLED(CONFIG_UDP_CHECKSUM) && ip->udp_xsum != 0) { ulong xsum; u8 *sumptr; ushort sumlen; @@ -1298,7 +1297,6 @@ void net_process_received_packet(uchar *in_packet, int len) return; } } -#endif #if defined(CONFIG_NETCONSOLE) && !defined(CONFIG_SPL_BUILD) nc_input_packet((uchar *)ip + IP_UDP_HDR_SIZE, diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 3285d3cd30e..f0715614895 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -2946,7 +2946,6 @@ CONFIG_UBI_SIZE CONFIG_UBOOTPATH CONFIG_UBOOT_SECTOR_COUNT CONFIG_UBOOT_SECTOR_START -CONFIG_UDP_CHECKSUM CONFIG_UEC_ETH CONFIG_UEC_ETH1 CONFIG_UEC_ETH2 -- 2.34.1.173.g76aa8bc2d0-goog