James Findley ad81158
Name:		netsniff-ng
James Findley ad81158
Version:	0.5.5.0
James Findley ad81158
Release:	0.4.211svn%{?dist}
James Findley ad81158
Summary:	A high performance network sniffer for packet inspection
James Findley ad81158
Group:		Applications/Internet
James Findley ad81158
License:	GPLv2+
James Findley ad81158
URL:		http://code.google.com/p/netsniff-ng/
James Findley ad81158
# We cannot get the source directly, due to bugs on 0.5.4.x, but later
James Findley ad81158
# revisions than 211 break the UDS functionality, and the replacement
James Findley ad81158
# is not yet complete.  When the replacement, which will be a netlink
James Findley ad81158
# multicast group, is stable, this workaround will be removed.
James Findley ad81158
#
James Findley ad81158
#  svn export -r 211 http://netsniff-ng.googlecode.com/svn/trunk/ netsniff-ng_0.5.5.0
James Findley ad81158
#  tar -czvf netsniff-ng-0.5.5.0.tar.gz netsniff-ng_0.5.5.0
James Findley ad81158
Source0:	netsniff-ng-%{version}.tar.gz
James Findley ad81158
Source1:	netsniff-ng.init
James Findley ad81158
Source2:	netsniff-ng.syscfg
James Findley ad81158
# To read from the UDS socket, a client app is needed which is not provided
James Findley ad81158
# So we grab the client app, check_packets, from an older source
James Findley ad81158
# Something about this particular URL upsets rpmlint, but it is valid.
James Findley ad81158
Source3:	http://netsniff-ng.googlecode.com/files/%{name}-0.5.3.tar.gz
James Findley ad81158
Patch0:		netsniff-ng-uds_server.patch
James Findley ad81158
Patch1:		netsniff-ng-help_text.patch
James Findley ad81158
Patch2:		check_packets.patch
James Findley ad81158
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
James Findley ad81158
Requires(post): chkconfig
James Findley ad81158
Requires(preun): chkconfig
James Findley ad81158
Requires(preun): initscripts
James Findley ad81158
James Findley ad81158
%description
James Findley ad81158
netsniff-ng is a high performance linux network sniffer for packet
James Findley ad81158
inspection. Basically, it is similar to tcpdump, but it doesn't need one
James Findley ad81158
syscall per packet. Instead, it uses an memory mapped area within kernelspace
James Findley ad81158
for accessing packets without copying them to userspace (zero-copy mechanism).
James Findley ad81158
James Findley ad81158
This tool is useful for debugging your network, measuring performance
James Findley ad81158
throughput or creating network statistics of incoming packets on central
James Findley ad81158
network nodes like routers or firewalls.
James Findley ad81158
James Findley ad81158
By providing an unix domain socket client, you're able to integrate your
James Findley ad81158
statistics into the nagios framework.
James Findley ad81158
James Findley ad81158
%prep
James Findley ad81158
%setup -q -n %{name}_%{version}
James Findley ad81158
James Findley ad81158
mkdir check_packets
James Findley ad81158
tar -C check_packets -xzf %{SOURCE3}
James Findley ad81158
James Findley ad81158
%patch0 -p1 
James Findley ad81158
%patch1 -p1 
James Findley ad81158
James Findley ad81158
pushd check_packets
James Findley ad81158
%patch2 -p1
James Findley ad81158
popd
James Findley ad81158
James Findley ad81158
%build
James Findley ad81158
#Main app
James Findley ad81158
pushd src
James Findley ad81158
make %{?_smp_mflags}		\
James Findley ad81158
	CC="%{__cc}"			\
James Findley ad81158
	CFLAGS="%{optflags} -Wno-format" \
James Findley ad81158
	BINDIR="%{_sbindir}"		\
James Findley ad81158
	ETCDIR="%{_sysconfdir}"		\
James Findley ad81158
	MANDIR="%{_mandir}/man8"
James Findley ad81158
popd
James Findley ad81158
James Findley ad81158
#check_packets client
James Findley ad81158
pushd check_packets/src
James Findley ad81158
#Remove the prebuilt binaries
James Findley ad81158
rm -f check_packets check_packets.o
James Findley ad81158
make %{?_smp_mflags}
James Findley ad81158
popd
James Findley ad81158
James Findley ad81158
%install
James Findley ad81158
rm -rf $RPM_BUILD_ROOT
James Findley ad81158
#Main app
James Findley ad81158
pushd src
James Findley ad81158
make DESTDIR="$RPM_BUILD_ROOT" install \
James Findley ad81158
	 CC="%{__cc}"			\
James Findley ad81158
	 CFLAGS="%{optflags}"		\
James Findley ad81158
	 BINDIR="%{_sbindir}"		\
