From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Oct 27 10:10:03 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA38D1065670 for ; Tue, 27 Oct 2009 10:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id ADBA68FC19 for ; Tue, 27 Oct 2009 10:10:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n9RAA3RK081432 for ; Tue, 27 Oct 2009 10:10:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n9RAA3Pn081431; Tue, 27 Oct 2009 10:10:03 GMT (envelope-from gnats) Resent-Date: Tue, 27 Oct 2009 10:10:03 GMT Resent-Message-Id: <200910271010.n9RAA3Pn081431@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mark Round Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8A39106566B for ; Tue, 27 Oct 2009 10:06:20 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id B5F1B8FC1D for ; Tue, 27 Oct 2009 10:06:20 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n9RA6If2046326 for ; Tue, 27 Oct 2009 10:06:18 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n9RA6II1046325; Tue, 27 Oct 2009 10:06:18 GMT (envelope-from nobody) Message-Id: <200910271006.n9RA6II1046325@www.freebsd.org> Date: Tue, 27 Oct 2009 10:06:18 GMT From: Mark Round To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/140012: Error in heartbeat-2.1.4_3, find_interface_bsd X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 10:10:04 -0000 >Number: 140012 >Category: ports >Synopsis: Error in heartbeat-2.1.4_3, find_interface_bsd >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: Tue Oct 27 10:10:03 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Mark Round >Release: 7.1-RELEASE >Organization: >Environment: FreeBSD freebsd1.ahc.uk.com 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 14:37:25 UTC 2009 root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: I am using the heartbeat-2.1.4_3 package, built from ports. There is a problem with the /usr/local/etc/ocf/resource.d/heartbeat/IPaddr script. Inside this file, there is a find_interface_bsd function, which contains a typo in a regex. The end result is that it returns true for an IP address, even if it's only a partial match (a substring match). This means that in some circumstances, heartbeat will not start, with an error similar to the following : 2009/10/25_10:20:48 CRITICAL: Resource IPaddr::192.168.1.1/24/bge0 is active, and should not be! 2009/10/25_10:20:48 CRITICAL: Non-idle resources can affect data integrity! >How-To-Repeat: - Install heartbeat-2.1.4_3 from ports - Configure an IP address on an interface, e.g: ifconfig bge0 172.16.7.120 netmask 255.255.255.0 Now try using the IPaddr script to check for the presence of an IP address that would be matched. As the faulty regex does not include a space at the end, it will return true if the IP address is a _substring_ of the configured ip address : # /usr/local/etc/ha.d/resource.d/IPaddr 172.16.7.1/24/em0 status 2009/10/27_10:00:00 INFO: Running OK INFO: Running OK # /usr/local/etc/ha.d/resource.d/IPaddr 172.16.7.12/24/em0 status 2009/10/27_10:00:03 INFO: Running OK INFO: Running OK Neither of the 172.16.7.1 or 172.16.7.12 IP addresses are actually being handled by that interface, but as they are substrings of the 172.16.7.120 IP address that _is_ being handled, they return true. >Fix: This is a problem with the way find_interface_bsd parses the output of ifconfig. By adding a space to the end of the regex, it only then finds exact matches : Simply patch /usr/local/etc/ocf/resource.d/heartbeat/IPaddr with the following (also attached as a .txt file to this report) *** IPaddr.orig Tue Oct 27 09:43:11 2009 --- IPaddr Tue Oct 27 09:43:37 2009 *************** *** 334,338 **** $if_status = ( /UP/ ) ? 1 : 0; } ! if ( /^\s+inet\s+${ip}/ ) { if ( $if_status ) { print $if_name; --- 334,338 ---- $if_status = ( /UP/ ) ? 1 : 0; } ! if ( /^\s+inet\s+${ip} / ) { if ( $if_status ) { print $if_name; Patch attached with submission follows: *** IPaddr.orig Tue Oct 27 09:43:11 2009 --- IPaddr Tue Oct 27 09:43:37 2009 *************** *** 334,338 **** $if_status = ( /UP/ ) ? 1 : 0; } ! if ( /^\s+inet\s+${ip}/ ) { if ( $if_status ) { print $if_name; --- 334,338 ---- $if_status = ( /UP/ ) ? 1 : 0; } ! if ( /^\s+inet\s+${ip} / ) { if ( $if_status ) { print $if_name; >Release-Note: >Audit-Trail: >Unformatted: