microsocks icon indicating copy to clipboard operation
microsocks copied to clipboard

Allow binding to another (non-default) interface

Open tahajahangir opened this issue 3 years ago • 10 comments

tahajahangir avatar Sep 25 '20 17:09 tahajahangir

SO_BINDTODEVICE seems to be a linux-specific API. what prevents you from using the ip address of the specified interface with the existing -b option?

rofl0r avatar Sep 25 '20 19:09 rofl0r

The existing -b option only works when the specified IP is on the same interface as the default route interface. When machine have multiple interfaces and the bind-ip is not on the default interface, this options solves the problem.

tahajahangir avatar Oct 10 '20 07:10 tahajahangir

Nice feature, but works only under linux.

soffchen avatar Jan 24 '21 03:01 soffchen

what prevents you from using the ip address of the specified interface with the existing -b option?

It would be nice to listen on a different interface that the outgoing connections.

mimi89999 avatar Oct 15 '21 12:10 mimi89999

The problem is that if the IP address set by the -b option is on the default route, the default route will be used and not the specified interface.

mimi89999 avatar Oct 15 '21 12:10 mimi89999

I've patched this PR against master and it works and does exactly what I needed. Would you consider accepting it, please?

zopieux avatar Jul 17 '22 22:07 zopieux

i can't merge this PR as-is, because it would break build on solaris, *BSD, and OSX

rofl0r avatar Jul 17 '22 23:07 rofl0r

It is a matter of surrounding the Linux-specific code with #if[def] fences?

zopieux avatar Jul 17 '22 23:07 zopieux

i dont want to litter the code with ugly ifdefs, they need to be in a single spot, if at all

rofl0r avatar Jul 18 '22 10:07 rofl0r