# HG changeset patch # User Shinji KONO # Date 1404300645 -32400 # Node ID 2132018b8c681ebf380c92b3a45c1fa68b8a28f7 # Parent 7b106b4a0c9fd8f951cff86af6b924185039a8ab fix netmask diff -r 7b106b4a0c9f -r 2132018b8c68 src/main/java/jp/ac/u_ryukyu/treevnc/TreeVNCNetwork.java --- a/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVNCNetwork.java Wed Jul 02 19:06:03 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/TreeVNCNetwork.java Wed Jul 02 20:30:45 2014 +0900 @@ -49,9 +49,9 @@ byte[] netmask = ipaddress.getAddress().getAddress(); for(int i = 0; i < netmask.length; i++) { int bitpos = i * 8; - if (bitpos > prefix) { + if (bitpos+8 > prefix) { netmask[i] = 0; - } else if (bitpos+8 > prefix) { + } else if (bitpos > prefix) { // ex. bitpos = 0, prefix = 2 // bitpos+8-prefix // 1100 0000