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