From 2486f856c3344331b0c821308316bdfa6651aedc Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 15 Oct 2013 09:50:13 +0800 Subject: [PATCH] fix for bug 3833: if ip forwarding is not enabled, do not use the MN as gateway --- perl-xCAT/xCAT/DBobjUtils.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) mode change 100644 => 100755 perl-xCAT/xCAT/DBobjUtils.pm diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm old mode 100644 new mode 100755 index af739198e..01683911a --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -2007,7 +2007,14 @@ sub getNetwkInfo my @nodes = ("$node"); my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes,"xcat","Node"); my $snkey = (keys %{$sn})[0]; - $nethash{$node}{'gateway'} = xCAT::NetworkUtils->getipaddr($snkey); + my $gw = xCAT::NetworkUtils->getipaddr($snkey); + # two possible cases when this code is run: + # 1. flat cluster: ip forwarding is not enabled on MN + # 2. hw ctrl in hierarchy cluster, in which HCP SN is not set + # in either case, MN itself should not be the gateway + if (xCAT::NetworkUtils->thishostisnot($gw)) { + $nethash{$node}{'gateway'} = $gw; + } } }