psi-im / psi

XMPP client
https://psi-im.org/
Other
403 stars 123 forks source link

Bytestreams file transfer from Psi to Gajim #492

Open somevar opened 4 years ago

somevar commented 4 years ago

Can't transfer file from Psi to Gajim because Psi send only localhost address for "bytestreams" file transfer, if didn't set "external ip address" in Psi preferences. Sorry for my English, please

OS: Windows 7 SP1 x64 Psi Version: 1.3 x64 (from installer), 1.4-dev x64 (portable)

Psi machine: one LAN interface in 172.16.5.0/24 subnet Gajim machine: one LAN interface in 172.16.5.0/24 subnet

If "external ip adress" was empty:

Send request from Psi

...
<iq xmlns="jabber:client" xml:lang="ru" to="someuser2@xmpp.domain/hostid2" from="someuser1@xmpp.domain/hostid1">
<si xmlns="http://jabber.org/protocol/si" profile="http://jabber.org/protocol/si/profile/file-transfer">
<file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="somefile.ext" size="0">
...

Accept from Gajim

...
<iq xmlns="jabber:client" to="someuser1@xmpp.domain/hostid1" from="someuser2@xmpp.domain/hostid2">
<si xmlns="http://jabber.org/protocol/si">
<feature xmlns="http://jabber.org/protocol/feature-neg">
...
<field var="stream-method">
<value>http://jabber.org/protocol/bytestreams</value>
</field>
...

Psi sent host/port

...
<iq xmlns="jabber:client" xml:lang="ru" to="someuser2@xmpp.domain/hostid2" from="someuser1@xmpp.domain/hostid1">
<query xmlns="http://jabber.org/protocol/bytestreams" mode="tcp">
<streamhost host="127.0.0.1" port="8010" jid="someuser1@xmpp.domain/hostid1" />
<fast xmlns="http://affinix.com/jabber/stream" />
...

Only localhost address will be recieved!

If "external ip address" was seted manualy to 172.16.5.98:

...
<iq xmlns="jabber:client" xml:lang="ru" to="someuser2@xmpp.domain/hostid2" from="someuser1@xmpp.domain/hostid1">
<query xmlns="http://jabber.org/protocol/bytestreams" mode="tcp">
<streamhost host="127.0.0.1" jid="someuser1@xmpp.domain/hostid1" port="8010" />
<streamhost host="172.16.5.98" jid="someuser1@xmpp.domain/hostid1" port="8010" />
...

File will be recieved normaly.

tehnick commented 4 years ago

Please try latest Psi+ builds: https://sourceforge.net/projects/psiplus/files/Windows/Personal-Builds/tehnick/ https://sourceforge.net/projects/psiplus/files/Windows/Personal-Builds/KukuRuzo/

Psi+ is a basis for next Psi IM releases.

Ri0n commented 4 years ago

burichenkoms: upnp is not supported and likely will not unless somebody will implement it as a plugin but even in this case it's highly probable s5b won't work because of gray IPs from ISP.

Though latest Psi builds use jingle which can fallback to ibb transport which is slow but always works

somevar commented 4 years ago

UPNP (or something else) is not required, because in my case these are not grey ISPs ip addresses. These are real IP addresses on our PCs (real IPs on the LAN interfaces of PCs connected to the same switch).

According to IANA (https://en.wikipedia.org/wiki/Private_network): 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 — private networks (not only for ISPs). 192.168.0.0/16 is mostly used by home networks (and small organizations). 172.16.0.0/12 is mostly used by middle-sized organizations (ISP too). Large organizations can use 10.0.0.0/12 (for example - Beeline). As a matter of fact — someone else may use any IP address in 0.0.0.0/0 network. But they, probably, may have problems with connect attempts to the real world (the OS might think that remote address in on the local subnet and will not send packets through the gateway)

In my case: Gateway and NS: 172.16.5.1/24 (CIDR 24: IPs from 172.16.5.1 to 172.16.5.254 (0 — subnet address, 255 — broadcast)) PC1 — 172.16.5.98/24 PC2 — 172.16.5.86/24

A PC1 OS's point of think — PC2 in the local subnet (without hops). And this is true. Packets transfers beetween PC1 and PC2 wtihout gateway. S5b sould be works fine, even if a gateway is used (pure, without NAT). But Psi not sending normal IPs to other side (all IPs of PC). He sending only localhost address.

If I manually set my IP in the settings of Psi (IP of PC’s LAN interface), then s5b works fine. In XML stansa’s i seeing two IPs – localhost and IP that i set. If Psi not sending PC’s IP (172.16.5…) because it is interpreted as invalid (only if I set them manualy in app settings) – this is wrong.

As I said before, in my case:

I tried to check Psi+ builds from tehnick comment (psi-plus-portable-1.4.980_win7_x86_64.7z). File transfer beetwen Psi and Gajim works, BUT Psi didn’t try to use s5b, only jingle (for sending and for receiving too). In XML stansa (negotiating for jingle method) i seeing all PC IPs (include IPv6 localhost). Why does Psi+ not try s5b?

Ri0n commented 4 years ago

Jingle usually uses s5b transport, while legacy file transfer is deprecated

somevar commented 4 years ago

I apparently confused in legacy method and s5b. Because the XML's from Psi and Psi+ look's completely different. What is the "stream-method" in Psi IM (XML in first comment)? Dump of file transfer of Psi+ looks like XEP-0065. On Psi isn't.

tehnick commented 4 years ago

A lot of code was changed since latest stable release of Psi 1.4. If you will test recent builds of Psi from master branch (see Experimental-Builds subdirectory on SF) you will see the same results as in Psi+.

Just look at Psi+ as on development version of Psi. (It is described in README in more details.)

Neustradamus commented 4 years ago

@BurichenkoMS: It is possible to have logs from:

And specify what Psi or Psi+ version with OS and Gajim too?

somevar commented 4 years ago

Yes, I'll do it until wednesday

Neustradamus commented 4 years ago

@BurichenkoMS: Happy New Year :) Have you tested?

somevar commented 4 years ago

Starting today. Was overwhelmed with work at end of year. Sorry

Neustradamus commented 4 years ago

@BurichenkoMS: No problem, never too late :)

Ri0n commented 4 years ago

Psi+ logs are not required. There is not differences at all between Psi and Psi+ wrt file transfer. And iirc I recall to implement a server socket allocator for legacy transfer too. So probably this task can be closed.