fix: switch inet_addr to a function

switch inet_addr to a function

close: #I4G4I4

Signed-off-by: liujiandong <liujiandong1@huawei.com>
This commit is contained in:
YOUR_NAME 2021-10-30 14:46:29 +08:00
parent 3bd6076697
commit b30e9139d5
2 changed files with 21 additions and 3 deletions

View File

@ -43,9 +43,6 @@
(ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr))
/* directly map this to the lwip internal functions */
#define inet_addr(cp) ipaddr_addr(cp)
#define inet_aton(cp, addr) ip4addr_aton(cp, (ip4_addr_t*)addr)
#define inet_ntoa(addr) ip4addr_ntoa((const ip4_addr_t*)&(addr))
#define inet_ntoa_r(addr, buf, buflen) ip4addr_ntoa_r((const ip4_addr_t*)&(addr), buf, buflen)
#endif /* LWIP_IPV4 */
#if LWIP_IPV6

View File

@ -161,6 +161,27 @@ int inet_pton(int af, const char *src, void *dst)
return lwip_inet_pton(af, src, dst);
}
#ifndef LWIP_INET_ADDR_FUNC
in_addr_t inet_addr(const char *cp)
{
return ipaddr_addr(cp);
}
#endif
#ifndef LWIP_INET_NTOA_FUNC
char *inet_ntoa(struct in_addr addr)
{
return ip4addr_ntoa((const ip4_addr_t*)&(addr));
}
#endif
#ifndef LWIP_INET_ATON_FUNC
int inet_aton(const char *cp, struct in_addr *addr)
{
return ip4addr_aton(cp, (ip4_addr_t*)addr);
}
#endif
int ioctlsocket(int s, long cmd, void *argp)
{
return lwip_ioctl(s, cmd, argp);