Lines Matching refs:flags

90 	  crecp->flags = 0;  in cache_init()
163 if (!(crecp->flags & F_REVERSE)) in cache_hash()
165 while (*up && ((*up)->flags & F_REVERSE)) in cache_hash()
168 if (crecp->flags & F_IMMORTAL) in cache_hash()
169 while (*up && !((*up)->flags & F_IMMORTAL)) in cache_hash()
178 crecp->flags &= ~F_FORWARD; in cache_free()
179 crecp->flags &= ~F_REVERSE; in cache_free()
191 if (crecp->flags & F_BIGNAME) in cache_free()
195 crecp->flags &= ~F_BIGNAME; in cache_free()
227 if (crecp->flags & F_BIGNAME) in cache_get_name()
229 else if (crecp->flags & (F_DHCP | F_CONFIG)) in cache_get_name()
237 if (!(crecp->flags & F_CNAME)) in is_outdated_cname_pointer()
248 if (crecp->flags & F_IMMORTAL) in is_expired()
257 static int cache_scan_free(char *name, struct all_addr *addr, time_t now, unsigned short flags) in cache_scan_free() argument
274 if (flags & F_FORWARD) in cache_scan_free()
280 if (!(crecp->flags & (F_HOSTS | F_DHCP))) in cache_scan_free()
286 else if ((crecp->flags & F_FORWARD) && in cache_scan_free()
287 ((flags & crecp->flags & (F_IPV4 | F_IPV6)) || ((crecp->flags | flags) & F_CNAME)) && in cache_scan_free()
290 if (crecp->flags & (F_HOSTS | F_DHCP)) in cache_scan_free()
303 int addrlen = (flags & F_IPV6) ? IN6ADDRSZ : INADDRSZ; in cache_scan_free()
309 crecp && ((crecp->flags & F_REVERSE) || !(crecp->flags & F_IMMORTAL)); in cache_scan_free()
314 if (!(crecp->flags & (F_HOSTS | F_DHCP))) in cache_scan_free()
320 else if (!(crecp->flags & (F_HOSTS | F_DHCP)) && in cache_scan_free()
321 (flags & crecp->flags & F_REVERSE) && in cache_scan_free()
322 (flags & crecp->flags & (F_IPV4 | F_IPV6)) && in cache_scan_free()
360 time_t now, unsigned long ttl, unsigned short flags) in cache_insert() argument
364 int freed_all = flags & F_REVERSE; in cache_insert()
367 log_query(flags | F_UPSTREAM, name, addr, NULL); in cache_insert()
370 flags &= ~F_CONFIG; in cache_insert()
379 if (!cache_scan_free(name, addr, now, flags)) in cache_insert()
397 if (new->flags & (F_FORWARD | F_REVERSE)) in cache_insert()
412 cache_scan_free(cache_get_name(new), &new->addr.addr, now, new->flags); in cache_insert()
448 new->flags = flags; in cache_insert()
452 new->flags |= F_BIGNAME; in cache_insert()
514 if ((crecp->flags & F_FORWARD) && in cache_find_by_name()
515 (crecp->flags & prot) && in cache_find_by_name()
518 if (crecp->flags & (F_HOSTS | F_DHCP)) in cache_find_by_name()
534 if (insert && (crecp->flags & (F_REVERSE | F_IMMORTAL)) == ins_flags) in cache_find_by_name()
546 ins_flags = crecp->flags & (F_REVERSE | F_IMMORTAL); in cache_find_by_name()
559 if (!(crecp->flags & (F_HOSTS | F_DHCP))) in cache_find_by_name()
571 (ans->flags & F_FORWARD) && in cache_find_by_name()
572 (ans->flags & prot) && in cache_find_by_name()
602 crecp && (crecp->flags & F_REVERSE); in cache_find_by_addr()
606 if ((crecp->flags & prot) && in cache_find_by_addr()
609 if (crecp->flags & (F_HOSTS | F_DHCP)) in cache_find_by_addr()
625 if (!(crecp->flags & (F_HOSTS | F_DHCP))) in cache_find_by_addr()
636 (ans->flags & F_REVERSE) && in cache_find_by_addr()
637 (ans->flags & prot) && in cache_find_by_addr()
645 unsigned short flags, int index, int addr_dup) in add_hosts_entry() argument
647 struct crec *lookup = cache_find_by_name(NULL, cache->name.sname, 0, flags & (F_IPV4 | F_IPV6)); in add_hosts_entry()
652 if (lookup && (lookup->flags & F_HOSTS)) in add_hosts_entry()
671 flags &= ~F_REVERSE; in add_hosts_entry()
676 if ((lookup->flags & F_HOSTS) && in add_hosts_entry()
677 (lookup->flags & flags & (F_IPV4 | F_IPV6)) && in add_hosts_entry()
680 flags &= ~F_REVERSE; in add_hosts_entry()
687 cache->flags = flags; in add_hosts_entry()
698 lookup->flags = F_FORWARD | F_IMMORTAL | F_CONFIG | F_HOSTS | F_CNAME; in add_hosts_entry()
758 unsigned short flags = 0, saved_flags = 0; in read_hostsfile() local
778 flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV4; in read_hostsfile()
784 flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV6; in read_hostsfile()
791 flags = F_HOSTS | F_IMMORTAL | F_FORWARD | F_REVERSE | F_IPV4; in read_hostsfile()
804 if (saved_flags == flags && memcmp(&addr, &saved_addr, addrlen) == 0) in read_hostsfile()
808 saved_flags = flags; in read_hostsfile()
842 add_hosts_entry(cache, &addr, addrlen, flags, index, addr_dup); in read_hostsfile()
849 add_hosts_entry(cache, &addr, addrlen, flags, index, addr_dup); in read_hostsfile()
880 if (cache->flags & F_HOSTS) in cache_reload()
885 else if (!(cache->flags & F_DHCP)) in cache_reload()
888 if (cache->flags & F_BIGNAME) in cache_reload()
893 cache->flags = 0; in cache_reload()
914 if (ah->flags & AH_DIR) in cache_reload()
915 ah->flags |= AH_INACTIVE; in cache_reload()
917 ah->flags &= ~AH_INACTIVE; in cache_reload()
921 if (!(ah->flags & AH_INACTIVE)) in cache_reload()
930 ah->flags |= AH_INACTIVE; in cache_reload()
963 ah1->flags &= ~AH_INACTIVE; in cache_reload()
985 ah1->flags = AH_DIR; in cache_reload()
991 if ((ah1->flags & AH_DIR) && stat(ah1->fname, &buf) != -1 && !S_ISREG(buf.st_mode)) in cache_reload()
992 ah1->flags |= AH_INACTIVE; in cache_reload()
1001 if (!(ah->flags & AH_INACTIVE)) in cache_reload()
1025 if (cache->flags & F_DHCP) in cache_unhash_dhcp()
1039 unsigned short flags = F_DHCP | F_FORWARD | F_IPV4 | F_REVERSE; in cache_add_dhcp_entry() local
1046 if (crec->flags & F_HOSTS) in cache_add_dhcp_entry()
1062 else if (!(crec->flags & F_DHCP)) in cache_add_dhcp_entry()
1064 cache_scan_free(host_name, NULL, 0, crec->flags & (F_IPV4 | F_CNAME | F_FORWARD)); in cache_add_dhcp_entry()
1075 if (crec->flags & F_NEG) in cache_add_dhcp_entry()
1079 flags &= ~F_REVERSE; in cache_add_dhcp_entry()
1089 crec->flags = flags; in cache_add_dhcp_entry()
1091 crec->flags |= F_IMMORTAL; in cache_add_dhcp_entry()
1109 aliasc->flags = F_FORWARD | F_CONFIG | F_DHCP | F_CNAME; in cache_add_dhcp_entry()
1111 aliasc->flags |= F_IMMORTAL; in cache_add_dhcp_entry()
1140 serv->flags &= ~SERV_COUNTED; in dump_cache()
1143 if (!(serv->flags & (SERV_NO_ADDR | SERV_LITERAL_ADDRESS | SERV_COUNTED))) in dump_cache()
1148 …if (!(serv1->flags & (SERV_NO_ADDR | SERV_LITERAL_ADDRESS | SERV_COUNTED)) && sockaddr_isequal(&se… in dump_cache()
1150 serv1->flags |= SERV_COUNTED; in dump_cache()
1169 if ((cache->flags & F_NEG) && (cache->flags & F_FORWARD)) in dump_cache()
1171 else if (cache->flags & F_CNAME) in dump_cache()
1181 if (cache->flags & F_IPV4) in dump_cache()
1183 else if (cache->flags & F_IPV6) in dump_cache()
1191 cache->flags & F_IPV4 ? "4" : "", in dump_cache()
1192 cache->flags & F_IPV6 ? "6" : "", in dump_cache()
1193 cache->flags & F_CNAME ? "C" : "", in dump_cache()
1194 cache->flags & F_FORWARD ? "F" : " ", in dump_cache()
1195 cache->flags & F_REVERSE ? "R" : " ", in dump_cache()
1196 cache->flags & F_IMMORTAL ? "I" : " ", in dump_cache()
1197 cache->flags & F_DHCP ? "D" : " ", in dump_cache()
1198 cache->flags & F_NEG ? "N" : " ", in dump_cache()
1199 cache->flags & F_NXDOMAIN ? "X" : " ", in dump_cache()
1200 cache->flags & F_HOSTS ? "H" : " "); in dump_cache()
1202 p += sprintf(p, "%lu", cache->flags & F_IMMORTAL ? 0: (unsigned long)(cache->ttd - now)); in dump_cache()
1204 p += sprintf(p, "%s", cache->flags & F_IMMORTAL ? "\n" : ctime(&(cache->ttd))); in dump_cache()
1237 void log_query(unsigned short flags, char *name, struct all_addr *addr, char *arg) in log_query() argument
1248 inet_ntop(flags & F_IPV4 ? AF_INET : AF_INET6, in log_query()
1255 if (flags & F_REVERSE) in log_query()
1261 if (flags & F_NEG) in log_query()
1263 if (flags & F_NXDOMAIN) in log_query()
1265 if (flags & F_IPV4) in log_query()
1267 else if (flags & F_IPV6) in log_query()
1274 if (flags & F_IPV4) in log_query()
1276 else if (flags & F_IPV6) in log_query()
1282 else if (flags & F_CNAME) in log_query()
1285 if (flags & F_NXDOMAIN) in log_query()
1291 if (flags & F_CONFIG) in log_query()
1293 else if (flags & F_DHCP) in log_query()
1295 else if (flags & F_HOSTS) in log_query()
1297 else if (flags & F_UPSTREAM) in log_query()
1299 else if (flags & F_SERVER) in log_query()
1304 else if (flags & F_QUERY) in log_query()