From owner-svn-ports-all@freebsd.org Thu Dec 27 20:41:55 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 959331422740; Thu, 27 Dec 2018 20:41:55 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3BC818AEDE; Thu, 27 Dec 2018 20:41:55 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F20C18E99; Thu, 27 Dec 2018 20:41:55 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wBRKft7T027575; Thu, 27 Dec 2018 20:41:55 GMT (envelope-from decke@FreeBSD.org) Received: (from decke@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wBRKfsQZ027573; Thu, 27 Dec 2018 20:41:54 GMT (envelope-from decke@FreeBSD.org) Message-Id: <201812272041.wBRKfsQZ027573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: decke set sender to decke@FreeBSD.org using -f From: Bernhard Froehlich Date: Thu, 27 Dec 2018 20:41:54 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r488567 - in head/net/chrony: . files X-SVN-Group: ports-head X-SVN-Commit-Author: decke X-SVN-Commit-Paths: in head/net/chrony: . files X-SVN-Commit-Revision: 488567 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3BC818AEDE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Dec 2018 20:41:55 -0000 Author: decke Date: Thu Dec 27 20:41:54 2018 New Revision: 488567 URL: https://svnweb.freebsd.org/changeset/ports/488567 Log: net/chrony: Fix chrony running as server and using bindaddress On FreeBSD, sendmsg() fails when IP_SENDSRCADDR specifies a source address on a socket that is bound to the address. This prevents a server configured with the bindaddress directive from responding to clients. Add a new variable to check whether the server IPv4 socket is not bound before setting the source address. PR: 233644 Submitted by: Colin T Reported by: ddrinnon@cdor.net Approved by: maintainer timeout (> 3 weeks) Obtained from: https://git.tuxfamily.org/chrony/chrony.git/commit/?id=6af39d63aa9323b4b8c39efe24ae0c88c949a901 Added: head/net/chrony/files/patch-ntp__io.c (contents, props changed) Modified: head/net/chrony/Makefile Modified: head/net/chrony/Makefile ============================================================================== --- head/net/chrony/Makefile Thu Dec 27 20:37:29 2018 (r488566) +++ head/net/chrony/Makefile Thu Dec 27 20:41:54 2018 (r488567) @@ -3,6 +3,7 @@ PORTNAME= chrony PORTVERSION= 3.4 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= http://download.tuxfamily.org/chrony/ Added: head/net/chrony/files/patch-ntp__io.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/chrony/files/patch-ntp__io.c Thu Dec 27 20:41:54 2018 (r488567) @@ -0,0 +1,65 @@ +From 6af39d63aa9323b4b8c39efe24ae0c88c949a901 Mon Sep 17 00:00:00 2001 +From: Miroslav Lichvar +Date: Mon, 3 Dec 2018 15:51:54 +0100 +Subject: ntp: don't use IP_SENDSRCADDR on bound socket + +On FreeBSD, sendmsg() fails when IP_SENDSRCADDR specifies a source +address on a socket that is bound to the address. This prevents a server +configured with the bindaddress directive from responding to clients. + +Add a new variable to check whether the server IPv4 socket is not bound +before setting the source address. +--- ntp_io.c.orig 2018-09-19 14:38:15 UTC ++++ ntp_io.c +@@ -105,6 +105,9 @@ static int separate_client_sockets; + disabled */ + static int permanent_server_sockets; + ++/* Flag indicating the server IPv4 socket is bound to an address */ ++static int bound_server_sock_fd4; ++ + /* Flag indicating that we have been initialised */ + static int initialised=0; + +@@ -168,6 +171,9 @@ prepare_socket(int family, int port_number, int client + my_addr.in4.sin_port = htons(port_number); + my_addr_len = sizeof (my_addr.in4); + ++ if (!client_only) ++ bound_server_sock_fd4 = my_addr.in4.sin_addr.s_addr != htonl(INADDR_ANY); ++ + break; + #ifdef FEAT_IPV6 + case AF_INET6: +@@ -821,8 +827,8 @@ NIO_SendPacket(NTP_Packet *packet, NTP_Remote_Address + msg.msg_flags = 0; + cmsglen = 0; + +- if (local_addr->ip_addr.family == IPADDR_INET4) { + #ifdef HAVE_IN_PKTINFO ++ if (local_addr->ip_addr.family == IPADDR_INET4) { + struct in_pktinfo *ipi; + + cmsg = CMSG_FIRSTHDR(&msg); +@@ -837,7 +843,11 @@ NIO_SendPacket(NTP_Packet *packet, NTP_Remote_Address + ipi->ipi_spec_dst.s_addr = htonl(local_addr->ip_addr.addr.in4); + if (local_addr->if_index != INVALID_IF_INDEX) + ipi->ipi_ifindex = local_addr->if_index; ++ } + #elif defined(IP_SENDSRCADDR) ++ /* Specify the IPv4 source address only if the socket is not bound */ ++ if (local_addr->ip_addr.family == IPADDR_INET4 && ++ local_addr->sock_fd == server_sock_fd4 && !bound_server_sock_fd4) { + struct in_addr *addr; + + cmsg = CMSG_FIRSTHDR(&msg); +@@ -850,8 +860,8 @@ NIO_SendPacket(NTP_Packet *packet, NTP_Remote_Address + + addr = (struct in_addr *)CMSG_DATA(cmsg); + addr->s_addr = htonl(local_addr->ip_addr.addr.in4); +-#endif + } ++#endif + + #ifdef HAVE_IN6_PKTINFO + if (local_addr->ip_addr.family == IPADDR_INET6) {