ports/54575: arpwatch.sh doesn't support multiple interfaces well

Gleb Smirnoff glebius at cell.sick.ru
Thu Jul 17 11:30:22 UTC 2003


>Number:         54575
>Category:       ports
>Synopsis:       arpwatch.sh doesn't support multiple interfaces well
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 17 04:30:19 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Gleb Smirnoff
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
Bestcom ISP
>Environment:
System: FreeBSD gw-f.bestcom.ru 4.8-STABLE FreeBSD 4.8-STABLE #7: Wed Jul 2 16:22:29 GMT 2003 root at angst.bestcom.ru:/usr/obj/usr/src/sys/GW-F i386

>Description:
	  arpwatch.sh is not part of arpwatch 2.1.a11, but a part of its
	FreeBSD port. arpwatch.sh is installed into /usr/local/etc/rc.d
	and starts arpwatch at boot time.
	  It runs as many arpwatches as specified by variable
	${arpwatch_interfaces} in rc.conf. 
	  The problem is that all this arpwatch processes try to use 
	the same /usr/local/arpwatch/arp.dat. At shutdown time there 
	exists a race condition between them: each arpwatch process dumps
	his data into arp.dat, and there remains table of the last
	exited one.

>How-To-Repeat:
	Set ${arpwatch_interfaces} to a list of interfaces, more than 1.
	Run arpwatch, look at your mail, write down 'new stations'. 
	killall arpwatches, start arpwatch.sh again. Look at your mail.
	Some 'new stations' will appear again.

>Fix:
	Let each arpwatch use his own arp.${iface}.dat:

--- arpwatch.sh.orig	Thu Jul 17 12:31:20 2003
+++ arpwatch.sh	Thu Jul 17 12:30:18 2003
@@ -35,7 +35,8 @@
 		;;
 	*)
 		for interface in ${arpwatch_interfaces}; do
-			"$PREFIX"/sbin/arpwatch -i "${interface}" && echo -n " arpwatch(${interface})"
+			touch $PREFIX/arpwatch/arp.${interface}.dat 
+			"$PREFIX"/sbin/arpwatch -i "${interface}" -f arp.${interface}.dat && echo -n " arpwatch(${interface})"
 		done
 		;;
 	esac
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list