schweikert / fping

High performance ping tool
https://fping.org
Other
1.03k stars 251 forks source link

fping: retain privileges until after privileged setsockopt #200

Closed hmh closed 4 years ago

hmh commented 4 years ago

On Linux, one needs privileges to setsockopt(SO_BINDTODEVICE), and the current code would drop setuid root privileges too soon.

Temporarily drop privileges instead, and raise them back to issue the privileged setsockopt(). Once we know we won't need to do any further privileged setsockopt(), permanently drop privileges.

For now, assume SO_BINDTODEVICE is the only setsockopt that needs this.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.7%) to 80.978% when pulling 59d83ed4020673ec09238bbb1cff275158b590a6 on simetnicbr:for-upstream/privileged-SO_BINDTODEVICE into 296de3d7a28b68476e42409cfd6fdff835a47146 on schweikert:develop.

hmh commented 4 years ago

Related to issue #199

schweikert commented 4 years ago

Looks good, thanks!