From 303ece5fa462713552e0013b48b66a08955a12d4 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 26 Mar 2024 22:31:43 +0100 Subject: iproxy: Use updated socket_create API to listen on IPv4 and IPv6 with a single socket --- configure.ac | 2 +- tools/iproxy.c | 17 +---------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 36df4b4..ec2cade 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ fi dnl Minimum package versions LIBPLIST_VERSION=2.2.0 -LIMD_GLUE_VERSION=1.0.0 +LIMD_GLUE_VERSION=1.2.0 AC_SUBST(LIBPLIST_VERSION) AC_SUBST(LIMD_GLUE_VERSION) diff --git a/tools/iproxy.c b/tools/iproxy.c index 6b8a345..1bb9e77 100644 --- a/tools/iproxy.c +++ b/tools/iproxy.c @@ -377,7 +377,7 @@ int main(int argc, char **argv) for (i = 0; i < num_pairs; i++) { printf("Creating listening port %d for device port %d\n", listen_port[i], device_port[i]); if (!source_addr) { - listen_sock[num_listen].fd = socket_create("127.0.0.1", listen_port[i]); + listen_sock[num_listen].fd = socket_create(NULL, listen_port[i]); if (listen_sock[num_listen].fd < 0) { int j; fprintf(stderr, "Error creating socket for listen port %u: %s\n", listen_port[i], strerror(errno)); @@ -390,21 +390,6 @@ int main(int argc, char **argv) } listen_sock[num_listen].index = i; num_listen++; -#if defined(AF_INET6) - listen_sock[num_listen].fd = socket_create("::1", listen_port[i]); - if (listen_sock[num_listen].fd < 0) { - int j; - fprintf(stderr, "Error creating socket for listen port %u: %s\n", listen_port[i], strerror(errno)); - free(source_addr); - free(device_udid); - for (j = num_listen; j >= 0; j--) { - socket_close(listen_sock[j].fd); - } - return -errno; - } - listen_sock[num_listen].index = i; - num_listen++; -#endif } else { listen_sock[num_listen].fd = socket_create(source_addr, listen_port[i]); if (listen_sock[num_listen].fd < 0) { -- cgit v1.1-32-gdbae