Skip to content

Commit c34608b

Browse files
fix ipv6 compatibility issues (#7339)
1 parent 90853ab commit c34608b

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

Diff for: components/net/lwip/lwip-2.0.3/src/include/lwip/ip_addr.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ extern const ip_addr_t ip_addr_broadcast;
373373

374374
extern const ip_addr_t ip6_addr_any;
375375

376-
/**
376+
/**
377377
* @ingroup ip6addr
378378
* IP6_ADDR_ANY can be used as a fixed ip_addr_t
379379
* for the IPv6 wildcard address
@@ -400,6 +400,8 @@ extern const ip_addr_t ip6_addr_any;
400400
#define IP_ANY_TYPE IP_ADDR_ANY
401401
#endif
402402

403+
struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);
404+
403405
#ifdef __cplusplus
404406
}
405407
#endif

Diff for: components/net/lwip/lwip-2.1.2/src/include/lwip/ip_addr.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ extern const ip_addr_t ip_addr_broadcast;
404404

405405
extern const ip_addr_t ip6_addr_any;
406406

407-
/**
407+
/**
408408
* @ingroup ip6addr
409409
* IP6_ADDR_ANY can be used as a fixed ip_addr_t
410410
* for the IPv6 wildcard address
@@ -431,6 +431,8 @@ extern const ip_addr_t ip6_addr_any;
431431
#define IP_ANY_TYPE IP_ADDR_ANY
432432
#endif
433433

434+
struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);
435+
434436
#ifdef __cplusplus
435437
}
436438
#endif

Diff for: components/net/lwip/lwip-2.1.2/src/include/lwip/prot/ip6.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ PACK_STRUCT_END
200200
#define IP6_ROUT_SEG_LEFT(hdr) ((hdr)->_segments_left)
201201

202202
/* Fragment header. */
203-
#define IP6_FRAG_HLEN 8
203+
#define IP6_FRAG_HLEN 12
204204
#define IP6_FRAG_OFFSET_MASK 0xfff8
205205
#define IP6_FRAG_MORE_FLAG 0x0001
206206

Diff for: components/net/lwip/port/ethernetif.c

+4
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,11 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len,
246246
local.sin_len = sizeof(local);
247247
local.sin_family = AF_INET;
248248
local.sin_port = 0;
249+
#ifndef NETDEV_USING_IPV6
249250
local.sin_addr.s_addr = (netif->ip_addr.addr);
251+
#else
252+
local.sin_addr.s_addr = (netif->ip_addr.u_addr.ip4.addr);
253+
#endif
250254
lwip_bind(s, (struct sockaddr *)&local, sizeof(struct sockaddr_in));
251255

252256
lwip_setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &recv_timeout, sizeof(recv_timeout));

Diff for: components/net/lwip/port/lwipopts.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@
585585
#endif
586586

587587
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */
588-
#define MEMP_NUM_SYS_TIMEOUT (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + 2*PPP_SUPPORT)
588+
#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))
589589

590590
/*
591591
* LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names.
@@ -642,8 +642,6 @@
642642
#else /* >= v2.1.2 */
643643
#define LWIP_HOOK_IP4_ROUTE_SRC(src, dest) lwip_ip4_route_src(dest, src)
644644
#endif
645-
#include "lwip/ip_addr.h"
646-
struct netif *lwip_ip4_route_src(const ip4_addr_t *dest, const ip4_addr_t *src);
647645
#endif /* RT_USING_LWIP_VER_NUM >= 0x20000 */
648646

649647
#endif /* __LWIPOPTS_H__ */

0 commit comments

Comments
 (0)