resolved-dns-server.c revision 3e684349c2cead2e6fd2f816c34eb17daba23a49
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2014 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "siphash24.h"
#include "resolved-dns-server.h"
int dns_server_new(
Manager *m,
Link *l,
int family,
const union in_addr_union *in_addr) {
assert(m);
if (!s)
return -ENOMEM;
if (type == DNS_SERVER_LINK) {
s->link = l;
} else if (type == DNS_SERVER_SYSTEM) {
} else if (type == DNS_SERVER_FALLBACK) {
} else
assert_not_reached("Unknown server type");
s->manager = m;
/* A new DNS server that isn't fallback is added and the one
* we used so far was a fallback one? Then let's try to pick
* the new one */
if (type != DNS_SERVER_FALLBACK &&
m->current_dns_server &&
if (ret)
*ret = s;
return 0;
}
if (!s)
return NULL;
if (s->manager) {
if (s->type == DNS_SERVER_LINK)
else if (s->type == DNS_SERVER_SYSTEM)
else if (s->type == DNS_SERVER_FALLBACK)
else
assert_not_reached("Unknown server type");
if (s->manager->current_dns_server == s)
}
free(s);
return NULL;
}
const DnsServer *s = p;
uint64_t u;
return u;
}
int dns_server_compare_func(const void *a, const void *b) {
const DnsServer *x = a, *y = b;
return -1;
return 1;
}