Skip to content

Added a new --interface option to knock#59

Open
sasanj wants to merge 3 commits intojvinet:masterfrom
sasanj:add_interface
Open

Added a new --interface option to knock#59
sasanj wants to merge 3 commits intojvinet:masterfrom
sasanj:add_interface

Conversation

@sasanj
Copy link

@sasanj sasanj commented Sep 17, 2018

Hi,
Recently I needed to knock a server from a client with multiple network interfaces which had different gateways, and since knock did not have a way to choose an interface, I added one.
Hopefully, It is useful to others.

I implemented two ways to find the ip address of an interface. One, using ioctl which is the way knockd also uses, and the other one uses glibc getifaddrs. The idea is to refactor the code for finding the interface's address; in both knock and knockd. There is an option in configure (namely --disable-getifaddrs) to choose between each way.

Manual pages have also been changed, accordingly.

@TDFKAOlli TDFKAOlli mentioned this pull request Jan 2, 2019
TDFKAOlli added a commit to TDFKAOlli/knock that referenced this pull request Jan 3, 2019
@TDFKAOlli
Copy link
Contributor

@sasanj As seen in previous comment I tried to apply your patch on top of the ipv6 feature in my fork. My tests are fine so far, but I lack a proper IPv6 address and name resolution in my virtual machine to test all combinations of force 4 or 6 or not force in combination with the interface flag. Would be great if you could have a look. 😏

@sasanj
Copy link
Author

sasanj commented Feb 28, 2019

@TDFKAOlli sorry for being late. This patch definitely won't work with IPv6. However, adding IPv6 support is simple. But I don't think it can be added to this repo. This knock is strictly IPv4.

@TDFKAOlli
Copy link
Contributor

@sasanj O.k. I think you didn't get what I meant. Sorry, let me try again: I have taken your patch and applied it to my repository including IPv6. Then I extended it to support IPv6. I have tested it in my virtual machine having an routable IPv4 address but only having a link local IPv6. So I wondered if you have time to review TDFKAOlli@dc9f84e

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.

2 participants