Bugzilla – Attachment 99751 Details for
Bug 24739
Buster ships with Net::Netmask 1.9104 which supports IPv6
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24739: Perform IPv6 tests only if Net::Netmask is correct version
Bug-24739-Perform-IPv6-tests-only-if-NetNetmask-is.patch (text/plain), 3.90 KB, created by
Marcel de Rooy
on 2020-02-28 09:37:20 UTC
(
hide
)
Description:
Bug 24739: Perform IPv6 tests only if Net::Netmask is correct version
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2020-02-28 09:37:20 UTC
Size:
3.90 KB
patch
obsolete
>From 71f1bf1fdc1dc22782d04bbb5519a8e7065e5c0e Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Fri, 28 Feb 2020 00:17:58 +0000 >Subject: [PATCH] Bug 24739: Perform IPv6 tests only if Net::Netmask is correct > version >Content-Type: text/plain; charset=utf-8 > >Test plan: >0. Apply patch >1. Set up Koha on stretch (e.g. koha/koha-testing:master) >2. perl t/Koha/Middlware/RealIP.t >3. Observe the following: >Subtest: IPv6 support > ok 1 - Warn on IPv6 koha_trusted_proxies > ok 2 - Unable to parse IPv6 address for trusted proxy, so ignore the X-Forwarded-For header > 1..2 >ok 13 - IPv6 support > >4. Set up Koha on buster (e.g. koha/koha-testing:master-buster) >5. perl t/Koha/Middlware/RealIP.t >6. Observe the following: >Subtest: IPv6 support > ok 1 - Trust proxy (2001:db8:1234:5678:abcd:1234:abcd:1234) using IPv6 CIDR notation, so use the X-Forwarded-For header for the remote address > 1..1 >ok 13 - IPv6 support > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/Koha/Middlware/RealIP.t | 49 +++++++++++++++++++++++++++++------------------ > 1 file changed, 30 insertions(+), 19 deletions(-) > >diff --git a/t/Koha/Middlware/RealIP.t b/t/Koha/Middlware/RealIP.t >index 28a45428e6..34bc02af26 100644 >--- a/t/Koha/Middlware/RealIP.t >+++ b/t/Koha/Middlware/RealIP.t >@@ -20,7 +20,7 @@ > > use strict; > use warnings; >-use Test::More tests => 14; >+use Test::More tests => 13; > use Test::Warn; > > use t::lib::Mocks; >@@ -85,22 +85,33 @@ t::lib::Mocks::mock_config('koha_trusted_proxies', '1.1.1.0:255.255.255.0'); > $address = Koha::Middleware::RealIP::get_real_ip( $remote_address, $x_forwarded_for_header ); > is($address,'2.2.2.2',"Trust proxy (1.1.1.1) using an IP address and netmask separated by a colon, so use the X-Forwarded-For header for the remote address"); > >-require Net::Netmask; >-SKIP: { >- skip "Net::Netmask at 1.9104+ supports IPv6", 2 unless Net::Netmask->VERSION < 1.9104; >- >- $remote_address = "2001:db8:1234:5678:abcd:1234:abcd:1234"; >- $x_forwarded_for_header = "2.2.2.2"; >- t::lib::Mocks::mock_config( 'koha_trusted_proxies', '2001:db8:1234:5678::/64' ); >- warning_is { >- $address = Koha::Middleware::RealIP::get_real_ip( $remote_address, >- $x_forwarded_for_header ); >+subtest "IPv6 support" => sub { >+ my ($remote_address,$x_forwarded_for_header,$address); >+ require Net::Netmask; >+ if (Net::Netmask->VERSION < 1.9104){ >+ $remote_address = "2001:db8:1234:5678:abcd:1234:abcd:1234"; >+ $x_forwarded_for_header = "2.2.2.2"; >+ t::lib::Mocks::mock_config( 'koha_trusted_proxies', '2001:db8:1234:5678::/64' ); >+ >+ warning_is { >+ $address = Koha::Middleware::RealIP::get_real_ip( $remote_address, >+ $x_forwarded_for_header ); >+ } >+ "could not parse 2001:db8:1234:5678::/64", >+ "Warn on IPv6 koha_trusted_proxies"; >+ is( >+ $address, >+ '2001:db8:1234:5678:abcd:1234:abcd:1234', >+ "Unable to parse IPv6 address for trusted proxy, so ignore the X-Forwarded-For header" >+ ); >+ done_testing(2); >+ } else { >+ $remote_address = "2001:db8:1234:5678:abcd:1234:abcd:1234"; >+ $x_forwarded_for_header = "2.2.2.2"; >+ t::lib::Mocks::mock_config( 'koha_trusted_proxies', '2001:db8:1234:5678::/64' ); >+ >+ $address = Koha::Middleware::RealIP::get_real_ip( $remote_address,$x_forwarded_for_header ); >+ is($address,'2.2.2.2',"Trust proxy (2001:db8:1234:5678:abcd:1234:abcd:1234) using IPv6 CIDR notation, so use the X-Forwarded-For header for the remote address"); >+ done_testing(1); > } >- "could not parse 2001:db8:1234:5678::/64", >- "Warn on IPv6 koha_trusted_proxies"; >- is( >- $address, >- '2001:db8:1234:5678:abcd:1234:abcd:1234', >- "IPv6 support was added in 1.9104 version of Net::Netmask" >- ); >-} >+}; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24739
:
99690
|
99729
|
99730
|
99748
|
99749
|
99750
| 99751 |
99752