From: Ronnie Sahlberg Date: Thu, 13 Sep 2007 04:28:18 +0000 (+1000) Subject: merge from tridge X-Git-Tag: tevent-0.9.20~348^2~2407^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ab1c8c074e851d99f4391490bd2dff5b8883b5ae;p=thirdparty%2Fsamba.git merge from tridge (This used to be ctdb commit eda3caa77be352967a41ff9bddda5296c94797a9) --- ab1c8c074e851d99f4391490bd2dff5b8883b5ae diff --cc ctdb/common/system_linux.c index 82a6575bab3,6e42199e83a..bd44bd75b40 --- a/ctdb/common/system_linux.c +++ b/ctdb/common/system_linux.c @@@ -266,75 -255,6 +255,7 @@@ bool ctdb_sys_have_ip(struct sockaddr_i return false; } ret = bind(s, (struct sockaddr *)&ip, sizeof(ip)); - if (ret) { - goto finished; - } - - - /* find out how much space we need to store the interface details */ - ifc.ifc_len = 0; - ifc.ifc_req = NULL; - ret = ioctl(s, SIOCGIFCONF, &ifc); - if (ret) { - DEBUG(0,(__location__ " ioctl to read interface list failed\n")); - goto finished; - } - - ifr = talloc_size(mem_ctx, ifc.ifc_len); - - /* get a list of all interface names and addresses */ - ifc.ifc_req = ifr; - ret = ioctl(s, SIOCGIFCONF, &ifc); - if (ret) { - DEBUG(0,(__location__ " ioctl to read interface list failed\n")); - goto finished; - } + - /* loop over all interfaces and search for the one matching ip */ - num_ifs = ifc.ifc_len/sizeof(struct ifreq); - for (i=0; isin_family != AF_INET) { - continue; - } - - /* this is not the interface you are looking for */ - if (!ctdb_same_ip(sa, &ip)) { - continue; - } - - /* this is the ifr entry for this interface/address - read the interface flags so we can tell if it is - loopback or not - */ - ret = ioctl(s, SIOCGIFFLAGS, &ifr[i]); - if (ret) { - DEBUG(0,(__location__ " failed to read interface flags for interface %s\n", ifr[i].ifr_name)); - goto finished; - } - - /* was this ip tied to a loopback interface ? */ - if (ifr[i].ifr_flags & IFF_LOOPBACK) { - if (is_loopback != NULL) { - *is_loopback = true; - } - } - - if (ifname) { - *ifname = talloc_asprintf(mem_ctx, "%s", ifr[i].ifr_name); - } - - /* if we got this far, we have found our interface so we can - exit the loop. - */ - break; - } - - finished: - talloc_free(ifr); close(s); return ret == 0; }