e6f414
%global _hardened_build 1
1a36a3
%global testsuite_ver c66922
1a36a3
%global clknetsim_ver ce3c4a
e6f414
e6f414
Name:		linuxptp
1a36a3
Version:	3.1.1
1a36a3
Release:	1%{?dist}
e6f414
Summary:	PTP implementation for Linux
e6f414
e6f414
Group:		System Environment/Base
e6f414
License:	GPLv2+
e6f414
URL:		http://linuxptp.sourceforge.net/
e6f414
e6f414
Source0:	https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tgz
e6f414
Source1:	phc2sys.service
e6f414
Source2:	ptp4l.service
e6f414
Source3:	timemaster.service
e6f414
Source4:	timemaster.conf
e6f414
# external test suite
e6f414
Source10:	https://github.com/mlichvar/linuxptp-testsuite/archive/%{testsuite_ver}/linuxptp-testsuite-%{testsuite_ver}.tar.gz
e6f414
# simulator for test suite
e6f414
Source11:	https://github.com/mlichvar/clknetsim/archive/%{clknetsim_ver}/clknetsim-%{clknetsim_ver}.tar.gz
e6f414
1a36a3
# don't repeat some log messages in multi-port configuration
1a36a3
Patch1:		linuxptp-logmsgs.patch
1a36a3
# add option to set clockClass threshold
1a36a3
Patch2:		linuxptp-classthreshold.patch
1a36a3
# increase default TX timestamp timeout to 10 ms
1a36a3
Patch3:		linuxptp-deftxtout.patch
e6f414
# limit unicast message rate per address and grant duration
e6f414
Patch4:		linuxptp-ucastrate.patch
1a36a3
# add read-only UDS port
1a36a3
Patch5:		linuxptp-udsro.patch
1a36a3
# fix quoting in ptp4l man page
1a36a3
Patch7:		linuxptp-manfix.patch
1a36a3
# close lstab file after use
1a36a3
Patch8:		linuxptp-fclose.patch
e6f414
# fix handling of zero-length messages
e6f414
Patch9:		linuxptp-zerolength.patch
e6f414
e6f414
BuildRequires:	kernel-headers > 4.18.0-87
e6f414
BuildRequires:	systemd
e6f414
e6f414
%{?systemd_requires}
e6f414
e6f414
%description
e6f414
This software is an implementation of the Precision Time Protocol (PTP)
e6f414
according to IEEE standard 1588 for Linux. The dual design goals are to provide
e6f414
a robust implementation of the standard and to use the most relevant and modern
e6f414
Application Programming Interfaces (API) offered by the Linux kernel.
e6f414
Supporting legacy APIs and other platforms is not a goal.
e6f414
e6f414
%prep
e6f414
%setup -q -a 10 -a 11 -n %{name}-%{!?gitfullver:%{version}}%{?gitfullver}
1a36a3
%patch1 -p1 -b .logmsgs
1a36a3
%patch2 -p1 -b .classthreshold
1a36a3
%patch3 -p1 -b .deftxtout
e6f414
%patch4 -p1 -b .ucastrate
1a36a3
%patch5 -p1 -b .udsro
1a36a3
%patch7 -p1 -b .manfix
1a36a3
%patch8 -p1 -b .fclose
e6f414
%patch9 -p1 -b .zerolength
e6f414
mv linuxptp-testsuite-%{testsuite_ver}* testsuite
e6f414
mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim
e6f414
e6f414
%build
e6f414
make %{?_smp_mflags} \
e6f414
	EXTRA_CFLAGS="$RPM_OPT_FLAGS" \
e6f414
	EXTRA_LDFLAGS="$RPM_LD_FLAGS"
e6f414
e6f414
%install
e6f414
%makeinstall
e6f414
e6f414
mkdir -p $RPM_BUILD_ROOT{%{_sysconfdir}/sysconfig,%{_unitdir},%{_mandir}/man5}
e6f414
install -m 644 -p configs/default.cfg $RPM_BUILD_ROOT%{_sysconfdir}/ptp4l.conf
e6f414
install -m 644 -p %{SOURCE1} %{SOURCE2} %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}
e6f414
install -m 644 -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}
e6f414
e6f414
echo 'OPTIONS="-f /etc/ptp4l.conf -i eth0"' > \
e6f414
	$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ptp4l
