diff --git a/openvswitch-2.17.6.tar.gz b/openvswitch-2.17.6.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..17f9b4ca1d9d2d6c22a800f68b8d2f2d061d5030 Binary files /dev/null and b/openvswitch-2.17.6.tar.gz differ diff --git a/openvswitch.spec b/openvswitch.spec new file mode 100644 index 0000000000000000000000000000000000000000..c36d65fb8e3a683fecfdd3efa5d26a5b9f73a225 --- /dev/null +++ b/openvswitch.spec @@ -0,0 +1,515 @@ +%define anolis_release 1 +%global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) +%global _hardened_build 1 +%define _rundir /run +%define dpdkarches aarch64 x86_64 + +%bcond_with dpdk +%ifarch x86_64 +%bcond_without check +%else +%bcond_with check +%endif +%bcond_with check_datapath_kernel +%bcond_without libcapng + +Name: openvswitch +Summary: Open vSwitch daemon/database/utilities +URL: https://www.openvswitch.org/ +Version: 2.17.6 +Release: %{anolis_release}%{?dist} +License: ASL 2.0 and LGPLv2+ and SISSL +Source0: https://www.openvswitch.org/releases/%{name}-%{version}.tar.gz +Source1: openvswitch.sysusers + +BuildRequires: gcc gcc-c++ make autoconf automake libtool +BuildRequires: systemd-rpm-macros openssl openssl-devel desktop-file-utils +BuildRequires: python3-devel python3-six python3-setuptools python3-sortedcontainers +BuildRequires: python3-sphinx python3-pyOpenSSL groff +BuildRequires: groff-base graphviz unbound-devel procps-ng + +%if %{with check_datapath_kernel} +BuildRequires: nmap-ncat +%endif + +%if %{with libcapng} +BuildRequires: libcap-ng libcap-ng-devel +%endif + +%if %{with dpdk} +BuildRequires: dpdk-devel libpcap-devel numactl-devel +BuildRequires: libibverbs >= 15 +%endif + +Requires: openssl iproute module-init-tools + +%{?systemd_requires} +%{?sysusers_requires_compat} + +Requires(post): /bin/sed +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives +Obsoletes: openvswitch-controller <= 0:2.1.0-1 + +%description +Open vSwitch provides standard network bridging functions and +support for the OpenFlow protocol for remote per-flow control of +traffic. + +%package -n python3-openvswitch +Summary: Open vSwitch python3 bindings +License: ASL 2.0 +Requires: python3 python3-six +Provides: python-openvswitch = %{?epoch:%{epoch}:}%{version}-%{release} +Obsoletes: python-openvswitch < 2.10.0-6 + +%description -n python3-openvswitch +Python bindings for the Open vSwitch database + +%package test +Summary: Open vSwitch testing utilities +License: ASL 2.0 +BuildArch: noarch +Requires: python3-openvswitch = %{?epoch:%{epoch}:}%{version}-%{release} + +%description test +Utilities that are useful to diagnose performance and connectivity +issues in Open vSwitch setup. + +%package testcontroller +Summary: Simple controller for testing OpenFlow setups +License: ASL 2.0 +Requires: openvswitch = %{?epoch:%{epoch}:}%{version}-%{release} + +%description testcontroller +This controller enables OpenFlow switches that connect to it to act as +MAC-learning Ethernet switches. +It can be used for initial testing of OpenFlow networks. +It is not a necessary or desirable part of a production OpenFlow deployment. + +%package devel +Summary: Open vSwitch OpenFlow development package (library, headers) +License: ASL 2.0 + +%description devel +This provides shared library, libopenswitch.so and the openvswitch header +files needed to build an external application. + +%package -n network-scripts-%{name} +Summary: Open vSwitch legacy network service support +License: ASL 2.0 +Requires: network-scripts +Supplements: (%{name} and network-scripts) + +%description -n network-scripts-%{name} +This provides the ifup and ifdown scripts for use with the legacy network +service. + +%package ipsec +Summary: Open vSwitch IPsec tunneling support +License: ASL 2.0 +Requires: openvswitch libreswan +Requires: python3-openvswitch = %{?epoch:%{epoch}:}%{version}-%{release} + +%description ipsec +This package provides IPsec tunneling support for OVS tunnels. + +%if %{with dpdk} +%ifarch %{dpdkarches} +%package dpdk +Summary: Open vSwitch OpenFlow development package (switch, linked with DPDK) +License: ASL 2.0 +Supplements: %{name} + +%description dpdk +This provides ovs-vswitchd linked with DPDK library. +%endif +%endif + +%package doc +Summary: Documentation files for %{name} +Requires: %{name} = %{EVR} +BuildArch: noarch + +%description doc +The %{name}-doc package contains documentation files for %{name}. + +%prep +%autosetup -n %{name}-%{version} -p1 + +%build +rm -f python/ovs/dirs.py + +./boot.sh +mkdir build build-dpdk +pushd build +ln -s ../configure +%configure --disable-static --enable-shared --enable-ssl \ +%if %{with libcapng} + --enable-libcapng \ +%else + --disable-libcapng \ +%endif + --with-pkidir=%{_sharedstatedir}/openvswitch/pki +make %{?_smp_mflags} +popd +%if %{with dpdk} +pushd build-dpdk +ln -s ../configure +%configure --disable-static --enable-shared --enable-ssl \ +%if %{with libcapng} + --enable-libcapng \ +%else + --disable-libcapng \ +%endif + --with-dpdk=shared \ + --with-pkidir=%{_sharedstatedir}/openvswitch/pki \ + --libdir=%{_libdir}/openvswitch-dpdk \ + --program-suffix=.dpdk +make %{?_smp_mflags} +popd +%endif + +/usr/bin/python3 build-aux/dpdkstrip.py \ + --dpdk \ + < rhel/usr_lib_systemd_system_ovs-vswitchd.service.in \ + > rhel/usr_lib_systemd_system_ovs-vswitchd.service + +%install +rm -rf %{buildroot} + +%if %{with dpdk} +make -C build-dpdk install-exec DESTDIR=%{buildroot} + +rm -rf %{buildroot}%{_bindir} +find %{buildroot}%{_sbindir} -mindepth 1 -maxdepth 1 -not -name ovs-vswitchd.dpdk -delete +find %{buildroot}%{_libdir}/openvswitch-dpdk -mindepth 1 -maxdepth 1 -not -name "libofproto*.so.*" -not -name "libopenvswitch*.so.*" -delete +%endif + +make -C build install DESTDIR=%{buildroot} +mv %{buildroot}%{_sbindir}/ovs-vswitchd %{buildroot}%{_sbindir}/ovs-vswitchd.nodpdk +touch %{buildroot}%{_sbindir}/ovs-vswitchd + +install -d -m 0755 %{buildroot}%{_rundir}/openvswitch +install -d -m 0750 %{buildroot}%{_localstatedir}/log/openvswitch +install -d -m 0755 %{buildroot}%{_sysconfdir}/openvswitch + +install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/openvswitch.conf + +install -p -D -m 0644 rhel/usr_lib_udev_rules.d_91-vfio.rules \ + %{buildroot}%{_udevrulesdir}/91-vfio.rules + +install -p -D -m 0644 \ + rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \ + %{buildroot}/%{_sysconfdir}/sysconfig/openvswitch + +for service in openvswitch ovsdb-server ovs-vswitchd ovs-delete-transient-ports \ + openvswitch-ipsec; do + install -p -D -m 0644 \ + rhel/usr_lib_systemd_system_${service}.service \ + %{buildroot}%{_unitdir}/${service}.service +done + +install -m 0755 rhel/etc_init.d_openvswitch \ + %{buildroot}%{_datadir}/openvswitch/scripts/openvswitch.init + +install -p -D -m 0644 rhel/etc_openvswitch_default.conf \ + %{buildroot}/%{_sysconfdir}/openvswitch/default.conf + +install -p -D -m 0644 rhel/etc_logrotate.d_openvswitch \ + %{buildroot}/%{_sysconfdir}/logrotate.d/openvswitch + +install -m 0644 vswitchd/vswitch.ovsschema \ + %{buildroot}/%{_datadir}/openvswitch/vswitch.ovsschema + +install -d -m 0755 %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/ +install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifdown-ovs \ + %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs +install -p -m 0755 rhel/etc_sysconfig_network-scripts_ifup-ovs \ + %{buildroot}/%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs + +install -d -m 0755 %{buildroot}%{python3_sitelib} +cp -a %{buildroot}/%{_datadir}/openvswitch/python/ovstest \ + %{buildroot}%{python3_sitelib} + +pushd python +( +export CPPFLAGS="-I ../include" +export LDFLAGS="%{__global_ldflags} -L %{buildroot}%{_libdir}" +%py3_build +%py3_install +[ -f "%{buildroot}/%{python3_sitearch}/ovs/_json$(python3-config --extension-suffix)" ] +) +popd + +rm -rf %{buildroot}/%{_datadir}/openvswitch/python/ + +install -d -m 0755 %{buildroot}/%{_sharedstatedir}/openvswitch + +install -d -m 0755 %{buildroot}%{_prefix}/lib/firewalld/services/ + +install -p -D -m 0755 \ + rhel/usr_share_openvswitch_scripts_ovs-systemd-reload \ + %{buildroot}%{_datadir}/openvswitch/scripts/ovs-systemd-reload + +touch %{buildroot}%{_sysconfdir}/openvswitch/conf.db +touch %{buildroot}%{_sysconfdir}/openvswitch/system-id.conf + +rm -f %{buildroot}/%{_bindir}/ovs-benchmark \ + %{buildroot}/%{_bindir}/ovs-docker \ + %{buildroot}/%{_bindir}/ovs-parse-backtrace \ + %{buildroot}/%{_sbindir}/ovs-vlan-bug-workaround \ + %{buildroot}/%{_mandir}/man1/ovs-benchmark.1* \ + %{buildroot}/%{_mandir}/man8/ovs-vlan-bug-workaround.8* + +rm -f %{buildroot}%{_bindir}/ovn* +rm -f %{buildroot}%{_mandir}/man1/ovn* +rm -f %{buildroot}%{_mandir}/man5/ovn* +rm -f %{buildroot}%{_mandir}/man7/ovn* +rm -f %{buildroot}%{_mandir}/man8/ovn* +rm -f %{buildroot}%{_datadir}/openvswitch/ovn* +rm -f %{buildroot}%{_datadir}/openvswitch/scripts/ovn* +rm -f %{buildroot}%{_includedir}/ovn/* +rm -rf %{buildroot}/%{_libdir}/*.a +%generate_compatibility_deps + +%check +for dir in build \ +%if %{with dpdk} +%ifarch %{dpdkarches} +build-dpdk \ +%endif +%endif +; do +pushd $dir +%if %{with check} + touch resolv.conf + export OVS_RESOLV_CONF=$(pwd)/resolv.conf + if make check TESTSUITEFLAGS='%{_smp_mflags}' || + make check TESTSUITEFLAGS='--recheck' || + make check TESTSUITEFLAGS='--recheck'; then :; + else + cat tests/testsuite.log + exit 1 + fi +%endif +%if %{with check_datapath_kernel} + if make check-kernel RECHECK=yes; then :; + else + cat tests/system-kmod-testsuite.log + exit 1 + fi +%endif +popd +done + +%preun +%if 0%{?systemd_preun:1} + %systemd_preun %{name}.service +%else + if [ $1 -eq 0 ] ; then + /bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || : + /bin/systemctl stop %{name}.service >/dev/null 2>&1 || : + fi +%endif + +%pre +%sysusers_create_compat %{SOURCE1} + +%post +%{_sbindir}/update-alternatives --install %{_sbindir}/ovs-vswitchd \ + ovs-vswitchd %{_sbindir}/ovs-vswitchd.nodpdk 10 +if [ $1 -eq 1 ]; then + sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch + + sed -i \ + 's@OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:hugetlbfs"@'\ + /etc/sysconfig/openvswitch +fi +chown -R openvswitch:openvswitch /etc/openvswitch + +%if 0%{?systemd_post:1} + %systemd_post %{name}.service +%else + # Package install, not upgrade + if [ $1 -eq 1 ]; then + /bin/systemctl daemon-reload >dev/null || : + fi +%endif + +%postun +if [ $1 -eq 0 ] ; then + %{_sbindir}/update-alternatives --remove ovs-vswitchd %{_sbindir}/ovs-vswitchd.nodpdk +fi +%if 0%{?systemd_postun:1} + %systemd_postun %{name}.service +%else + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +%endif + +%if %{with dpdk} +%ifarch %{dpdkarches} +%post dpdk +if fgrep -qw sse4_1 /proc/cpuinfo; then + priority=20 +else + echo "Warning: the CPU doesn't support SSE 4.1, dpdk support is not enabled." >&2 + priority=5 +fi +%{_sbindir}/update-alternatives --install %{_sbindir}/ovs-vswitchd \ + ovs-vswitchd %{_sbindir}/ovs-vswitchd.dpdk $priority + +%postun dpdk +if [ $1 -eq 0 ] ; then + %{_sbindir}/update-alternatives --remove ovs-vswitchd %{_sbindir}/ovs-vswitchd.dpdk +fi +%endif +%endif + +%files +%defattr(-,openvswitch,openvswitch) +%license LICENSE +%dir %{_sysconfdir}/openvswitch +%{_sysconfdir}/openvswitch/default.conf +%config %ghost %verify(not owner group md5 size mtime) %{_sysconfdir}/openvswitch/conf.db +%ghost %attr(0600,-,-) %verify(not owner group md5 size mtime) %{_sysconfdir}/openvswitch/.conf.db.~lock~ +%config %ghost %{_sysconfdir}/openvswitch/system-id.conf +%defattr(-,root,root) +%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/sysconfig/openvswitch +%{_sysconfdir}/bash_completion.d/ovs-appctl-bashcomp.bash +%{_sysconfdir}/bash_completion.d/ovs-vsctl-bashcomp.bash +%config(noreplace) %{_sysconfdir}/logrotate.d/openvswitch +%{_unitdir}/openvswitch.service +%{_unitdir}/ovsdb-server.service +%{_unitdir}/ovs-vswitchd.service +%{_unitdir}/ovs-delete-transient-ports.service +%{_datadir}/openvswitch/scripts/openvswitch.init +%{_datadir}/openvswitch/scripts/ovs-lib +%{_datadir}/openvswitch/scripts/ovs-save +%{_datadir}/openvswitch/scripts/ovs-ctl +%{_datadir}/openvswitch/scripts/ovs-kmod-ctl +%{_datadir}/openvswitch/scripts/ovs-systemd-reload +%config %{_datadir}/openvswitch/local-config.ovsschema +%config %{_datadir}/openvswitch/vswitch.ovsschema +%config %{_datadir}/openvswitch/vtep.ovsschema +%{_bindir}/ovs-appctl +%{_bindir}/ovs-dpctl +%{_bindir}/ovs-ofctl +%{_bindir}/ovs-vsctl +%{_bindir}/ovsdb-client +%{_bindir}/ovsdb-tool +%{_bindir}/ovs-pki +%{_bindir}/vtep-ctl +%{_libdir}/*.so.* +%ghost %{_sbindir}/ovs-vswitchd +%{_sbindir}/ovs-vswitchd.nodpdk +%{_sbindir}/ovsdb-server +%{_mandir}/man1/ovsdb-client.1* +%{_mandir}/man1/ovsdb-server.1* +%{_mandir}/man1/ovsdb-tool.1* +%{_mandir}/man5/ovsdb.5* +%{_mandir}/man5/ovsdb.local-config.5* +%{_mandir}/man5/ovsdb-server.5.* +%{_mandir}/man5/ovs-vswitchd.conf.db.5* +%{_mandir}/man5/vtep.5* +%{_mandir}/man7/ovsdb-server.7* +%{_mandir}/man7/ovsdb.7* +%{_mandir}/man7/ovs-actions.7* +%{_mandir}/man7/ovs-fields.7* +%{_mandir}/man8/vtep-ctl.8* +%{_mandir}/man8/ovs-appctl.8* +%{_mandir}/man8/ovs-ctl.8* +%{_mandir}/man8/ovs-dpctl.8* +%{_mandir}/man8/ovs-kmod-ctl.8.* +%{_mandir}/man8/ovs-ofctl.8* +%{_mandir}/man8/ovs-pki.8* +%{_mandir}/man8/ovs-vsctl.8* +%{_mandir}/man8/ovs-vswitchd.8* +%{_mandir}/man8/ovs-parse-backtrace.8* +%{_udevrulesdir}/91-vfio.rules +/var/lib/openvswitch +%attr(750,openvswitch,openvswitch) %verify(not owner group) /var/log/openvswitch +%ghost %attr(755,root,root) %verify(not owner group) %{_rundir}/openvswitch +%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs +%{_sysconfdir}/sysconfig/network-scripts/ifdown-ovs +%{_sysusersdir}/openvswitch.conf +%dir %{abidir} +%{abidir}/lib*.dump +%{abidir}/ovs-appctl-option.list +%{abidir}/ovs-dpctl-option.list +%{abidir}/ovs-ofctl-option.list +%{abidir}/ovs-pki-option.list +%{abidir}/ovs-vsctl-option.list +%{abidir}/ovs-vswitchd.nodpdk-option.list +%{abidir}/ovsdb-client-option.list +%{abidir}/ovsdb-server-option.list +%{abidir}/ovsdb-tool-option.list +%{abidir}/vtep-ctl-option.list + +%files -n python3-openvswitch +%license LICENSE +%{python3_sitearch}/ovs +%{python3_sitearch}/ovs-*.egg-info +%{_datadir}/openvswitch/bugtool-plugins/ +%{_datadir}/openvswitch/scripts/ovs-bugtool-* +%{_datadir}/openvswitch/scripts/ovs-check-dead-ifs +%{_datadir}/openvswitch/scripts/ovs-vtep +%{_bindir}/ovs-dpctl-top +%{_sbindir}/ovs-bugtool +%{_mandir}/man8/ovs-dpctl-top.8* +%{_mandir}/man8/ovs-bugtool.8* +%{abidir}/ovs-dpctl-top-option.list +%{abidir}/_json.cpython-*-gnu.dump +%{abidir}/ovs-bugtool-option.list + +%files test +%{_bindir}/ovs-pcap +%{_bindir}/ovs-tcpdump +%{_bindir}/ovs-tcpundump +%{_mandir}/man1/ovs-pcap.1* +%{_mandir}/man8/ovs-tcpdump.8* +%{_mandir}/man1/ovs-tcpundump.1* +%{_bindir}/ovs-test +%{_bindir}/ovs-vlan-test +%{_bindir}/ovs-l3ping +%{_mandir}/man8/ovs-test.8* +%{_mandir}/man8/ovs-vlan-test.8* +%{_mandir}/man8/ovs-l3ping.8* +%{python3_sitelib}/ovstest +%{abidir}/ovs-pcap-option.list +%{abidir}/ovs-tcpundump-option.list +%{abidir}/ovs-vlan-test-option.list + +%files testcontroller +%{_bindir}/ovs-testcontroller +%{_mandir}/man8/ovs-testcontroller.8* +%{abidir}/ovs-testcontroller-option.list + +%files devel +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc +%{_includedir}/openvswitch/* +%{_includedir}/openflow/* + +%files -n network-scripts-%{name} +%{_sysconfdir}/sysconfig/network-scripts/ifup-ovs + +%files ipsec +%{_datadir}/openvswitch/scripts/ovs-monitor-ipsec +%{_unitdir}/openvswitch-ipsec.service + +%if %{with dpdk} +%ifarch %{dpdkarches} +%files dpdk +%{_libdir}/openvswitch-dpdk/ +%ghost %{_sbindir}/ovs-vswitchd +%{_sbindir}/ovs-vswitchd.dpdk +%endif +%endif + +%files doc +%doc NOTICE README.rst NEWS + +%changelog +* Tue Apr 18 2023 happy_orange -2.17.6-1 +- init package diff --git a/openvswitch.sysusers b/openvswitch.sysusers new file mode 100644 index 0000000000000000000000000000000000000000..9a464c21ad56dea14628a57bd50b60e1104c7bef --- /dev/null +++ b/openvswitch.sysusers @@ -0,0 +1,3 @@ +#Type Name ID GECOS Home directory Shell +u openvswitch - "Open vSwitch Daemons" / /sbin/nologin +m openvswitch hugetlbfs