Upgrade linuxptp to 3.1.1 and promote to SPECS (#8267)

Co-authored-by: Harshit Gupta <guptaharshit@microsoft.com>
This commit is contained in:
Harshit Gupta 2024-03-06 11:36:30 -05:00 коммит произвёл GitHub
Родитель cf9a54e1a4
Коммит 1bdd02eefa
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
12 изменённых файлов: 11774 добавлений и 42 удалений

Просмотреть файл

@ -1,11 +0,0 @@
{
"Signatures": {
"clknetsim-79ffe4.tar.gz": "2d60fb5d6a12dd12fafa07b86a0ed8eba2bf552987e960c6d468c4869199dd6a",
"linuxptp-e05809.tar.gz": "296bcd84942ad0f9d0dccd703b89ba19a70a2633990598d0460dc7d017d15360",
"linuxptp-testsuite-a7f6e1.tar.gz": "ac0fc97a5e4b3ae61665bb07c922fdcf1e0d62ccc097a3de4367d72c2b0ec70a",
"phc2sys.service": "4bab3fe8ba6b801d6092d820c4fa4514973f441af5967f4c597ecd60d863c752",
"ptp4l.service": "2d85b55077bb99091ddf66917b86044f75fe31584b647a7df06994eee5ecf6bd",
"timemaster.conf": "c8bbe715944126ac4063199981c4e157228ee52ed7caa71e2a9523d5d0c57943",
"timemaster.service": "01af35467d2400f12e7c95df94e069bba89ad06c048b6f346fc26676db2e6b42"
}
}

Просмотреть файл

@ -0,0 +1,22 @@
commit 2c62b9a3d8aa61bbb45a522c47be1ff2261e9b0e
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Mon Mar 14 11:40:50 2022 +0100
bash: remove default options for phc2sys
Don't set any options by default for phc2sys to avoid conflict between
-O and -a.
diff --git a/clknetsim.bash b/clknetsim.bash
index becc94d..eed622c 100644
--- a/clknetsim.bash
+++ b/clknetsim.bash
@@ -82,7 +82,7 @@ start_client() {
args+=($opts)
;;
phc2sys)
- args=(-s /dev/ptp0 -O 0 $opts $config)
+ args=($opts $config)
;;
nsm)
args=($opts)

11615
SPECS/linuxptp/enable-ha.patch Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,37 @@
commit 9633ab52460f58c92c6daa35e9d24e4ce9c5ab1c
Author: Miroslav Lichvar <mlichvar@redhat.com>
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 <mlichvar@redhat.com>
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)

Просмотреть файл

@ -0,0 +1,12 @@
{
"Signatures": {
"clknetsim-9ed48d.tar.gz": "4e464ddb20c6436e8dfbc82305ae5187831a4b6b60b89dcdc92f59a0d3539496",
"linuxptp-3.1.1.tgz": "94d6855f9b7f2d8e9b0ca6d384e3fae6226ce6fc012dbad02608bdef3be1c0d9",
"linuxptp-testsuite-ff37e2.tar.gz": "038b1bb07ce5f03b3207bbfabe6f85d2cbbb16ef54b121a35749ca7e01d54648",
"phc2sys.service": "4bab3fe8ba6b801d6092d820c4fa4514973f441af5967f4c597ecd60d863c752",
"ptp4l.conf": "c3ae7d8d845619f41f3743da9e46ea6f690d218383f127e0bf2b64de2e69c283",
"ptp4l.service": "2d85b55077bb99091ddf66917b86044f75fe31584b647a7df06994eee5ecf6bd",
"timemaster.conf": "068104a097f468aaeb12bcf67eab2705736665a5546cda29be62be3c4593ddd5",
"timemaster.service": "01af35467d2400f12e7c95df94e069bba89ad06c048b6f346fc26676db2e6b42"
}
}

Просмотреть файл

