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

Allow binding to another (non-default) interface #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tahajahangir
Copy link

No description provided.

@rofl0r
Copy link
Owner

rofl0r commented Sep 25, 2020

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?

@tahajahangir
Copy link
Author

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.

@soffchen
Copy link

soffchen commented Jan 24, 2021

Nice feature, but works only under linux.

@mimi89999
Copy link

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
Copy link

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.

@zopieux
Copy link

zopieux commented Jul 17, 2022

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

@rofl0r
Copy link
Owner

rofl0r commented Jul 17, 2022

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

@zopieux
Copy link

zopieux commented Jul 17, 2022

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

@rofl0r
Copy link
Owner

rofl0r commented Jul 18, 2022

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

@alexandervlpl
Copy link

alexandervlpl commented Apr 29, 2024

For anyone else looking for this functionality. Dante doesn't have it either, their external option lets you "bind" to an interface by name but in practice works the same way using the default route. 😢 But this PR works perfectly, thanks @tahajahangir !

I do appreciate that @rofl0r doesn't want to clutter such a clean minimalist project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants