summaryrefslogtreecommitdiff
path: root/net/eth-uclass.c
diff options
context:
space:
mode:
authorRamon Fried <[email protected]>2019-07-18 21:43:30 +0300
committerJoe Hershberger <[email protected]>2019-09-04 11:37:19 -0500
commit3eaac6307dff1e281f89fece521dc8a14078bf61 (patch)
tree9bc58bd8fde06dc4fc92a2ecfc7270a55d95b906 /net/eth-uclass.c
parent1bad991205780cd9f7ebdbdeb0d3a7d118f9f247 (diff)
net: introduce packet capture support
Add support for capturing ethernet packets and storing them in memory in PCAP(2.4) format, later to be analyzed by any PCAP viewer software (IE. Wireshark) This feature greatly assist debugging network issues such as detecting dropped packets, packet corruption etc. Signed-off-by: Ramon Fried <[email protected]> Reviewed-by: Alex Marginean <[email protected]> Tested-by: Alex Marginean <[email protected]> Acked-by: Joe Hershberger <[email protected]>
Diffstat (limited to 'net/eth-uclass.c')
-rw-r--r--net/eth-uclass.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 1d5d2f03b7d..3bd98b01ad3 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -11,6 +11,7 @@
#include <net.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
+#include <net/pcap.h>
#include "eth_internal.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -344,6 +345,10 @@ int eth_send(void *packet, int length)
/* We cannot completely return the error at present */
debug("%s: send() returned error %d\n", __func__, ret);
}
+#if defined(CONFIG_CMD_PCAP)
+ if (ret >= 0)
+ pcap_post(packet, length, true);
+#endif
return ret;
}