Permalink
Browse files

RC5 last minute fixes continued:

- updated README and INSTALL
- maximum unicast destination count changed to
  2048 in configure.ac
- RPM specs updated for rc5
- added hostname+pid info to status file
- added "Status update:" line to periodic updates
- fixed unused variable warnings for
  debug inet_ntoa() supporting struct in_addr
- removed unicastAddr completely
- ensured that initial timeLeft is set to
  requested +10 on first grant
1 parent a0b3238 commit cda230b6f1dc543dea30424fea6843a8d1191ea0 @wowczarek wowczarek committed Jun 15, 2015
Showing with 140 additions and 109 deletions.
  1. +3 −3 COPYRIGHT
  2. +23 −12 INSTALL
  3. +5 −1 README
  4. +4 −3 configure.ac
  5. +7 −6 packagebuild/rpm-rh/ptpd-slaveonly.spec
  6. +7 −6 packagebuild/rpm-rh/ptpd.spec
  7. +1 −1 src/dep/datatypes_dep.h
  8. +27 −32 src/dep/net.c
  9. +3 −3 src/dep/ntpengine/ntpdcontrol.c
  10. +2 −2 src/dep/snmp.c
  11. +15 −10 src/dep/sys.c
  12. +7 −6 src/display.c
  13. +10 −6 src/protocol.c
  14. +26 −18 src/signaling.c
