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! 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: 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.
Maintainer of sysutils/heartbeat, Please note that PR ports/140012 has just been submitted. If it contains a patch for an upgrade, an enhancement or a bug fix you agree on, reply to this email stating that you approve the patch and a committer will take care of it. The full text of the PR can be found at: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/140012 -- Edwin Groothuis via the GNATS Auto Assign Tool edwin@FreeBSD.org
State Changed From-To: open->feedback Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Couple of follow-up points : - My test case had a cut'n'paste typo - I configured the interface on bge0, but then tested it using em0. If you test this, both interfaces should be the same. - My alteration added a space at the end of the regex. To keep with the original function's style, this could also be "\s+" marker (Perl whitespsace marker, one or more times). E.g. /^\s+inet\s+${ip}\s+/ - It looks like this function was added as a patch in ports/137865.
Attached is an update to the current port patch located at files/patch-resources-OCF-IPaddr. It includes the requester's update as well as a few updates i made to tighten up the regex matching. Tested and it does fix the requester's problem description. - Justin
I don't understand why my simple text files can never seem to show correctly through FreeBSD's bug tool. I send attachments just fine to everywhere else. Here is a paste below. - Justin --- --- files/patch-resources-OCF-IPaddr.orig 2009-08-21 03:55:41.000000000 -0500 +++ files/patch-resources-OCF-IPaddr 2009-10-31 10:02:44.000000000 -0500 @@ -41,11 +41,11 @@ + + while (<STDIN>) { + chomp(); -+ if ( /^(\w+):\s+flags=/ ) { ++ if ( /^(\w+):\sflags=/ ) { + $if_name = $1; + $if_status = ( /UP/ ) ? 1 : 0; + } -+ if ( /^\s+inet\s+${ip}/ ) { ++ if ( /^\tinet\s${ip}\s/ ) { + if ( $if_status ) { + print $if_name; + exit(0)
Great stuff. I applied your patch and rebuilt heartbeat from ports. The patched resource gets installed properly, and I can confirm this fixes the problem.=20
Responsible Changed From-To: freebsd-ports-bugs->bsam Take.
bsam 2009-11-16 08:51:33 UTC FreeBSD ports repository Modified files: sysutils/heartbeat Makefile sysutils/heartbeat/files patch-resources-OCF-IPaddr Log: . fix some regexps for ip address detection; [1] . bump PORTREVISION. PR: ports/140012 [1] Submitted by: Mark Round <mark.round at ahc.uk.com> [1] Final patch by: maintainer (Justin Head <ports at encarnate.com>) [1] Revision Changes Path 1.23 +1 -1 ports/sysutils/heartbeat/Makefile 1.2 +2 -2 ports/sysutils/heartbeat/files/patch-resources-OCF-IPaddr _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
State Changed From-To: feedback->closed Committed, thanks!