4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-21 01:07:18 +08:00

fix ipv6 compatibility issues (#7339)

This commit is contained in:
xiaoniaoyou6hua 2023-04-26 09:19:41 +08:00 committed by GitHub
parent 90853abb08
commit c34608b4a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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));

View File

@ -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__ */