mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-26 12:13:47 +00:00
ping: sizeof to struct not pointer
This commit is contained in:
parent
53c09fe921
commit
553fedd443
@ -152,7 +152,7 @@ ping_send(int s, const ip_addr_t *addr)
|
|||||||
#if LWIP_IPV4
|
#if LWIP_IPV4
|
||||||
if(IP_IS_V4(addr)) {
|
if(IP_IS_V4(addr)) {
|
||||||
struct sockaddr_in *to4 = (struct sockaddr_in*)&to;
|
struct sockaddr_in *to4 = (struct sockaddr_in*)&to;
|
||||||
to4->sin_len = sizeof(to4);
|
to4->sin_len = sizeof(*to4);
|
||||||
to4->sin_family = AF_INET;
|
to4->sin_family = AF_INET;
|
||||||
inet_addr_from_ip4addr(&to4->sin_addr, ip_2_ip4(addr));
|
inet_addr_from_ip4addr(&to4->sin_addr, ip_2_ip4(addr));
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ ping_send(int s, const ip_addr_t *addr)
|
|||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
if(IP_IS_V6(addr)) {
|
if(IP_IS_V6(addr)) {
|
||||||
struct sockaddr_in6 *to6 = (struct sockaddr_in6*)&to;
|
struct sockaddr_in6 *to6 = (struct sockaddr_in6*)&to;
|
||||||
to6->sin6_len = sizeof(to6);
|
to6->sin6_len = sizeof(*to6);
|
||||||
to6->sin6_family = AF_INET6;
|
to6->sin6_family = AF_INET6;
|
||||||
inet6_addr_from_ip6addr(&to6->sin6_addr, ip_2_ip6(addr));
|
inet6_addr_from_ip6addr(&to6->sin6_addr, ip_2_ip6(addr));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user