72e637
# service legacy actions
72e637
%define legacy_actions %{_libexecdir}/initscripts/legacy-actions
72e637
72e637
Name:             ipset
72e637
Version:          7.1
72e637
Release:          1%{?dist}
72e637
Summary:          Manage Linux IP sets
72e637
72e637
License:          GPLv2
72e637
URL:              http://ipset.netfilter.org/
72e637
Source0:          http://ipset.netfilter.org/%{name}-%{version}.tar.bz2
72e637
Source1:          %{name}.service
72e637
Source2:          %{name}.start-stop
72e637
Source3:          %{name}-config
72e637
Source4:          %{name}.save-legacy
72e637
72e637
BuildRequires:    libmnl-devel
72e637
72e637
# An explicit requirement is needed here, to avoid cases where a user would
72e637
# explicitly update only one of the two (e.g 'yum update ipset')
72e637
Requires:         %{name}-libs%{?_isa} = %{version}-%{release}
72e637
72e637
%description
72e637
IP sets are a framework inside the Linux kernel since version 2.4.x, which can
72e637
be administered by the ipset utility. Depending on the type, currently an IP
72e637
set may store IP addresses, (TCP/UDP) port numbers or IP addresses with MAC
72e637
addresses in a way, which ensures lightning speed when matching an entry
72e637
against a set.
72e637
72e637
If you want to:
72e637
 - store multiple IP addresses or port numbers and match against the collection
72e637
   by iptables at one swoop;
72e637
 - dynamically update iptables rules against IP addresses or ports without
72e637
   performance penalty;
72e637
 - express complex IP address and ports based rulesets with one single iptables
72e637
   rule and benefit from the speed of IP sets
72e637
then ipset may be the proper tool for you.
72e637
72e637
72e637
%package libs
72e637
Summary:       Shared library providing the IP sets functionality
72e637
72e637
%description libs
72e637
This package contains the libraries which provide the IP sets funcionality.
72e637
72e637
72e637
%package devel
72e637
Summary:       Development files for %{name}
72e637
Requires:      %{name}-libs%{?_isa} == %{version}-%{release}
72e637
72e637
%description devel
72e637
This package contains the files required to develop software using the %{name}
72e637
libraries.
72e637
72e637
72e637
%package service
72e637
Summary:          %{name} service for %{name}s
72e637
Requires:         %{name} = %{version}-%{release}
72e637
BuildRequires:    systemd
72e637
Requires:         iptables-services
72e637
Requires(post):   systemd
72e637
Requires(preun):  systemd
72e637
Requires(postun): systemd
72e637
BuildArch:        noarch
72e637
72e637
%description service
72e637
This package provides the service %{name} that is split
72e637
out of the base package since it is not active by default.
72e637
72e637
72e637
%prep
72e637
%setup -q
72e637
72e637
72e637
%build
72e637
%configure --enable-static=no --with-kmod=no
72e637
72e637
# Just to make absolutely sure we are not building the bundled kernel module
72e637
# I have to do it after the configure run unfortunately
72e637
rm -fr kernel
72e637
72e637
# Prevent libtool from defining rpath
72e637
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
72e637
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
72e637
72e637
make %{?_smp_mflags}
72e637
72e637
72e637
%install
72e637
make install DESTDIR=%{buildroot}
72e637
find %{buildroot} -name '*.la' -exec rm -f '{}' \;
72e637
72e637
# install systemd unit file
72e637
install -d -m 755 %{buildroot}/%{_unitdir}
72e637
install -c -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}
72e637
72e637
# install supporting script
72e637
install -d -m 755 %{buildroot}%{_libexecdir}/%{name}
72e637
install -c -m 755 %{SOURCE2} %{buildroot}%{_libexecdir}/%{name}
72e637
72e637
# install ipset-config
72e637
install -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig
72e637
install -c -m 600 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name}-config
72e637
72e637
# install legacy actions for service command
72e637
install -d %{buildroot}/%{legacy_actions}/ipset
72e637
install -c -m 755 %{SOURCE4} %{buildroot}/%{legacy_actions}/ipset/save
72e637
72e637
# Create directory for configuration
72e637
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
72e637
72e637
72e637
%preun
72e637
if [[ $1 -eq 0 && -n $(lsmod | grep "^xt_set ") ]]; then
72e637
    rmmod xt_set 2>/dev/null
72e637
    [[ $? -ne 0 ]] && echo Current iptables configuration requires ipsets && exit 1
72e637
fi
72e637
72e637
72e637
%post libs -p /sbin/ldconfig
72e637
72e637
%postun libs -p /sbin/ldconfig
72e637
72e637
72e637
%post service
72e637
%systemd_post %{name}.service
72e637
72e637
%preun service
72e637
if [[ $1 -eq 0 && -n $(lsmod | grep "^xt_set ") ]]; then
72e637
    rmmod xt_set 2>/dev/null
