bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */
9805f5093a0e0845f028fb8fd52b0eec27d8f7abTimo Sirainenstatic bool imap_remote_ip_is_usable(const struct ip_addr *ip)
9805f5093a0e0845f028fb8fd52b0eec27d8f7abTimo Sirainen#define IP4(a,b,c,d) ((unsigned)(a)<<24|(unsigned)(b)<<16|(unsigned)(c)<<8|(unsigned)(d))
9805f5093a0e0845f028fb8fd52b0eec27d8f7abTimo Sirainen if (addr >= IP4(10,0,0,0) && addr <= IP4(10,255,255,255))
9805f5093a0e0845f028fb8fd52b0eec27d8f7abTimo Sirainen if (addr >= IP4(192,168,0,0) && addr <= IP4(192,168,255,255))
9805f5093a0e0845f028fb8fd52b0eec27d8f7abTimo Sirainen if (addr >= IP4(172,16,0,0) && addr <= IP4(172,31,255,255))
9805f5093a0e0845f028fb8fd52b0eec27d8f7abTimo Sirainen if (addr >= IP4(127,0,0,0) && addr <= IP4(127,255,255,255))
9805f5093a0e0845f028fb8fd52b0eec27d8f7abTimo Sirainenimap_keepalive_interval_msecs(const char *username, const struct ip_addr *ip,
4aeb50a8311a86fd8e5d3bb71d56f2e3094f19dfTimo Sirainen client_hash = ip != NULL && imap_remote_ip_is_usable(ip) ?