summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-11-02 12:47:36 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2018-11-02 12:47:36 +0000
commite8bdab3538f60f6c3aab62730ce9a6906beff573 (patch)
tree7658ddf72902d8b4244fb18ca862661507c32739
parentf3048dc97316ede624764c7b6c8dadf4ede71b35 (diff)
parent8754e33fc9c85ac2175a5c4bd0c874c47eff65df (diff)
Merge "afb-socket: Handle listening on all interfaces"
-rw-r--r--src/afb-socket.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/afb-socket.c b/src/afb-socket.c
index f4ee7e1e..63de2cf2 100644
--- a/src/afb-socket.c
+++ b/src/afb-socket.c
@@ -178,6 +178,11 @@ static int open_tcp(const char *spec, int server)
memset(&hint, 0, sizeof hint);
hint.ai_family = AF_INET;
hint.ai_socktype = SOCK_STREAM;
+ if (server) {
+ hint.ai_flags = AI_PASSIVE;
+ if (host[0] == 0 || (host[0] == '*' && host[1] == 0))
+ host = NULL;
+ }
rc = getaddrinfo(host, service, &hint, &rai);
if (rc != 0) {
errno = EINVAL;