From 4b37fd146bb86b72f52b97386602ae58727b09fc Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 18 Dec 2021 11:27:49 -0700 Subject: Convert CONFIG_UDP_CHECKSUM to Kconfig This converts the following to Kconfig: CONFIG_UDP_CHECKSUM Signed-off-by: Simon Glass --- 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 cc307ce43b..e79791cdfd 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 1cd48d6c4a..b8292fdccf 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 8a7a2d64f5..a6896650b1 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 f40e86ff22..c640a3c38e 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 8e61b72887..c5aa3fd5e4 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 5ed624c7b7..3723c5db0d 100644 --- a/include/configs/M5208EVBE.h +++ b/include/configs/M5208EVBE.h @@ -39,8 +39,6 @@ /* I2C */ -#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 5db189ae2d..d70ebac7fd 100644 --- a/include/configs/M53017EVB.h +++ b/include/configs/M53017EVB.h @@ -54,8 +54,6 @@ /* I2C */ -#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 f96f54ef65..e59187d719 100644 --- a/include/configs/M5329EVB.h +++ b/include/configs/M5329EVB.h @@ -48,8 +48,6 @@ /* I2C */ -#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 b7906013e0..2a56c9056d 100644 --- a/include/configs/M5373EVB.h +++ b/include/configs/M5373EVB.h @@ -50,8 +50,6 @@ /* I2C */ -#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 1dd21d5e92..2cb8a90f5e 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 8e9579afb2..8ddea2823a 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -108,4 +108,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 c2992a0908..43e230aeb9 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 f67f6eb6af..fa242540d3 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -2087,7 +2087,6 @@ CONFIG_UBI_SIZE CONFIG_UBOOTPATH CONFIG_UBOOT_SECTOR_COUNT CONFIG_UBOOT_SECTOR_START -CONFIG_UDP_CHECKSUM CONFIG_UEC_ETH CONFIG_UEC_ETH2 CONFIG_UPDATEB -- cgit v1.2.3