From 96b453c5e37b21e2710e912b22e5a51617655f25 Mon Sep 17 00:00:00 2001 From: Marius Tolzmann Date: Thu, 10 Jan 2013 11:20:43 +0100 Subject: [PATCH] mxstartup2mxconfig: Skip unresolvable ip aliases in corrupted mxstartup config --- mxstartup2mxconfig | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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 }; }