BIND 10 master, updated. 127e416cb3b2d08b2cd9356ca7c8bd109dbef95d [master] Check IPv6 mask length

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Oct 30 12:26:12 UTC 2012


The branch, master has been updated
       via  127e416cb3b2d08b2cd9356ca7c8bd109dbef95d (commit)
      from  61d7c3959eb991b22bc1c0ef8f4ecb96b65d9325 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 127e416cb3b2d08b2cd9356ca7c8bd109dbef95d
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Oct 30 17:48:08 2012 +0530

    [master] Check IPv6 mask length

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dhcp/addr_utilities.cc |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/addr_utilities.cc b/src/lib/dhcp/addr_utilities.cc
index de1e8b4..db35ca6 100644
--- a/src/lib/dhcp/addr_utilities.cc
+++ b/src/lib/dhcp/addr_utilities.cc
@@ -45,9 +45,13 @@ const uint8_t bitMask6[]= { 0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
 /// @param len prefix length
 isc::asiolink::IOAddress firstAddrInPrefix6(const isc::asiolink::IOAddress& prefix,
                                             uint8_t len) {
-
     uint8_t packed[V6ADDRESS_LEN];
 
+    if (len > 128) {
+        isc_throw(isc::BadValue,
+                  "Too large netmask. 0..128 is allowed in IPv6");
+    }
+
     // First we copy the whole address as 16 bytes.
     memcpy(packed, prefix.getAddress().to_v6().to_bytes().data(), 16);
 
@@ -104,7 +108,7 @@ isc::asiolink::IOAddress firstAddrInPrefix4(const isc::asiolink::IOAddress& pref
 isc::asiolink::IOAddress lastAddrInPrefix4(const isc::asiolink::IOAddress& prefix,
                                            uint8_t len) {
     uint32_t addr = prefix;
-    if (len>32) {
+    if (len > 32) {
         isc_throw(isc::BadValue, "Too large netmask. 0..32 is allowed in IPv4");
     }
 
@@ -123,6 +127,11 @@ isc::asiolink::IOAddress lastAddrInPrefix6(const isc::asiolink::IOAddress& prefi
 
     uint8_t packed[V6ADDRESS_LEN];
 
+    if (len > 128) {
+        isc_throw(isc::BadValue,
+                  "Too large netmask. 0..128 is allowed in IPv6");
+    }
+
     // First we copy the whole address as 16 bytes.
     memcpy(packed, prefix.getAddress().to_v6().to_bytes().data(), 16);
 



More information about the bind10-changes mailing list