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.
Coverage decreased (-0.7%) to 80.978% when pulling 59d83ed4020673ec09238bbb1cff275158b590a6 on simetnicbr:for-upstream/privileged-SO_BINDTODEVICE into 296de3d7a28b68476e42409cfd6fdff835a47146 on schweikert:develop.
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.