2005-10-03 jrandom

* Properly reject unroutable IP addresses *cough*
This commit is contained in:
jrandom
2005-10-04 02:05:52 +00:00
committed by zzz
parent f540dc798b
commit 0a1f59940a
3 changed files with 11 additions and 8 deletions

View File

@ -1,4 +1,7 @@
$Id: history.txt,v 1.278 2005/10/03 13:55:10 ragnarok Exp $
$Id: history.txt,v 1.279 2005/10/03 19:27:35 ragnarok Exp $
2005-10-03 jrandom
* Properly reject unroutable IP addresses *cough*
2005-10-03 rangarok
* Changed default update delay to twelve hours, and enforced a minimum

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.253 $ $Date: 2005/09/30 18:12:57 $";
public final static String ID = "$Revision: 1.254 $ $Date: 2005/10/01 14:20:09 $";
public final static String VERSION = "0.6.1.1";
public final static long BUILD = 0;
public final static long BUILD = 1;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -356,11 +356,11 @@ public abstract class TransportImpl implements Transport {
public void recheckReachability() {}
public static boolean isPubliclyRoutable(byte addr[]) {
if (addr[0] == (int)127) return false;
if (addr[0] == (int)10) return false;
if ( (addr[0] == (int)172) && (addr[1] >= (int)16) && (addr[1] <= (int)31) ) return false;
if ( (addr[0] == (int)192) && (addr[1] == (int)168) ) return false;
if (addr[0] >= (int)224) return false; // no multicast
if ((addr[0]&0xFF) == 127) return false;
if ((addr[0]&0xFF) == 10) return false;
if ( ((addr[0]&0xFF) == 172) && ((addr[1]&0xFF) >= 16) && ((addr[1]&0xFF) <= 31) ) return false;
if ( ((addr[0]&0xFF) == 192) && ((addr[1]&0xFF) == 168) ) return false;
if ((addr[0]&0xFF) >= 224) return false; // no multicast
return true; // or at least possible to be true
}
}