Skip to content

Commit

Permalink
iproxy: Use updated socket_create API to listen on IPv4 and IPv6 with…
Browse files Browse the repository at this point in the history
… a single socket
  • Loading branch information
nikias committed Mar 26, 2024
1 parent a435ebf commit 303ece5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 1 addition & 16 deletions tools/iproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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) {
Expand Down

0 comments on commit 303ece5

Please sign in to comment.