142fa3
# service legacy actions
142fa3
%define legacy_actions %{_libexecdir}/initscripts/legacy-actions
142fa3
142fa3
Name:             ipset
142fa3
Version:          7.1
142fa3
Release:          1%{?dist}
142fa3
Summary:          Manage Linux IP sets
142fa3
142fa3
License:          GPLv2
142fa3
URL:              http://ipset.netfilter.org/
142fa3
Source0:          http://ipset.netfilter.org/%{name}-%{version}.tar.bz2
142fa3
Source1:          %{name}.service
142fa3
Source2:          %{name}.start-stop
142fa3
Source3:          %{name}-config
142fa3
Source4:          %{name}.save-legacy
142fa3
142fa3
BuildRequires:    libmnl-devel
142fa3
142fa3
# An explicit requirement is needed here, to avoid cases where a user would
142fa3
# explicitly update only one of the two (e.g 'yum update ipset')
142fa3
Requires:         %{name}-libs%{?_isa} = %{version}-%{release}
142fa3
142fa3
%description
142fa3
IP sets are a framework inside the Linux kernel since version 2.4.x, which can
142fa3
be administered by the ipset utility. Depending on the type, currently an IP
142fa3
set may store IP addresses, (TCP/UDP) port numbers or IP addresses with MAC
142fa3
addresses in a way, which ensures lightning speed when matching an entry
142fa3
against a set.
142fa3
142fa3
If you want to:
142fa3
 - store multiple IP addresses or port numbers and match against the collection
142fa3
   by iptables at one swoop;
142fa3
 - dynamically update iptables rules against IP addresses or ports without
142fa3
   performance penalty;
142fa3
 - express complex IP address and ports based rulesets with one single iptables
142fa3
   rule and benefit from the speed of IP sets
142fa3
then ipset may be the proper tool for you.
142fa3
142fa3
142fa3
%package libs
142fa3
Summary:       Shared library providing the IP sets functionality
142fa3
142fa3
%description libs
142fa3
This package contains the libraries which provide the IP sets funcionality.
142fa3
142fa3
142fa3
%package devel
142fa3
Summary:       Development files for %{name}
142fa3
Requires:      %{name}-libs%{?_isa} == %{version}-%{release}
142fa3
Requires:      kernel-devel
142fa3
142fa3
%description devel
142fa3
This package contains the files required to develop software using the %{name}
142fa3
libraries.
142fa3
142fa3
142fa3
%package service
142fa3
Summary:          %{name} service for %{name}s
142fa3
Requires:         %{name} = %{version}-%{release}
142fa3
BuildRequires:    systemd
142fa3
Requires:         iptables-services
142fa3
Requires(post):   systemd
142fa3
Requires(preun):  systemd
142fa3
Requires(postun): systemd
142fa3
BuildArch:        noarch
142fa3
142fa3
%description service
142fa3
This package provides the service %{name} that is split
142fa3
out of the base package since it is not active by default.
142fa3
142fa3
142fa3
%prep
142fa3
%setup -q
142fa3
142fa3
142fa3
%build
142fa3
%configure --enable-static=no --with-kmod=no
142fa3
142fa3
# Just to make absolutely sure we are not building the bundled kernel module
142fa3
# I have to do it after the configure run unfortunately
142fa3
rm -fr kernel
142fa3
142fa3
# Prevent libtool from defining rpath
142fa3
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
142fa3
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
142fa3
142fa3
make %{?_smp_mflags}
142fa3
142fa3
142fa3
%install
142fa3
make install DESTDIR=%{buildroot}
142fa3
find %{buildroot} -name '*.la' -exec rm -f '{}' \;
142fa3
142fa3
# install systemd unit file
142fa3
install -d -m 755 %{buildroot}/%{_unitdir}
142fa3
install -c -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}
142fa3
142fa3
# install supporting script
142fa3
install -d -m 755 %{buildroot}%{_libexecdir}/%{name}
142fa3
install -c -m 755 %{SOURCE2} %{buildroot}%{_libexecdir}/%{name}
142fa3
142fa3
# install ipset-config
142fa3
install -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig
142fa3
install -c -m 600 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name}-config
142fa3
142fa3
# install legacy actions for service command
142fa3
install -d %{buildroot}/%{legacy_actions}/ipset
142fa3
install -c -m 755 %{SOURCE4} %{buildroot}/%{legacy_actions}/ipset/save
142fa3
142fa3
# Create directory for configuration
142fa3
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
142fa3
142fa3
142fa3
%preun
142fa3
if [[ $1 -eq 0 && -n $(lsmod | grep "^xt_set ") ]]; then
142fa3
    rmmod xt_set 2>/dev/null
142fa3
    [[ $? -ne 0 ]] && echo Current iptables configuration requires ipsets && exit 1
