summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorkurisaw <[email protected]>2024-10-31 16:48:52 +0800
committerRbb666 <[email protected]>2024-11-05 09:43:57 +0800
commit13a6c5201d71bde412fa0ea453ad10a6e2ace82c (patch)
tree46f389e24d643ad29c4e852dcf855a60c705b531 /components
parenta939e8e4ea7d25fe4e5a6d94055015377e6f68bf (diff)
[net][lwip] lwip hook functions are provided to provide greater flexibility for unknown Ethernet protocols
Diffstat (limited to 'components')
-rw-r--r--components/net/lwip/Kconfig4
-rw-r--r--components/net/lwip/port/lwipopts.h11
2 files changed, 15 insertions, 0 deletions
diff --git a/components/net/lwip/Kconfig b/components/net/lwip/Kconfig
index 883c14a4d1..48f2a1d86a 100644
--- a/components/net/lwip/Kconfig
+++ b/components/net/lwip/Kconfig
@@ -281,6 +281,10 @@ if RT_USING_LWIP
endif
endif
+ config RT_LWIP_ENABLE_USER_HOOKS
+ bool "Enable user-defined LWIP hooks"
+ default n
+
menuconfig RT_LWIP_DEBUG
bool "Enable lwIP Debugging Options"
default n
diff --git a/components/net/lwip/port/lwipopts.h b/components/net/lwip/port/lwipopts.h
index 37ed55b8a5..a297af7060 100644
--- a/components/net/lwip/port/lwipopts.h
+++ b/components/net/lwip/port/lwipopts.h
@@ -654,4 +654,15 @@
#endif
#endif /* RT_USING_LWIP_VER_NUM >= 0x20000 */
+#if RT_LWIP_ENABLE_USER_HOOKS
+/**
+ * This hook provides flexibility for handling unknown Ethernet protocols.
+ *
+ * For example, you can define how to handle packets of unknown types,
+ * such as forwarding them to another interface, discarding them,
+ * or passing them to an application for further processing.
+ */
+#define LWIP_HOOK_UNKNOWN_ETH_PROTOCOL lwip_hook_unknown_eth_protocol
+#endif /* RT_LWIP_ENABLE_USER_HOOKS */
+
#endif /* __LWIPOPTS_H__ */