diff --git a/conf.ptpd.init b/conf.ptpd.init deleted file mode 100644 index 2c52428..0000000 --- a/conf.ptpd.init +++ /dev/null @@ -1,188 +0,0 @@ -#!/bin/sh -# -# SuSE system startup script for service/daemon ptpd -# Copyright (C) 1995--2007 SUSE / Novell Inc. -# -# This library is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or (at -# your option) any later version. -# -# This library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, -# USA. -# -# /etc/init.d/ptpd -# and its symbolic link -# /usr/sbin/rcptpd -# -# LSB compatible service control script; see http://www.linuxbase.org/spec/ -# Please send feedback to http://www.suse.de/feedback/ -# -# chkconfig: 345 71 29 -# description: Precision Time Protocol as defined by IEEE 1588 -# -### BEGIN INIT INFO -# Provides: ptpd -# Required-Start: $remote_fs $syslog $network -# Should-Start: $time -# Required-Stop: $remote_fs $syslog $network -# Should-Stop: $time -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Precision Time Protocol as defined by IEEE 1588 -# Description: PTP is designed to provide very precise -# time coordination of LAN connected computers. -### END INIT INFO -# - -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance -PTPD_BIN=/usr/sbin/ptpd -test -x $PTPD_BIN || { echo "$PTPD_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -# Check for existence of needed config file and read it -PTPD_CONFIG=/etc/sysconfig/ptpd -test -r $PTPD_CONFIG || { echo "$PTPD_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - -# Read config -. $PTPD_CONFIG - -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v be verbose in local rc status and clear it afterwards -# rc_status -v -r ditto and clear both the local and overall rc status -# rc_status -s display "skipped" and exit with status 3 -# rc_status -u display "unused" and exit with status 3 -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear both the local and overall rc status -# rc_exit exit appropriate to overall rc status -# rc_active checks whether a service is activated by symlinks -. /etc/rc.status - -# Reset status of this service -rc_reset - -# Return values acc. to LSB for all commands but status: -# 0 - success -# 1 - generic or unspecified error -# 2 - invalid or excess argument(s) -# 3 - unimplemented feature (e.g. "reload") -# 4 - user had insufficient privileges -# 5 - program is not installed -# 6 - program is not configured -# 7 - program is not running -# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) -# -# Note that starting an already running service, stopping -# or restarting a not-running service as well as the restart -# with force-reload (in case signaling is not supported) are -# considered a success. - -case "$1" in - start) - echo -n "Starting ptpd " - ## Start daemon with startproc(8). If this fails - ## the return value is set appropriately by startproc. - /sbin/startproc $PTPD_BIN $PTPD_OPTIONS - - # Remember status and be verbose - rc_status -v - ;; - stop) - echo -n "Shutting down ptpd " - ## Stop daemon with killproc(8) and if this fails - ## killproc sets the return value according to LSB. - - /sbin/killproc -TERM $PTPD_BIN - - # Remember status and be verbose - rc_status -v - ;; - try-restart|condrestart) - ## Do a restart only if the service was active before. - ## Note: try-restart is now part of LSB (as of 1.9). - ## RH has a similar command named condrestart. - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - ## Signal the daemon to reload its config. Most daemons - ## do this on signal 1 (SIGHUP). - ## If it does not support it, restart the service if it - ## is running. - - echo -n "Reload service ptpd " - $0 try-restart - rc_status - ;; - reload) - ## Like force-reload, but if daemon does not support - ## signaling, do nothing (!) - - ## Otherwise if it does not support reload: - rc_failed 3 - rc_status -v - ;; - status) - echo -n "Checking for service ptpd " - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Return value is slightly different for the status command: - # 0 - service up and running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running (unused) - # 4 - service status unknown :-( - # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) - - # NOTE: checkproc returns LSB compliant status values. - /sbin/checkproc $PTPD_BIN - # NOTE: rc_status knows that we called this init script with - # "status" option and adapts its messages accordingly. - rc_status -v - ;; - probe) - ## Optional: Probe for the necessity of a reload, print out the - ## argument to this init script which is required for a reload. - ## Note: probe is not (yet) part of LSB (as of 1.9) - - $0 reload - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" - exit 1 - ;; -esac -rc_exit diff --git a/conf.sysconfig.ptpd b/conf.sysconfig.ptpd index 01e35c1..cb9a0b3 100644 --- a/conf.sysconfig.ptpd +++ b/conf.sysconfig.ptpd @@ -1,22 +1,8 @@ -## Path: Network/PTPD -## Description: Precision Time Protocol (PTP) daemon options -## Type: string -## Default: AUTO-2 -## ServiceRestart: ptpd -# -## Type: string -## Default: "" -# -# Additional arguments when starting ptpd. The most important ones would be -# -x do not reset the clock if off by more than one second -# -t do not adjust the system clock -# -# -g run as slave only -# -p make this a preferred clock -# -# -b NAME bind PTP to network interface NAME -# -# -n NAME specify PTP subdomain name (not related to IP or DNS) -# -a NUMBER,NUMBER specify clock servo P and I attenuations -# -w NUMBER specify one way delay filter stiffness -PTPD_OPTIONS="" +# Config file location +PTPD_CONFIG_FILE="/etc/ptpd2.conf" +# Lock / PID file location +#PTPD_PID_FILE="/var/run/ptpd2.lock" +# Status file location +#PTPD_STATUS_FILE="/var/run/ptpd2.status" +# Any extra command-line options +PTPD_EXTRA_OPTIONS="" diff --git a/ptpd-1.1.0.tar.gz b/ptpd-1.1.0.tar.gz deleted file mode 100644 index 5d57d9c..0000000 --- a/ptpd-1.1.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a7c6ea83bd53da75ae04a7b7a25fe7c597b4e9ff1f93d46f4502e3fa8a2cb950 -size 401064 diff --git a/ptpd-2.3.0.tar.gz b/ptpd-2.3.0.tar.gz new file mode 100644 index 0000000..3fd75cf --- /dev/null +++ b/ptpd-2.3.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a4e90496f004bfd91657ccc49209101dc25b787e540648c07c0973469f1d8f7 +size 785362 diff --git a/ptpd.changes b/ptpd.changes index 57145ce..5608862 100644 --- a/ptpd.changes +++ b/ptpd.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Mon Jun 1 08:41:34 UTC 2015 - mpluskal@suse.com + +- Update to 2.3.0 + * see attached Changelog for full list of changes +- Add systemd unit file and config file + * ptpd2.conf + * ptpd2.service +- Drop init file + * conf.ptpd.init +- Cleanup spec file with spec-clener + ------------------------------------------------------------------- Thu Oct 27 18:12:26 UTC 2011 - coolo@suse.com diff --git a/ptpd.spec b/ptpd.spec index bd0ad62..66a5256 100644 --- a/ptpd.spec +++ b/ptpd.spec @@ -1,7 +1,7 @@ # # spec file for package ptpd # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,20 +15,28 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild - Name: ptpd -Summary: Implements the Precision Time protocol as defined by IEEE 1588 standard -Version: 1.1.0 +Version: 2.3.0 Release: 0 +Summary: Implements the Precision Time protocol as defined by IEEE 1588 standard License: BSD-3-Clause Group: System/Daemons -Source0: http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/%{name}-%{version}.tar.gz -Source1: conf.ptpd.init -Source2: conf.sysconfig.ptpd Url: http://ptpd.sourceforge.net/ +Source0: http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/%{name}-%{version}.tar.gz +Source1: ptpd2.service +Source2: ptpd2.conf +Source3: conf.sysconfig.ptpd +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libpcap-devel +BuildRequires: libtool +BuildRequires: net-snmp-devel +BuildRequires: openssl-devel +BuildRequires: systemd-rpm-macros +BuildRequires: zlib-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build +%{?systemd_requires} %description The PTP daemon (PTPd) implements the Precision Time protocol (PTP) as @@ -51,50 +59,46 @@ PTPd is free. Everyone is invited to use and contribute to PTPd. %prep %setup -q +autoreconf -fiv %build -cd src -CFLAGS="$RPM_OPT_FLAGS" make +%configure \ + --enable-statistics \ + --enable-ntpdc \ + --enable-sigusr2=counters %install -mkdir -p $RPM_BUILD_ROOT%{_sbindir} -mkdir -p $RPM_BUILD_ROOT%{_initrddir} -mkdir -p ${RPM_BUILD_ROOT}/var/adm/fillup-templates -mkdir -p ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name} -install -m 755 src/ptpd $RPM_BUILD_ROOT%{_sbindir}/ptpd -# -# boot scripts -# -install -m 755 %{S:1} $RPM_BUILD_ROOT%{_initrddir}/ptpd -ln -s ../..%{_initrddir}/ptpd $RPM_BUILD_ROOT%{_sbindir}/rcptpd -# -# configuration -# -install -m 644 %{S:2} ${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.ptpd -# -# documentation -# -cp -r README COPYRIGHT doc RELEASE_NOTES tools ${RPM_BUILD_ROOT}/%{_docdir} -find ${RPM_BUILD_ROOT}/%{_docdir} -type f -print0 | xargs -0 chmod 644 - -%clean -rm -rf ${RPM_BUILD_ROOT} +make DESTDIR=%{buildroot} install %{?_smp_mflags} +install -D -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}/%{name}2.service +ln -sv %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}2 +install -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}2.conf +install -D -m 644 %{SOURCE3} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.ptpd2 +# have to create the below, else ptpd will not log drift +install -d %{buildroot}%{_localstatedir}/log +touch %{buildroot}%{_localstatedir}/log/ptpd2_kernelclock.drift %files %defattr(-, root, root) +%doc COPYRIGHT ChangeLog README +%config %{_sysconfdir}/%{name}2.conf %{_sbindir}/* -%{_initrddir}/* -/var/adm/fillup-templates/* -%{_docdir} +%{_mandir}/man8/* +%{_mandir}/man5/* +%{_libexecdir}/systemd/system/ptpd2.service +%{_localstatedir}/adm/fillup-templates/* +%config %ghost %{_localstatedir}/log/ptpd2_kernelclock.drift + +%pre +%service_add_pre %{name}2.service %preun -%{stop_on_removal} ptpd +%service_del_preun %{name}2.service %post -%{fillup_only -n ptpd} +%service_add_post %{name}2.service +%{fillup_only -n ptpd2} %postun -%restart_on_update ptpd -%{insserv_cleanup} +%service_del_postun %{name}2.service %changelog diff --git a/ptpd2.conf b/ptpd2.conf new file mode 100644 index 0000000..ea158ef --- /dev/null +++ b/ptpd2.conf @@ -0,0 +1,68 @@ +; +============================================================================== +; This is a recommended configuration for a PTPv2 slave +; For a full list of options run ptpd2 -H or see the documentation and man +pages +; +============================================================================== + +; interface has to be specified +ptpengine:interface= + +; PTP domain +ptpengine:domain=0 + +; available presets are slaveonly, masteronly and masterslave (full IEEE +1588 implementation) +ptpengine:preset=slaveonly + +; multicast for both sync and delay requests - use hybrid for unicast delay +requests +ptpengine:ip_mode=multicast + +; when enabled, sniffing is used instead of sockets to send and receive +packets +ptpengine:use_libpcap=n + +; go into panic mode for 10 minutes instead of resetting the clock +ptpengine:panic_mode=y +ptpengine:panic_mode_duration=10 + +; uncomment this to enable outlier filters +ptpengine:sync_outlier_filter_enable=y +ptpengine:delay_outlier_filter_enable=y + +; store observed drift in a file +clock:drift_handling=file +clock:drift_file=/var/log/ptpd2_kernelclock.drift + +; update online statistics every 5 seconds +global:statistics_update_interval=5 + +; wait 5 statistics intervals for one-way delay to stabilise +ptpengine:calibration_delay=5 + +; log file, event log only. if timing statistics are needed, see +statistics_file +global:log_file=/var/log/ptpd2.log +; log file up to 5M +global:log_file_max_size=5000 +; rotate logs up to 5 files +global:log_file_max_files=5 + +; status file providing an overview of ptpd's operation and statistics +global:log_status=y + +; required if ip_mode is set to hybrid +;ptpengine:log_delayreq_interval=0 + +; uncomment this to log a timing log like in previous ptpd versions +;global:statistics_file=/var/log/ptpd2.stats + +; on multi-core systems it is recommended to bind ptpd to a single core +;global:cpuaffinity_cpucore=0 + +; use DSCP 46 for expedited forwarding over ipv4 networks +ptpengine:ip_dscp=46 + +; always keep a new line in the end diff --git a/ptpd2.service b/ptpd2.service new file mode 100644 index 0000000..43655d6 --- /dev/null +++ b/ptpd2.service @@ -0,0 +1,10 @@ +[Unit] +Description=ptpd time precision daemon + +[Service] +Type=forking +EnvironmentFile=-/etc/sysconfig/ptpd2 +ExecStart=/usr/bin/ptpd2 -c $PTPD_CONFIG_FILE $PTPD_EXTRA_OPTIONS + +[Install] +WantedBy=multi-user.target