NSClient++ Help (#1) - classless IP address in allowed_hosts [SOLVED] (#272) - Message List

classless IP address in allowed_hosts [SOLVED]

Hi,

I set a classless IP address to allowed_hosts, but this is not work. To calculate netmask is wrong.

Could you apply the following patch to fix it?

--- tags_0.3.5-r169/tags/0.3.5/include/Socket.h.org	2008-10-17 21:14:19.443000000 +0900
+++ tags_0.3.5-r169/tags/0.3.5/include/Socket.h	2008-10-22 13:58:18.891000000 +0900
@@ -710,7 +710,7 @@
 			}
 			if (masklen > 32)
 				masklen = 32;
-			return (~((unsigned int)0))>>(32-masklen);
+			return ntohl(~((unsigned int)0)<<(32-masklen));
 		}
 		void lookupList() {
 			for (host_list::iterator it = allowedHosts_.begin();it!=allowedHosts_.end();++it) {
  • Message #1902

    Fixed in next nightly (out in secs...

    allowed_hosts=192.168.0.1/24   ,192.168.1.1, www.ibm.com/32	,www.google.com/0,     www.nsclient.org/16,			www.nsclient.com/4
    Added: 192.168.0.1		with mask 255.255.255.0		from 192.168.0.1/24
    Added: 192.168.1.1		with mask 255.255.255.255	from 192.168.1.1
    Added: 129.42.60.216	with mask 255.255.255.255	from www.ibm.com/32
    Added: 74.125.77.147	with mask 255.255.255.255	from www.google.com/0
    Added: 91.198.2.105		with mask 255.255.0.0		from www.nsclient.org/16
    Added: 91.198.2.105		with mask 240.0.0.0			from www.nsclient.com/4
    

    // Michael Medin

Subscriptions