Try to ignore the usual value restrictions of sockopt SO_RCVBUF when running
as root (with CAP_NET_ADMIN) by using SO_RCVBUFFORCE if possible.pull/7/head
parent
3c019ea611
commit
9327499121
|
|
@ -355,7 +355,7 @@ int main(int argc, char **argv)
|
|||
|
||||
if (silent == SILENT_INI) {
|
||||
if (log) {
|
||||
fprintf(stderr, "\nDisabled standard output while logging.");
|
||||
fprintf(stderr, "Disabled standard output while logging.\n");
|
||||
silent = SILENT_ON; /* disable output on stdout */
|
||||
} else
|
||||
silent = SILENT_OFF; /* default output */
|
||||
|
|
@ -482,6 +482,12 @@ int main(int argc, char **argv)
|
|||
int curr_rcvbuf_size;
|
||||
socklen_t curr_rcvbuf_size_len = sizeof(curr_rcvbuf_size);
|
||||
|
||||
/* try SO_RCVBUFFORCE first, if we run with CAP_NET_ADMIN */
|
||||
if (setsockopt(s[i], SOL_SOCKET, SO_RCVBUFFORCE,
|
||||
&rcvbuf_size, sizeof(rcvbuf_size)) < 0) {
|
||||
#ifdef DEBUG
|
||||
printf("SO_RCVBUFFORCE failed so try SO_RCVBUF ...\n");
|
||||
#endif
|
||||
if (setsockopt(s[i], SOL_SOCKET, SO_RCVBUF,
|
||||
&rcvbuf_size, sizeof(rcvbuf_size)) < 0) {
|
||||
perror("setsockopt SO_RCVBUF");
|
||||
|
|
@ -500,6 +506,7 @@ int main(int argc, char **argv)
|
|||
fprintf(stderr, "The socket receive buffer size was "
|
||||
"adjusted due to /proc/sys/net/core/rmem_max.\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (timestamp || log || logfrmt) {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue