projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
configs: am65x_evm_a53: Disable PSCI_RESET
[oweals/u-boot.git]
/
net
/
net.c
diff --git
a/net/net.c
b/net/net.c
index 58b0417cbe9401a7e267d73b286bdfc9dd04cbdb..ded86e7456715ebfc39ce1f52cdd5fd954870963 100644
(file)
--- a/
net/net.c
+++ b/
net/net.c
@@
-90,11
+90,15
@@
#include <common.h>
#include <command.h>
#include <console.h>
#include <common.h>
#include <command.h>
#include <console.h>
-#include <environment.h>
+#include <env.h>
+#include <env_internal.h>
#include <errno.h>
#include <net.h>
#include <net/fastboot.h>
#include <net/tftp.h>
#include <errno.h>
#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>
#if defined(CONFIG_LED_STATUS)
#include <miiphy.h>
#include <status_led.h>
@@
-671,6
+675,11
@@
done:
net_set_icmp_handler(NULL);
#endif
net_set_state(prev_net_state);
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;
}
return ret;
}
@@
-1083,6
+1092,9
@@
void net_process_received_packet(uchar *in_packet, int len)
debug_cond(DEBUG_NET_PKT, "packet received\n");
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;
net_rx_packet = in_packet;
net_rx_packet_len = len;
et = (struct ethernet_hdr *)in_packet;
@@
-1252,6
+1264,9
@@
void net_process_received_packet(uchar *in_packet, int len)
return;
}
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);
debug_cond(DEBUG_DEV_PKT,
"received UDP (to=%pI4, from=%pI4, len=%d)\n",
&dst_ip, &src_ip, len);
@@
-1613,3
+1628,15
@@
ushort env_get_vlan(char *var)
{
return string_to_vlan(env_get(var));
}
{
return string_to_vlan(env_get(var));
}
+
+void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
+{
+ char *end;
+ int i;
+
+ for (i = 0; i < 6; ++i) {
+ enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
+ if (addr)
+ addr = (*end) ? end + 1 : end;
+ }
+}