mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 08:42:12 +02:00
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 <rfried.dev@gmail.com> Reviewed-by: Alex Marginean <alexm.osslist@gmail.com> Tested-by: Alex Marginean <alexm.osslist@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
committed by
Joe Hershberger
parent
1bad991205
commit
3eaac6307d
@@ -11,6 +11,7 @@
|
||||
#include <net.h>
|
||||
#include <phy.h>
|
||||
#include <linux/errno.h>
|
||||
#include <net/pcap.h>
|
||||
#include "eth_internal.h"
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
@@ -352,10 +353,17 @@ int eth_is_active(struct eth_device *dev)
|
||||
|
||||
int eth_send(void *packet, int length)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!eth_current)
|
||||
return -ENODEV;
|
||||
|
||||
return eth_current->send(eth_current, packet, length);
|
||||
ret = eth_current->send(eth_current, packet, length);
|
||||
#if defined(CONFIG_CMD_PCAP)
|
||||
if (ret >= 0)
|
||||
pcap_post(packet, lengeth, true);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
int eth_rx(void)
|
||||
|
Reference in New Issue
Block a user