From: Lennart Poettering Date: Thu, 25 Aug 2005 14:01:48 +0000 (+0000) Subject: * support GetNetworkInterfaceNameByIndex/IndexByName on IPv6-only hosts X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=37baeac93cdde3a5c38092d30df6a574c7e30b75;p=catta * support GetNetworkInterfaceNameByIndex/IndexByName on IPv6-only hosts git-svn-id: file:///home/lennart/svn/public/avahi/trunk@442 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-daemon/dbus-protocol.c b/avahi-daemon/dbus-protocol.c index 8a0bd55..b7965a3 100644 --- a/avahi-daemon/dbus-protocol.c +++ b/avahi-daemon/dbus-protocol.c @@ -1550,10 +1550,11 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void #else if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - char txt[256]; - snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno)); - return respond_error(c, m, AVAHI_ERR_OS, txt); - } + if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { + char txt[256]; + snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno)); + return respond_error(c, m, AVAHI_ERR_OS, txt); + } memset(&ifr, 0, sizeof(ifr)); ifr.ifr_ifindex = idx; @@ -1584,10 +1585,11 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, void return respond_int32(c, m, 1); #else if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - char txt[256]; - snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno)); - return respond_error(c, m, AVAHI_ERR_OS, txt); - } + if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { + char txt[256]; + snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno)); + return respond_error(c, m, AVAHI_ERR_OS, txt); + } memset(&ifr, 0, sizeof(ifr)); snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", n);