Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jul 2008 17:59:37 GMT
From:      Seth Mos <seth.mos@xs4all.nl>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/125192: net apinger port 0.6.1 marks all hosts as down
Message-ID:  <200807021759.m62HxbTi050007@www.freebsd.org>
Resent-Message-ID: <200807021800.m62I030v069222@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 02 18:00:03 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Seth Mos
>Release:        RELENG_7_0
>Organization:
pfSense
>Environment:
# 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@builder7.bgn.pfsense.org:/usr/obj.pfSense/usr/src/sys/pfSense_wrap.7  i386

>Description:
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


>How-To-Repeat:
Generate a apinger.conf configuration file. Then stop and start until apinger has a process id higher then 16 bits.
>Fix:
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;
 	signal(SIGTERM,signal_handler);
 	signal(SIGINT,signal_handler);
 	signal(SIGHUP,signal_handler);


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807021759.m62HxbTi050007>