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

Add a filter function to enable bindhost to be device name, instead o… #69

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

markfoodyburton
Copy link

Add a filter function to enable bindhost to be device name, instead of an IP address. This means that if the IP address is dynamic, the correct IP address will still be found

The changes are made in config.c, so they happen only during config read (hence the configuration would need to be re-read on an IP address change).

One use for this is if the devices are (for instance) PPP devices where the IP address is dynamically allocated by the service provider.

…f an IP address. This means that if the IP address is dynamic, the correct IP address will still be found

The changes are made in config.c, so they happen only during config read (hence the configuration would need to be re-read on an IP address change).
@zehome
Copy link
Owner

zehome commented Apr 7, 2016

Thank you,

yes, that's something I want to do but not this way.
As you said, the address lookup would be incorrect when the ip address of the interface changes.
It's also incorrect if the interface have multiple adresses and if the interface is IPv6 only.

In order do to it the proper way, we have to listen to kernel events. (libnl3 / bsd equivalent)

See another attempt in branch bindtodev: 89b59dd + b06af8b I don't remember if that works or not.

@markfoodyburton
Copy link
Author

That other approach is MUCH cleaner than this one. And simpler too, and doesn't require listening to kernel events I dont think... - whether it works through an interface going down/up, I dont know.
Anyway - I'll close this, because its not the right approach

@stapelberg
Copy link
Contributor

I applied the two commits and can confirm that they do indeed work when the interface goes down/up.

@zehome Could you merge the commits into master please?

@zehome zehome reopened this Oct 23, 2016
@zehome
Copy link
Owner

zehome commented Oct 23, 2016

Ok I'll look into it as soon as possible

@stapelberg
Copy link
Contributor

FWIW, there is one nit that should be addressed when merging: currently, the binddev option is only effective when bindhost is also specified, but the two should be independent. I’ve changed this in my local source tree and am successfully using binddev without bindhost.

(for tuntap_linux only, it may need to be done for other platforms,
 but they may differ in behaviour)
…tunnel is advancing the sequence number - it's

    (Anyway this is an improvement on what was there before)
Add a mechanism to set tunnel weights based on the srtt (averaged)
Call this mechanism if the tunnels dont have their bandwidth set.
(and revert back to using DEFAULT_MTU for the tuntap read)
@coral
Copy link

coral commented Nov 21, 2017

@zehome
any update on this?

@georgyo
Copy link

georgyo commented Dec 30, 2021

This is a pretty old ticket, but I would like to rehash this.

systemd-network makes it really easy to create routing tables that match on the interface name, this automatically catches all the dhcp router and essentially ensures that only traffic going down that interface will infact use those routing rules. This has added benefits that make it possible to have links on different networks that both share 192.168.1.0/24 subsets without fear of conflicting.

IE:

# /etc/systemd/network/mv-linknyc.network
[Match]
Name=mv-enp0s29f7u1

[Link]
ActivationPolicy=always-up
RequiredForOnline=false

[Network]
DHCP=yes

[RoutingPolicyRule]
OutgoingInterface=mv-enp0s29f7u1
Table=53

[DHCPv4]
RouteTable=53

[IPv6AcceptRA]
RouteTable=53

It is possible to add source rules, but several of my hot spots do not allow changing the subnet and are very unreliable to give my machine the same IP address after going to sleep.

It would be great if I could just bind to the interface and have the traffic just do the right thing.

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.

5 participants