Hello community,
here is the log from the commit of package arping2 for openSUSE:Factory checked in at 2017-09-04 12:35:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/arping2 (Old)
and /work/SRC/openSUSE:Factory/.arping2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "arping2"
Mon Sep 4 12:35:27 2017 rev:18 rq:520251 version:2.19
Changes:
--------
--- /work/SRC/openSUSE:Factory/arping2/arping2.changes 2016-12-10 18:30:23.739479026 +0100
+++ /work/SRC/openSUSE:Factory/.arping2.new/arping2.changes 2017-09-04 12:35:31.742207264 +0200
@@ -1,0 +2,7 @@
+Thu Aug 31 04:30:22 UTC 2017 - luc14n0@linuxmail.org
+
+- Update to version 2.19
+ * Make `arping` -w/-W behave like `ping` and `iputils-arping`
+ * Add option -g to specify group to drop privs to
+
+-------------------------------------------------------------------
Old:
----
arping-2.17.tar.gz
arping-2.17.tar.gz.asc
New:
----
arping-2.19.tar.gz
arping-2.19.tar.gz.asc
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ arping2.spec ++++++
--- /var/tmp/diff_new_pack.tSnR94/_old 2017-09-04 12:35:32.846052058 +0200
+++ /var/tmp/diff_new_pack.tSnR94/_new 2017-09-04 12:35:32.862049809 +0200
@@ -1,7 +1,7 @@
#
# spec file for package arping2
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: arping2
-Version: 2.17
+Version: 2.19
Release: 0
Summary: Layer-2 Ethernet pinger
License: GPL-2.0+
++++++ arping-2.17.tar.gz -> arping-2.19.tar.gz ++++++
++++ 2762 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/HACKING.md new/arping-2.19/HACKING.md
--- old/arping-2.17/HACKING.md 2016-06-28 00:07:15.000000000 +0200
+++ new/arping-2.19/HACKING.md 2017-07-09 19:52:08.000000000 +0200
@@ -12,3 +12,11 @@
9. Upload to http://www.habets.pp.se/synscan/files/
10. Update webpage.
11. Send email to synscan-announce@googlegroups.com
+
+## Fuzzing
+
+```shell
+CC=/path/to/afl-gcc ./configure
+make
+/path/to/afl-fuzz -i fuzz/pingip/ -o fuzz/out/ ./src/fuzz_pingip
+```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/README new/arping-2.19/README
--- old/arping-2.17/README 2016-06-28 00:07:15.000000000 +0200
+++ new/arping-2.19/README 2017-07-09 19:52:08.000000000 +0200
@@ -10,7 +10,7 @@
Introduction
------------
-Arping is a util to find out it a specific IP address on the LAN is 'taken'
+Arping is a util to find out if a specific IP address on the LAN is 'taken'
and what MAC address owns it. Sure, you *could* just use 'ping' to find out if
it's taken and even if the computer blocks ping (and everything else) you still
get an entry in your ARP cache. But what if you aren't on a routable net? Or
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/compile new/arping-2.19/compile
--- old/arping-2.17/compile 2016-06-28 00:07:18.000000000 +0200
+++ new/arping-2.19/compile 2017-07-09 19:52:12.000000000 +0200
@@ -3,7 +3,7 @@
scriptversion=2012-10-14.11; # UTC
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey .
#
# This program is free software; you can redistribute it and/or modify
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/configure.ac new/arping-2.19/configure.ac
--- old/arping-2.17/configure.ac 2016-06-28 00:07:15.000000000 +0200
+++ new/arping-2.19/configure.ac 2017-07-09 19:52:08.000000000 +0200
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT(arping, 2.17, thomas@habets.se)
+AC_INIT(arping, 2.19, thomas@habets.se)
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([src/arping.c])
AM_INIT_AUTOMAKE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/doc/arping.8 new/arping-2.19/doc/arping.8
--- old/arping-2.17/doc/arping.8 2016-06-28 00:07:15.000000000 +0200
+++ new/arping-2.19/doc/arping.8 2017-07-09 19:52:08.000000000 +0200
@@ -5,7 +5,7 @@
arping \- sends arp and/or ip pings to a given host
.PP
.SH "SYNOPSIS"
-\fBarping\fP [\-0aAbBdDeFhpqrRuUv] [\-S \fIhost/ip\fP] [\-T \fIhost/ip\fP] [\-s \fIMAC\fP] [\-t \fIMAC\fP] [\-c \fIcount\fP] [\-i \fIinterface\fP] [ \-w \fIus\fP ] [ \-V \fIvlan\fP ] [ \-Q \fIpriority\fP ] <\fIhost\fP | \-B>
+\fBarping\fP [\-0aAbBdDeFhpqrRuUv] [\-S \fIhost/ip\fP] [\-T \fIhost/ip\fP] [\-s \fIMAC\fP] [\-t \fIMAC\fP] [\-c \fIcount\fP] [\-i \fIinterface\fP] [ \-w \fIseconds\fP ] [ \-W \fIseconds\fP ] [ \-V \fIvlan\fP ] [ \-Q \fIpriority\fP ] [ \-g \fIgroup\fP ] <\fIhost\fP | \-B>
.PP
\fBarping\fP \-\-help
.PP
@@ -72,6 +72,8 @@
.IP "\-F"
Don\(cq\&t try to be smart about the interface name\&. Even if this
switch is not given, \-i disables this smartness\&.
+.IP "\-g \fIgroup\fP"
+setgid() to this group instead of the nobody group\&.
.IP "\-h"
Displays a help message and exits\&.
.IP "\-i \fIinterface\fP"
@@ -130,10 +132,10 @@
Verbose output\&. Use twice for more messages\&.
.IP "\-V \fIvlan\fP"
VLAN tag to set\&. Defaults to no VLAN tag\&.
-.IP "\-w \fIusec\fP"
-Time to wait between pings, in microseconds\&.
+.IP "\-w \fIsec\fP"
+Specify a timeout before ping exits regardless of how many packets have been sent or received\&.
.IP "\-W \fIsec\fP"
-Same as \-w, but in floating point seconds\&.
+Time to wait between pings\&.
.PP
.SH "EXAMPLES"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/doc/arping.yodl new/arping-2.19/doc/arping.yodl
--- old/arping-2.17/doc/arping.yodl 2016-06-28 00:07:15.000000000 +0200
+++ new/arping-2.19/doc/arping.yodl 2017-07-09 19:52:08.000000000 +0200
@@ -4,7 +4,8 @@
manpagesynopsis()
bf(arping) [-0aAbBdDeFhpqrRuUv] [-S em(host/ip)] [-T em(host/ip)] [-s em(MAC)] \
-[-t em(MAC)] [-c em(count)] [-i em(interface)] [ -w em(us) ] [ -V em(vlan) ] [ -Q em(priority) ]
+[-t em(MAC)] [-c em(count)] [-i em(interface)] [ -w em(seconds) ] [ -W em(seconds) ] [ -V em(vlan) ] [ -Q em(priority) ] [ -g em(group) ] \
+
bf(arping) --help
@@ -59,6 +60,7 @@
dit(-e) Like -a but beep when there is no reply.
dit(-F) Don't try to be smart about the interface name. Even if this
switch is not given, -i disables this smartness.
+ dit(-g em(group)) setgid() to this group instead of the nobody group.
dit(-h) Displays a help message and exits.
dit(-i em(interface)) Don't guess, use the specified interface.
dit(-m em(type)) Type of timestamp to use for incoming packets.
@@ -100,8 +102,8 @@
$ arping -i <interface> -U <interface IP>
dit(-v) Verbose output. Use twice for more messages.
dit(-V em(vlan)) VLAN tag to set. Defaults to no VLAN tag.
- dit(-w em(usec)) Time to wait between pings, in microseconds.
- dit(-W em(sec)) Same as -w, but in floating point seconds.
+ dit(-w em(sec)) Specify a timeout before ping exits regardless of how many packets have been sent or received.
+ dit(-W em(sec)) Time to wait between pings.
enddit()
Binary files old/arping-2.17/fuzz/pingip/normal.data and new/arping-2.19/fuzz/pingip/normal.data differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/missing new/arping-2.19/missing
--- old/arping-2.17/missing 2016-06-28 00:07:18.000000000 +0200
+++ new/arping-2.19/missing 2017-07-09 19:52:12.000000000 +0200
@@ -3,7 +3,7 @@
scriptversion=2013-10-28.13; # UTC
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard , 1996.
# This program is free software; you can redistribute it and/or modify
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/src/Makefile.am new/arping-2.19/src/Makefile.am
--- old/arping-2.17/src/Makefile.am 2016-06-28 00:07:15.000000000 +0200
+++ new/arping-2.19/src/Makefile.am 2017-07-09 19:52:08.000000000 +0200
@@ -3,11 +3,15 @@
include $(top_srcdir)/Makefile.am.common
sbin_PROGRAMS = arping
-arping_SOURCES = arping.c arping_main.c unix.c
+noinst_PROGRAMS = fuzz_pingip
+arping_SOURCES = arping.c arping_main.c unix.c
arping_LDADD = $(LIBOBJS)
+fuzz_pingip_SOURCES = arping.c fuzz_pingip.c unix.c mock_libpcap.c mock_libnet.c
+fuzz_pingip_LDADD = $(LIBOBJS)
+
TESTS=arping_test
check_PROGRAMS=arping_test
arping_test_SOURCES=arping.c arping_test.c unix.c mock_libpcap.c mock_libnet.c
-arping_test_LDADD=$(LIBOBJS) -lcheck -lpthread
+arping_test_LDADD=$(LIBOBJS) -lcheck -lpthread -lsubunit
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/src/arping.c new/arping-2.19/src/arping.c
--- old/arping-2.17/src/arping.c 2016-06-28 00:07:15.000000000 +0200
+++ new/arping-2.19/src/arping.c 2017-07-09 19:52:08.000000000 +0200
@@ -15,7 +15,7 @@
*
*/
/*
- * Copyright (C) 2000-2016 Thomas Habets
+ * Copyright (C) 2000-2017 Thomas Habets
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -305,10 +305,53 @@
}
/**
+ * Get GID of input (handle both name and number) or die.
+ */
+static gid_t
+must_get_group(const char* ident)
+{
+ // Special case empty string, because strtol.
+ int saved_errno;
+ if (*ident) {
+ // First try it as a name.
+ {
+ struct group* gr;
+ errno = 0;
+ if (gr = getgrnam(ident)) {
+ return gr->gr_gid;
+ }
+ saved_errno = errno;
+ }
+
+ // Not a name. Try it as an integer.
+ {
+ char* endp = NULL;
+ gid_t r = strtol(ident, &endp, 0);
+ if (!*endp) {
+ return r;
+ }
+ }
+ }
+
+ if (saved_errno != 0) {
+ fprintf(stderr,
+ "arping: %s not a number and getgrnam(%s): %s\n",
+ ident, ident, strerror(saved_errno));
+ } else {
+ // If group was supplied, then not
+ // existing is fatal error too.
+ fprintf(stderr,
+ "arping: %s is not a number or group\n",
+ ident);
+ }
+ exit(1);
+}
+
+/**
* drop all privileges.
*/
static void
-drop_privileges()
+drop_privileges(const char* drop_group)
{
// Need to get uid/gid of 'nobody' before chroot().
const char* drop_user = "nobody";
@@ -318,14 +361,23 @@
gid_t gid = 0;
if (!(pw = getpwnam(drop_user))) {
if (verbose) {
- printf("arping: getpwnam(%s): %s\n",
- drop_user, strerror(errno));
+ if (errno != 0) {
+ printf("arping: getpwnam(%s): %s\n",
+ drop_user, strerror(errno));
+ } else {
+ printf("arping: getpwnam(%s): unknown user\n",
+ drop_user);
+ }
}
- return;
} else {
uid = pw->pw_uid;
gid = pw->pw_gid;
}
+
+ // If group is supplied, use that gid instead.
+ if (drop_group != NULL) {
+ gid = must_get_group(drop_group);
+ }
drop_fs_root();
drop_uid(uid, gid);
drop_capabilities();
@@ -602,6 +654,8 @@
" -e Like -a but beep when there is no reply.\n"
" -F Don't try to be smart about the interface name. (even if this\n"
" switch is not given, -i overrides smartness)\n"
+ " -g group\n"
+ " setgid() to this group instead of the nobody group.\n"
" -h Displays a help message and exits.\n"
" -i interface\n"
" Use the specified interface.\n"
@@ -638,8 +692,9 @@
" -U Send unsolicited ARP.\n"
" -v Verbose output. Use twice for more messages.\n"
" -V num 802.1Q tag to add. Defaults to no VLAN tag.\n"
- " -w Time to wait between pings, in microseconds.\n"
- " -W Same as -w, but in floating point seconds.\n");
+ " -w sec Specify a timeout before ping exits regardless of how"
+ " many\npackets have been sent or received.\n"
+ " -W sec Time to wait between pings.\n");
printf("Report bugs to: thomas@habets.se\n"
"Arping home page: http://www.habets.pp.se/synscan/\n"
"Development repo: http://github.com/ThomasHabets/arping\n");
@@ -653,14 +708,15 @@
{
printf("ARPing %s, by Thomas Habets \n",
version);
- printf("usage: arping [ -0aAbdDeFpPqrRuUv ] [ -w <us> ] "
+ printf("usage: arping [ -0aAbdDeFpPqrRuUv ] [ -w <sec> ] "
"[ -W <sec> ] "
"[ -S ]\n"
" "
"[ -T \n");
@@ -783,6 +839,30 @@
}
/**
+ * return number of microseconds to wait for packets.
+ */
+static uint32_t
+wait_time(double deadline, uint32_t packetwait)
+{
+ struct timespec ts;
+
+ // If deadline not specified, then don't use it.
+ if (deadline < 0) {
+ return packetwait;
+ }
+
+ getclock(&ts);
+ const double max_wait = deadline - timespec2dbl(&ts);
+ if (max_wait < 0) {
+ return 0;
+ }
+ if (max_wait > packetwait / 1000000) {
+ return packetwait;
+ }
+ return max_wait * 1000000;
+}
+
+/**
* max size of buffer is intsize + 1 + intsize + 4 = 70 bytes or so
*
* Still, I'm using at least 128bytes below
@@ -839,7 +919,7 @@
// Without this padding some systems (e.g. Raspberry Pi 3
// wireless interface) failed. dmesg said:
// arping: packet size is too short (42 <= 50)
- const char padding[16] = {0};
+ const uint8_t padding[16] = {0};
int c;
@@ -930,7 +1010,7 @@
// Without this padding some systems (e.g. Raspberry Pi 3
// wireless interface) failed. dmesg said:
// arping: packet size is too short (42 <= 50)
- const char padding[16] = {0};
+ const uint8_t padding[16] = {0};
if (-1 == (arp = libnet_build_arp(ARPHRD_ETHER,
ETHERTYPE_IP,
@@ -985,7 +1065,7 @@
(long)lastpacketsent.tv_nsec);
}
if (-1 == libnet_write(libnet)) {
- fprintf(stderr, "arping: libnet_write(): %s\n",
+ fprintf(stderr, "arping: libnet_write(): %s\n",
libnet_geterror(libnet));
sigint(0);
}
@@ -1288,6 +1368,11 @@
fixup_timespec(&endtime);
fd = pcap_get_selectable_fd(pcap);
+ if (fd == -1) {
+ fprintf(stderr, "arping: pcap_get_selectable_fd()=-1: %s\n",
+ pcap_geterr(pcap));
+ exit(1);
+ }
old_received = numrecvd;
for (;!done;) {
@@ -1429,10 +1514,11 @@
int dstip_given = 0;
const char *srcmac_opt = NULL;
const char *dstmac_opt = NULL;
- const char *ifname = NULL;
+ const char *ifname = NULL; // -i/-I
int opt_B = 0;
int opt_T = 0;
int opt_U = 0;
+ const char* drop_group = NULL; // -g
const char *parm; // First argument, meaning the target IP.
int c;
unsigned int maxcount = -1;
@@ -1440,7 +1526,8 @@
struct bpf_program bp;
pcap_t *pcap;
enum { NONE, PINGMAC, PINGIP } mode = NONE;
- unsigned int packetwait = 1000000;
+ unsigned int packetwait = 1000000; // Default one second.
+ double deadline = -1;
char bpf_filter[64];
ebuf[0] = 0;
@@ -1457,7 +1544,7 @@
memcpy(dstmac, ethxmas, ETH_ALEN);
while (EOF != (c = getopt(argc, argv,
- "0aAbBC:c:dDeFhi:I:m:pPqQ:rRs:S:t:T:uUvV:w:W:"))) {
+ "0aAbBC:c:dDeFg:hi:I:m:pPqQ:rRs:S:t:T:uUvV:w:W:"))) {
switch(c) {
case '0':
srcip_opt = "0.0.0.0";
@@ -1496,6 +1583,9 @@
break;
case 'h':
usage(0);
+ case 'g':
+ drop_group = optarg;
+ break;
case 'i':
if (strchr(optarg, ':')) {
fprintf(stderr, "arping: If you're trying to "
@@ -1574,7 +1664,7 @@
}
break;
case 'w':
- packetwait = (unsigned)atoi(optarg);
+ deadline = atof(optarg);
break;
case 'W':
packetwait = (unsigned)(1000000.0 * atof(optarg));
@@ -1592,7 +1682,7 @@
}
if (((mode == PINGIP) && opt_T)
- || (mode == PINGMAC) && (opt_B || dstmac_opt || opt_U)) {
+ || ((mode == PINGMAC) && (opt_B || dstmac_opt || opt_U))) {
fprintf(stderr, "arping: -T can only be used to ping MAC"
" and -BtU only to ping IPs");
exit(1);
@@ -1650,9 +1740,14 @@
if (verbose > 1) {
#if HAVE_CLOCK_MONOTONIC
struct timespec ts;
- clock_getres(CLOCK_MONOTONIC, &ts);
- printf("arping: clock_getres() = %ld %ld\n",
- (long)ts.tv_sec, (long)ts.tv_nsec);
+ if (clock_getres(CLOCK_MONOTONIC, &ts)) {
+ fprintf(stderr,
+ "arping: clock_getres(CLOCK_MONOTONIC, ...): %s\n",
+ strerror(errno));
+ } else {
+ printf("arping: clock_getres() = %lds %ldns\n",
+ (long)ts.tv_sec, (long)ts.tv_nsec);
+ }
#else
printf("arping: Using gettimeofday() for time measurements\n");
#endif
@@ -1694,7 +1789,7 @@
do_libnet_init(ifname, 0);
parm = strdup(libnet_addr2name4(dstip,0));
if (!parm) {
- fprintf(stderr, "arping: out of mem\n");
+ fprintf(stderr, "arping: out of memory\n");
exit(1);
}
}
@@ -1812,7 +1907,7 @@
fprintf(stderr, "arping: pcap_open_live(): %s\n", ebuf);
exit(1);
}
- drop_privileges();
+ drop_privileges(drop_group);
if (pcap_setnonblock(pcap, 1, ebuf)) {
strip_newline(ebuf);
fprintf(stderr, "arping: pcap_set_nonblock(): %s\n", ebuf);
@@ -1845,8 +1940,8 @@
snprintf(bpf_filter, sizeof(bpf_filter), "arp");
}
if (-1 == pcap_compile(pcap, &bp, bpf_filter, 0, -1)) {
- fprintf(stderr, "arping: pcap_compile(%s): error\n",
- bpf_filter);
+ fprintf(stderr, "arping: pcap_compile(%s): %s\n",
+ bpf_filter, pcap_geterr(pcap));
exit(1);
}
} else { /* ping mac */
@@ -1858,13 +1953,14 @@
snprintf(bpf_filter, sizeof(bpf_filter), "icmp");
}
if (-1 == pcap_compile(pcap, &bp, bpf_filter, 0,-1)) {
- fprintf(stderr, "arping: pcap_compile(%s): error\n",
- bpf_filter);
+ fprintf(stderr, "arping: pcap_compile(%s): %s\n",
+ bpf_filter, pcap_geterr(pcap));
exit(1);
}
}
if (-1 == pcap_setfilter(pcap, &bp)) {
- fprintf(stderr, "arping: pcap_setfilter(): error\n");
+ fprintf(stderr, "arping: pcap_setfilter(): %s\n",
+ pcap_geterr(pcap));
exit(1);
}
@@ -1908,14 +2004,22 @@
/*
* let's roll
*/
+ if (deadline > 0) {
+ struct timespec ts;
+ getclock(&ts);
+ deadline += timespec2dbl(&ts);
+ }
if (mode == PINGIP) {
unsigned int c;
unsigned int r;
for (c = 0; c < maxcount && !time_to_die; c++) {
pingip_send();
r = numrecvd;
- ping_recv(pcap,packetwait,
- (pcap_handler)pingip_recv);
+ const uint32_t w = wait_time(deadline, packetwait);
+ if (w == 0) {
+ break;
+ }
+ ping_recv(pcap, w, (pcap_handler)pingip_recv);
}
} else { /* PINGMAC */
unsigned int c;
@@ -1923,8 +2027,11 @@
for (c = 0; c < maxcount && !time_to_die; c++) {
pingmac_send(rand(), c);
r = numrecvd;
- ping_recv(pcap,packetwait,
- (pcap_handler)pingmac_recv);
+ const uint32_t w = wait_time(deadline, packetwait);
+ if (w == 0) {
+ break;
+ }
+ ping_recv(pcap, w, (pcap_handler)pingmac_recv);
}
}
if (display == DOT) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/src/fuzz_pingip.c new/arping-2.19/src/fuzz_pingip.c
--- old/arping-2.17/src/fuzz_pingip.c 1970-01-01 01:00:00.000000000 +0100
+++ new/arping-2.19/src/fuzz_pingip.c 2017-07-09 19:52:08.000000000 +0200
@@ -0,0 +1,75 @@
+/* arping/src/fuzz_pingip.c
+ *
+ * Copyright (C) 2016 Thomas Habets
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include"arping.h"
+
+int
+main()
+{
+ const size_t maxpacket = 1500;
+ char* const packet = calloc(1, maxpacket);
+ size_t packet_size = 0;
+
+ // Read packet.
+ {
+ char* p = packet;
+ size_t size = maxpacket;
+ while (size > 0) {
+ const ssize_t n = read(STDIN_FILENO, p, size);
+ if (n == 0) {
+ break;
+ }
+ if (n < 0) {
+ fprintf(stderr, "read(): %s\n", strerror(errno));
+ return 1;
+ }
+ size -= n;
+ p += n;
+ }
+ packet_size = p - packet;
+ }
+
+ struct pcap_pkthdr pkthdr;
+ pkthdr.ts.tv_sec = time(NULL);
+ pkthdr.ts.tv_usec = 0;
+ pkthdr.len = packet_size;
+ pkthdr.caplen = packet_size;
+
+ dstip = htonl(0x12345678);
+ pingip_recv(NULL, &pkthdr, packet);
+
+ free(packet);
+ return 0;
+}
+/* ---- Emacs Variables ----
+ * Local Variables:
+ * c-basic-offset: 8
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/src/fuzz_pingmac.c new/arping-2.19/src/fuzz_pingmac.c
--- old/arping-2.17/src/fuzz_pingmac.c 1970-01-01 01:00:00.000000000 +0100
+++ new/arping-2.19/src/fuzz_pingmac.c 2017-07-09 19:52:08.000000000 +0200
@@ -0,0 +1,56 @@
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include"arping.h"
+
+int
+main()
+{
+ const size_t maxpacket = 1500;
+ char* const packet = calloc(1, maxpacket);
+ size_t packet_size = 0;
+
+ // Read packet.
+ {
+ char* p = packet;
+ size_t size = maxpacket;
+ while (size > 0) {
+ const ssize_t n = read(STDIN_FILENO, p, size);
+ if (n == 0) {
+ break;
+ }
+ if (n < 0) {
+ fprintf(stderr, "read(): %s\n", strerror(errno));
+ return 1;
+ }
+ size -= n;
+ p += n;
+ }
+ packet_size = p - packet;
+ }
+
+ struct pcap_pkthdr pkthdr;
+ pkthdr.ts.tv_sec = time(NULL);
+ pkthdr.ts.tv_usec = 0;
+ pkthdr.len = packet_size;
+ pkthdr.caplen = packet_size;
+
+ verbose = 9;
+ dstip = htonl(0x12345678);
+ pingip_recv(NULL, &pkthdr, packet);
+
+ free(packet);
+ return 0;
+}
+/* ---- Emacs Variables ----
+ * Local Variables:
+ * c-basic-offset: 8
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/arping-2.17/test-driver new/arping-2.19/test-driver
--- old/arping-2.17/test-driver 2016-06-28 00:07:18.000000000 +0200
+++ new/arping-2.19/test-driver 2017-07-09 19:52:12.000000000 +0200
@@ -3,7 +3,7 @@
scriptversion=2013-07-13.22; # UTC
-# Copyright (C) 2011-2013 Free Software Foundation, Inc.
+# Copyright (C) 2011-2014 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -106,11 +106,14 @@
# Test script is run here.
"$@" >$log_file 2>&1
estatus=$?
+
if test $enable_hard_errors = no && test $estatus -eq 99; then
- estatus=1
+ tweaked_estatus=1
+else
+ tweaked_estatus=$estatus
fi
-case $estatus:$expect_failure in
+case $tweaked_estatus:$expect_failure in
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
@@ -119,6 +122,12 @@
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
+# Report the test outcome and exit status in the logs, so that one can
+# know whether the test passed or failed simply by looking at the '.log'
+# file, without the need of also peaking into the corresponding '.trs'
+# file (automake bug#11814).
+echo "$res $test_name (exit status: $estatus)" >>$log_file
+
# Report outcome to console.
echo "${col}${res}${std}: $test_name"