From 4fed6d751ae4f3189b9ed974ace51a10f8f957fd Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 4 May 2016 11:24:27 -0400 Subject: [PATCH] Use version_cmp() to compare the version number --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 80fa858d2..1e1a70375 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -836,7 +836,7 @@ sub snmp_scan { # command. # for version 4.75, the line as :"Host 10.4.25.1 appears to be up ... good." # other higher version has line like this: "Discovered open port 161/udp on 10.4.25.1" - if ($nmap_version <= 4.75) { + if (xCAT::Utils->version_cmp($nmap_version,"4.75") <= 0) { $ccmd = "/usr/bin/nmap -P0 -v -sU -p 161 -oA snmp_scan @$ranges | grep up | grep good "; } else { $ccmd = "/usr/bin/nmap -P0 -v -sU -p 161 -oA snmp_scan @$ranges | grep 'open port 161' ";