freelan-developers / freelan

The main freelan repository.
http://www.freelan.org
Other
1.35k stars 200 forks source link

SIOCSIFTXQLEN not permitted #216

Closed HenryNe closed 4 years ago

HenryNe commented 4 years ago

On a vServer without full rights to kernel, freelan stops with that message:

2020-03-22T12:48:55.504637 [INFORMATION] FSCP server started.
2020-03-22T12:48:55.520067 [ERROR] Operation not permitted

First it was difficult to find, what goes wrong, because the error message says nothing about the operation. So strace was used to find:

open("/dev/net/tap", O_RDWR)            = 14
ioctl(14, TUNSETIFF, 0x7ffcc1b8dfe0)    = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 15
getuid()                                = 0
ioctl(15, SIOCSIFTXQLEN, {ifr_name="tap0", ifr_qlen=100}) = -1 EPERM (Operation not permitted)
close(15)                               = 0
close(14)                               = 0

I suggest do not "return", if the buffer size can not change. https://github.com/freelan-developers/freelan/blob/4bfe5a7be1a26b04c43fc4d9768cb5238bceee0c/libs/asiotap/src/posix/posix_tap_adapter.cpp#L336

System info:

# uname -a
Linux srvXXXX 4.20.8-1.el7.elrepo.x86_64 #1 SMP Tue Feb 12 18:03:03 EST 2019 x86_64 GNU/Linux
s-vincent commented 4 years ago

Hi and thanks for report and PR !

Yes I also think that we should not fail in this case, maybe just log something.

I will review your PR ASAP. Thanks again for that !

s-vincent commented 4 years ago

PR #220 merged. Thanks !