Skip to content

Commit 13a6c52

Browse files
kurisaWRbb666
authored andcommitted
[net][lwip] lwip hook functions are provided to provide greater flexibility for unknown Ethernet protocols
1 parent a939e8e commit 13a6c52

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

components/net/lwip/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ if RT_USING_LWIP
281281
endif
282282
endif
283283

284+
config RT_LWIP_ENABLE_USER_HOOKS
285+
bool "Enable user-defined LWIP hooks"
286+
default n
287+
284288
menuconfig RT_LWIP_DEBUG
285289
bool "Enable lwIP Debugging Options"
286290
default n

components/net/lwip/port/lwipopts.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,4 +654,15 @@
654654
#endif
655655
#endif /* RT_USING_LWIP_VER_NUM >= 0x20000 */
656656

657+
#if RT_LWIP_ENABLE_USER_HOOKS
658+
/**
659+
 * This hook provides flexibility for handling unknown Ethernet protocols.
660+
 *
661+
 * For example, you can define how to handle packets of unknown types,
662+
 * such as forwarding them to another interface, discarding them,
663+
 * or passing them to an application for further processing.
664+
 */
665+
#define LWIP_HOOK_UNKNOWN_ETH_PROTOCOL lwip_hook_unknown_eth_protocol
666+
#endif /* RT_LWIP_ENABLE_USER_HOOKS */
667+
657668
#endif /* __LWIPOPTS_H__ */

0 commit comments

Comments
 (0)