Skip to content

Commit

Permalink
update to fping-4.2
Browse files Browse the repository at this point in the history
without flags, the main fping binary is v4/v6 dual stack, use -4 / -6 to
force one particular af.

a v6-only fping6 is installed to provide support for dependent ports, using
the method from schweikert/fping#139
  • Loading branch information
sthen committed Mar 31, 2019
1 parent 50bcfd5 commit 1af8ca5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 43 deletions.
25 changes: 10 additions & 15 deletions net/fping/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
# $OpenBSD: Makefile,v 1.45 2018/08/02 09:07:47 sthen Exp $
# $OpenBSD: Makefile,v 1.46 2019/03/31 00:09:09 sthen Exp $

COMMENT= quickly ping N hosts w/o flooding the network

# XXX sticking with 3.x for now;
DISTNAME= fping-3.16
REVISION= 2

# some dependent programs (net/zabbix, net/monitoring-plugins,
# net/smokeping, net/librenms) expect fping/fping6 separation and would
# want patching to move to "fping -4" / "fping -6".
#
# there is a build method supposed to give exact compatibility, which
# can be handled with some bodging in the port, but the new "--disable-ipv4"
# configure flag doesn't actually work as of 4.0 so e.g. "fping6 somehost"
# succeeds even if somehost is unreachable over v6.
DISTNAME= fping-4.2

CATEGORIES= net

Expand All @@ -31,7 +20,13 @@ MASTER_SITES= https://fping.org/dist/

CONFIGURE_STYLE= gnu
SEPARATE_BUILD= Yes
CONFIGURE_ARGS= --bindir=${PREFIX}/sbin \
--enable-ipv6
CONFIGURE_ARGS= --bindir=${PREFIX}/sbin

# some dependent programs want fping/fping6 separation e.g. net/zabbix,
# net/smokeping, net/librenms; with this symlink fping6 is v6-only,
# fping is dual-stack, or fping -4/-6 can be used to force it.
# see https://github.com/schweikert/fping/pull/139
post-install:
ln -s fping ${PREFIX}/sbin/fping6

.include <bsd.port.mk>
4 changes: 2 additions & 2 deletions net/fping/distinfo
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
SHA256 (fping-3.16.tar.gz) = L3UwlOTfPNsdmb4Wh8D7fS8UwNUm6/AxWMjFUZvHj1Q=
SIZE (fping-3.16.tar.gz) = 162629
SHA256 (fping-4.2.tar.gz) = fTOWdLapWq4ditSH/1BW/ZW0dMNlCTgmj2qQXDdxtko=
SIZE (fping-4.2.tar.gz) = 171409
13 changes: 5 additions & 8 deletions net/fping/patches/patch-doc_Makefile_in
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
$OpenBSD: patch-doc_Makefile_in,v 1.1 2015/09/17 12:03:42 sthen Exp $
$OpenBSD: patch-doc_Makefile_in,v 1.2 2019/03/31 00:09:09 sthen Exp $

remove unnecessary GNUism; in traditional make(1), $< may only be used
in a suffix rule.

--- doc/Makefile.in.orig Thu Sep 17 12:55:36 2015
+++ doc/Makefile.in Thu Sep 17 12:55:13 2015
@@ -478,10 +478,10 @@ uninstall-man: uninstall-man8
Index: doc/Makefile.in
--- doc/Makefile.in.orig
+++ doc/Makefile.in
@@ -476,7 +476,7 @@ uninstall-man: uninstall-man8


fping.8: fping.pod
- pod2man -c "" -s 8 -r "fping" $< >$@
+ pod2man -c "" -s 8 -r "fping" $> >$@

fping6.8: fping.pod
- pod2man -c "" -s 8 -r "fping" -n fping6 $< >$@
+ pod2man -c "" -s 8 -r "fping" -n fping6 $> >$@

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
31 changes: 16 additions & 15 deletions net/fping/patches/patch-src_fping_c
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
$OpenBSD: patch-src_fping_c,v 1.6 2018/08/01 15:02:18 millert Exp $
$OpenBSD: patch-src_fping_c,v 1.7 2019/03/31 00:09:09 sthen Exp $
Index: src/fping.c
--- src/fping.c.orig
+++ src/fping.c
@@ -354,6 +354,9 @@ int main(int argc, char** argv)
int tos = 0;
@@ -352,6 +352,9 @@ int main(int argc, char** argv)
HOST_ENTRY* cursor;
struct optparse optparse_state;

+ if (pledge("stdio inet rpath dns id", NULL) == -1)
+ perror("pledge");
+
/* pre-parse -h/--help, so that we also can output help information
* without trying to open the socket, which might fail */
prog = argv[0];

s = open_ping_socket(ping_data_size);
@@ -364,6 +367,9 @@ int main(int argc, char** argv)
perror("cannot setuid");
@@ -376,6 +379,10 @@ int main(int argc, char** argv)
}

optparse_init(&optparse_state, argv);
+
+ if (pledge("stdio inet rpath dns", NULL) == -1)
+ perror("pledge");
+
ident = getpid() & 0xFFFF;
verbose_flag = 1;
backoff_flag = 1;
@@ -583,6 +589,11 @@ int main(int argc, char** argv)
@@ -710,6 +717,11 @@ int main(int argc, char** argv)
}
}

Expand All @@ -33,22 +34,22 @@ Index: src/fping.c
+
/* validate various option settings */

if (ttl > 255) {
@@ -798,6 +809,10 @@ int main(int argc, char** argv)
#ifndef IPV6
@@ -962,6 +974,10 @@ int main(int argc, char** argv)
exit(num_noaddress ? 2 : 1);
}

+ /* done with file and dns/rdns lookups */
+ if (pledge("stdio inet", NULL) == -1)
+ perror("pledge");
+
if (src_addr_present) {
socket_set_src_addr(s, src_addr);
if (src_addr_set && socket4 >= 0) {
socket_set_src_addr_ipv4(socket4, &src_addr);
}
@@ -1667,7 +1682,7 @@ int wait_for_reply(long wait_time)
@@ -1831,7 +1847,7 @@ int decode_icmp_ipv4(
struct icmp* icp;
int hlen = 0;

#ifndef IPV6
ip = (struct ip*)buffer;
-#if defined(__alpha__) && __STDC__ && !defined(__GLIBC__)
+#if defined(__alpha__) && __STDC__ && !defined(__GLIBC__) && !defined(__OpenBSD__)
/* The alpha headers are decidedly broken.
Expand Down
5 changes: 2 additions & 3 deletions net/fping/pkg/PLIST
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@comment $OpenBSD: PLIST,v 1.7 2015/09/17 12:03:42 sthen Exp $
@comment $OpenBSD: PLIST,v 1.8 2019/03/31 00:09:09 sthen Exp $
@man man/man8/fping.8
@man man/man8/fping6.8
@mode 4555
@bin sbin/fping
@bin sbin/fping6
@mode
sbin/fping6

0 comments on commit 1af8ca5

Please sign in to comment.