View Single Post
  #6 (permalink)  
Old February 22nd, 2002
Unregistered
Guest
 
Posts: n/a
Default

Sorry, thanks for explaining the problem better. Easy fix:

in hosts.c add this line in check_valid_host()

if (ip == (guint32) 0xFFFFFFFF) return FALSE;

so now it looks like the below (tabs are messed up here).
let me know if there are any other problems like this, 255.255.255.255 seems to be the only one that does this.
Code:
gboolean check_valid_host(guint32 ip, guint16 port)
{
	if (!ip || !port) return FALSE;									/* IP == 0 || Port == 0					*/

	if (ip == (guint32) 0x01020304 || ip == (guint32) 0x01010101) return FALSE;	/* IP == 1.2.3.4 || IP == 1.1.1.1 	*/
	if ((ip & (guint32) 0xFF000000) == (guint32) 0x00000000) return FALSE;			/* IP == 0.0.0.0 / 8					 	*/
	if ((ip & (guint32) 0xFF000000) == (guint32) 0x7F000000) return FALSE;			/* IP == 127.0.0.0 / 8					*/
	if ((ip & (guint32) 0xFF000000) == (guint32) 0x0A000000) return FALSE;			/* IP == 10.0.0.0 / 8					*/
	if ((ip & (guint32) 0xFFF00000) == (guint32) 0xAC100000) return FALSE;			/* IP == 172.16.0.0 / 12				*/
	if ((ip & (guint32) 0xFFFF0000) == (guint32) 0xC0A80000) return FALSE;			/* IP == 192.168.0.0 / 16				*/
	if (ip  == (guint32) 0xFFFFFFFF) return FALSE;											/* IP == 255.255.255.255				*/

	return TRUE;
}
Reply With Quote