2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2024-11-21 17:11:45 +00:00

fping for IPv6 support

Former-commit-id: ea421dd2af29b9bbcf18f3816f7c9701d3a95c13
This commit is contained in:
ligc 2010-06-13 01:55:25 +00:00
parent e5aa2184ca
commit ba197be7b2
3 changed files with 236 additions and 0 deletions

View File

@ -0,0 +1,21 @@
Build notes
The fping version 2.4b2_1-1 is compiled from the fping-2.4b2_to-ipv6.tar.gz,
to vaoid confusions with IPv4 support, changed the version to 2.4b2_1-1.
This fping package ships two binary: fping and fping6, the fping is the IPv4 version,
and fping6 is the IPv6 version.
1. download fping-2.4b2_to-ipv6.tar.gz from http://unfix.org/projects/ipv6/fping-2.4b2_to-ipv6.tar.gz,
and copy it to /tmp/fping directory.
2. cd to /tmp/fping.
3. un-tar the files
4. patch the fping.c using fping.patch.ipv6
5. run ./fping-2.4b2_1-1/configure to create a Makefile.
6. tar -cvf fping.tar fping-2.4b2_1-1
7. gzip fping.tar to create a new fping.tar.gz
8. copy fping.tar.gz to /opt/freeware/src/packages/SOURCES/ directory
9. copy fping.spec to /opt/freeware/src/packages/SPECS/ directory
10. cd to /opt/freeware/src/packages/SPECS
11. run rpm -bb fping.spec
* patch was created using "diff -r -C 3 fping-2.4b2_1/fping.c fping-2.4b2_to-ipv6/fping.c" command

182
AIX/fping/fping.patch.ipv6 Normal file
View File

