Skip to content

Instantly share code, notes, and snippets.

@bodgit
Last active August 31, 2015 12:17
Show Gist options
  • Save bodgit/92c9412ec648959d0da4 to your computer and use it in GitHub Desktop.
Save bodgit/92c9412ec648959d0da4 to your computer and use it in GitHub Desktop.
RPM spec for xtables-addons
diff -up xtables-addons-1.47.1/extensions/compat_xtables.c.orig xtables-addons-1.47.1/extensions/compat_xtables.c
--- xtables-addons-1.47.1/extensions/compat_xtables.c.orig 2015-04-16 22:48:40.467146548 +0100
+++ xtables-addons-1.47.1/extensions/compat_xtables.c 2015-04-16 22:48:51.849146108 +0100
@@ -626,13 +626,4 @@ int xtnu_ipv6_skip_exthdr(const struct s
EXPORT_SYMBOL_GPL(xtnu_ipv6_skip_exthdr);
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0) && defined(WITH_IPV6)
-int xtnu_ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
- int target, unsigned short *fragoff, int *fragflg)
-{
- return ipv6_find_hdr(skb, offset, target, fragoff);
-}
-EXPORT_SYMBOL_GPL(xtnu_ipv6_find_hdr);
-#endif
-
MODULE_LICENSE("GPL");
diff -up xtables-addons-1.47.1/extensions/compat_xtables.h.orig xtables-addons-1.47.1/extensions/compat_xtables.h
--- xtables-addons-1.47.1/extensions/compat_xtables.h.orig 2015-04-16 22:48:04.651147932 +0100
+++ xtables-addons-1.47.1/extensions/compat_xtables.h 2015-04-16 22:48:12.570147626 +0100
@@ -120,10 +120,6 @@
# define NIPQUAD_FMT "%u.%u.%u.%u"
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0)
-# define ipv6_find_hdr xtnu_ipv6_find_hdr
-#endif
-
#define ip_route_me_harder xtnu_ip_route_me_harder
#define skb_make_writable xtnu_skb_make_writable
#define xt_target xtnu_target
diff -up xtables-addons-1.47.1/mconfig.orig xtables-addons-1.47.1/mconfig
--- xtables-addons-1.47.1/mconfig.orig 2015-04-16 22:47:12.700149940 +0100
+++ xtables-addons-1.47.1/mconfig 2015-04-16 22:47:34.514149097 +0100
@@ -9,9 +9,9 @@ build_DNETMAP=m
build_ECHO=m
build_IPMARK=m
build_LOGMARK=m
-build_RAWNAT=m
+build_RAWNAT=n
build_STEAL=m
-build_SYSRQ=m
+build_SYSRQ=n
build_TARPIT=m
build_TEE=
build_condition=m
@@ -21,8 +21,8 @@ build_gradm=m
build_iface=m
build_ipp2p=m
build_ipv4options=m
-build_length2=m
+build_length2=n
build_lscan=m
build_pknock=m
-build_psd=m
+build_psd=n
build_quota2=m
Name: xtables-addons
%if 0%{?rhel} < 7
Version: 1.47.1
%else
Version: 2.6
%endif
Release: 1%{?dist}
Summary: Additional packet filter extensions
Group: System Environment/Base
License: GPLv2
URL: http://xtables-addons.sourceforge.net
Source0: %{name}-%{version}.tar.xz
Patch0: %{name}-1.47.1-el6.patch
BuildRequires: iptables-devel
Requires: iptables, wget, %{name}-dkms = %{version}-%{release}
%description
xtables-addons is a set of additional extensions for the packet filter present
in the Linux kernel.
%package dkms
Summary: Kernel module package for %{name}
Group: System Environment/Kernel
Requires: dkms
%description dkms
xtables-addons DKMS kernel modules.
%package devel
Summary: Development package for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
xtables-addons development headers and libraries.
%prep
%setup -q
%if 0%{?rhel} < 7
%patch0 -p1
%endif
%build
%configure --without-kbuild
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
%{__rm} %{buildroot}%{_libdir}/libxt_ACCOUNT_cl.la
%{__mkdir_p} %{buildroot}%{_includedir}
%{__cp} extensions/ACCOUNT/libxt_ACCOUNT_cl.h %{buildroot}%{_includedir}
%{__cp} extensions/ACCOUNT/xt_ACCOUNT.h %{buildroot}%{_includedir}
%{__mkdir_p} %{buildroot}%{_datadir}/xt_geoip
%{__mkdir_p} %{buildroot}%{_usrsrc}
%{__tar} -Jxf %{SOURCE0} -C %{buildroot}%{_usrsrc}
%if 0%{?rhel} < 7
pushd %{buildroot}%{_usrsrc}/%{name}-%{version}
%{__patch} -p1 <%{PATCH0}
popd
%endif
%{__cat} >%{buildroot}%{_usrsrc}/%{name}-%{version}/dkms.conf <<-'EOF'
PACKAGE_NAME="%{name}"
PACKAGE_VERSION="%{version}"
BDIR="${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
MAKEARGS=" -C ${kernel_source_dir} M=${BDIR}/extensions XA_ABSTOPSRCDIR=${BDIR} XA_TOPSRCDIR=${BDIR} V=1"
CLEAN="make ${MAKEARGS} clean"
MAKE="make ${MAKEARGS} modules"
AUTOINSTALL="yes"
BUILT_MODULE_LOCATION[0]="extensions/ACCOUNT"
BUILT_MODULE_NAME[0]="xt_ACCOUNT"
DEST_MODULE_LOCATION[0]="/updates"
BUILT_MODULE_LOCATION[1]="extensions/pknock"
BUILT_MODULE_NAME[1]="xt_pknock"
DEST_MODULE_LOCATION[1]="/updates"
BUILT_MODULE_LOCATION[2]="extensions"
BUILT_MODULE_NAME[2]="compat_xtables"
DEST_MODULE_LOCATION[2]="/updates"
BUILT_MODULE_LOCATION[3]="extensions"
BUILT_MODULE_NAME[3]="xt_CHAOS"
DEST_MODULE_LOCATION[3]="/updates"
BUILT_MODULE_LOCATION[4]="extensions"
BUILT_MODULE_NAME[4]="xt_DELUDE"
DEST_MODULE_LOCATION[4]="/updates"
BUILT_MODULE_LOCATION[5]="extensions"
BUILT_MODULE_NAME[5]="xt_DHCPMAC"
DEST_MODULE_LOCATION[5]="/updates"
BUILT_MODULE_LOCATION[6]="extensions"
BUILT_MODULE_NAME[6]="xt_DNETMAP"
DEST_MODULE_LOCATION[6]="/updates"
BUILT_MODULE_LOCATION[7]="extensions"
BUILT_MODULE_NAME[7]="xt_IPMARK"
DEST_MODULE_LOCATION[7]="/updates"
BUILT_MODULE_LOCATION[8]="extensions"
BUILT_MODULE_NAME[8]="xt_LOGMARK"
DEST_MODULE_LOCATION[8]="/updates"
BUILT_MODULE_LOCATION[9]="extensions"
BUILT_MODULE_NAME[9]="xt_TARPIT"
DEST_MODULE_LOCATION[9]="/updates"
BUILT_MODULE_LOCATION[10]="extensions"
BUILT_MODULE_NAME[10]="xt_condition"
DEST_MODULE_LOCATION[10]="/updates"
BUILT_MODULE_LOCATION[11]="extensions"
BUILT_MODULE_NAME[11]="xt_fuzzy"
DEST_MODULE_LOCATION[11]="/updates"
BUILT_MODULE_LOCATION[12]="extensions"
BUILT_MODULE_NAME[12]="xt_geoip"
DEST_MODULE_LOCATION[12]="/updates"
BUILT_MODULE_LOCATION[13]="extensions"
BUILT_MODULE_NAME[13]="xt_iface"
DEST_MODULE_LOCATION[13]="/updates"
BUILT_MODULE_LOCATION[14]="extensions"
BUILT_MODULE_NAME[14]="xt_ipp2p"
DEST_MODULE_LOCATION[14]="/updates"
BUILT_MODULE_LOCATION[15]="extensions"
BUILT_MODULE_NAME[15]="xt_ipv4options"
DEST_MODULE_LOCATION[15]="/updates"
BUILT_MODULE_LOCATION[16]="extensions"
BUILT_MODULE_NAME[16]="xt_lscan"
DEST_MODULE_LOCATION[16]="/updates"
BUILT_MODULE_LOCATION[17]="extensions"
BUILT_MODULE_NAME[17]="xt_quota2"
DEST_MODULE_LOCATION[17]="/updates"
%if 0%{?rhel} < 7
BUILT_MODULE_LOCATION[18]="extensions"
BUILT_MODULE_NAME[18]="xt_STEAL"
DEST_MODULE_LOCATION[18]="/updates"
%else
BUILT_MODULE_LOCATION[18]="extensions"
BUILT_MODULE_NAME[18]="xt_ECHO"
DEST_MODULE_LOCATION[18]="/updates"
BUILT_MODULE_LOCATION[19]="extensions"
BUILT_MODULE_NAME[19]="xt_SYSRQ"
DEST_MODULE_LOCATION[19]="/updates"
BUILT_MODULE_LOCATION[20]="extensions"
BUILT_MODULE_NAME[20]="xt_length2"
DEST_MODULE_LOCATION[20]="/updates"
BUILT_MODULE_LOCATION[21]="extensions"
BUILT_MODULE_NAME[21]="xt_psd"
DEST_MODULE_LOCATION[21]="/updates"
%endif
EOF
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%post dkms
/usr/lib/dkms/common.postinst %{name} %{version}
%preun dkms
dkms remove -m %{name} -v %{version} --all --rpm_safe_upgrade
%files
%doc README LICENSE doc/changelog.txt
%{_libdir}/libxt_ACCOUNT_cl.so.0
%{_libdir}/libxt_ACCOUNT_cl.so.0.0.0
%if 0%{?rhel} < 7
/%{_lib}/xtables/*
%else
%{_libdir}/xtables/*
%endif
%{_libexecdir}/%{name}/*
%{_sbindir}/iptaccount
%{_mandir}/man1/*
%{_mandir}/man8/*
%ghost %{_datadir}/xt_geoip
%files dkms
%{_usrsrc}/%{name}-%{version}
%files devel
%{_includedir}/libxt_ACCOUNT_cl.h
%{_includedir}/xt_ACCOUNT.h
%{_libdir}/libxt_ACCOUNT_cl.so
%changelog
* Thu Apr 16 2015 Matt Dainty <[email protected]> - 2.6-1
- Initial release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment