From 37baeac93cdde3a5c38092d30df6a574c7e30b75 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 25 Aug 2005 14:01:48 +0000 Subject: * support GetNetworkInterfaceNameByIndex/IndexByName on IPv6-only hosts git-svn-id: file:///home/lennart/svn/public/avahi/trunk@442 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-daemon/dbus-protocol.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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); -- cgit