diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test
index 16ac171..af5ac1c 100644
--- a/modules/simpletest/tests/bootstrap.test
+++ b/modules/simpletest/tests/bootstrap.test
@@ -16,6 +16,10 @@ class BootstrapIPAddressTestCase extends DrupalWebTestCase {
     $this->remote_ip = '127.0.0.1';
     $this->proxy_ip = '127.0.0.2';
     $this->proxy2_ip = '127.0.0.3';
+    $this->proxy3_ip = '10.0.0.1';
+    $this->proxy3_range = '10.0.0.0/8';
+    $this->proxy4_ip = '2404:6800:4003:c02::deca:fbad';
+    $this->proxy4_range = '2404:6800:4003:c02::/64';
     $this->forwarded_ip = '127.0.0.4';
     $this->cluster_ip = '127.0.0.5';
     $this->untrusted_ip = '0.0.0.0';
@@ -53,7 +57,7 @@ class BootstrapIPAddressTestCase extends DrupalWebTestCase {
     );
 
     // Proxy forwarding on and proxy address not trusted.
-    variable_set('reverse_proxy_addresses', array($this->proxy_ip, $this->proxy2_ip));
+    variable_set('reverse_proxy_addresses', array($this->proxy_ip, $this->proxy2_ip, $this->proxy3_range, $this->proxy4_range));
     drupal_static_reset('ip_address');
     $_SERVER['REMOTE_ADDR'] = $this->untrusted_ip;
     $this->assertTrue(
@@ -79,6 +83,42 @@ class BootstrapIPAddressTestCase extends DrupalWebTestCase {
       'Visiting from trusted proxy got proxy IP address.'
     );
 
+    // Proxy forwarding on and proxy address in trusted network range.
+    $_SERVER['REMOTE_ADDR'] = $this->proxy3_ip;
+    $_SERVER['HTTP_X_FORWARDED_FOR'] = $this->forwarded_ip;
+    drupal_static_reset('ip_address');
+    $this->assertTrue(
+      ip_address() == $this->forwarded_ip,
+      'Proxy forwarding with trusted proxy in network range got forwarded IP address.'
+    );
+
+    // Proxy forwarding on and proxy address in trusted network range and visiting from proxy.
+    $_SERVER['REMOTE_ADDR'] = $this->proxy3_ip;
+    $_SERVER['HTTP_X_FORWARDED_FOR'] = $this->proxy3_ip;
+    drupal_static_reset('ip_address');
+    $this->assertTrue(
+      ip_address() == $this->proxy3_ip,
+      'Visiting from trusted proxy in network range got proxy IP address.'
+    );
+
+    // Proxy forwarding on and proxy address in trusted IPv6 network range.
+    $_SERVER['REMOTE_ADDR'] = $this->proxy4_ip;
+    $_SERVER['HTTP_X_FORWARDED_FOR'] = $this->forwarded_ip;
+    drupal_static_reset('ip_address');
+    $this->assertTrue(
+      ip_address() == $this->forwarded_ip,
+      'Proxy forwarding with trusted proxy in IPv6 network range got forwarded IP address.'
+    );
+
+    // Proxy forwarding on and proxy address in trusted IPv6 network range and visiting from proxy.
+    $_SERVER['REMOTE_ADDR'] = $this->proxy4_ip;
+    $_SERVER['HTTP_X_FORWARDED_FOR'] = $this->proxy4_ip;
+    drupal_static_reset('ip_address');
+    $this->assertTrue(
+      ip_address() == $this->proxy4_ip,
+      'Visiting from trusted proxy in IPv6 network range got proxy IP address.'
+    );
+
     // Multi-tier architecture with comma separated values in header.
     $_SERVER['REMOTE_ADDR'] = $this->proxy_ip;
     $_SERVER['HTTP_X_FORWARDED_FOR'] = implode(', ', array($this->untrusted_ip, $this->forwarded_ip, $this->proxy2_ip));
