This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new b6103f2 [thirdparty] add SO_REUSEPORT for chronyd NTP socket
b6103f2 is described below
commit b6103f263f43229c09d7cae2df3c9e1a7506728f
Author: Alexey Serbin <[email protected]>
AuthorDate: Fri Sep 13 00:03:59 2019 -0700
[thirdparty] add SO_REUSEPORT for chronyd NTP socket
This patch adds SO_REUSEPORT option for NTP server socket opened
by chronyd. This is to allow for using the port reservation
technique from external minicluster when starting chronyd test
NTP servers.
Change-Id: Iee26fcf93976dd7affe77254751016bcbf398620
Reviewed-on: http://gerrit.cloudera.org:8080/14228
Tested-by: Alexey Serbin <[email protected]>
Reviewed-by: Greg Solovyev <[email protected]>
Reviewed-by: Hao Hao <[email protected]>
Reviewed-by: Adar Dembo <[email protected]>
---
thirdparty/download-thirdparty.sh | 5 +++--
thirdparty/patches/chrony-reuseport.patch | 33 +++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/thirdparty/download-thirdparty.sh
b/thirdparty/download-thirdparty.sh
index 7160c5d..ed62f31 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -442,12 +442,13 @@ fetch_and_patch \
$YAML_SOURCE \
$YAML_PATCHLEVEL
-CHRONY_PATCHLEVEL=1
+CHRONY_PATCHLEVEL=2
fetch_and_patch \
$CHRONY_NAME.tar.gz \
$CHRONY_SOURCE \
$CHRONY_PATCHLEVEL \
- "patch -p1 < $TP_DIR/patches/chrony-no-superuser.patch"
+ "patch -p1 < $TP_DIR/patches/chrony-no-superuser.patch" \
+ "patch -p1 < $TP_DIR/patches/chrony-reuseport.patch"
echo "---------------"
echo "Thirdparty dependencies downloaded successfully"
diff --git a/thirdparty/patches/chrony-reuseport.patch
b/thirdparty/patches/chrony-reuseport.patch
new file mode 100644
index 0000000..e42d59c
--- /dev/null
+++ b/thirdparty/patches/chrony-reuseport.patch
@@ -0,0 +1,33 @@
+commit 7f5475515484885c112dffc51f32db3985acc4d6
+Author: Alexey Serbin <[email protected]>
+Date: Thu Sep 12 23:48:20 2019 -0700
+
+ ntp: add SO_REUSEPORT option for NTP server socket
+
+ This patch makes the NTP server socket capable of binding to a port
+ which is already bound, but not yet listened to. This is useful
+ in scenarios when it's necessary to make chronyd serving NTP requests
+ at a port which has been reserved for chronyd by some other process.
+
+diff --git a/ntp_io.c b/ntp_io.c
+index ab08372..1ab554d 100644
+--- a/ntp_io.c
++++ b/ntp_io.c
+@@ -206,6 +206,17 @@ prepare_socket(int family, int port_number, int
client_only)
+ LOG(LOGS_ERR, "Could not set %s socket option", "SO_REUSEADDR");
+ /* Don't quit - we might survive anyway */
+ }
++
++ /* Make the socket capable of binding to a port which is already bound,
++ * but not yet listened to. This is useful in scenarios when it's necessary
++ * to make chronyd serving NTP requests at a port which has been reserved
++ * for chronyd by some other process.
++ */
++ if (!client_only && port_number &&
++ setsockopt(sock_fd, SOL_SOCKET, SO_REUSEPORT, (char *)&on_off,
sizeof(on_off)) < 0) {
++ LOG(LOGS_ERR, "Could not set %s socket option", "SO_REUSEPORT");
++ /* Don't quit yet - we might survive anyway */
++ }
+
+ /* Make the socket capable of sending broadcast pkts - needed for NTP
broadcast mode */
+ if (!client_only &&