3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 23:09:34 +01:00

resolve: Add "none" method

There may be situations where DNS information should not be set (for
example in auto-tests where the resolver daemon is not running) or if a
user wishes to ignore DNS information obtained.
This commit is contained in:
Denis Kenzior 2022-05-20 10:03:42 -05:00
parent f12cf1ab9d
commit b96bbb35e0

View File

@ -558,6 +558,38 @@ static const struct resolve_method_ops resolve_method_resolvconf_ops = {
.alloc = resolve_resolvconf_alloc, .alloc = resolve_resolvconf_alloc,
}; };
static void resolve_none_destroy(struct resolve *resolve)
{
l_free(resolve);
}
static struct resolve_ops none_ops = {
.destroy = resolve_none_destroy,
};
static int resolve_none_init(void)
{
return 0;
}
static void resolve_none_exit(void)
{
}
static struct resolve *resolve_none_alloc(uint32_t ifindex)
{
struct resolve *r = l_new(struct resolve, 1);
_resolve_init(r, ifindex, &none_ops);
return r;
}
static const struct resolve_method_ops resolve_method_none_ops = {
.init = resolve_none_init,
.exit = resolve_none_exit,
.alloc = resolve_none_alloc,
};
static const struct resolve_method_ops *configured_method; static const struct resolve_method_ops *configured_method;
struct resolve *resolve_new(uint32_t ifindex) struct resolve *resolve_new(uint32_t ifindex)
@ -574,6 +606,7 @@ static const struct {
} resolve_method_ops_list[] = { } resolve_method_ops_list[] = {
{ "systemd", &resolve_method_systemd_ops }, { "systemd", &resolve_method_systemd_ops },
{ "resolvconf", &resolve_method_resolvconf_ops }, { "resolvconf", &resolve_method_resolvconf_ops },
{ "none", &resolve_method_none_ops },
{ } { }
}; };