Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2312 closed Bug (fixed)

DHT doesn't use bind-address-ipv4

Reported by: gornack Owned by: gornack
Priority: Normal Milestone: 1.74
Component: libtransmission Version: 1.73
Severity: Normal Keywords:
Cc:

Description

I have 2 network interfaces on my Debian box : eth0 (which is the standard network interface), and ppp0 (which is a PPP interface).

I want Transmission to use ppp0 only, so I set bind-address-ipv4 to the associated IP address (because Transmission does not seem to support SO_BINDTODEVICE, but that's another matter).

I think that bind-address-ipv4 setting does not apply to DHT protocol (UDP on peer-port, as far as I understand).

My settings.json says (I xxx'd my ppp0 IP address) :

"bind-address-ipv4": "xxx.xxx.149.38",
"peer-port": 5151,
"dht-enabled": true

But here is what netstat tells me (I xxx'd my IP address) :

$ netstat -4nlp | grep 5151
tcp        0      0 xxx.xxx.149.38:5151     0.0.0.0:*               LISTEN      19760/transmission-
udp        0      0 0.0.0.0:5151            0.0.0.0:*                           19760/transmission-

Furthermore, I'm wondering if the tracker announce really announces the IP address set through bind-address-ipv4, because, since I've been using bind-address-ipv4 to bind to ppp0, I've also configured my firewall to drop TCP & UDP traffic incoming on port 5151 on eth0 and it drops many TCP packets incoming on eth0 (about 20-25 packets/minute). But maybe that's just because a tracker somewhere still gives my eth0 IP address to other peers.

I hope my indications have been clear enough (not sure though ;-) ). Let me know if you need any further information.

Attachments (2)

DHT-bind-bugfix.patch (2.0 KB) - added by gornack 12 years ago.
Patch that should make DHT algorithm bind on the specified interface only
DHT-bind-bugfix.2.patch (2.0 KB) - added by gornack 12 years ago.
Patch v2. Might be more portable.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 12 years ago by gornack

  • Component changed from Transmission to libtransmission
  • Owner set to gornack
  • Status changed from new to assigned

comment:2 Changed 12 years ago by gornack

I think the attached patch (attachment:DHT-bind-bugfix.patch) might do the trick. It's IPv4 only since the whole DHT implementation is IPv4 only.

Netstat is now giving me :

# netstat -4nlp | grep 5151
tcp        0      0 xxx.xxx.149.38:5151      0.0.0.0:*               LISTEN      31846/transmission-
udp        0      0 xxx.xxx.149.38:5151      0.0.0.0:*                           31846/transmission-

Can someone review and test it (it's working fine on my box, and I'm not having dropped packets on eth0 anymore) ? The patch is against transmission-1.73, not the SVN version. Thanks in advance.

PS : I really am sorry for the following line :

sin.sin_addr.s_addr = tr_addr->addr.addr4.s_addr;

;-)

Changed 12 years ago by gornack

Patch that should make DHT algorithm bind on the specified interface only

comment:3 Changed 12 years ago by jch

I'm not sure if assigning to the s_addr field is portable. I'd do something like

memcpy(...->sin_addr, addr, 4);

which is ugly, but works on all systems known to man.

Other than that, nullum obstat.

--Juliusz

Changed 12 years ago by gornack

Patch v2. Might be more portable.

comment:4 Changed 12 years ago by gornack

You're right. I corrected that in the new patch (attachment:DHT-bind-bugfix.2.patch).

Plus it's easier to read (for humans, I mean) since I'm memcpy'ing the whole "struct in_addr" instead of going down to the "s_addr" field.

comment:5 Changed 12 years ago by charles

Thanks to both of you.

applied the DHT-bind-bugfix.2.patch to svn trunk in r8881 for 1.74 or 1.80, whichever comes first.

comment:6 Changed 12 years ago by charles

Looks like maybe http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTINTERFACE is the way to handle the other half of this ticket. Anyone want to make a patch for it, too?

comment:7 Changed 12 years ago by charles

  • Resolution set to fixed
  • Status changed from assigned to closed
06:38 < gornack> charles_, It think the second half of ticket 2312 actually is the same than ticket 2313
06:39 < gornack> (at first I though it was independant)
06:39 < gornack> maybe you can close ticket 2312
06:41 <@charles_> you don't have to ask me twice ;)
06:41  * charles_ loves closing tickets

comment:8 Changed 12 years ago by charles

  • Milestone changed from None Set to 1.74

comment:9 Changed 12 years ago by charles

  • Summary changed from bind-address-ipv4 does not seem to apply to DHT nor tracker announce to DHT doesn't use bind-address-ipv4
Note: See TracTickets for help on using tickets.