James Findley ad81158
	 ETCDIR="%{_sysconfdir}"	\
James Findley ad81158
	 MANDIR="%{_mandir}/man8"
James Findley ad81158
install -D -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/%{name}
James Findley ad81158
install -D -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
James Findley ad81158
chmod 0644 $RPM_BUILD_ROOT/%{_mandir}/man8/%{name}.8*
James Findley ad81158
popd
James Findley ad81158
James Findley ad81158
#check_packets client
James Findley ad81158
pushd check_packets/src
James Findley ad81158
make install DESTDIR=$RPM_BUILD_ROOT
James Findley ad81158
popd
James Findley ad81158
James Findley ad81158
%clean
James Findley ad81158
rm -rf $RPM_BUILD_ROOT
James Findley ad81158
James Findley ad81158
%post
James Findley ad81158
/sbin/chkconfig --add %{name}
James Findley ad81158
James Findley ad81158
%preun
James Findley ad81158
if [ $1 = 0 ] ; then
James Findley ad81158
    /sbin/service %{name} stop >/dev/null 2>&1
James Findley ad81158
    /sbin/chkconfig --del %{name}
James Findley ad81158
fi
James Findley ad81158
James Findley ad81158
%files
James Findley ad81158
%defattr(-, root, root, -)
James Findley ad81158
%doc AUTHORS Changelog COPYING CREDITS README TODO
James Findley ad81158
%doc examples
James Findley ad81158
%{_sbindir}/%{name}
James Findley ad81158
%{_bindir}/check_packets
James Findley ad81158
%dir %{_sysconfdir}/%{name}
James Findley ad81158
%dir %{_sysconfdir}/%{name}/rules
James Findley ad81158
%{_initrddir}/%{name}
James Findley ad81158
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
James Findley ad81158
%config(noreplace) %{_sysconfdir}/%{name}/rules/*.bpf
James Findley ad81158
%{_mandir}/man8/%{name}.8*
James Findley ad81158
James Findley ad81158
%changelog
James Findley ad81158
* Tue Feb 23 2010 James Findley <sixy@gmx.com> - 0.5.5.0-0.4.211svn
James Findley ad81158
- Improved the way sources are provided
James Findley ad81158
- Used the upstream copy of 0.5.3 for check_packets, with a patch
James Findley ad81158
James Findley ad81158
* Wed Feb 17 2010 James Findley <sixy@gmx.com> - 0.5.5.0-0.3.211svn
James Findley ad81158
- Added the check_packets client app:
James Findley ad81158
 - This makes the unix domain socket actually useful
James Findley ad81158
 - This is taken from the 0.5.3 sources, but with a modified makefile
James Findley ad81158
James Findley ad81158
* Sun Feb 14 2010 James Findley <sixy@gmx.com> - 0.5.5.0-0.2.211svn
James Findley ad81158
- Patched the UDS server
James Findley ad81158
- Patched the help text to correctly mark features not yet implemented
James Findley ad81158
- Added BuildRequires and Requires
James Findley ad81158
James Findley ad81158
* Wed Jan 27 2010 James Findley <sixy@gmx.com> - 0.5.5.0-0.1.211svn
James Findley ad81158
- Prerelease of 0.5.0
James Findley ad81158
- Should now work properly on older (e.g. RHEL 5.x) OSes
James Findley ad81158
- Many new features added
James Findley ad81158
James Findley ad81158
* Fri Jan 08 2010 James Findley <sixy@gmx.com> - 0.5.4.1-5
James Findley ad81158
- Added -Wno-format to hide spurious gcc warnings on AMD64
James Findley ad81158
James Findley ad81158
* Thu Jan 07 2010 James Findley <sixy@gmx.com> - 0.5.4.1-4
James Findley ad81158
- Fixed a few typos in the spec
James Findley ad81158
- Zero padded changelog dates
James Findley ad81158
James Findley ad81158
* Thu Jan 07 2010 James Findley <sixy@gmx.com> - 0.5.4.1-3
James Findley ad81158
- Fixed a few more spec errors
James Findley ad81158
James Findley ad81158
* Thu Jan 07 2010 James Findley <sixy@gmx.com> - 0.5.4.1-2
James Findley ad81158
- Adapted for Fedora packaging policy
James Findley ad81158
- Added an initscript
James Findley ad81158
James Findley ad81158
* Wed Jan 06 2010 James Findley <sixy@gmx.com> - 0.5.4.1-1
James Findley ad81158
- Updated to latest stable upstream
James Findley ad81158
James Findley ad81158
* Mon Nov 27 2009 James Findley	<sixy@gmx.com> - 0.5.2-1
James Findley ad81158
- Initial Release
James Findley ad81158