From 81d7dc1003895dd140aec78c59336cb423b3e4d8 Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Mar 11 2021 20:28:45 +0000 Subject: Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/linuxptp.git#c99ec5dcd38b81105342b6015739c314b82fea72 --- diff --git a/linuxptp-zerolength.patch b/linuxptp-zerolength.patch new file mode 100644 index 0000000..0ab5ed4 --- /dev/null +++ b/linuxptp-zerolength.patch @@ -0,0 +1,37 @@ +commit 9633ab52460f58c92c6daa35e9d24e4ce9c5ab1c +Author: Miroslav Lichvar +Date: Tue Feb 23 11:01:43 2021 +0100 + + sk: Don't return error for zero-length messages. + + The recvmsg() call can return zero for a zero-length UDP message, which + should be handled as a bad message and not a fault of the port. This was + addressed in commit 6b61ba29c78e ("Avoid fault when receiving zero + length packets"), but later regressed in commit a6e0b83bd503 + ("sk: Convey transmit path errors to the caller."). + + Signed-off-by: Miroslav Lichvar + Fixes: a6e0b83bd503 ("sk: Convey transmit path errors to the caller.") + +diff --git a/sk.c b/sk.c +index c9ef4d2..8be0708 100644 +--- a/sk.c ++++ b/sk.c +@@ -391,7 +391,7 @@ int sk_receive(int fd, void *buf, int buflen, + + if (!ts) { + memset(&hwts->ts, 0, sizeof(hwts->ts)); +- return cnt < 1 ? -errno : cnt; ++ return cnt < 0 ? -errno : cnt; + } + + switch (hwts->type) { +@@ -407,7 +407,7 @@ int sk_receive(int fd, void *buf, int buflen, + hwts->ts = timespec_to_tmv(ts[1]); + break; + } +- return cnt < 1 ? -errno : cnt; ++ return cnt < 0 ? -errno : cnt; + } + + int sk_set_priority(int fd, int family, uint8_t dscp) diff --git a/linuxptp.spec b/linuxptp.spec index 0821d40..9db3735 100644 --- a/linuxptp.spec +++ b/linuxptp.spec @@ -4,7 +4,7 @@ Name: linuxptp Version: 3.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: PTP implementation for Linux License: GPLv2+ @@ -15,14 +15,16 @@ Source1: phc2sys.service Source2: ptp4l.service Source3: timemaster.service Source4: timemaster.conf +Source5: ptp4l.conf # external test suite Source10: https://github.com/mlichvar/linuxptp-testsuite/archive/%{testsuite_ver}/linuxptp-testsuite-%{testsuite_ver}.tar.gz # simulator for test suite Source11: https://github.com/mlichvar/clknetsim/archive/%{clknetsim_ver}/clknetsim-%{clknetsim_ver}.tar.gz -BuildRequires: gcc gcc-c++ systemd -BuildRequires: net-snmp-devel -BuildRequires: make +# fix handling of zero-length messages +Patch1: linuxptp-zerolength.patch + +BuildRequires: gcc gcc-c++ make systemd %{?systemd_requires} @@ -35,6 +37,7 @@ Supporting legacy APIs and other platforms is not a goal. %prep %setup -q -a 10 -a 11 -n %{name}-%{!?gitfullver:%{version}}%{?gitfullver} +%patch1 -p1 -b .zerolength mv linuxptp-testsuite-%{testsuite_ver}* testsuite mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim @@ -47,11 +50,10 @@ mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim %makeinstall mkdir -p $RPM_BUILD_ROOT{%{_sysconfdir}/sysconfig,%{_unitdir},%{_mandir}/man5} -install -m 644 -p configs/default.cfg $RPM_BUILD_ROOT%{_sysconfdir}/ptp4l.conf install -m 644 -p %{SOURCE1} %{SOURCE2} %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir} -install -m 644 -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir} +install -m 644 -p %{SOURCE4} %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir} -echo 'OPTIONS="-f /etc/ptp4l.conf -i eth0"' > \ +echo 'OPTIONS="-f /etc/ptp4l.conf"' > \ $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ptp4l echo 'OPTIONS="-a -r"' > $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/phc2sys @@ -95,6 +97,11 @@ PATH=..:$PATH ./run %{_mandir}/man8/*.8* %changelog +* Thu Feb 25 2021 Miroslav Lichvar 3.1-3 +- fix handling of zero-length messages +- minimize default configuration +- remove obsolete build requirement + * Tue Jan 26 2021 Fedora Release Engineering - 3.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/ptp4l.conf b/ptp4l.conf new file mode 100644 index 0000000..4b4b1db --- /dev/null +++ b/ptp4l.conf @@ -0,0 +1,14 @@ +# For more information about this file, see the ptp4l(8) man page. +# Examples are available in /usr/share/doc/linuxptp/configs. + +[global] +domainNumber 0 +slaveOnly 1 +time_stamping hardware +tx_timestamp_timeout 1 +logging_level 6 +summary_interval 0 + +[eth0] +network_transport UDPv4 +hybrid_e2e 0 diff --git a/timemaster.conf b/timemaster.conf index fd8e77e..1476209 100644 --- a/timemaster.conf +++ b/timemaster.conf @@ -14,18 +14,11 @@ ntp_program chronyd [chrony.conf] include /etc/chrony.conf -[ntp.conf] -includefile /etc/ntp.conf - [ptp4l.conf] [chronyd] path /usr/sbin/chronyd -[ntpd] -path /usr/sbin/ntpd -options -u ntp:ntp -g - [phc2sys] path /usr/sbin/phc2sys