diff options
author | Ron Yorston <rmy@pobox.com> | 2021-01-14 13:28:49 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-01-14 13:28:49 +0000 |
commit | 89963b524d211e1aec12b72b3725be05ee95c8cf (patch) | |
tree | 48590aef62b7ee7686b7898256f29def8d9c50b9 /libbb/xconnect.c | |
parent | 9aa5a829070392c2ac6494d0c4e674c0c2bc7dab (diff) | |
parent | 2b7c1aa92c68524559a2067609d09309d5c09adc (diff) | |
download | busybox-w32-89963b524d211e1aec12b72b3725be05ee95c8cf.tar.gz busybox-w32-89963b524d211e1aec12b72b3725be05ee95c8cf.tar.bz2 busybox-w32-89963b524d211e1aec12b72b3725be05ee95c8cf.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb/xconnect.c')
-rw-r--r-- | libbb/xconnect.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libbb/xconnect.c b/libbb/xconnect.c index 38faef38e..f5c514b2c 100644 --- a/libbb/xconnect.c +++ b/libbb/xconnect.c | |||
@@ -428,17 +428,14 @@ int FAST_FUNC create_and_bind_to_netlink(int proto, int grp, unsigned rcvbuf) | |||
428 | struct sockaddr_nl sa; | 428 | struct sockaddr_nl sa; |
429 | int fd; | 429 | int fd; |
430 | 430 | ||
431 | memset(&sa, 0, sizeof(sa)); | ||
432 | sa.nl_family = AF_NETLINK; | ||
433 | sa.nl_pid = getpid(); | ||
434 | sa.nl_groups = grp; | ||
435 | fd = xsocket(AF_NETLINK, SOCK_DGRAM, proto); | 431 | fd = xsocket(AF_NETLINK, SOCK_DGRAM, proto); |
436 | xbind(fd, (struct sockaddr *) &sa, sizeof(sa)); | ||
437 | close_on_exec_on(fd); | ||
438 | 432 | ||
433 | /* Set receive buffer size before binding the socket | ||
434 | * We want to have enough space before we start receiving messages. | ||
435 | */ | ||
439 | if (rcvbuf != 0) { | 436 | if (rcvbuf != 0) { |
440 | // SO_RCVBUFFORCE (root only) can go above net.core.rmem_max sysctl | 437 | setsockopt_SOL_SOCKET_int(fd, SO_RCVBUF, rcvbuf); |
441 | setsockopt_SOL_SOCKET_int(fd, SO_RCVBUF, rcvbuf); | 438 | /* SO_RCVBUFFORCE (root only) can go above net.core.rmem_max */ |
442 | setsockopt_SOL_SOCKET_int(fd, SO_RCVBUFFORCE, rcvbuf); | 439 | setsockopt_SOL_SOCKET_int(fd, SO_RCVBUFFORCE, rcvbuf); |
443 | # if 0 | 440 | # if 0 |
444 | { | 441 | { |
@@ -450,6 +447,13 @@ int FAST_FUNC create_and_bind_to_netlink(int proto, int grp, unsigned rcvbuf) | |||
450 | # endif | 447 | # endif |
451 | } | 448 | } |
452 | 449 | ||
450 | memset(&sa, 0, sizeof(sa)); | ||
451 | sa.nl_family = AF_NETLINK; | ||
452 | sa.nl_pid = getpid(); | ||
453 | sa.nl_groups = grp; | ||
454 | xbind(fd, (struct sockaddr *) &sa, sizeof(sa)); | ||
455 | close_on_exec_on(fd); | ||
456 | |||
453 | return fd; | 457 | return fd; |
454 | } | 458 | } |
455 | #endif | 459 | #endif |