summaryrefslogtreecommitdiff
path: root/net/net.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-09-04 16:02:03 -0400
committerTom Rini <trini@konsulko.com>2019-09-04 16:02:03 -0400
commitece9834f7d223097cec92e3d3c70cd37b3768482 (patch)
treed2935e582cb3494364bf2b7bc89a3d227d616e97 /net/net.c
parent448f11f7503995746a7b71e5e3b3a831c4651be9 (diff)
parent5a5d1def59024dd3225e2a6142f8ee3ee10180a8 (diff)
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-net
- Assorted CVE fixes - Other fixes
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/net.c b/net/net.c
index 40511db645d..ded86e74567 100644
--- a/net/net.c
+++ b/net/net.c
@@ -96,6 +96,9 @@
#include <net.h>
#include <net/fastboot.h>
#include <net/tftp.h>
+#if defined(CONFIG_CMD_PCAP)
+#include <net/pcap.h>
+#endif
#if defined(CONFIG_LED_STATUS)
#include <miiphy.h>
#include <status_led.h>
@@ -672,6 +675,11 @@ done:
net_set_icmp_handler(NULL);
#endif
net_set_state(prev_net_state);
+
+#if defined(CONFIG_CMD_PCAP)
+ if (pcap_active())
+ pcap_print_status();
+#endif
return ret;
}
@@ -1084,6 +1092,9 @@ void net_process_received_packet(uchar *in_packet, int len)
debug_cond(DEBUG_NET_PKT, "packet received\n");
+#if defined(CONFIG_CMD_PCAP)
+ pcap_post(in_packet, len, false);
+#endif
net_rx_packet = in_packet;
net_rx_packet_len = len;
et = (struct ethernet_hdr *)in_packet;
@@ -1253,6 +1264,9 @@ void net_process_received_packet(uchar *in_packet, int len)
return;
}
+ if (ntohs(ip->udp_len) < UDP_HDR_SIZE || ntohs(ip->udp_len) > ntohs(ip->ip_len))
+ return;
+
debug_cond(DEBUG_DEV_PKT,
"received UDP (to=%pI4, from=%pI4, len=%d)\n",
&dst_ip, &src_ip, len);