View
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 2015 Wojciech Owczarek,
- * Copyright (c) 2014 Perseus Telecom,
+ * Copyright (c) 2015 Wojciech Owczarek.
+ * Copyright (c) 2014 Perseus Telecom.
* Copyright (c) 2013-2014 Harlan Stenn,
* George N. Neville-Neil,
* Wojciech Owczarek,
@@ -20,7 +20,7 @@
* Martin Burnicki,
* Jan Breuer,
* Gael Mace,
- * Alexandre Van Kempen
+ * Alexandre Van Kempen.
*
* Copyright (c) 2005-2008 Kendall Correll, Aidan Williams
*
View
@@ -1,6 +1,6 @@
PTP Daemon Version 2 Build and Installation Instructions
-12 June 2015
+15 June 2015
George V. Neville-Neil, Wojciech Owczarek
@@ -58,23 +58,34 @@ You will need the following tools and libraries to build ptpd2:
* As of 2.3.1, support was added for multiple unicast destinations
(both GMs and slaves) - with negotiation (signaling) and without.
The default maximum number of unicast destinations (also the
- maximum number of slaves for a signaling GM) is set to 16. This
- can be changed to a maximum of 1024 using:
-
- ./configure --with-max-unicast-destinations=[16...1024]
-
- It is possible to change this limit to more than 1024, but realistically,
- due to message scheduling, timer signal usage and single-thread
- architecture, anywhere above 400 ptpd will struggle.
+ maximum number of slaves for a signaling GM) is set to 128. This
+ can be changed to a maximum of 2048 using:
+
+ ./configure --with-max-unicast-destinations=[16...2048]
+
+ It is possible to change this limit to more than 2048, but realistically,
+ due to message scheduling, timer signal usage and single-threaded
+ architecture, anywhere above 1000 ptpd may struggle. Ptpd has been
+ successfully tested as unicast Telecom (negotiation) master
+ at 1000 slaves at low message rates (1/sec) and provided adequate
+ performance. When running high numbers of slaves, it is recommended
+ to use libpcap (ptpengine:use_libpcap=y) to allow easier matching
+ of Sync and FollowUp, unless the NIC supports software transmit
+ timestamps. Without those and without libpcap, ptpd loops packets
+ back into its own socket, so the followUp destination cannot be
+ matched with the Sync destination, and a lookup table is used.
+ Hash collissions are low, but they may happen, in which case
+ ptpd will send followUp to the wrong slave. This is only and issue
+ in extreme scenarios.
* With certain NIC drivers on Linux providing the SO_TIMESTAMPING
functionality with software transmit timestamps (SOF_TIMESTAMPING_
TX_SOFTWARE), unpredictable transmit timestamp failures can occur,
which may cause unstable operation and in some cases high CPU usage
(see https://sourceforge.net/p/ptpd/discussion/469208/thread/4aea6e47).
- While fixes have been implemented, there is still some risk.
- To disable SO_TIMESTAMPING support completely on Linux,
- regardless of OS support, use:
+ While fixes have been implemented and have shown success,
+ there is still some risk. To disable SO_TIMESTAMPING support on Linux
+ completely, regardless of OS support, use:
./configure --disable-so-timestamping
View
@@ -1,4 +1,4 @@
-README for PTPd Version 2
+README for PTPd Version 2.x
- Introduction -
@@ -22,6 +22,10 @@ If you are just looking for software to update the time on your desktop, you
probably want something that implements the Network Time Protocol. It can
coordinate computer clocks with an absolute time reference such as UTC.
+Please refer to the INSTALL file for build instructions and configuration
+options. Please refer to the README.repocheckout file for information
+on how to build from source code repositories.
+
- Legal notice -
PTPd was written by using only information contained within 'IEEE Std
View
@@ -592,17 +592,18 @@ AC_MSG_CHECKING([for maximum unicast destination table size])
AC_ARG_WITH(
[max-unicast-destinations],
[AS_HELP_STRING(
- [--with-max-unicast-destinations = [ 16 .. 1024]],
+ [--with-max-unicast-destinations = [ 16 .. 2048]],
[Change maximum supported number of unicast destinations -
this determines the maximum supported number of slaves
in unicast mode (with and without signaling)]
)],
[max_destinations=$with_max_unicast_destinations],
- [max_destinations=0]
+ [max_destinations=128]
)
test $max_destinations -lt 16 && max_destinations=16
-test $max_destinations -gt 1024 && max_destinations=1024
+test $max_destinations -gt 2048 && max_destinations=2048
+
PTP_UNICAST_MAX="-DPTPD_UNICAST_MAX=$max_destinations"
AC_SUBST([PTP_UNICAST_MAX])
AC_MSG_RESULT([$max_destinations])
@@ -1,4 +1,4 @@
-# (c) 2014: Wojciech Owczarek, PTPd project
+# (c) 2014-2015: Wojciech Owczarek, PTPd project
%define _use_internal_dependency_generator 0
@@ -12,11 +12,11 @@
Summary: Synchronises system time using the Precision Time Protocol (PTP) implementing the IEEE 1588-2008 (PTP v 2) standard
Name: ptpd-slaveonly
Version: 2.3.1
-Release: 0.99.rc4%{distver}
+Release: 0.99.rc5%{distver}
License: distributable
Group: System Environment/Daemons
Vendor: PTPd project team
-Source0: ptpd-2.3.1-rc4.tar.gz
+Source0: ptpd-2.3.1-rc5.tar.gz
Source1: ptpd.init
Source2: ptpd.sysconfig
Source3: ptpd.conf
@@ -45,11 +45,11 @@ build - it is not possible to run as PTP master using ptpd-slave-only.
%prep
-%setup -n ptpd-2.3.1-rc4
+%setup -n ptpd-2.3.1-rc5
%build
-./configure --enable-slave-only --with-max-unicast-destinations=128
+./configure --enable-slave-only --with-max-unicast-destinations=512
make
@@ -157,8 +157,9 @@ fi
%{_datadir}/ptpd/*
%changelog
+* Mon Jun 15 2015 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.1-0.99.rc5
* Mon Jun 01 2015 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.1-0.99.rc4
-- RC4 release, adds leap seconds file
+- rc4 release, adds leap seconds file
* Wed Apr 15 2015 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.1-0.99.rc4.pre2
- Added the slaveonly spec
* Mon Apr 13 2015 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.1-0.99.rc4.pre1
@@ -1,4 +1,4 @@
-# (c) 2014: Wojciech Owczarek, PTPd project
+# (c) 2014-2015: Wojciech Owczarek, PTPd project
%define _use_internal_dependency_generator 0
@@ -12,11 +12,11 @@
Summary: Synchronises system time using the Precision Time Protocol (PTP) implementing the IEEE 1588-2008 (PTP v 2) standard
Name: ptpd
Version: 2.3.1
-Release: 0.99.rc4%{distver}
+Release: 0.99.rc5%{distver}
License: distributable
Group: System Environment/Daemons
Vendor: PTPd project team
-Source0: ptpd-2.3.1-rc4.tar.gz
+Source0: ptpd-2.3.1-rc5.tar.gz
Source1: ptpd.init
Source2: ptpd.sysconfig
Source3: ptpd.conf
@@ -44,11 +44,11 @@ time synchronised via the PTP protocol or serving PTP time.
%prep
-%setup -n ptpd-2.3.1-rc4
+%setup -n ptpd-2.3.1-rc5
%build
-./configure --with-max-unicast-destinations=128
+./configure --with-max-unicast-destinations=512
make
@@ -156,8 +156,9 @@ fi
%{_datadir}/ptpd/*
%changelog
+* Mon Jun 15 2015 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.1-0.99.rc5
* Mon Jun 01 2015 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.1-0.99.rc4
-- RC4 release, adds leap seconds file and config files
+- rc5 release, adds leap seconds file and config files
* Wed Apr 15 2015 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.1-0.99.rc4.pre2
* Mon Apr 13 2015 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.1-0.99.rc4.pre1
* Tue Oct 07 2014 Wojciech Owczarek <wojciech@owczarek.co.uk> 2.3.1-0.99.rc3
@@ -81,7 +81,7 @@ typedef struct {
*/
typedef struct {
Integer32 eventSock, generalSock;
- Integer32 multicastAddr, peerMulticastAddr,unicastAddr;
+ Integer32 multicastAddr, peerMulticastAddr;
/* Interface address and capability descriptor */
InterfaceInfo interfaceInfo;
View
@@ -1447,11 +1447,13 @@ netRecvEvent(Octet * buf, TimeInternal * time, NetPath * netPath, int flags)
if(!(flags & MSG_ERRQUEUE))
#endif
netPath->lastSourceAddr = from_addr.sin_addr.s_addr;
+
+ netPath->receivedPacketsTotal++;
+
/* do not report "from self" */
if(!netPath->lastSourceAddr || (netPath->lastSourceAddr != netPath->interfaceAddr.s_addr)) {
netPath->receivedPackets++;
}
- netPath->receivedPacketsTotal++;
if (msg.msg_controllen <= 0) {
ERROR("received short ancillary data (%ld/%ld)\n",
@@ -1481,6 +1483,8 @@ netRecvEvent(Octet * buf, TimeInternal * time, NetPath * netPath, int flags)
DBG("IP_RECVDSTADDR Dst: %s\n", inet_ntoa(*pa));
}
#endif
+
+
if (cmsg->cmsg_level == SOL_SOCKET) {
#if defined(SO_TIMESTAMPING) && defined(SO_TIMESTAMPNS)
if(cmsg->cmsg_type == SO_TIMESTAMPING ||
@@ -1531,6 +1535,7 @@ netRecvEvent(Octet * buf, TimeInternal * time, NetPath * netPath, int flags)
}
+
if (!timestampValid) {
/*
* do not try to get by with recording the time here, better
@@ -1573,10 +1578,11 @@ netRecvEvent(Octet * buf, TimeInternal * time, NetPath * netPath, int flags)
netPath->lastDestAddr = *(Integer32 *)(pkt_data + 30);
}
- /* do not report "from self" */
- if(!netPath->lastSourceAddr || (netPath->lastSourceAddr != netPath->interfaceAddr.s_addr)) {
- netPath->receivedPackets++;
- }
+ /* do not report "from self" */
+ if(!netPath->lastSourceAddr || (netPath->lastSourceAddr != netPath->interfaceAddr.s_addr)) {
+ netPath->receivedPackets++;
+ }
+
netPath->receivedPacketsTotal++;
/* XXX Total cheat */
@@ -1666,7 +1672,7 @@ netRecvGeneral(Octet * buf, NetPath * netPath)
/* do not report "from self" */
if(!netPath->lastSourceAddr || (netPath->lastSourceAddr != netPath->interfaceAddr.s_addr)) {
- netPath->receivedPackets++;
+ netPath->receivedPackets++;
}
netPath->receivedPacketsTotal++;
@@ -1703,16 +1709,16 @@ netSendPcapEther(Octet * buf, UInteger16 length,
#endif
//
-// alt_dst: alternative destination.
+// destinationAddress: destination:
// if filled, send to this unicast dest;
-// if zero, do the normal operation (send to unicast with -u, or send to the multcast group)
+// if zero, sending to multicast.
//
///
/// TODO: merge these 2 functions into one
///
ssize_t
netSendEvent(Octet * buf, UInteger16 length, NetPath * netPath,
- const RunTimeOpts *rtOpts, Integer32 alt_dst, TimeInternal * tim)
+ const RunTimeOpts *rtOpts, Integer32 destinationAddress, TimeInternal * tim)
{
ssize_t ret;
struct sockaddr_in addr;
@@ -1730,23 +1736,22 @@ netSendEvent(Octet * buf, UInteger16 length, NetPath * netPath,
(struct ether_addr *)netPath->interfaceID,
netPath->pcapGeneral);
- if (ret <= 0)
+ if (ret <= 0)
DBG("Error sending ether multicast event message\n");
else {
netPath->sentPackets++;
netPath->sentPacketsTotal++;
}
} else {
#endif
- if (netPath->unicastAddr || alt_dst ) {
- if(alt_dst) {
- addr.sin_addr.s_addr = alt_dst;
- } else if (netPath->unicastAddr) {
- addr.sin_addr.s_addr = netPath->unicastAddr;
- }
+ if (destinationAddress ) {
+ addr.sin_addr.s_addr = destinationAddress;
/*
- * This function is used for PTP only anyway...
+ * This function is used for PTP only anyway - for now.
* If we're sending to a unicast address, set the UNICAST flag.
+ * Transport API in LibCCK / 2.4 uses a callback for this,
+ * so the client can do something with the payload before it's sent,
+ * depending if it's unicast or multicast.
*/
*(char *)(buf + 6) |= PTP_UNICAST;
@@ -1836,7 +1841,7 @@ netSendEvent(Octet * buf, UInteger16 length, NetPath * netPath,
ssize_t
netSendGeneral(Octet * buf, UInteger16 length, NetPath * netPath,
- const const RunTimeOpts *rtOpts, Integer32 alt_dst)
+ const const RunTimeOpts *rtOpts, Integer32 destinationAddress)
{
ssize_t ret;
struct sockaddr_in addr;
@@ -1859,13 +1864,9 @@ netSendGeneral(Octet * buf, UInteger16 length, NetPath * netPath,
}
} else {
#endif
- if(alt_dst || netPath->unicastAddr) {
- if(alt_dst) {
- addr.sin_addr.s_addr = alt_dst;
- } else if (netPath->unicastAddr) {
- addr.sin_addr.s_addr = netPath->unicastAddr;
- }
+ if(destinationAddress) {
+ addr.sin_addr.s_addr = destinationAddress;
/*
* This function is used for PTP only anyway...
* If we're sending to a unicast address, set the UNICAST flag.
@@ -1928,6 +1929,7 @@ netSendPeerGeneral(Octet * buf, UInteger16 length, NetPath * netPath, const RunT
if (ret <= 0)
DBG("error sending ether multicast general message\n");
+
} else if (dst)
#else
if (dst)
@@ -1962,6 +1964,7 @@ netSendPeerGeneral(Octet * buf, UInteger16 length, NetPath * netPath, const RunT
sizeof(struct sockaddr_in));
if (ret <= 0)
DBG("Error sending multicast peer general message\n");
+
}
if (ret > 0) {
@@ -2009,10 +2012,6 @@ netSendPeerEvent(Octet * buf, UInteger16 length, NetPath * netPath, const RunTim
sizeof(struct sockaddr_in));
if (ret <= 0)
DBG("Error sending unicast peer event message\n");
- else {
- netPath->sentPackets++;
- netPath->sentPacketsTotal++;
- }
#ifndef SO_TIMESTAMPING
/*
@@ -2062,10 +2061,6 @@ netSendPeerEvent(Octet * buf, UInteger16 length, NetPath * netPath, const RunTim
sizeof(struct sockaddr_in));
if (ret <= 0)
DBG("Error sending multicast peer event message\n");
- else {
- netPath->sentPackets++;
- netPath->sentPacketsTotal++;
- }
#ifdef SO_TIMESTAMPING
if(!netPath->txTimestampFailure) {
if(!getTxTimestamp(netPath, tim)) {
@@ -693,9 +693,9 @@ NTPDCquery(
* Try to be compatible with older implementations of ntpd.
*/
if (res == INFO_ERR_FMT && req_pkt_size != 48) {
- int oldsize;
-
- oldsize = req_pkt_size;
+#ifdef RUNTIME_DEBUG
+ int oldsize = req_pkt_size;
+#endif /* RUNTIME_DEBUG */
switch(req_pkt_size) {
case REQ_LEN_NOMAC:
Oops, something went wrong.

0 comments on commit cda230b

Please sign in to comment.