diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index d2b45b953..6f65ea2e2 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -2186,12 +2186,17 @@ sub isValidMAC sub isValidHostname { my ($class, $hostname) = @_; - if ($hostname =~ /^[a-z0-9][\-a-z0-9]+[a-z0-9]$/){ - return 1; + if ($hostname =~ /^[a-z0-9]/){ + if ($hostname =~ /[a-z0-9]$/){ + if ($hostname =~ /[\-a-z0-9]+/){ + return 1; + } + } } return 0; } + #------------------------------------------------------------------------------- =head3 isValidFQDN