e6f414
echo 'OPTIONS="-a -r"' > $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/phc2sys
e6f414
e6f414
echo '.so man8/ptp4l.8' > $RPM_BUILD_ROOT%{_mandir}/man5/ptp4l.conf.5
e6f414
echo '.so man8/timemaster.8' > $RPM_BUILD_ROOT%{_mandir}/man5/timemaster.conf.5
e6f414
1a36a3
# Remove patch backup files and non-linuxptp configuration
1a36a3
find configs -type f ! -name '*.cfg' -delete
1a36a3
e6f414
%check
e6f414
cd testsuite
e6f414
# set random seed to get deterministic results
e6f414
export CLKNETSIM_RANDOM_SEED=26743
e6f414
make %{?_smp_mflags} -C clknetsim
e6f414
PATH=..:$PATH ./run
e6f414
e6f414
%post
e6f414
%systemd_post phc2sys.service ptp4l.service timemaster.service
e6f414
e6f414
%preun
e6f414
%systemd_preun phc2sys.service ptp4l.service timemaster.service
e6f414
e6f414
%postun
e6f414
%systemd_postun_with_restart phc2sys.service ptp4l.service timemaster.service
e6f414
e6f414
%files
e6f414
%doc COPYING README.org configs
e6f414
%config(noreplace) %{_sysconfdir}/ptp4l.conf
e6f414
%config(noreplace) %{_sysconfdir}/sysconfig/phc2sys
e6f414
%config(noreplace) %{_sysconfdir}/sysconfig/ptp4l
e6f414
%config(noreplace) %{_sysconfdir}/timemaster.conf
e6f414
%{_unitdir}/phc2sys.service
e6f414
%{_unitdir}/ptp4l.service
e6f414
%{_unitdir}/timemaster.service
e6f414
%{_sbindir}/hwstamp_ctl
e6f414
%{_sbindir}/nsm
e6f414
%{_sbindir}/phc2sys
e6f414
%{_sbindir}/phc_ctl
e6f414
%{_sbindir}/pmc
e6f414
%{_sbindir}/ptp4l
e6f414
%{_sbindir}/timemaster
1a36a3
%{_sbindir}/ts2phc
e6f414
%{_mandir}/man5/*.5*
e6f414
%{_mandir}/man8/*.8*
e6f414
e6f414
%changelog
1a36a3
* Mon Jul 26 2021 Miroslav Lichvar <mlichvar@redhat.com> 3.1.1-1
1a36a3
- update to 3.1.1 (#1895005 CVE-2021-3571)
1a36a3
- add read-only UDS port (#1929797)
1a36a3
- add option to set clockClass threshold (#1980386)
1a36a3
- don't repeat some log messages in multi-port configuration (#1980377)
1a36a3
- increase default TX timestamp timeout to 10 ms (#1977136)
1a36a3
1a36a3
* Thu Jun 24 2021 Miroslav Lichvar <mlichvar@redhat.com> 2.0-5.el8_4.1
1a36a3
- validate length of forwarded messages (CVE-2021-3570)
1a36a3
e6f414
* Mon Apr 27 2020 Miroslav Lichvar <mlichvar@redhat.com> 2.0-5
e6f414
- fix sample timestamps when synchronizing PHC to system clock (#1787376)
e6f414
- fix handling of zero-length messages (#1827275)
e6f414
e6f414
* Thu May 16 2019 Miroslav Lichvar <mlichvar@redhat.com> 2.0-4
e6f414
- rebuild with enabled gating (#1680888)
e6f414
e6f414
* Wed May 15 2019 Miroslav Lichvar <mlichvar@redhat.com> 2.0-3
e6f414
- add support for active-backup team interface (#1685467)
e6f414
- add support for more accurate synchronization to phc2sys (#1677217)
e6f414
- add hwts_filter option to ptp4l (#1708554)
e6f414
- limit unicast message rate per address and grant duration (#1707395)
e6f414
- fix comparing of unicast addresses (#1707395)
e6f414
- fix building with new kernel headers (#1707395)
e6f414
- update testsuite (#1707395)
e6f414
- don't leak memory when allocation fails (#1707395)
e6f414
e6f414
* Tue Nov 13 2018 Miroslav Lichvar <mlichvar@redhat.com> 2.0-2
e6f414
- start ptp4l, timemaster and phc2sys after network-online target (#1632282)
e6f414
e6f414
* Mon Aug 13 2018 Miroslav Lichvar <mlichvar@redhat.com> 2.0-1
e6f414
- update to 2.0 (#1614300)
e6f414
e6f414
* Mon Apr 09 2018 Miroslav Lichvar <mlichvar@redhat.com> 1.9.2-1
e6f414
- update to 1.9.2
e6f414
e6f414
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.8-7.20180101git303b08
e6f414
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
e6f414
e6f414
* Tue Jan 30 2018 Miroslav Lichvar <mlichvar@redhat.com> 1.8-6.20180101git303b08
e6f414
- use macro for systemd scriptlet dependencies
e6f414
e6f414
* Thu Jan 11 2018 Miroslav Lichvar <mlichvar@redhat.com> 1.8-5.20180101git303b08
e6f414
- update to 20180101git303b08
e6f414
e6f414
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.8-4
e6f414
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
e6f414
e6f414
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.8-3
e6f414
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
e6f414
e6f414
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.8-2
e6f414
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
e6f414
e6f414
* Mon Nov 07 2016 Miroslav Lichvar <mlichvar@redhat.com> 1.8-1
e6f414
- update to 1.8
e6f414
e6f414
* Fri Jul 22 2016 Miroslav Lichvar <mlichvar@redhat.com> 1.7-1
e6f414
- update to 1.7
e6f414
- add delay option to default timemaster.conf
e6f414
e6f414
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-2
e6f414
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
e6f414
e6f414
* Tue Sep 22 2015 Miroslav Lichvar <mlichvar@redhat.com> 1.6-1
e6f414
- update to 1.6
e6f414
- set random seed in testing to get deterministic results
e6f414
- remove trailing whitespace in default timemaster.conf
e6f414
e6f414
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5-2
e6f414
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
e6f414
e6f414
* Mon Jan 05 2015 Miroslav Lichvar <mlichvar@redhat.com> 1.5-1
e6f414
- update to 1.5
e6f414
e6f414
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-3
e6f414
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
e6f414
e6f414
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-2
e6f414
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
e6f414
e6f414
* Fri Feb 21 2014 Miroslav Lichvar <mlichvar@redhat.com> 1.4-1
e6f414
- update to 1.4
e6f414
- replace hardening build flags with _hardened_build
e6f414
- include test suite
e6f414
e6f414
* Fri Aug 02 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.3-1
e6f414
- update to 1.3
e6f414
e6f414
* Tue Jul 30 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.2-3.20130730git7789f0
e6f414
- update to 20130730git7789f0
e6f414
e6f414
* Fri Jul 19 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.2-2.20130719git46db40
e6f414
- update to 20130719git46db40
e6f414
- drop old systemd scriptlets
e6f414
- add man page link for ptp4l.conf
e6f414
e6f414
* Mon Apr 22 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.2-1
e6f414
- update to 1.2
e6f414
e6f414
* Mon Feb 18 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.1-1
e6f414
- update to 1.1
e6f414
- log phc2sys output
e6f414
e6f414
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-2
e6f414
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
e6f414
e6f414
* Thu Dec 13 2012 Miroslav Lichvar <mlichvar@redhat.com> 1.0-1
e6f414
- update to 1.0
e6f414
e6f414
* Fri Nov 09 2012 Miroslav Lichvar <mlichvar@redhat.com> 0-0.3.20121109git4e8107
e6f414
- update to 20121109git4e8107
e6f414
- install unchanged default.cfg as ptp4l.conf
e6f414
- drop conflicts from phc2sys service
e6f414
e6f414
* Fri Sep 21 2012 Miroslav Lichvar <mlichvar@redhat.com> 0-0.2.20120920git6ce135
e6f414
- fix issues found in package review (#859193)
e6f414
e6f414
* Thu Sep 20 2012 Miroslav Lichvar <mlichvar@redhat.com> 0-0.1.20120920git6ce135
e6f414
- initial release