aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbsam <bsam@FreeBSD.org>2009-08-21 16:55:41 +0800
committerbsam <bsam@FreeBSD.org>2009-08-21 16:55:41 +0800
commitbd2de1d2cf656a46ea5fe212108495ca513660f1 (patch)
tree964578eb76ac7908369530a2679544da3e967ef6
parent6ec1331cfcb8676cca1281b86862ca5dcddc16e3 (diff)
downloadfreebsd-ports-gnome-bd2de1d2cf656a46ea5fe212108495ca513660f1.tar.gz
freebsd-ports-gnome-bd2de1d2cf656a46ea5fe212108495ca513660f1.tar.zst
freebsd-ports-gnome-bd2de1d2cf656a46ea5fe212108495ca513660f1.zip
. current implementation of function find_interface_bsd() in [1]
heartbeat-2.1.4 used in port sysutils/heartbeat does not work correctly if there are multiple interfaces with the same IP address (where only one of is UP, the others are DOWN). Fix this with files/patch-resources-OCF-IPaddr; . bump PORTREVISION. PR: ports/137865 [1] Submitted by: Michael Leun <michael.leun at arcor.net> [1] Approved by: Justin Head <ports at encarnate.com> (maintainer) [1]
-rw-r--r--sysutils/heartbeat/Makefile2
-rw-r--r--sysutils/heartbeat/files/patch-resources-OCF-IPaddr67
2 files changed, 68 insertions, 1 deletions
diff --git a/sysutils/heartbeat/Makefile b/sysutils/heartbeat/Makefile
index 4718fc08140e..df472bab491d 100644
--- a/sysutils/heartbeat/Makefile
+++ b/sysutils/heartbeat/Makefile
@@ -7,7 +7,7 @@
PORTNAME= heartbeat
PORTVERSION= 2.1.4
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= sysutils
#MASTER_SITES= http://hg.linux-ha.org/lha-2.1/archive/STABLE-2.1.4.tar.bz2
MASTER_SITES= ${MASTER_SITE_LOCAL}
diff --git a/sysutils/heartbeat/files/patch-resources-OCF-IPaddr b/sysutils/heartbeat/files/patch-resources-OCF-IPaddr
new file mode 100644
index 000000000000..0c64e197478e
--- /dev/null
+++ b/sysutils/heartbeat/files/patch-resources-OCF-IPaddr
@@ -0,0 +1,67 @@
+patch attached
+
+Patch attached with submission follows:
+
+--- resources/OCF/IPaddr.orig 2009-08-06 13:08:35.000000000 +0200
++++ resources/OCF/IPaddr 2009-08-06 13:12:35.000000000 +0200
+@@ -298,9 +298,56 @@
+ return $OCF_ERR_GENERIC
+ }
+
++#
++# Find out which alias serves the given IP address
++# The argument is an IP address, and its output
++# is an interface name (e.g., "em0").
++#
++# parse the output of ifconfig and find the interface
++# that holds ip address $ip (multiple may exist, but
++# only one with flag UP)
++# Try to find an interface with flag UP. If we don't find
++# such an interface, try to find one with flag DOWN
++
+ find_interface_bsd() {
+- #$IFCONFIG $IFCONFIG_A_OPT | grep "inet.*[: ]$OCF_RESKEY_ip "
+- $IFCONFIG | grep "$ipaddr" -B20 | grep "UP," | tail -n 1 | cut -d ":" -f 1
++
++ ipaddr="$1";
++
++ /sbin/ifconfig \
++ | /usr/bin/perl -w -e '
++
++ my $ip = $ARGV[0];
++
++ if (! $ip) {
++ exit(255);
++ }
++
++ my $if_name = "";
++ my $if_status = 0;
++
++ my $down_if_name = "";
++
++ while (<STDIN>) {
++ chomp();
++ if ( /^(\w+):\s+flags=/ ) {
++ $if_name = $1;
++ $if_status = ( /UP/ ) ? 1 : 0;
++ }
++ if ( /^\s+inet\s+${ip}/ ) {
++ if ( $if_status ) {
++ print $if_name;
++ exit(0)
++ } else {
++ $down_if_name = $if_name;
++ }
++ }
++ }
++
++ if ($down_if_name) {
++ print $down_if_name;
++ }
++
++ ' $ipaddr
+ }
+
+ #
+
+