resolved-dns-server.c revision b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce
/*-*- 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 "alloc-util.h"
#include "resolved-dns-server.h"
#include "siphash24.h"
/* After how much time to repeat classic DNS requests */
int dns_server_new(
Manager *m,
Link *l,
int family,
const union in_addr_union *in_addr) {
assert(m);
if (!s)
return -ENOMEM;
s->n_ref = 1;
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;
s->n_ref ++;
return s;
}
if (!s)
return NULL;
free(s);
return NULL;
}
if (!s)
return NULL;
if (s->n_ref == 1)
dns_server_free(s);
else
s->n_ref --;
return NULL;
}
assert(s);
}
}
assert(s);
if (s->resend_timeout <= usec)
}
const DnsServer *s = p;
assert(s);
}
static int dns_server_compare_func(const void *a, const void *b) {
const DnsServer *x = a, *y = b;
return -1;
return 1;
}
const struct hash_ops dns_server_hash_ops = {
};