@ -1,32 +1,38 @@
Vendor: Microsoft Corporation
Distribution: Azure Linux
%global gitfullver e0580929f451e685d92cd10d80b76f39e9b09a97
%global gitver %(c=%{gitfullver}; echo ${c:0:6})
%global _hardened_build 1
%global testsuite_ver a7f6e1
%global clknetsim_ver 79ffe4
%global testsuite_ver ff37e2
%global clknetsim_ver 9ed48d
Name: linuxptp
Version: 2.0
Release: 8%{?dist}
Version: 3.1.1
Release: 1%{?dist}
Summary: PTP implementation for Linux
License: GPLv2+
URL: http://linuxptp.sourceforge.net/
#Source0: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tgz
Source0: https://github.com/richardcochran/%{name}/archive/%{gitver}/%{name}-%{gitver}.tar.gz
Source0: https://sourceforge.net/projects/%{name}/files/v3.1/%{name}-%{version}.tgz
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
Source10: linuxptp-testsuite-%{testsuite_ver}.tar.gz
# simulator for test suite
Source11: https://github.com/mlichvar/clknetsim/archive/%{clknetsim_ver}/clknetsim-%{clknetsim_ver}.tar.gz
Source11: clknetsim-%{clknetsim_ver}.tar.gz
BuildRequires: gcc gcc-c++ systemd
BuildRequires: net-snmp-devel
# fix handling of zero-length messages
Patch0: linuxptp-zerolength.patch
# revert phc2sys options needed by the older version of test suite
Patch1: clknetsim-phc2sys.patch
# The following patch is a combination of multiple patches to enable HA in linuxptp
# https://review.opendev.org/c/starlingx/integ/+/891638
Patch2: enable-ha.patch
BuildRequires: gcc gcc-c++ make systemd
%{?systemd_requires}
@ -39,11 +45,18 @@ Supporting legacy APIs and other platforms is not a goal.
%prep
%setup -q -a 10 -a 11 -n %{name}-%{!?gitfullver:%{version}}%{?gitfullver}
%patch 0 -p1 -b .zerolength
mv linuxptp-testsuite-%{testsuite_ver}* testsuite
mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim
pushd testsuite/clknetsim
%patch 1 -p1 -R -b .phc2sys
popd
%patch 2 -p1 -b .pre-ha
%build
make %{?_smp_mflags} \
%{make_build} \
EXTRA_CFLAGS="$RPM_OPT_FLAGS" \
EXTRA_LDFLAGS="$RPM_LD_FLAGS"
@ -51,11 +64,10 @@ make %{?_smp_mflags} \
%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
@ -66,7 +78,7 @@ echo '.so man8/timemaster.8' > $RPM_BUILD_ROOT%{_mandir}/man5/timemaster.conf.5
cd testsuite
# set random seed to get deterministic results
export CLKNETSIM_RANDOM_SEED=26743
make %{?_smp_mflags} -C clknetsim
%{make_build} -C clknetsim
PATH=..:$PATH ./run
%post
@ -93,15 +105,53 @@ PATH=..:$PATH ./run
%{_sbindir}/phc_ctl
%{_sbindir}/pmc
%{_sbindir}/ptp4l
%{_sbindir}/snmp4lptp
%{_sbindir}/timemaster
%{_sbindir}/ts2phc
%{_mandir}/man5/*.5*
%{_mandir}/man8/*.8*
%changelog
* Thu Oct 14 2021 Pawel Winogrodzki <pawelwi@microsoft.com> - 2.0-8
- Initial CBL-Mariner import from Fedora 32 (license: MIT).
- Converting the 'Release' tag to the '[number].[distribution]' format.
* Thu Nov 16 2023 Harshit Gupta <guptaharshit@microsoft.com> - 3.1.1-1
- Initial CBL-Mariner import from Fedora 37 (license: MIT).
- License Verified.
- Upstream linuxptp 3.1.1-6 has been imported into Azure Linux with package 3.1.1-1
- Remove SELinux policy
* Wed Jan 11 2023 Miroslav Lichvar <mlichvar@redhat.com> 3.1.1-6
- update selinux policy (#2159919)
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue Apr 26 2022 Miroslav Lichvar <mlichvar@redhat.com> 3.1.1-4
- fix tests on ppc64le (#2046706)
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Miroslav Lichvar <mlichvar@redhat.com> 3.1.1-2
- package selinux policy
* Wed Jul 07 2021 Miroslav Lichvar <mlichvar@redhat.com> 3.1.1-1
- update to 3.1.1 (CVE-2021-3570, CVE-2021-3571)
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.1-4
- Rebuilt for updated systemd-rpm-macros
See https://pagure.io/fesco/issue/2583.
* Thu Feb 25 2021 Miroslav Lichvar <mlichvar@redhat.com> 3.1-3
- fix handling of zero-length messages
- minimize default configuration
- remove obsolete build requirement
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Sep 29 2020 Miroslav Lichvar <mlichvar@redhat.com> 3.1-1
- update to 3.1
* Mon Jul 27 2020 Miroslav Lichvar <mlichvar@redhat.com> 3.0-1
- update to 3.0
* Mon Feb 03 2020 Miroslav Lichvar <mlichvar@redhat.com> 2.0-7.20191225gite05809
- update to 20191225gite05809

Просмотреть файл

14
SPECS/linuxptp/ptp4l.conf Normal file
Просмотреть файл

@ -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

Просмотреть файл

Просмотреть файл

@ -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

Просмотреть файл

@ -11981,8 +11981,8 @@
"type": "other",
"other": {
"name": "linuxptp",
"version": "2.0",
"downloadUrl": "https://github.com/richardcochran/linuxptp/archive/e05809/linuxptp-e05809.tar.gz"
"version": "3.1.1",
"downloadUrl": "https://sourceforge.net/projects/linuxptp/files/v3.1/linuxptp-3.1.1.tgz"
}
}
},
@ -30626,4 +30626,4 @@
}
],
"Version": 1
}
}