ports/125192: net apinger port 0.6.1 marks all hosts as down

Seth Mos seth.mos at xs4all.nl
Wed Jul 2 18:00:03 UTC 2008

>Number:         125192
>Category:       ports
>Synopsis:       net apinger port 0.6.1 marks all hosts as down
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 02 18:00:03 UTC 2008
>Originator:     Seth Mos
>Release:        RELENG_7_0
# uname -a
FreeBSD lutjebroek.coltex.nl 7.0-RELEASE-p2 FreeBSD 7.0-RELEASE-p2 #0: Tue Jul  1 01:34:41 EDT 2008     sullrich at builder7.bgn.pfsense.org:/usr/obj.pfSense/usr/src/sys/pfSense_wrap.7  i386

The pfSense projecting is currently integrating apinger into the pfSense product to monitor all gateways on the system.

When starting apinger at sytem boot it will report all hosts as down.
When killing and starting apinger again it will work about 1 out of every 4 tries. This is very frustrating as this results to incorrect rule generation for load balancing.

When running apinger in debug mode using apinger -f -d -c /var/etc/apinger.conf it will reveal in the output "Alien reply received". This string comes from icmp.c in the apinger sources and is output when the icmp reply does not match the seq number on the sent ping.

A tcpdump on the interface reveals that a icmp echo and reply are indeed received with the correct sequence numbers.

After a quick investigation by Ermal Luci of the pfSense project it appears the ident is generated using the process id. The process id on FreeBSD can be larger then 16 bits which results in incorrect sequence numbers being used which results in triggering the error.

A patch is attached to this PR which corrects it. Cursory testing and rebooting the aforementioned host indicates the problem does not exist any more and apinger correctly generates a status report.

Kind regards,

Seth Mos
pfSense Developer

Generate a apinger.conf configuration file. Then stop and start until apinger has a process id higher then 16 bits.
See attached patch.

Patch attached with submission follows:

--- main.c.org	2008-07-02 22:43:14.000000000 +0200
+++ main.c	2008-07-02 22:11:49.000000000 +0200
@@ -277,7 +277,7 @@
 		return 1;
-	ident=getpid();
+	ident=getpid() & 0xFFFF;


More information about the freebsd-ports-bugs mailing list