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 support for -k/--fwmark option #202

Closed
wants to merge 7 commits into from

Conversation

tomangert
Copy link

No description provided.

@coveralls
Copy link

coveralls commented Sep 7, 2020

Coverage Status

Coverage increased (+0.09%) to 81.777% when pulling f562f49 on tomangert:develop into 296de3d on schweikert:develop.

@tomangert tomangert changed the title Add ipv4 support for -k/--fwmark option Add support for -k/--fwmark option Sep 7, 2020
@tomangert
Copy link
Author

Satisfies Issue #158

I am not configured to test ipv6 but it should work.

@tomangert
Copy link
Author

For --fwmark to work either run as root or set the cap_net_raw and cap_net_admin file capabilities. setuid does not work for fwmark.

sudo chmod u-s /usr/bin/fping
sudo setcap "cap_net_admin,cap_net_raw+ep" /usr/bin/fping

README.md ci/prepare-linux.sh and contrib/fping.spec can be updated to reflect this. I will add those changes.

@hmh
Copy link
Contributor

hmh commented Sep 12, 2020

This is rather strange, setuid to unrestricted root should be very much equivalent to all capabilities.

Maybe you hit the same problem I had with SO_BINDTODEVICE ? Refer to #199 and PR #200 for a hint of the issue.

@tomangert
Copy link
Author

Yes it looks like the same thing. At least for fwmark there is cap_net_admin as a workaround. For SO_BINDTODEVICE I don't see a capability that will work documented anywhere.

@tomangert
Copy link
Author

Checked the kernel source. cap_net_raw should work for SO_BINDTODEVICE, but I didn't try it.

@hmh
Copy link
Contributor

hmh commented Sep 13, 2020

Yes, cap_net_raw works for SO_BINDTODEVICE.

However, without my extra changes to unbreak setuid (or some other change to the same effect), fping remains half-broken on a very large set of machines that cannot operate with capabilites. E.g. every small OpenWrt router. They simply don't use filesystems (and in some case, deployment and update methods) that can deal with extended attributes. That means effectively no capabilities support, even if it is Linux, and even if capabilities are enabled in the kernel.

I am not against merging this PR as-is. I will just adjust mine to also fix -k/--fwmark if it lands first, because I believe fping should work in setuid mode just as well as it does with capabilities.

@hmh
Copy link
Contributor

hmh commented Sep 13, 2020

So, to be very clear, I have no objections against the merge of this PR in its current state.

@tomangert
Copy link
Author

@hmh I just looked at #200 and agree it will be trivial to merge with this one (or vice versa).

I checked a diskless embedded linux implementation and see what you mean about not having xattr support.

So either order of merge is fine by me also. I will update the request if needed.

@darless
Copy link
Contributor

darless commented Jun 29, 2021

What's holding up this from being merged? #200 shows a status of merged. Status checks show that all checks have passed.

@deepkv
Copy link
Contributor

deepkv commented Dec 15, 2023

I'd also like to see this merged, and I see it has some conflicts. If no one else has time, I'd be happy to reimplement this on top of the current HEAD.

@deepkv
Copy link
Contributor

deepkv commented Dec 15, 2023

Done: #289

@schweikert schweikert closed this Feb 4, 2024
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