Blob Blame History Raw
Name:		netsniff-ng
Version:	0.5.5.0
Release:	0.4.211svn%{?dist}
Summary:	A high performance network sniffer for packet inspection
Group:		Applications/Internet
License:	GPLv2+
URL:		http://code.google.com/p/netsniff-ng/
# We cannot get the source directly, due to bugs on 0.5.4.x, but later
# revisions than 211 break the UDS functionality, and the replacement
# is not yet complete.  When the replacement, which will be a netlink
# multicast group, is stable, this workaround will be removed.
#
#  svn export -r 211 http://netsniff-ng.googlecode.com/svn/trunk/ netsniff-ng_0.5.5.0
#  tar -czvf netsniff-ng-0.5.5.0.tar.gz netsniff-ng_0.5.5.0
Source0:	netsniff-ng-%{version}.tar.gz
Source1:	netsniff-ng.init
Source2:	netsniff-ng.syscfg
# To read from the UDS socket, a client app is needed which is not provided
# So we grab the client app, check_packets, from an older source
# Something about this particular URL upsets rpmlint, but it is valid.
Source3:	http://netsniff-ng.googlecode.com/files/%{name}-0.5.3.tar.gz
Patch0:		netsniff-ng-uds_server.patch
Patch1:		netsniff-ng-help_text.patch
Patch2:		check_packets.patch
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts

%description
netsniff-ng is a high performance linux network sniffer for packet
inspection. Basically, it is similar to tcpdump, but it doesn't need one
syscall per packet. Instead, it uses an memory mapped area within kernelspace
for accessing packets without copying them to userspace (zero-copy mechanism).

This tool is useful for debugging your network, measuring performance
throughput or creating network statistics of incoming packets on central
network nodes like routers or firewalls.

By providing an unix domain socket client, you're able to integrate your
statistics into the nagios framework.

%prep
%setup -q -n %{name}_%{version}

mkdir check_packets
tar -C check_packets -xzf %{SOURCE3}

%patch0 -p1 
%patch1 -p1 

pushd check_packets
%patch2 -p1
popd

%build
#Main app
pushd src
make %{?_smp_mflags}		\
	CC="%{__cc}"			\
	CFLAGS="%{optflags} -Wno-format" \
	BINDIR="%{_sbindir}"		\
	ETCDIR="%{_sysconfdir}"		\
	MANDIR="%{_mandir}/man8"
popd

#check_packets client
pushd check_packets/src
#Remove the prebuilt binaries
rm -f check_packets check_packets.o
make %{?_smp_mflags}
popd

%install
rm -rf $RPM_BUILD_ROOT
#Main app
pushd src
make DESTDIR="$RPM_BUILD_ROOT" install \
	 CC="%{__cc}"			\
	 CFLAGS="%{optflags}"		\
	 BINDIR="%{_sbindir}"		\
	 ETCDIR="%{_sysconfdir}"	\
	 MANDIR="%{_mandir}/man8"
install -D -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/%{name}
install -D -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
chmod 0644 $RPM_BUILD_ROOT/%{_mandir}/man8/%{name}.8*
popd

#check_packets client
pushd check_packets/src
make install DESTDIR=$RPM_BUILD_ROOT
popd

%clean
rm -rf $RPM_BUILD_ROOT

%post
/sbin/chkconfig --add %{name}

%preun
if [ $1 = 0 ] ; then
    /sbin/service %{name} stop >/dev/null 2>&1
    /sbin/chkconfig --del %{name}
fi

%files
%defattr(-, root, root, -)
%doc AUTHORS Changelog COPYING CREDITS README TODO
%doc examples
%{_sbindir}/%{name}
%{_bindir}/check_packets
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/rules
%{_initrddir}/%{name}
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/rules/*.bpf
%{_mandir}/man8/%{name}.8*

%changelog
* Tue Feb 23 2010 James Findley <sixy@gmx.com> - 0.5.5.0-0.4.211svn
- Improved the way sources are provided
- Used the upstream copy of 0.5.3 for check_packets, with a patch

* Wed Feb 17 2010 James Findley <sixy@gmx.com> - 0.5.5.0-0.3.211svn
- Added the check_packets client app:
 - This makes the unix domain socket actually useful
 - This is taken from the 0.5.3 sources, but with a modified makefile

* Sun Feb 14 2010 James Findley <sixy@gmx.com> - 0.5.5.0-0.2.211svn
- Patched the UDS server
- Patched the help text to correctly mark features not yet implemented
- Added BuildRequires and Requires

* Wed Jan 27 2010 James Findley <sixy@gmx.com> - 0.5.5.0-0.1.211svn
- Prerelease of 0.5.0
- Should now work properly on older (e.g. RHEL 5.x) OSes
- Many new features added

* Fri Jan 08 2010 James Findley <sixy@gmx.com> - 0.5.4.1-5
- Added -Wno-format to hide spurious gcc warnings on AMD64

* Thu Jan 07 2010 James Findley <sixy@gmx.com> - 0.5.4.1-4
- Fixed a few typos in the spec
- Zero padded changelog dates

* Thu Jan 07 2010 James Findley <sixy@gmx.com> - 0.5.4.1-3
- Fixed a few more spec errors

* Thu Jan 07 2010 James Findley <sixy@gmx.com> - 0.5.4.1-2
- Adapted for Fedora packaging policy
- Added an initscript

* Wed Jan 06 2010 James Findley <sixy@gmx.com> - 0.5.4.1-1
- Updated to latest stable upstream

* Mon Nov 27 2009 James Findley	<sixy@gmx.com> - 0.5.2-1
- Initial Release