diff options
author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-06-13 19:15:50 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-06-13 19:15:50 +0200 |
commit | 139e12782c5cbbcb31ac89a1c59d8d5b4215ebf5 (patch) | |
tree | 512522b15278a9a979beaf70b6882470ce1e7e10 /src/socket.c | |
parent | 4761ba9d33a61cb654d45c0e9037b30a77e3f94a (diff) | |
parent | ee50081daa3a80586f3044056517337a8e8fac9f (diff) |
Merge branch 'master' of git.osmocom.org:libosmocore
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/socket.c b/src/socket.c index 66907c8c..0be98b93 100644 --- a/src/socket.c +++ b/src/socket.c @@ -6,10 +6,8 @@ #include <osmocom/core/select.h> #include <osmocom/core/socket.h> -#include <arpa/inet.h> #include <sys/socket.h> #include <sys/types.h> -#include <netinet/in.h> #include <stdio.h> #include <unistd.h> @@ -33,6 +31,9 @@ int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto, hints.ai_flags = 0; hints.ai_protocol = proto; + if (connect0_bind1) + hints.ai_flags |= AI_PASSIVE; + rc = getaddrinfo(host, portbuf, &hints, &result); if (rc != 0) { perror("getaddrinfo returned NULL"); @@ -169,6 +170,8 @@ int osmo_sockaddr_is_local(struct sockaddr *addr, socklen_t addrlen) } for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { + if (!ifa->ifa_addr) + continue; if (sockaddr_equal(ifa->ifa_addr, addr, addrlen)) return 1; } |