From: liuzhifu Date: Sun, 9 Oct 2016 07:45:25 +0000 (+0800) Subject: lwip/esp32: support iperf X-Git-Tag: v1.0~119^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d71894bf99a3e9eab9d0c62fb3863b99be1039ce;p=esp-idf lwip/esp32: support iperf 1. Add _exit() definition in syscalls.c 2. Fix a bug in sockets.c on which iperf depends --- diff --git a/components/esp32/syscalls.c b/components/esp32/syscalls.c index 537efed1d4..052605ee3e 100644 --- a/components/esp32/syscalls.c +++ b/components/esp32/syscalls.c @@ -142,6 +142,10 @@ int _open_r(struct _reent *r, const char * path, int flags, int mode) { return 0; } +void _exit(int __status) { + abort(); +} + ssize_t _write_r(struct _reent *r, int fd, const void * data, size_t size) { const char *data_c = (const char *)data; if (fd == STDOUT_FILENO) { diff --git a/components/lwip/api/sockets.c b/components/lwip/api/sockets.c index 91a5222e68..350847b57c 100755 --- a/components/lwip/api/sockets.c +++ b/components/lwip/api/sockets.c @@ -1442,8 +1442,15 @@ lwip_sendto(int s, const void *data, size_t size, int flags, #ifdef LWIP_ESP8266 /*fix the code for getting the UDP proto's remote information by liuh at 2014.8.27*/ if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_UDP){ - buf.addr.u_addr.ip4.addr = sock->conn->pcb.udp->remote_ip.u_addr.ip4.addr; - remote_port = sock->conn->pcb.udp->remote_port; + if(NETCONNTYPE_ISIPV6(netconn_type(sock->conn))) { + memcpy(&buf.addr.u_addr.ip6.addr, sock->conn->pcb.udp->remote_ip.u_addr.ip6.addr,16); + remote_port = sock->conn->pcb.udp->remote_port; + IP_SET_TYPE(&buf.addr, IPADDR_TYPE_V6); + } else { + buf.addr.u_addr.ip4.addr = sock->conn->pcb.udp->remote_ip.u_addr.ip4.addr; + remote_port = sock->conn->pcb.udp->remote_port; + IP_SET_TYPE(&buf.addr, IPADDR_TYPE_V4); + } } else { #endif remote_port = 0;