]> sjero.net Git - linphone/commitdiff
fix get local address in case of 3G connectivity on ios
authorJehan Monnier <jehan.monnier@linphone.org>
Mon, 24 Sep 2012 10:41:13 +0000 (12:41 +0200)
committerJehan Monnier <jehan.monnier@linphone.org>
Mon, 24 Sep 2012 10:41:13 +0000 (12:41 +0200)
coreapi/misc.c

index 15fc5374c53bde478f6c2f2468a7f0a3e664130a..df65b53f47268bd2063ced4e221ae5a11ccdd27b 100644 (file)
@@ -971,10 +971,15 @@ static int get_local_ip_with_getifaddrs(int type, char *address, int size)
        if (getifaddrs(&ifpstart) < 0) {
                return -1;
        }
-
+#ifndef __linux
+       #define UP_FLAG IFF_UP /* interface is up */
+#else
+       #define UP_FLAG IFF_RUNNING /* resources allocated */
+#endif
+       
        for (ifp = ifpstart; ifp != NULL; ifp = ifp->ifa_next) {
                if (ifp->ifa_addr && ifp->ifa_addr->sa_family == type
-                       && (ifp->ifa_flags & IFF_RUNNING) && !(ifp->ifa_flags & IFF_LOOPBACK))
+                       && (ifp->ifa_flags & UP_FLAG) && !(ifp->ifa_flags & IFF_LOOPBACK))
                {
                        getnameinfo(ifp->ifa_addr,
                                                (type == AF_INET6) ?