diff --git a/mxstartup2mxconfig b/mxstartup2mxconfig index 6315ef1..4851e69 100755 --- a/mxstartup2mxconfig +++ b/mxstartup2mxconfig @@ -147,9 +147,18 @@ sub parse_ips { # printf "ip = $_\n"; # printf "todest = $_todest\n"; - - $ip = inet_ntoa(scalar gethostbyname($_)); - $_todest = inet_ntoa(scalar gethostbyname($_todest)); + + if (! ($tmphostname = gethostbyname($_)) ) { + printf STDERR "mxvip::$name *ERROR* Can't resolve '$_'. Skipping.\n"; + next; + } + $ip = inet_ntoa($tmphostname); + + if (! ($tmphostname = gethostbyname($_todest)) ) { + printf STDERR "mxvip::$name *ERROR* Can't resolve '$_'. Skipping.\n"; + next; + } + $_todest = inet_ntoa($tmphostname); $H->{$ip} = { device => $device, addressprefix => $addressprefix, ports => {%ports}, todest => $_todest }; }