summaryrefslogtreecommitdiff
path: root/components/net
diff options
context:
space:
mode:
authorxiaoniaoyou6hua <[email protected]>2023-04-26 09:19:41 +0800
committerGitHub <[email protected]>2023-04-26 09:19:41 +0800
commitc34608b4a93256d57bf55f0bef6190e3a871fe7f (patch)
tree7e98914e3a8f7872f6daa194328f52b540d24b75 /components/net
parent90853abb086ceb34a70bf539d3aeb14d47985959 (diff)
fix ipv6 compatibility issues (#7339)
Diffstat (limited to 'components/net')
-rw-r--r--components/net/lwip/lwip-2.0.3/src/include/lwip/ip_addr.h4
-rw-r--r--components/net/lwip/lwip-2.1.2/src/include/lwip/ip_addr.h4
-rw-r--r--components/net/lwip/lwip-2.1.2/src/include/lwip/prot/ip6.h2
-rw-r--r--components/net/lwip/port/ethernetif.c4
-rw-r--r--components/net/lwip/port/lwipopts.h4
5 files changed, 12 insertions, 6 deletions
diff --git a/components/net/lwip/lwip-2.0.3/src/include/lwip/ip_addr.h b/components/net/lwip/lwip-2.0.3/src/include/lwip/ip_addr.h
index 11f65d25bd..0732bf7e8a 100644
--- a/components/net/lwip/lwip-2.0.3/src/include/lwip/ip_addr.h
+++ b/components/net/lwip/lwip-2.0.3/src/include/lwip/ip_addr.h
@@ -373,7 +373,7 @@ extern const ip_addr_t ip_addr_broadcast;
extern const ip_addr_t ip6_addr_any;
-/**
+/**
* @ingroup ip6addr
* IP6_ADDR_ANY can be used as a fixed ip_addr_t
* for the IPv6 wildcard address
@@ -400,6 +400,8 @@ extern const ip_addr_t ip6_addr_any;
#define IP_ANY_TYPE IP_ADDR_ANY
#endif
+struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);
+
#ifdef __cplusplus
}
#endif
diff --git a/components/net/lwip/lwip-2.1.2/src/include/lwip/ip_addr.h b/components/net/lwip/lwip-2.1.2/src/include/lwip/ip_addr.h
index 2f977709d1..6f0f5d6925 100644
--- a/components/net/lwip/lwip-2.1.2/src/include/lwip/ip_addr.h
+++ b/components/net/lwip/lwip-2.1.2/src/include/lwip/ip_addr.h
@@ -404,7 +404,7 @@ extern const ip_addr_t ip_addr_broadcast;
extern const ip_addr_t ip6_addr_any;
-/**
+/**
* @ingroup ip6addr
* IP6_ADDR_ANY can be used as a fixed ip_addr_t
* for the IPv6 wildcard address
@@ -431,6 +431,8 @@ extern const ip_addr_t ip6_addr_any;
#define IP_ANY_TYPE IP_ADDR_ANY
#endif
+struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);
+
#ifdef __cplusplus
}
#endif
diff --git a/components/net/lwip/lwip-2.1.2/src/include/lwip/prot/ip6.h b/components/net/lwip/lwip-2.1.2/src/include/lwip/prot/ip6.h
index 0f6de45593..6c0913289f 100644
--- a/components/net/lwip/lwip-2.1.2/src/include/lwip/prot/ip6.h
+++ b/components/net/lwip/lwip-2.1.2/src/include/lwip/prot/ip6.h
@@ -200,7 +200,7 @@ PACK_STRUCT_END
#define IP6_ROUT_SEG_LEFT(hdr) ((hdr)->_segments_left)
/* Fragment header. */
-#define IP6_FRAG_HLEN 8
+#define IP6_FRAG_HLEN 12
#define IP6_FRAG_OFFSET_MASK 0xfff8
#define IP6_FRAG_MORE_FLAG 0x0001
diff --git a/components/net/lwip/port/ethernetif.c b/components/net/lwip/port/ethernetif.c
index 4ce432ca6f..fa2ed36edd 100644
--- a/components/net/lwip/port/ethernetif.c
+++ b/components/net/lwip/port/ethernetif.c
@@ -246,7 +246,11 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len,
local.sin_len = sizeof(local);
local.sin_family = AF_INET;
local.sin_port = 0;
+#ifndef NETDEV_USING_IPV6
local.sin_addr.s_addr = (netif->ip_addr.addr);
+#else
+ local.sin_addr.s_addr = (netif->ip_addr.u_addr.ip4.addr);
+#endif
lwip_bind(s, (struct sockaddr *)&local, sizeof(struct sockaddr_in));
lwip_setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &recv_timeout, sizeof(recv_timeout));
diff --git a/components/net/lwip/port/lwipopts.h b/components/net/lwip/port/lwipopts.h
index c342977538..054b408c95 100644
--- a/components/net/lwip/port/lwipopts.h
+++ b/components/net/lwip/port/lwipopts.h
@@ -585,7 +585,7 @@
#endif
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */
-#define MEMP_NUM_SYS_TIMEOUT (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + 2*PPP_SUPPORT)
+#define MEMP_NUM_SYS_TIMEOUT (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT + (LWIP_IPV6 ? (1 + (2*LWIP_IPV6)) : 0))
/*
* LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
@@ -642,8 +642,6 @@
#else /* >= v2.1.2 */
#define LWIP_HOOK_IP4_ROUTE_SRC(src, dest) lwip_ip4_route_src(dest, src)
#endif
-#include "lwip/ip_addr.h"
-struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);
#endif /* RT_USING_LWIP_VER_NUM >= 0x20000 */
#endif /* __LWIPOPTS_H__ */