| [chrony-dev] [RFC PATCH 0/9] Allow sources with same IP address and different port |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: [chrony-dev] [RFC PATCH 0/9] Allow sources with same IP address and different port
- From: Wojtek Wasko <wwasko@xxxxxxxxxx>
- Date: Thu, 12 Nov 2026 17:22:29 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h+CYMhmMBrP6d+0hHjOe7MUYVApqGHD6aN0XLG9jULo=; b=dTKDD16+u3FEnGX53EZj3eFLNeYvRTYl21po1SspmXP/bJDrULPIazMU+GKkdse+d6VhqCLwh0sy1bVX+rqZCDFTxitJzeSQdfnH27OvvHPjmM2vtbxgT3eO8hzal61jHD1SoHlvpZPe067d2D2nZFmSJakyw7YX24YRpaKlQMyBHOwgy1az6f85tIovHlPAJfs81u2pgVGkZ01gvfUnTKmtz0Rl0vhOmrhFVhug3XAw3AXPyNoKDI3KC2Z/+02FjCVSs1P5l8Fqs3vwaL7e17xJAFZoQfZjdAsYiP1ju6I6QOuujibJ2wwd8uu2CcnULVCltnXHFoL2lYsIBAeb6Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nDCfeFpWzr1CiVN019wXMkD4/ed1e3miUZTnLJ0vsLk9KFnYsvuOyAhVanTMD9/0oAC60UJk0zR5d6qtQkdQ6u1hxnPAeH9LkBujtCUsHHpom6Ps8/9Eq8JcM36Ob5Yq5IvjgEM/c/BfaP542I/9B28rTHljqomkxE8iR0PdZ+oMXK5HRtCdq5h8S8g34/75lpv6moxbCNTXhUcwIB9OQUGGrsp+otJN/P2HvmqnAdrCD0RsDuHsuk7+9NSuByFw1BACO/qRbn85IZ9ceyZDCx5dOruxrx/SE8cxk/4esixGmtSLRbNGVuDadnpa5qZDcyCCZfunhpToE27WgqLy7w==
- Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com;
- Cc: Wojtek Wasko <wwasko@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=h+CYMhmMBrP6d+0hHjOe7MUYVApqGHD6aN0XLG9jULo=; b=A2Qr5BcCA+tGQy7lkrwsQ1XMbYG7iolsNtjj2eUUy3JX1u/iwWOa1Qa6FJOJN56bBcOyB5EV1wk0RQj+cMlgYFfldpaf4Luq7DL0KkFyo7tZpuOOJBwxw2de5MNmqtBIpF2oOUsGPCkZL2BnDzu6L0MEl/gXH8yvBZIsaK/ghqAem6lksHFn0SGf9/lLyRTJM17wdSNiQL7A1FUB+o3y3Gq5lw3PzSXlJxkVvrRQU8BjC2eMSfAFigyMs0o6sV5+XDyDhgXRgbfV0hluMDU0H97fMU1RRst0TuWQHnLX3H7iqX+EZaGiVC9Wker25tlJhUsBeOR1mvcAlP4+YZ46xQ==
With the ptpport directive, a chronyd server answers on both the NTP
port and the PTP port (RFC 10030). A client can't use both, though,
because chronyd identifies an NTP source by its IP address. A server
can only be specified with one of the ports, and a second source with
the same address is rejected as already in use, or stays unresolved if
it's specified by name.
That makes NTP over PTP harder to roll out in an existing network.
Enabling it incrementally next to NTP, with NTP still available as a
fallback, typically means giving every server a second IP address.
This series makes the address and port together identify an NTP
source. A server specified twice, once with the PTP port and once
without the port option, gives two independent sources. Each has its
own state, statistics, and dump file, and source selection treats them
like any other two sources. For example:
ptpport 319
server ntp1.example.net xleave port 319 extfield 10A
server ntp1.example.net xleave
Logs, dump file names, and chronyc output include the port when it
isn't the NTP port, e.g. 192.0.2.1:319 or [2001:db8::1]:319, and
chronyc accepts the same forms, plus name:port, in commands that take
a source. Without a port, a command picks the source on the NTP port
if there is one, so existing usage keeps working. The command protocol
carries the port in the padding field of IPAddr, which older clients
leave zero and ignore in reports.
There's one problem I haven't solved yet. Older daemons ignore the
padding field in requests too, and pick the source by address only. So
with a new chronyc and an older chronyd, "delete 192.0.2.1:319" can end
up deleting 192.0.2.1:123 instead. I can see three ways to fix it:
- chronyc first checks with an ntpdata request that the daemon has a
source with that address and port. That needs no protocol change,
and commands still work with an older daemon whose source happens
to use the specified port, but every command with a port costs an
extra request.
- Requests with a port get new command codes, which older daemons
reject with 502 Invalid command. There's no extra request, but
every command that names a source needs a new code.
- Requests with a port use a new protocol version, which older
daemons reject with 517 Protocol version mismatch. That's a smaller
change, but requests with a port must no longer fall back to the
older protocol version.
I'm sending this as an RFC because I'd like to hear what you think of
the approach before going further. The patches are working, so they
can serve as a proof of concept if you want to try it out, and I'm
happy to rework them in whatever direction you think is best.
Wojtek Wasko (9):
util: add functions for addresses of NTP sources with port
util: include port in hash of addresses
sources: save port of NTP sources
ntp: allow sources with same address and different port
ntp: print port of NTP sources in logs and dump file names
cmdmon: add port to addresses of NTP sources
client: allow specifying and printing ports of NTP sources
test: add 153-dualtransport test
doc: describe using NTP and NTP over PTP with same server
candm.h | 6 +
client.c | 190 ++++++++++++---------
clientlog.c | 7 +-
cmdmon.c | 87 ++++++----
doc/chrony.conf.adoc | 20 ++-
doc/chronyc.adoc | 5 +
ntp_core.c | 33 ++--
ntp_sources.c | 161 +++++++++---------
ntp_sources.h | 32 ++--
reference.c | 27 +--
reference.h | 5 +-
reports.h | 4 +
sources.c | 82 +++++----
sources.h | 13 +-
sourcestats.c | 16 +-
sourcestats.h | 6 +-
test/simulation/153-dualtransport | 265 ++++++++++++++++++++++++++++++
test/unit/ntp_sources.c | 134 ++++++++++++---
test/unit/sources.c | 46 +++++-
test/unit/util.c | 98 ++++++++++-
util.c | 91 +++++++++-
util.h | 21 ++-
22 files changed, 1027 insertions(+), 322 deletions(-)
create mode 100755 test/simulation/153-dualtransport
base-commit: c97d8083cf9a9edc64d53236565916d326d8a109
--
2.43.0
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.