diff options
author | Oleksij Rempel <o.rempel@pengutronix.de> | 2022-04-13 10:22:05 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-04-19 09:11:04 +0200 |
commit | 2bf8244b52438479f6d3c082252e36094c7cd548 (patch) | |
tree | 7ee9fa100f7b87098a231166f3f4dd8d93959cdb /include | |
parent | f50be0f9b97774191fef73585a4454f73b2ded67 (diff) | |
download | barebox-2bf8244b52438479f6d3c082252e36094c7cd548.tar.gz barebox-2bf8244b52438479f6d3c082252e36094c7cd548.tar.xz |
add ethlog command
It is kind of tcpdump or tshark for barebox. Instead of starting
application it will let barebox dump everything to the console by still
allowing to use other application.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.barebox.org/20220413082205.429509-15-o.rempel@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/net.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/net.h b/include/net.h index 8013f79c2e..b50b6e76c8 100644 --- a/include/net.h +++ b/include/net.h @@ -46,6 +46,8 @@ struct eth_device { int (*set_ethaddr) (struct eth_device*, const unsigned char *adr); int (*rx_preprocessor) (struct eth_device*, unsigned char **packet, int *length); + void (*rx_monitor) (struct eth_device*, void *packet, int length); + void (*tx_monitor) (struct eth_device*, void *packet, int length); struct eth_device *next; void *priv; @@ -90,6 +92,15 @@ static inline const char *eth_name(struct eth_device *edev) return edev->devname; } +static inline int eth_send_raw(struct eth_device *edev, void *packet, + int length) +{ + if (edev->tx_monitor) + edev->tx_monitor(edev, packet, length); + + return edev->send(edev, packet, length); +} + int eth_register(struct eth_device* dev); /* Register network device */ void eth_unregister(struct eth_device* dev); /* Unregister network device */ int eth_set_ethaddr(struct eth_device *edev, const char *ethaddr); |