142fa3
fi
142fa3
142fa3
142fa3
%post libs -p /sbin/ldconfig
142fa3
142fa3
%postun libs -p /sbin/ldconfig
142fa3
142fa3
142fa3
%post service
142fa3
%systemd_post %{name}.service
142fa3
142fa3
%preun service
142fa3
if [[ $1 -eq 0 && -n $(lsmod | grep "^xt_set ") ]]; then
142fa3
    rmmod xt_set 2>/dev/null
142fa3
    [[ $? -ne 0 ]] && echo Current iptables configuration requires ipsets && exit 1
142fa3
fi
142fa3
%systemd_preun %{name}.service
142fa3
142fa3
%postun service
142fa3
%systemd_postun_with_restart %{name}.service
142fa3
142fa3
%triggerin service -- ipset-service < 6.38-1.el7
142fa3
# Before 6.38-1, ipset.start-stop keeps a backup of previously saved sets, but
142fa3
# doesn't touch the /etc/sysconfig/ipset.d/.saved flag. Remove the backup on
142fa3
# upgrade, so that we use the current version of saved sets
142fa3
rm -f /etc/sysconfig/ipset.save || :
142fa3
exit 0
142fa3
142fa3
%triggerun service -- ipset-service < 6.38-1.el7
142fa3
# Up to 6.29-1, ipset.start-stop uses a single data file
142fa3
for f in /etc/sysconfig/ipset.d/*; do
142fa3
    [ "${f}" = "/etc/sysconfig/ipset.d/*" ] && break
142fa3
    cat ${f} >> /etc/sysconfig/ipset || :
142fa3
done
142fa3
exit 0
142fa3
142fa3
%files
142fa3
%doc COPYING ChangeLog
142fa3
%doc %{_mandir}/man8/%{name}.8.gz
142fa3
%{_sbindir}/%{name}
142fa3
142fa3
%files libs
142fa3
%doc COPYING
142fa3
%{_libdir}/lib%{name}.so.13*
142fa3
%doc %{_mandir}/man3/lib%{name}.3.gz
142fa3
142fa3
%files devel
142fa3
%{_includedir}/lib%{name}
142fa3
%{_libdir}/lib%{name}.so
142fa3
%{_libdir}/pkgconfig/lib%{name}.pc
142fa3
142fa3
%files service
142fa3
%{_unitdir}/%{name}.service
142fa3
%dir %{_libexecdir}/%{name}
142fa3
%config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/ipset-config
142fa3
%ghost %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/ipset
142fa3
%attr(0755,root,root) %{_libexecdir}/%{name}/%{name}.start-stop
142fa3
%dir %{legacy_actions}/ipset
142fa3
%{legacy_actions}/ipset/save
142fa3
142fa3
142fa3
%changelog
142fa3
* Sun Feb 24 2019 Stefano Brivio <sbrivio@redhat.com> - 7.1-1
142fa3
- Rebase to 7.1 (RHBZ#1649080):
142fa3
  - Add compatibility support for strscpy()
142fa3
  - Correct the manpage about the sort option
142fa3
  - Add missing functions to libipset.map
142fa3
  - configure.ac: Fix build regression on RHEL/CentOS/SL (Serhey Popovych)
142fa3
  - Implement sorting for hash types in the ipset tool
142fa3
  - Fix to list/save into file specified by option (reported by Isaac Good)
142fa3
  - Introduction of new commands and protocol version 7, updated kernel include files
142fa3
  - Add compatibility support for async in pernet_operations
142fa3
  - Use more robust awk patterns to check for backward compatibility
142fa3
  - Prepare the ipset tool to handle multiple protocol version
142fa3
  - Fix warning message handlin
142fa3
  - Correct to test null valued entry in hash:net6,port,net6 test
142fa3
  - Library reworked to support embedding ipset completely
142fa3
  - Add compatibility to support kvcalloc()
142fa3
  - Validate string type attributes in attr2data() (Stefano Brivio)
142fa3
  - manpage: Add comment about matching on destination MAC address (Stefano Brivio)
142fa3
    (RHBZ#1649079)
142fa3
  - Add compatibility to support is_zero_ether_addr()
142fa3
  - Fix use-after-free in ipset_parse_name_compat() (Stefano Brivio) (RHBZ#1649073)
142fa3
  - Fix leak in build_argv() on line parsing error (Stefano Brivio) (RHBZ#1649073)
142fa3
  - Simplify return statement in ipset_mnl_query() (Stefano Brivio) (RHBZ#1649073)
142fa3
  - tests/check_klog.sh: Try dmesg too, don't let shell terminate script (Stefano Brivio) 
142fa3
- Fixes:
142fa3
  - Fix all shellcheck warnings in init script (RHBZ#1649073)
142fa3
  - Make error reporting consistent, introduce different severities (RHBZ#1649877)
142fa3
  - While restoring, on invalid entries, remove them and retry (RHBZ#1650297)
142fa3
  - Fix covscan SC2166 warning in init script (RHBZ#1649073)
142fa3
  - Hardcode triggerin, triggerun versions for ipset-service (RHBZ#1646666)
142fa3
142fa3
* Tue Nov 06 2018 Stefano Brivio <sbrivio@redhat.com> - 6.38-3
142fa3
- Fix loading of sets with dependencies on other sets (RHBZ#1646666)
142fa3
142fa3
* Wed Jun 27 2018 Stefano Brivio <sbrivio@redhat.com> - 6.38-2
142fa3
- Fix upgrade and downgrade triggers in specfile (RHBZ#1594722)
142fa3
142fa3
* Mon Apr 16 2018 Stefano Brivio <sbrivio@redhat.com> - 6.38-1
142fa3
- Rebase to 6.38 (RHBZ#1557600):
142fa3
  - hash:ipmac type support added to ipset, userspace part (Tomasz Chilinski)
142fa3
- Refactor /etc/sysconfig/ipset.start-stop
142fa3
- Fixes:
142fa3
  - IPSet Service Monolithic Operation (RHBZ#1440741)
142fa3
  - "systemctl start ipset" doesn't handle existing ipset's having counters
142fa3
    (RHBZ#1502212)
142fa3
142fa3
* Wed Feb  1 2017 Thomas Woerner <twoerner@redhat.com> - 6.29-1
142fa3
- Rebase to 6.29 (RHBZ#1351299)
142fa3
- Fixes:
142fa3
  - Backport ipset capability to run in namespaces (RHBZ#1226051)
142fa3
  - Fix service save with empty ipset list and existing ipset save file
142fa3
    (RHBZ#1377621)
142fa3
  - Fix internal error at printing to output buffer (RHBZ#1395865)
142fa3
142fa3
* Wed Aug 17 2016 Thomas Woerner <twoerner@redhat.com> - 6.19-6
142fa3
- Use /etc/sysconfig/ipset-config in service as EnvironmentFile (RHBZ#1136257)
142fa3
- Use /etc/sysconfig/ipset for data as in RHEL-6 (RHBZ#1136257)
142fa3
- No save on reload, but legacy save action (RHBZ#1136257)
142fa3
142fa3
* Wed Jun 29 2016 Thomas Woerner <twoerner@redhat.com> - 6.19-5
142fa3
- New service sub package to provide the ipset service (RHBZ#1136257)
142fa3
  Service and start-stop script from F-24
142fa3
- Fixed ipset package summary (RHBZ#1195171)
142fa3
  Spec file derived from F-24
142fa3
142fa3
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 6.19-4
142fa3
- Mass rebuild 2014-01-24
142fa3
142fa3
* Tue Jan 14 2014 Thomas Woerner <twoerner@redhat.com> - 6.19-3
142fa3
- fixed failed rmdiff testing (RHBZ#884500)
142fa3
142fa3
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 6.19-2
142fa3
- Mass rebuild 2013-12-27
142fa3
142fa3
* Thu Aug 15 2013 Mathieu Bridon <bochecha@fedoraproject.org> - 6.19
142fa3
- New upstream release.
142fa3
142fa3
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.16.1-3
142fa3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
142fa3
142fa3
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.16.1-2
142fa3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
142fa3
142fa3
* Wed Sep 26 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.16.1-1
142fa3
- New upstream release.
142fa3
- Fix a requirement.
142fa3
142fa3
* Wed Sep 26 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.14-1
142fa3
- New upstream release.
142fa3
- Fix scriptlets, ldconfig is needed for the libs subpackage, not the main one.
142fa3
142fa3
* Mon Jul 30 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.13-1
142fa3
- New upstream release.
142fa3
- Split out the library in its own subpackage.
142fa3
142fa3
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.11-2
142fa3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
142fa3
142fa3
* Mon Feb 06 2012 Mathieu Bridon <bochecha@fedoraproject.org> - 6.11-1
142fa3
- New upstream release.
142fa3
- Removed our patch, it has been integrated upstream. As such, we also don't
142fa3
  need to re-run autoreconf any more.
142fa3
142fa3
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.9.1-3
142fa3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
142fa3
142fa3
* Fri Sep 16 2011 Mathieu Bridon <bochecha@fedoraproject.org> - 6.9.1-2
142fa3
- Some fixes based on Pierre-Yves' review feedback.
142fa3
142fa3
* Wed Sep 14 2011 Mathieu Bridon <bochecha@fedoraproject.org> - 6.9.1-1
142fa3
- Initial packaging.