From 2a812180cf55cf8bb8a219fc0a0c8f146b4d47c9 Mon Sep 17 00:00:00 2001 From: Mats Dufberg Date: Tue, 19 Jan 2021 16:07:22 +0100 Subject: [PATCH 1/4] Updates the ipv4 and ipv6 command line options Makes the ipv4 and ipv6 options undefined unless explicitly set on the command line. Changes so that the ip setting is only changed if the option is explicitly set on the command line. --- lib/Zonemaster/CLI.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Zonemaster/CLI.pm b/lib/Zonemaster/CLI.pm index a081a544..90ab9d67 100755 --- a/lib/Zonemaster/CLI.pm +++ b/lib/Zonemaster/CLI.pm @@ -147,7 +147,6 @@ has 'restore' => ( has 'ipv4' => ( is => 'ro', isa => 'Bool', - default => 1, documentation => __( 'Flag to permit or deny queries being sent via IPv4. --ipv4 permits IPv4 traffic, --no-ipv4 forbids it.' ), ); @@ -155,7 +154,6 @@ has 'ipv4' => ( has 'ipv6' => ( is => 'ro', isa => 'Bool', - default => 1, documentation => __( 'Flag to permit or deny queries being sent via IPv6. --ipv6 permits IPv6 traffic, --no-ipv6 forbids it.' ), ); @@ -358,9 +356,9 @@ sub run { } # These two must come after any profile from command line has been loaded - # to override the profile setting - Zonemaster::Engine::Profile->effective->set( q{net.ipv4}, 0+$self->ipv4 ); - Zonemaster::Engine::Profile->effective->set( q{net.ipv6}, 0+$self->ipv6 ); + # to override the profile setting, but only if selected. + Zonemaster::Engine::Profile->effective->set( q{net.ipv4}, 0+$self->ipv4 ) if defined ($self->ipv4); + Zonemaster::Engine::Profile->effective->set( q{net.ipv6}, 0+$self->ipv6 ) if defined ($self->ipv6); if ( $self->dump_profile ) { From 8bc72a89b93fb46734cbbe9c59d2e796e0f910a7 Mon Sep 17 00:00:00 2001 From: Mats Dufberg Date: Wed, 20 Jan 2021 11:28:08 +0100 Subject: [PATCH 2/4] Editorial updates. --- lib/Zonemaster/CLI.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Zonemaster/CLI.pm b/lib/Zonemaster/CLI.pm index 90ab9d67..e69798d8 100755 --- a/lib/Zonemaster/CLI.pm +++ b/lib/Zonemaster/CLI.pm @@ -356,9 +356,13 @@ sub run { } # These two must come after any profile from command line has been loaded - # to override the profile setting, but only if selected. - Zonemaster::Engine::Profile->effective->set( q{net.ipv4}, 0+$self->ipv4 ) if defined ($self->ipv4); - Zonemaster::Engine::Profile->effective->set( q{net.ipv6}, 0+$self->ipv6 ) if defined ($self->ipv6); + # to make any IPv4/IPv6 option override the profile setting. + if defined ($self->ipv4) { + Zonemaster::Engine::Profile->effective->set( q{net.ipv4}, 0+$self->ipv4 ); + } + if defined ($self->ipv6) { + Zonemaster::Engine::Profile->effective->set( q{net.ipv6}, 0+$self->ipv6 ); + }; if ( $self->dump_profile ) { From 0801d9a026db6f79a71729e7b9a2e2fdcdbf9797 Mon Sep 17 00:00:00 2001 From: Mats Dufberg Date: Wed, 20 Jan 2021 12:12:33 +0100 Subject: [PATCH 3/4] Very minor editorial update. --- lib/Zonemaster/CLI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Zonemaster/CLI.pm b/lib/Zonemaster/CLI.pm index e69798d8..65f44ed9 100755 --- a/lib/Zonemaster/CLI.pm +++ b/lib/Zonemaster/CLI.pm @@ -362,7 +362,7 @@ sub run { } if defined ($self->ipv6) { Zonemaster::Engine::Profile->effective->set( q{net.ipv6}, 0+$self->ipv6 ); - }; + } if ( $self->dump_profile ) { From 11e753eee34b80c980c50351be55fe4ec7506d78 Mon Sep 17 00:00:00 2001 From: Mats Dufberg Date: Wed, 20 Jan 2021 13:32:41 +0100 Subject: [PATCH 4/4] Adds missing parentheses that created failing code. --- lib/Zonemaster/CLI.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Zonemaster/CLI.pm b/lib/Zonemaster/CLI.pm index 65f44ed9..a55a547d 100755 --- a/lib/Zonemaster/CLI.pm +++ b/lib/Zonemaster/CLI.pm @@ -357,10 +357,10 @@ sub run { # These two must come after any profile from command line has been loaded # to make any IPv4/IPv6 option override the profile setting. - if defined ($self->ipv4) { + if ( defined ($self->ipv4) ) { Zonemaster::Engine::Profile->effective->set( q{net.ipv4}, 0+$self->ipv4 ); } - if defined ($self->ipv6) { + if ( defined ($self->ipv6) ) { Zonemaster::Engine::Profile->effective->set( q{net.ipv6}, 0+$self->ipv6 ); }