Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error "xfer: cannot find available port for xfer" when own_ip set #5

Closed
ruuk opened this Issue Mar 6, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@ruuk
Copy link

ruuk commented Mar 6, 2014

Weechat gives the error: "xfer: cannot find available port for xfer" when xfer.network.own_ip is set to a non-local-machine address.

My network router address is 192.168.1.1
My local machine address is 192.168.1.24
I have a port range set on my router and in weechat for 30000-31000 which does not affect the issue when set or unset in weechat.
Setting xfer.network.own_ip to 192.168.1.24: No error
Setting xfer.network.own_ip to 127.0.0.1: No error
Setting xfer.network.own_ip to <EXTERNAL_IP>: xfer: cannot find available port for xfer
Setting xfer.network.own_ip to 192.168.1.1: xfer: cannot find available port for xfer

Error started in 0.4.3 and continues to 0.4.4-dev
Error is not present in 0.4.2

@flashcode flashcode added the bug label Mar 6, 2014

@flashcode

This comment has been minimized.

Copy link
Member

flashcode commented Mar 7, 2014

I'm able to reproduce the problem with 0.4.3 and 0.4.4-dev. It works fine with 0.4.2, so before the support of IPv6 in xfer.
@talisein any ideas about this problem?

@talisein

This comment has been minimized.

Copy link
Contributor

talisein commented Mar 8, 2014

Yes, I made a mistake. The old code used to check xfer.network.own_ip to be sure it was valid, then set struct xfer.localaddress to that address (which then later gets sent to the person you are trying to connect with).... but it bind()s to the address that is connected to the irc server rather than xfer.network.own_ip.

The code now checks own_ip to be sure it is valid, but also tries to bind() to that address, which fails when it is not a local address. I'll work a fix over the weekend.

talisein added a commit to talisein/weechat-1 that referenced this issue Mar 9, 2014

xfer: Fix xfer.network.own_ip behavior
Github weechat#5. xfer shouldn't try to bind() to the own_ip
address. Instead, always bind to the same local address that is
connected to the irc server, and just change the out_addr if own_ip is
used.

Also fixes a memory leak in error path.

talisein added a commit to talisein/weechat-1 that referenced this issue Mar 9, 2014

xfer: Fix xfer.network.own_ip behavior
Github weechat#5. xfer shouldn't try to bind() to the own_ip
address. Instead, always bind to the same local address that is
connected to the irc server, and just change the out_addr if own_ip is
used.

Also fixes a memory leak in error path.

talisein added a commit to talisein/weechat-1 that referenced this issue Mar 9, 2014

xfer: Fix xfer.network.own_ip behavior
Fixes weechat#5. xfer shouldn't try to bind() to the own_ip
address. Instead, always bind to the same local address that is
connected to the irc server, and just change the out_addr if own_ip is
used.

Also fixes a memory leak in error path.

talisein added a commit to talisein/weechat-1 that referenced this issue Mar 11, 2014

xfer: Fix xfer.network.own_ip behavior
Fixes weechat#5. xfer shouldn't try to bind() to the own_ip
address. Instead, always bind to the same local address that is
connected to the irc server, and just change the out_addr if own_ip is
used.

Also fixes a memory leak in error path.

talisein added a commit to talisein/weechat-1 that referenced this issue Mar 12, 2014

xfer: Fix xfer.network.own_ip behavior
Fixes weechat#5. xfer shouldn't try to bind() to the own_ip
address. Instead, always bind to the same local address that is
connected to the irc server, and just change the out_addr if own_ip is
used.

Also fixes a memory leak in error path.

@flashcode flashcode closed this in 9f140ca Mar 12, 2014

talisein added a commit to talisein/weechat-1 that referenced this issue Aug 20, 2014

xfer: bind to wildcard address when sending
When weechat#5 was fixed, we started to always bind to the local address
connected to the irc server because the xfer.network.own_ip address
may not be able to be bound to when NATed. But this means when the
own_ip address is a different family (IPv4 vs IPv6) from the irc
server connection, we were listening for connections on the wrong
interface.

This patch lets us figure out which family is being used,
(xfer.network.own_ip's family, or the irc connection's family
otherwise) and bind() into the correct family via that family's
wildcard address.

talisein added a commit to talisein/weechat-1 that referenced this issue Aug 20, 2014

xfer: bind to wildcard address when sending
When weechat#5 was fixed, we started to always bind to the local address
connected to the irc server because the xfer.network.own_ip address
may not be able to be bound to when NATed. But this means when the
own_ip address is a different family (IPv4 vs IPv6) from the irc
server connection, we were listening for connections on the wrong
interface.

This patch lets us figure out which family is being used,
(xfer.network.own_ip's family, or the irc connection's family
otherwise) and bind() into the correct family via that family's
wildcard address.

@flashcode flashcode added this to the 1.0 milestone Nov 16, 2014

@flashcode flashcode self-assigned this Nov 16, 2014

@Bysmyyr Bysmyyr referenced this issue Oct 30, 2017

Closed

crashes #1093

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.