summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorsayo <treacly@gmail.com>2017-06-11 16:29:07 +0100
committersayo <treacly@gmail.com>2017-06-11 16:29:07 +0100
commit87266d5b27778af56a814347fdd8926274b9c315 (patch)
tree78a077c6e43c046f2ea9a8a4e4de9830a0fdcd65 /scripts
parentd133ba0fcdda4bb1c4a7653e2b275a2a3ec4434b (diff)
downloadvyatta-cfg-system-87266d5b27778af56a814347fdd8926274b9c315.tar.gz
vyatta-cfg-system-87266d5b27778af56a814347fdd8926274b9c315.zip
Fix to generate correct NTP config when specifying ipv6 servers.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/system/vyatta_update_ntp.pl19
1 files changed, 7 insertions, 12 deletions
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;