Skip to content

Commit

Permalink
fix ipv6 compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoniaoyou6hua committed Apr 21, 2023
1 parent 3f442bb commit b40606c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/net/lwip/lwip-2.1.2/src/include/lwip/prot/ip6.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions components/net/lwip/port/ethernetif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion components/net/lwip/port/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b40606c

Please sign in to comment.