Skip to content
Permalink
Browse files

net/udp: Always drop IPv6 UDP packet if checksum field is 0

Missing checksum is only valid in IPv4 and only on certain context.

Fixes #16483

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
  • Loading branch information...
tbursztyka authored and jukkar committed May 29, 2019
1 parent c3c6dfa commit e9a4ef2b0ae32bb5361a0f802480848520b11cd2
Showing with 7 additions and 3 deletions.
  1. +7 −3 subsys/net/ip/udp.c
@@ -163,9 +163,13 @@ struct net_udp_hdr *net_udp_input(struct net_pkt *pkt,

if (IS_ENABLED(CONFIG_NET_UDP_CHECKSUM) &&
net_if_need_calc_rx_checksum(net_pkt_iface(pkt))) {
if (IS_ENABLED(CONFIG_NET_UDP_MISSING_CHECKSUM) &&
net_pkt_family(pkt) == AF_INET && !udp_hdr->chksum) {
goto out;
if (!udp_hdr->chksum) {
if (IS_ENABLED(CONFIG_NET_UDP_MISSING_CHECKSUM) &&
net_pkt_family(pkt) == AF_INET) {
goto out;
}

goto drop;
}

if (net_calc_verify_chksum_udp(pkt) != 0U) {

0 comments on commit e9a4ef2

Please sign in to comment.
You can’t perform that action at this time.