mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Handle multiple addresses when removing duplicates in host files.
This commit is contained in:
committed by
Simon Kelley
parent
0017dd74d5
commit
936be022d9
@@ -1048,12 +1048,13 @@ struct crec *cache_find_by_addr(struct crec *crecp, union all_addr *addr,
|
||||
static void add_hosts_entry(struct crec *cache, union all_addr *addr, int addrlen,
|
||||
unsigned int index, struct crec **rhash, int hashsz)
|
||||
{
|
||||
struct crec *lookup = cache_find_by_name(NULL, cache_get_name(cache), 0, cache->flags & (F_IPV4 | F_IPV6));
|
||||
int i;
|
||||
unsigned int j;
|
||||
struct crec *lookup = NULL;
|
||||
|
||||
/* Remove duplicates in hosts files. */
|
||||
if (lookup && (lookup->flags & F_HOSTS) && memcmp(&lookup->addr, addr, addrlen) == 0)
|
||||
while ((lookup = cache_find_by_name(lookup, cache_get_name(cache), 0, cache->flags & (F_IPV4 | F_IPV6))))
|
||||
if ((lookup->flags & F_HOSTS) && memcmp(&lookup->addr, addr, addrlen) == 0)
|
||||
{
|
||||
free(cache);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user