Fix tftp startup for systems that have explicitly disabled IPv6 in kernel

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11933 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2012-03-21 16:01:15 +00:00
parent 7c64bb6b05
commit 459dca23dd

View File

@ -1481,13 +1481,27 @@ sub enable_TFTPhpa
#}
#xCAT::MsgUtils->message("S", " The tftp-hpa has been reconfigured.");
}
my $protocols;
my $v4only="-4 ";
open($protocols,"<","/proc/net/protocols");
if ($protocols) {
my $line;
while ($line = <$protocols>) {
if ($line =~ /^TCPv6/) {
$v4only="";
last;
}
}
} else {
$v4only="";
}
if (-x "/usr/sbin/in.tftpd") {
system("killall in.tftpd"); #xinetd can leave behind blocking tftp servers even if it won't start new ones
my @tftpprocs=`ps axf|grep -v grep|grep in.tftpd`;
while (@tftpprocs) {
sleep 0.1;
}
system("/usr/sbin/in.tftpd -v -l -s /tftpboot -m /etc/tftpmapfile4xcat.conf");
system("/usr/sbin/in.tftpd $v4only -v -l -s /tftpboot -m /etc/tftpmapfile4xcat.conf");
}
return 0;