From 87266d5b27778af56a814347fdd8926274b9c315 Mon Sep 17 00:00:00 2001 From: sayo Date: Sun, 11 Jun 2017 16:29:07 +0100 Subject: Fix to generate correct NTP config when specifying ipv6 servers. --- scripts/system/vyatta_update_ntp.pl | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'scripts') diff --git a/scripts/system/vyatta_update_ntp.pl b/scripts/system/vyatta_update_ntp.pl index 36a2807e..eaaae14a 100755 --- a/scripts/system/vyatta_update_ntp.pl +++ b/scripts/system/vyatta_update_ntp.pl @@ -35,19 +35,14 @@ sub ntp_format { if (defined($ip)) { my $address = $ip->addr(); my $mask = $ip->mask(); - - if ($ip->masklen() == 32) { - if ($ip->version() == 6) { - return "-6 $address"; - } else { - return "$address"; - } + + if ( + ($ip->version() == 6 && $ip->masklen() == 128) + || ($ip->version() == 4 && $ip->masklen() == 32) + ) { + return "$address"; } else { - if ($ip->version() == 6) { - return "-6 $address mask $mask"; - } else { - return "$address mask $mask"; - } + return "$address mask $mask"; } } else { return undef; -- cgit v1.2.3