link-local/Bonjour XMPP can't be contacted on Windows
With Gajim 0.16.1 on Windows 7, link-local/Bonjour XMPP can't be contacted. It seems to listen on [::]:5298 IPv6-only, but registers via Bonjour for IPv4 only. Connecting to the IP address and port via telnet locally does not work for IPv4, but works for IPv6. But the other host will try IPv4 only, so can't contact the Windows machine.
It seems there would be a flag missing when creating/binding the socket so that it will receive IPv4 connections, too. Otherwise, two sockets would need to be used, one for IPv6 only and one for IPv4 only.
(Besides, it would be nice if Gajim could register with Bonjour for IPv6, too, but this might be a problem on Apple's side.)
Steps to reproduce
Install Gajim on Windows 7 with Apple Bonjour printing services installed, start up and try to chat to the Windows machine from another machine on the network. It will try to connect via IPv4 and eventually time out. When chatting from the Windows machine to the other machine, the message is received and one can send answers to the Windows machine that will be received, too. But when trying initial contact anew from the other machine to the Windows machine, it will time out again.
OS version: Windows 7
GTK version: 2.24.10
PyGTK version: 2.24.0
Dual-Stack Sockets for IPv6 Winsock Applications has some information on this:
By default, an IPv6 socket created on Windows Vista and later only operates over the IPv6 protocol. In order to make an IPv6 socket into a dual-stack socket, the setsockopt function must be called with the IPV6_V6ONLY socket option to set this value to zero before the socket is bound to an IP address. When the IPV6_V6ONLY socket option is set to zero, a socket created for the AF_INET6 address family can be used to send and receive packets to and from an IPv6 address or an IPv4 mapped address.
There is an installer with latest patches from #8025 (closed) and a patch for this one. Could you test and tell me if it works ok?
Installer available here
Patch is this one:
diff -r 4916254b34b7 src/common/zeroconf/client_zeroconf.py --- a/src/common/zeroconf/client_zeroconf.py Mon Apr 06 19:14:33 2015 +0200 +++ b/src/common/zeroconf/client_zeroconf.py Sat May 09 21:48:14 2015 +0200 @@ -30,6 +30,7 @@ import socket import errno import sys +import os import string from random import Random @@ -71,6 +72,12 @@ self._serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self._serv.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) self._serv.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + if os.name == 'nt': + ver = os.sys.getwindowsversion() + if (ver, ver) == (2, 6): # Win Vista + + # 47 is socket.IPPROTO_IPV6 + # 27 is socket.IPV6_V6ONLY under windows, but not defined ... + self._serv.setsockopt(41, 27, 0) # will fail when port is busy, or we don't have rights to bind try: self._serv.bind((ai, self.port))
I am using gajim-0.16.1-1.exe.
I can transmit link-local presence, but I can't see link-local contacts. I can receive link-local messages but can't send link-local messages (a message that contact is offline appears in chat).
Is this the problem that was fixed here or is it a different problem?
commit (6 days ago) is after 0.16.1 (5 months ago)
I know. I asked whether it is the same problem.