72e637
    [[ $? -ne 0 ]] && echo Current iptables configuration requires ipsets && exit 1
72e637
fi
72e637
%systemd_preun %{name}.service
72e637
72e637
%postun service
72e637
%systemd_postun_with_restart %{name}.service
72e637
72e637
%triggerin service -- ipset-service < 6.38-1.el7
72e637
# Before 6.38-1, ipset.start-stop keeps a backup of previously saved sets, but
72e637
# doesn't touch the /etc/sysconfig/ipset.d/.saved flag. Remove the backup on
72e637
# upgrade, so that we use the current version of saved sets
72e637
rm -f /etc/sysconfig/ipset.save || :
72e637
exit 0
72e637
72e637
%triggerun service -- ipset-service < 6.38-1.el7
72e637
# Up to 6.29-1, ipset.start-stop uses a single data file
72e637
for f in /etc/sysconfig/ipset.d/*; do
72e637
    [ "${f}" = "/etc/sysconfig/ipset.d/*" ] && break
72e637
    cat ${f} >> /etc/sysconfig/ipset || :
72e637
done
72e637
exit 0
72e637
72e637
%files
72e637
%doc COPYING ChangeLog
72e637
%doc %{_mandir}/man8/%{name}.8.gz
72e637
%{_sbindir}/%{name}
72e637
72e637
%files libs
72e637
%doc COPYING
72e637
%{_libdir}/lib%{name}.so.13*
72e637
%doc %{_mandir}/man3/lib%{name}.3.gz
72e637
72e637
%files devel
72e637
%{_includedir}/lib%{name}
72e637
%{_libdir}/lib%{name}.so
72e637
%{_libdir}/pkgconfig/lib%{name}.pc
72e637
72e637
%files service
72e637
%{_unitdir}/%{name}.service
72e637
%dir %{_libexecdir}/%{name}
72e637
%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/ipset-config
72e637
%ghost %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/ipset
72e637
%attr(0755,root,root) %{_libexecdir}/%{name}/%{name}.start-stop
72e637
%dir %{legacy_actions}/ipset
72e637
%{legacy_actions}/ipset/save
72e637
72e637
72e637
%changelog
72e637
* Sun May 26 2019 Stefano Brivio <sbrivio@redhat.com> - 7.1-1
72e637
- Rebase to 7.1 (RHBZ#1649090):
72e637
  - Add compatibility support for strscpy()
72e637
  - Correct the manpage about the sort option
72e637
  - Add missing functions to libipset.map
72e637
  - configure.ac: Fix build regression on RHEL/CentOS/SL (Serhey Popovych)
72e637
  - Implement sorting for hash types in the ipset tool
72e637
  - Fix to list/save into file specified by option (reported by Isaac Good)
72e637
  - Introduction of new commands and protocol version 7, updated kernel include files
72e637
  - Add compatibility support for async in pernet_operations
72e637
  - Use more robust awk patterns to check for backward compatibility
72e637
  - Prepare the ipset tool to handle multiple protocol version
72e637
  - Fix warning message handlin
72e637
  - Correct to test null valued entry in hash:net6,port,net6 test
72e637
  - Library reworked to support embedding ipset completely
72e637
  - Add compatibility to support kvcalloc()
72e637
  - Validate string type attributes in attr2data() (Stefano Brivio)
72e637
  - manpage: Add comment about matching on destination MAC address (Stefano Brivio)
72e637
    (RHBZ#1649079)
72e637
  - Add compatibility to support is_zero_ether_addr()
72e637
  - Fix use-after-free in ipset_parse_name_compat() (Stefano Brivio) (RHBZ#1649085)
72e637
  - Fix leak in build_argv() on line parsing error (Stefano Brivio) (RHBZ#1649085)
72e637
  - Simplify return statement in ipset_mnl_query() (Stefano Brivio) (RHBZ#1649085)
72e637
  - tests/check_klog.sh: Try dmesg too, don't let shell terminate script (Stefano Brivio) 
72e637
- Fixes:
72e637
  - Fix all shellcheck warnings in init script (RHBZ#1649085)
72e637
  - Make error reporting consistent, introduce different severities (RHBZ#1683711)
72e637
  - While restoring, on invalid entries, remove them and retry (RHBZ#1683713)
72e637
  - Fix covscan SC2166 warning in init script (RHBZ#1649085)
72e637
72e637
* Tue Nov 13 2018 Stefano Brivio <sbrivio@redhat.com> - 6.38-3
72e637
- Fix loading of sets with dependencies on other sets (RHBZ#1647096), and
72e637
  hardcode 6.38-1.el7 for ipset-service upgrade and downgrade triggers, so that
72e637
  we don't run into issues with z-stream updates
72e637
72e637
* Mon Oct 08 2018 Stefano Brivio <sbrivio@redhat.com> - 6.38-2
72e637
- Drop ipset-devel dependency on kernel-devel (RHBZ#163175)
72e637
72e637
* Tue Aug 14 2018 Stefano Brivio <sbrivio@redhat.com> - 6.38-1
72e637
- Update to 6.38, source from RHEL7 6.38-2 (RHBZ#1615967)
72e637
72e637
* Mon Feb 12 2018 Eric Garver <egarver@redhat.com> - 6.35-3
72e637
- Patch for missing header file (RHBZ#1543596)
72e637
72e637
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 6.35-2
72e637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
72e637
72e637
* Mon Jan 08 2018 Nicolas Chauvet <kwizart@gmail.com> - 6.35-1
72e637
- Update to 6.35
72e637
72e637
* Mon Jul 31 2017 Nicolas Chauvet <kwizart@gmail.com> - 6.32-1
72e637
- Update to 6.32
72e637
72e637
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 6.29-4
72e637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
72e637
72e637
* Fri Apr 07 2017 Nicolas Chauvet <kwizart@gmail.com> - 6.29-3
72e637
- Userspace needs kernel-headers - rhbz#1420864
72e637
72e637
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 6.29-2
72e637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
72e637
72e637
* Mon Apr 18 2016 Thomas Woerner <twoerner@redhat.com> - 6.29-1
72e637
- New upstream version 6.29 (RHBZ#1317208)
72e637
  - Suppress unnecessary stderr in command loop for resize and list
72e637
  - Correction in comment test
72e637
  - Support chroot buildroots (reported by Jan Engelhardt)
72e637
  - Fix "configure" breakage due to pkg-config related changes
72e637
    (reported by Jan Engelhardt)
72e637
  - Support older pkg-config packages
72e637
  - Add bash completion to the install routine (Mart Frauenlob)
72e637
  - Fix misleading error message with comment extension
72e637
  - Test added to check 0.0.0.0/0,iface to be matched in hash:net,iface type
72e637
  - Fix link with libtool >= 2.4.4 (Olivier Blin)
72e637
72e637
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 6.27-2
72e637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
72e637
72e637
* Tue Nov 10 2015 Thomas Woerner <twoerner@redhat.com> - 6.27-1
72e637
- New upstream version 6.27 (RHBZ#1145913)
72e637
72e637
* Sat Oct 10 2015 Haïkel Guémar <hguemar@fedoraproject.org> - 6.26-1
72e637
- Upstream 6.26 (RHBZ#1145913)
72e637
72e637
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.22-2
72e637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
72e637
72e637
* Thu Sep 18 2014 Mathieu Bridon <bochecha@fedoraproject.org> - 6.22-1
72e637
- New upstream release.
72e637
72e637
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.21.1-4
72e637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
72e637
72e637
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.21.1-3
72e637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
72e637
72e637
* Tue Mar 11 2014 Mathieu Bridon <bochecha@fedoraproject.org> - 6.21.1-2
72e637
- Remove runtime requirement on the kernel.
72e637
  https://lists.fedoraproject.org/pipermail/devel/2014-March/196565.html
72e637
72e637
* Tue Oct 29 2013 Mathieu Bridon <bochecha@fedoraproject.org> - 6.20.1-1
72e637
- New upstream release.
72e637
72e637
* Tue Aug 27 2013 Quentin Armitage <quentin@armitage.org.uk> 6.19-2
72e637
- Add service pkg - adds save and reload functionality on shutdown/startup
72e637
- Add requires dependency of ipset on matching ipset-libs
72e637
72e637
* Thu Aug 15 2013 Mathieu Bridon <bochecha@fedoraproject.org> - 6.19-1
72e637
- New upstream release.
72e637
72e637
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.16.1-3
72e637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
72e637
72e637
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.16.1-2
72e637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
72e637
72e637
* Wed Sep 26 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.16.1-1
72e637
- New upstream release.
72e637
- Fix a requirement.
72e637
72e637
* Wed Sep 26 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.14-1
72e637
- New upstream release.
72e637
- Fix scriptlets, ldconfig is needed for the libs subpackage, not the main one.
72e637
72e637
* Mon Jul 30 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.13-1
72e637
- New upstream release.
72e637
- Split out the library in its own subpackage.
72e637
72e637
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.11-2
72e637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
72e637
72e637
* Mon Feb 06 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.11-1
72e637
- New upstream release.
72e637
- Removed our patch, it has been integrated upstream. As such, we also don't
72e637
  need to re-run autoreconf any more.
72e637
72e637
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.9.1-3
72e637
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
72e637
72e637
* Fri Sep 16 2011 Mathieu Bridon <bochecha@fedoraproject.org> - 6.9.1-2
72e637
- Some fixes based on Pierre-Yves' review feedback.
72e637
72e637
* Wed Sep 14 2011 Mathieu Bridon <bochecha@fedoraproject.org> - 6.9.1-1
72e637
- Initial packaging.