summaryrefslogtreecommitdiffstatsabout
path: root/SylixOS
diff options
context:
space:
mode:
authorHanhui <hanhui@acoinfo.com>2020-11-22 17:19:38 (GMT)
committer Hanhui <hanhui@acoinfo.com>2020-11-22 17:19:38 (GMT)
commitb03c5f108949d508caeddc6305be397930e4d4fb (patch)
treeab36cc14ce6b7942dbd1ddeab6be63af02911864 /SylixOS
parent13ec4332870a830bacee6c67425dfe6eff5af255 (diff)
downloadlibsylixos-b03c5f108949d508caeddc6305be397930e4d4fb.zip
libsylixos-b03c5f108949d508caeddc6305be397930e4d4fb.tar.gz
libsylixos-b03c5f108949d508caeddc6305be397930e4d4fb.tar.bz2
IPv4 & IPv6 add transport layer protocol detection and save, convenient for hook program to process.
Diffstat (limited to 'SylixOS')
-rw-r--r--SylixOS/include/network/lwip/ip.h8
-rw-r--r--SylixOS/net/lwip/src/core/ipv4/ip4.c4
-rw-r--r--SylixOS/net/lwip/src/core/ipv6/ip6.c4
3 files changed, 16 insertions, 0 deletions
diff --git a/SylixOS/include/network/lwip/ip.h b/SylixOS/include/network/lwip/ip.h
index 052f283..bc80d68 100644
--- a/SylixOS/include/network/lwip/ip.h
+++ b/SylixOS/include/network/lwip/ip.h
@@ -126,6 +126,10 @@ struct ip_globals
ip_addr_t current_iphdr_src;
/** Destination IP address of current_header */
ip_addr_t current_iphdr_dest;
+#ifdef SYLIXOS /* SylixOS add next header type */
+ /** Next protocol of current_ip4/6_header */
+ u8_t current_next_proto;
+#endif /* SYLIXOS */
};
extern struct ip_globals ip_data;
@@ -174,6 +178,10 @@ extern struct ip_globals ip_data;
/** Destination IP4 address of current_header */
#define ip4_current_dest_addr() (ip_2_ip4(&ip_data.current_iphdr_dest))
+#ifdef SYLIXOS /* SylixOS add next header type */
+#define ip_current_next_proto() (ip_data.current_next_proto)
+#endif /* SYLIXOS */
+
#elif LWIP_IPV4 /* LWIP_IPV4 && LWIP_IPV6 */
/** Get the IPv4 header of the current packet.
diff --git a/SylixOS/net/lwip/src/core/ipv4/ip4.c b/SylixOS/net/lwip/src/core/ipv4/ip4.c
index 50055a4..3e96a61 100644
--- a/SylixOS/net/lwip/src/core/ipv4/ip4.c
+++ b/SylixOS/net/lwip/src/core/ipv4/ip4.c
@@ -781,6 +781,10 @@ ip4_input(struct pbuf *p, struct netif *inp)
ip_data.current_ip4_header = iphdr;
ip_data.current_ip_header_tot_len = IPH_HL_BYTES(iphdr);
+#ifdef SYLIXOS /* SylixOS add next header type */
+ ip_data.current_next_proto = IPH_PROTO(iphdr);
+#endif /* SYLIXOS */
+
#ifdef SYLIXOS /* SylixOS Add this hook */
if (lwip_ip_hook(IP_HOOK_V4, IP_HT_LOCAL_IN, p, inp, NULL)) {
pbuf_free(p);
diff --git a/SylixOS/net/lwip/src/core/ipv6/ip6.c b/SylixOS/net/lwip/src/core/ipv6/ip6.c
index d98befb..a84a739 100644
--- a/SylixOS/net/lwip/src/core/ipv6/ip6.c
+++ b/SylixOS/net/lwip/src/core/ipv6/ip6.c
@@ -1122,6 +1122,10 @@ options_done:
ip_data.current_ip_header_tot_len = hlen_tot;
+#ifdef SYLIXOS /* SylixOS add next header type */
+ ip_data.current_next_proto = *nexth;
+#endif /* SYLIXOS */
+
#ifdef SYLIXOS /* SylixOS Add this hook */
if (lwip_ip_hook(IP_HOOK_V6, IP_HT_LOCAL_IN, p, inp, NULL)) {
pbuf_free(p);