mirror of
https://github.com/systemd/systemd
synced 2024-07-21 18:24:38 +00:00
![Yu Watanabe](/assets/img/avatar_default.png)
This improves the performance of parsing the file and reduces memory pressure. Running 'fuzz-etc-hosts timeout-strv' with valgrind, Before: total heap usage: 321,020 allocs, 321,020 frees, 15,820,387,193 bytes allocated real 0m23.531s user 0m21.458s sys 0m1.961s After: total heap usage: 112,408 allocs, 112,408 frees, 7,297,480 bytes allocated real 0m8.664s user 0m8.545s sys 0m0.065s Hopefully fixes oss-fuzz#47708 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47708).
23 lines
594 B
C
23 lines
594 B
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
#pragma once
|
|
|
|
#include "resolved-manager.h"
|
|
#include "resolved-dns-question.h"
|
|
#include "resolved-dns-answer.h"
|
|
|
|
typedef struct EtcHostsItemByAddress {
|
|
struct in_addr_data address;
|
|
Set *names;
|
|
} EtcHostsItemByAddress;
|
|
|
|
typedef struct EtcHostsItemByName {
|
|
char *name;
|
|
Set *addresses;
|
|
} EtcHostsItemByName;
|
|
|
|
int etc_hosts_parse(EtcHosts *hosts, FILE *f);
|
|
void etc_hosts_clear(EtcHosts *hosts);
|
|
|
|
void manager_etc_hosts_flush(Manager *m);
|
|
int manager_etc_hosts_lookup(Manager *m, DnsQuestion* q, DnsAnswer **answer);
|