diff options
author | Jose Bollo <jose.bollo@iot.bzh> | 2018-10-30 10:55:49 +0100 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2018-10-30 16:39:55 +0100 |
commit | 8754e33fc9c85ac2175a5c4bd0c874c47eff65df (patch) | |
tree | 7658ddf72902d8b4244fb18ca862661507c32739 | |
parent | f3048dc97316ede624764c7b6c8dadf4ede71b35 (diff) |
afb-socket: Handle listening on all interfaces
Change-Id: I909493166f98f152e5aeb02a72f40bc3c58b42b2
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | src/afb-socket.c | 5 |
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; |