@ -0,0 +1,182 @@
diff -r -C 3 fping-2.4b2_1/fping.c fping-2.4b2_to-ipv6/fping.c
*** fping-2.4b2_1/fping.c Sat Jun 12 00:58:29 2010
--- fping-2.4b2_to-ipv6/fping.c Sat Jun 12 01:05:19 2010
***************
*** 125,131 ****
--- 125,133 ----
extern char *optarg;
extern int optind,opterr;
+ #ifndef h_errno
extern int h_errno;
+ #endif
#ifdef __cplusplus
}
***************
*** 456,499 ****
*/
#ifdef IPV6_RECVHOPOPTS
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPOPTS, &opton, sizeof(opton)))
! err(1, "setsockopt(IPV6_RECVHOPOPTS)");
#else /* old adv. API */
if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPOPTS, &opton, sizeof(opton)))
! err(1, "setsockopt(IPV6_HOPOPTS)");
#endif
#ifdef IPV6_RECVDSTOPTS
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVDSTOPTS, &opton, sizeof(opton)))
! err(1, "setsockopt(IPV6_RECVDSTOPTS)");
#else /* old adv. API */
if (setsockopt(s, IPPROTO_IPV6, IPV6_DSTOPTS, &opton, sizeof(opton)))
! err(1, "setsockopt(IPV6_DSTOPTS)");
#endif
#ifdef IPV6_RECVRTHDRDSTOPTS
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVRTHDRDSTOPTS, &opton, sizeof(opton)))
! err(1, "setsockopt(IPV6_RECVRTHDRDSTOPTS)");
#endif
#ifdef IPV6_RECVRTHDR
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVRTHDR, &opton, sizeof(opton)))
! err(1, "setsockopt(IPV6_RECVRTHDR)");
#else /* old adv. API */
if (setsockopt(s, IPPROTO_IPV6, IPV6_RTHDR, &opton, 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)) < 0)
! warn("setsockopt(IPV6_RECVPKTINFO)"); /* XXX err? */
#else /* old adv. API */
if (setsockopt(s, IPPROTO_IPV6, IPV6_PKTINFO, &opton, sizeof(opton)) < 0)
! warn("setsockopt(IPV6_PKTINFO)"); /* XXX err? */
#endif
#endif /* USE_SIN6_SCOPE_ID */
#ifdef IPV6_RECVHOPLIMIT
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &opton, sizeof(opton)) < 0)
! warn("setsockopt(IPV6_RECVHOPLIMIT)"); /* XXX err? */
#else /* old adv. API */
if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPLIMIT, &opton, sizeof(opton)) < 0)
! warn("setsockopt(IPV6_HOPLIMIT)"); /* XXX err? */
#endif
#ifdef IPV6_CHECKSUM
#ifndef SOL_RAW
--- 458,501 ----
*/
#ifdef IPV6_RECVHOPOPTS
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPOPTS, &opton, sizeof(opton)))
! /*err(1, "setsockopt(IPV6_RECVHOPOPTS)");*/
#else /* old adv. API */
if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPOPTS, &opton, sizeof(opton)))
! /*err(1, "setsockopt(IPV6_HOPOPTS)");*/
#endif
#ifdef IPV6_RECVDSTOPTS
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVDSTOPTS, &opton, sizeof(opton)))
! /*err(1, "setsockopt(IPV6_RECVDSTOPTS)");*/
#else /* old adv. API */
if (setsockopt(s, IPPROTO_IPV6, IPV6_DSTOPTS, &opton, sizeof(opton)))
! /*err(1, "setsockopt(IPV6_DSTOPTS)");*/
#endif
#ifdef IPV6_RECVRTHDRDSTOPTS
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVRTHDRDSTOPTS, &opton, sizeof(opton)))
! /*err(1, "setsockopt(IPV6_RECVRTHDRDSTOPTS)");*/
#endif
#ifdef IPV6_RECVRTHDR
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVRTHDR, &opton, sizeof(opton)))
! /*err(1, "setsockopt(IPV6_RECVRTHDR)");*/
#else /* old adv. API */
if (setsockopt(s, IPPROTO_IPV6, IPV6_RTHDR, &opton, 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)) < 0)
! /*warn("setsockopt(IPV6_RECVPKTINFO)");*/ /* XXX err? */
#else /* old adv. API */
if (setsockopt(s, IPPROTO_IPV6, IPV6_PKTINFO, &opton, sizeof(opton)) < 0)
! /*warn("setsockopt(IPV6_PKTINFO)");*/ /* XXX err? */
#endif
#endif /* USE_SIN6_SCOPE_ID */
#ifdef IPV6_RECVHOPLIMIT
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &opton, sizeof(opton)) < 0)
! /*warn("setsockopt(IPV6_RECVHOPLIMIT)");*/ /* XXX err? */
#else /* old adv. API */
if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPLIMIT, &opton, sizeof(opton)) < 0)
! /*warn("setsockopt(IPV6_HOPLIMIT)");*/ /* XXX err? */
#endif
#ifdef IPV6_CHECKSUM
#ifndef SOL_RAW
***************
*** 501,507 ****
#endif
opton = 2;
if (setsockopt(s, SOL_RAW, IPV6_CHECKSUM, &opton, sizeof(opton)) < 0)
! err(1, "setsockopt(SOL_RAW,IPV6_CHECKSUM)");
#endif
#endif
--- 503,509 ----
#endif
opton = 2;
if (setsockopt(s, SOL_RAW, IPV6_CHECKSUM, &opton, sizeof(opton)) < 0)
! /*err(1, "setsockopt(SOL_RAW,IPV6_CHECKSUM)");*/
#endif
#endif
***************
*** 824,831 ****
hints.ai_family = AF_INET6;
#endif
ret_ga = getaddrinfo(sourceip, NULL, &hints, &res);
! if (ret_ga) errx(1, "%s: %s", gai_strerror(ret_ga), sourceip);
! if (!res->ai_addr) errx(2, "invalid source address %s; getaddrinfo failed", sourceip);
(void)memcpy(&src, res->ai_addr, res->ai_addrlen < sizeof(FPING_SOCKADDR) ? res->ai_addrlen : sizeof(FPING_SOCKADDR));
if (bind(s, (struct sockaddr *)&src, sizeof(FPING_SOCKADDR)) == 0)
{
--- 826,833 ----
hints.ai_family = AF_INET6;
#endif
ret_ga = getaddrinfo(sourceip, NULL, &hints, &res);
! if (ret_ga) printf("%s: %s", gai_strerror(ret_ga), sourceip);
! if (!res->ai_addr) printf("invalid source address %s; getaddrinfo failed", sourceip);
(void)memcpy(&src, res->ai_addr, res->ai_addrlen < sizeof(FPING_SOCKADDR) ? res->ai_addrlen : sizeof(FPING_SOCKADDR));
if (bind(s, (struct sockaddr *)&src, sizeof(FPING_SOCKADDR)) == 0)
{
***************
*** 840,846 ****
printf("Pinging from %s (%s)\n", sourceip, buf);
}
}
! else errx(2, "Couldn't bind to interface %s...", sourceip);
}
/* handle host names supplied on command line or in a file */
--- 842,848 ----
printf("Pinging from %s (%s)\n", sourceip, buf);
}
}
! else printf("Couldn't bind to interface %s...", sourceip);
}
/* handle host names supplied on command line or in a file */
***************
*** 2232,2241 ****
hints.ai_protocol = IPPROTO_ICMPV6;
ret_ga = getaddrinfo(name, NULL, &hints, &res);
! if (ret_ga) errx(1, "%s", gai_strerror(ret_ga));
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, res->ai_addrlen < sizeof(FPING_SOCKADDR) ? res->ai_addrlen : sizeof(FPING_SOCKADDR));
add_addr(name, name, &dst);
#endif
--- 2234,2243 ----
hints.ai_protocol = IPPROTO_ICMPV6;
ret_ga = getaddrinfo(name, NULL, &hints, &res);
! if (ret_ga) printf("%s", gai_strerror(ret_ga));
if (res->ai_canonname) hostname = res->ai_canonname;
else hostname = name;
! if (!res->ai_addr) printf("getaddrinfo failed");
(void)memcpy(&dst, res->ai_addr, res->ai_addrlen < sizeof(FPING_SOCKADDR) ? res->ai_addrlen : sizeof(FPING_SOCKADDR));
add_addr(name, name, &dst);
#endif

33
AIX/fping/fping.spec.ipv6 Normal file
View File

@ -0,0 +1,33 @@
Source: fping.tar.gz
Release: 1
AutoReq: true
AutoProv: true
BuildRoot: %{_tmppath}/fping-2.4b2_1-root
Name: fping
Version: 2.4b2_1
Group: System/Utilities
License: Stanford
Summary: Pings hosts in parallel
URL: http://fping.sourceforge.net/
%Description
fping pings hosts in parallel
%Prep
%setup -q
%Build
make
%Install
mkdir -p $RPM_BUILD_ROOT/usr/bin
cp fping $RPM_BUILD_ROOT/usr/bin
cp fping6 $RPM_BUILD_ROOT/usr/bin
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man8/
cp fping.8 $RPM_BUILD_ROOT/usr/share/man/man8/
pwd
echo $RPM_BUILD_ROOT
%Files
%defattr(-,root,root)
/usr/bin/fping
/usr/bin/fping6
/usr/share/man/man8/fping.8