From 459dca23ddbebcb901fa2336eae6cb4fc67569cb Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 21 Mar 2012 16:01:15 +0000 Subject: [PATCH] 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 --- xCAT-server/lib/xcat/plugins/AAsn.pm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/AAsn.pm b/xCAT-server/lib/xcat/plugins/AAsn.pm index 99f57c526..1461cdab1 100644 --- a/xCAT-server/lib/xcat/plugins/AAsn.pm +++ b/xCAT-server/lib/xcat/plugins/AAsn.pm @@ -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;