automatic version update by autodist [release 3.9-1mamba;Mon Mar 10 2014]

This commit is contained in:
Automatic Build System 2024-01-05 22:31:52 +01:00
parent 5f1f5fcf8b
commit ad5960c5cc
3 changed files with 173 additions and 0 deletions

View File

@ -1,2 +1,10 @@
# fping
fping is a ping like program which uses the Internet Control Message Protocol (ICMP) echo request to determine if a host is up.
fping is different from ping in that you can specify any number of hosts on the command line, or specify a file containing the lists of hosts to ping.
Instead of trying one host until it timeouts or replies, fping will send out a ping packet and move on to the next host in a round-robin fashion.
If a host replies, it is noted and removed from the list of hosts to check.
If a host does not respond within a certain time limit and/or retry limit it will be considered unreachable.
Unlike ping, fping is meant to be used in scripts and its output is easy to parse.

View File

@ -0,0 +1,88 @@
--- fping.c 2002-01-21 02:06:30.000000000 +0100
+++ fping.c.oden 2004-05-31 16:24:27.655765808 +0200
@@ -42,7 +42,6 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define IPV6 1 /* This should be a compiler option, or even better be done from the Makefile... ;) */
#ifndef _NO_PROTO
#if !__STDC__ && !defined( __cplusplus ) && !defined( FUNCPROTO ) \
@@ -150,7 +149,11 @@
#define MIN_PING_DATA sizeof( PING_DATA )
#define MAX_IP_PACKET 65536 /* (theoretical) max IP packet size */
#define SIZE_IP_HDR 20
+#ifndef IPV6
#define SIZE_ICMP_HDR ICMP_MINLEN /* from ip_icmp.h */
+#else
+#define SIZE_ICMP_HDR sizeof(FPING_ICMPHDR)
+#endif
#define MAX_PING_DATA ( MAX_IP_PACKET - SIZE_IP_HDR - SIZE_ICMP_HDR )
/* sized so as to be like traditional ping */
@@ -474,6 +477,35 @@
sizeof(opton)))
err(1, "setsockopt(IPV6_RTHDR)");
#endif
+#ifndef USE_SIN6_SCOPE_ID
+#ifdef IPV6_RECVPKTINFO
+ if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &opton,
+ sizeof(opton)))
+ err(1, "setsockopt(IPV6_RECVPKTINFO)");
+#else /* old adv. API */
+ if (setsockopt(s, IPPROTO_IPV6, IPV6_PKTINFO, &opton,
+ sizeof(opton)))
+ err(1, "setsockopt(IPV6_PKTINFO)");
+#endif
+#endif /* USE_SIN6_SCOPE_ID */
+#ifdef IPV6_RECVHOPLIMIT
+ if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &opton,
+ sizeof(opton)))
+ err(1, "setsockopt(IPV6_RECVHOPLIMIT)");
+#else /* old adv. API */
+ if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPLIMIT, &opton,
+ sizeof(opton)))
+ err(1, "setsockopt(IPV6_HOPLIMIT)");
+#endif
+#ifdef IPV6_CHECKSUM
+#ifndef SOL_RAW
+#define SOL_RAW IPPROTO_IPV6
+#endif
+ opton = 2;
+ if (setsockopt(s, SOL_RAW, IPV6_CHECKSUM, &opton,
+ sizeof(opton)))
+ err(1, "setsockopt(SOL_RAW,IPV6_CHECKSUM)");
+#endif
#endif
if( ( uid = getuid() ) )
@@ -1382,8 +1414,8 @@
if( h->num_recv_i <= h->num_sent_i )
{
fprintf( stderr, " xmt/rcv/%%loss = %d/%d/%d%%",
- h->num_sent_i, h->num_recv_i,
- ( ( h->num_sent_i - h->num_recv_i ) * 100 ) / h->num_sent_i );
+ h->num_sent_i, h->num_recv_i, h->num_sent_i > 0 ?
+ ( ( h->num_sent_i - h->num_recv_i ) * 100 ) / h->num_sent_i : 0 );
}/* IF */
else
@@ -2165,6 +2197,7 @@
struct addrinfo *res, hints;
int ret_ga;
char *hostname;
+ size_t len;
/* getaddrinfo */
bzero(&hints, sizeof(struct addrinfo));
@@ -2178,7 +2211,9 @@
if (res->ai_canonname) hostname = res->ai_canonname;
else hostname = name;
if (!res->ai_addr) errx(1, "getaddrinfo failed");
- (void)memcpy(&dst, res->ai_addr, sizeof(FPING_SOCKADDR)); /*res->ai_addrlen);*/
+ len = res->ai_addrlen;
+ if (len > sizeof(FPING_SOCKADDR)) len = sizeof(FPING_SOCKADDR);
+ (void)memcpy(&dst, res->ai_addr, len);
add_addr(name, name, &dst);
#endif
} /* add_name() */

77
fping.spec Normal file
View File

@ -0,0 +1,77 @@
Name: fping
Version: 3.9
Release: 1mamba
Summary: Quickly ping N number of hosts to determine their reachability
Group: Applications/Networking
Vendor: openmamba
Distribution: openmamba
Packager: Aleph0 <aleph0@openmamba.org>
URL: http://www.fping.com/
Source: http://fping.org/dist/fping-%{version}.tar.gz
Patch0: fping-2.4b2_to-ipv6-debian_fix.diff.bz2
License: GPL
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
fping is a ping like program which uses the Internet Control Message Protocol (ICMP) echo request to determine if a host is up.
fping is different from ping in that you can specify any number of hosts on the command line, or specify a file containing the lists of hosts to ping.
Instead of trying one host until it timeouts or replies, fping will send out a ping packet and move on to the next host in a round-robin fashion.
If a host replies, it is noted and removed from the list of hosts to check.
If a host does not respond within a certain time limit and/or retry limit it will be considered unreachable.
Unlike ping, fping is meant to be used in scripts and its output is easy to parse.
%prep
%setup -q
#%patch0 -p0
# fix strange perms
chmod 644 README ChangeLog
%build
%configure
%make
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%files
%defattr(-,root,root)
%attr(4755,root,root) %{_sbindir}/fping
%{_mandir}/man8/fping.*
%doc ChangeLog COPYING README
%changelog
* Mon Mar 10 2014 Automatic Build System <autodist@mambasoft.it> 3.9-1mamba
- automatic version update by autodist
* Sun Nov 17 2013 Automatic Build System <autodist@mambasoft.it> 3.8-1mamba
- automatic version update by autodist
* Fri Oct 11 2013 Automatic Build System <autodist@mambasoft.it> 3.6-1mamba
- automatic version update by autodist
* Thu May 23 2013 Automatic Build System <autodist@mambasoft.it> 3.5-1mamba
- automatic version update by autodist
* Mon Sep 10 2012 Automatic Build System <autodist@mambasoft.it> 3.4-1mamba
- automatic version update by autodist
* Fri Jul 06 2012 Automatic Build System <autodist@mambasoft.it> 3.2-1mamba
- update to 3.2
* Thu Sep 13 2007 Aleph0 <aleph0@openmamba.org> 2.4b2-4mamba
- spec file fixed and updated
* Fri Jul 02 2004 Davide Madrisan <davide.madrisan@qilinux.it> 2.4b2-3qilnx
- added debian patch
* Mon Feb 23 2004 Davide Madrisan <davide.madrisan@qilinux.it> 2.4b2-2qilnx
- fix: fping must be setuid root
* Tue Oct 23 2003 Davide Madrisan <davide.madrisan@qilinux.it> 2.4b2-1qilnx
- first build