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 --- net/Kconfig | 7 +++++++ net/net.c | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'net') diff --git a/net/Kconfig b/net/Kconfig index 8e9579afb2b..8ddea2823ac 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 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, -- cgit v1.2.3