From c899f25ff1f7817e787fa809779ace65641e8e7b Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Fri, 13 Aug 1999 00:10:08 +0000 Subject: [PATCH] (get_addrs_int): try the different ways sequentially instead of just one. this helps if your heimdal was built with v6-support but your kernel doesn't have it, for example. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6806 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/get_addrs.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/krb5/get_addrs.c b/lib/krb5/get_addrs.c index 649384cbb..453bfbc3a 100644 --- a/lib/krb5/get_addrs.c +++ b/lib/krb5/get_addrs.c @@ -240,14 +240,24 @@ static krb5_error_code get_addrs_int (krb5_context context, krb5_addresses *res, int loop) { krb5_error_code ret = -1; + #if defined(AF_INET6) && defined(SIOCGIF6CONF) && defined(SIOCGIF6FLAGS) - ret = find_all_addresses (context, res, loop, - AF_INET6, SIOCGIF6CONF, SIOCGIF6FLAGS, - sizeof(struct in6_ifreq)); -#elif defined(AF_INET) && defined(SIOCGIFCONF) && defined(SIOCGIFFLAGS) - ret = find_all_addresses (context, res, loop, - AF_INET, SIOCGIFCONF, SIOCGIFFLAGS, - sizeof(struct ifreq)); + if (ret) + ret = find_all_addresses (context, res, loop, + AF_INET6, SIOCGIF6CONF, SIOCGIF6FLAGS, + sizeof(struct in6_ifreq)); +#endif +#if defined(HAVE_IPV6) && defined(SIOCGIFCONF) + if (ret) + ret = find_all_addresses (context, res, loop, + AF_INET6, SIOCGIFCONF, SIOCGIFFLAGS, + sizeof(struct ifreq)); +#endif +#if defined(AF_INET) && defined(SIOCGIFCONF) && defined(SIOCGIFFLAGS) + if (ret) + ret = find_all_addresses (context, res, loop, + AF_INET, SIOCGIFCONF, SIOCGIFFLAGS, + sizeof(struct ifreq)); #endif if(ret || res->len == 0) ret = gethostname_fallback (res);