HowTo: Bind to a specific network interface

Ask for help and report issues with the Mac OS X version of Transmission
davids
Posts: 5
Joined: Thu Feb 28, 2019 1:50 am

Re: HowTo: Bind to a specific network interface

Post by davids » Fri Mar 01, 2019 12:46 am

I suspect that checking for the ppp0 interface is a lightweight process, but it why is it necessary to check every 10 seconds? If Transmission is already bound to a VPN's IP address by having BindAddressIPv4 and BindAddressIPv6 stored in its configuration file, that means it will not be able to send or receive unless the VPN is operating at those addresses. Therefore, 10 seconds is the maximum time Transmission would not be operable before it is bound to the VPN's IP address and restarted. Waiting a minute or two hardly seem too long. There is a security risk only if BindAddressIPv4 and BindAddressIPv6 haven't been stored before Transmission starts. My concern probably probably reflects having worked extensively with 2 MHz Z80 CPU's. At one time the IBM PC's 4.77 MHz pseudo-16bit CPU (16-bit addresses but fetching data 8-bits at a time) was state of the art!

BTW, it would be helpful if when one clicks on the Clutch icon in macOS's status bar, it displayed Clutch version number.

hbwhite
Posts: 16
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite » Fri Mar 01, 2019 3:14 am

@davids Clutch checks every 10 seconds so you don't have to wait very long for Transmission to resume if your VPN connection drops and then resumes. There is another app named Vuze that performs a similar check every 10 seconds or so (polling is the only way to do it on Macs, because the SO_BINDTODEVICE bind option isn't available). I can assure you the check is lightweight (just a few calls to glibc; the code is almost exactly the sample code at the end of the page here: http://man7.org/linux/man-pages/man3/getifaddrs.3.html).

I've posted the full source code for Clutch at https://github.com/hbwhite/Clutch if you want to edit the POLL_INTERVAL variable in the file ClutchAgent/AppDelegate.m

Clutch v1.3 integrates automatic updates, and you can always check the current version by selecting "Check for Updates..." from the menu bar in either app. See my next post for the download link. Thanks again!

hbwhite
Posts: 16
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite » Fri Mar 01, 2019 3:20 am

Clutch v1.3 is now available!

This version automatically checks for updates and allows you to update Clutch automatically within the app!

• It also fixes the issue found by @davids: Clutch now restarts Transmission if your binding interface disappears and reappears without changing its IP. This fixes an issue where Transmission would fail to bind to your VPN if it started before the interface was online (this could happen on boot if Transmission opened before your VPN started)

Download v1.3 here:
https://mega.nz/#!2BYHGYJS!TYZUOT01O2uT ... 5V9ZtJ8qW4

davids
Posts: 5
Joined: Thu Feb 28, 2019 1:50 am

Re: HowTo: Bind to a specific network interface

Post by davids » Fri Mar 01, 2019 6:49 pm

Hbwhite,

Clutch v1.3 works great!

Thanks,
David

hbwhite
Posts: 16
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite » Sun Feb 02, 2020 10:52 pm

Clutch v1.4 is now available!

- Clutch can now restart Transmission gracefully without using force-quit. This prevents you from losing your progress or torrent settings when Clutch has to restart Transmission. Enable this feature in Clutch for setup instructions.
- Added regex support for interface names. Be sure to use real regex and not shell glob. For example, enter utun.* instead of utun* if you want to use regex.
- Added a nice loading animation while Transmission is binding/unbinding
- Clutch now updates the list of interfaces each time you open the dropdown
- Fixed a bug where Transmission wouldn't restart if the bar menu was open
- Clutch now uses the new Mac OS hardened runtime
- Other minor bug fixes and performance improvements

Major portions of the app were rewritten to add the graceful quit option. Check out diff d3982b7 to see how much the code has changed!

You can update to the latest version by going to Clutch > Check for Updates...

New users, download the latest version of Clutch here:

https://github.com/hbwhite/Clutch/relea ... h-v1.4.zip

Full source code here:

https://github.com/hbwhite/Clutch

Enjoy! -H

Post Reply