MINOR: resolvers: renames some resolvers specific types to not use dns prefix
This patch applies those changes on names:
-struct dns_resolution {
+struct resolv_resolution {
-struct dns_requester {
+struct resolv_requester {
-struct dns_srvrq {
+struct resolv_srvrq {
@@ -185,12 +185,12 @@ struct stream {
struct {
- struct dns_requester *dns_requester;
+ struct resolv_requester *requester;
...
- } dns_ctx;
+ } resolv_ctx;
diff --git a/include/haproxy/action.h b/include/haproxy/action.h
index edd34f1..7338a75 100644
--- a/include/haproxy/action.h
+++ b/include/haproxy/action.h
@@ -27,8 +27,8 @@
#include <haproxy/list.h>
#include <haproxy/sample.h>
-int act_resolution_cb(struct dns_requester *requester, struct dns_counters *counters);
-int act_resolution_error_cb(struct dns_requester *requester, int error_code);
+int act_resolution_cb(struct resolv_requester *requester, struct dns_counters *counters);
+int act_resolution_error_cb(struct resolv_requester *requester, int error_code);
static inline struct action_kw *action_lookup(struct list *keywords, const char *kw)
{
diff --git a/include/haproxy/dns-t.h b/include/haproxy/dns-t.h
index 51365b2..ef28298 100644
--- a/include/haproxy/dns-t.h
+++ b/include/haproxy/dns-t.h
@@ -31,7 +31,7 @@
#include <haproxy/task-t.h>
#include <haproxy/thread.h>
-extern struct pool_head *dns_requester_pool;
+extern struct pool_head *resolv_requester_pool;
/*DNS maximum values */
/*
@@ -260,7 +260,7 @@
* The only link between the resolution and a nameserver is through the
* query_id.
*/
-struct dns_resolution {
+struct resolv_resolution {
struct resolvers *resolvers; /* pointer to the resolvers structure owning the resolution */
struct list requesters; /* list of requesters using this resolution */
int uuid; /* unique id (used for debugging purpose) */
@@ -286,12 +286,12 @@
};
/* Structure used to describe the owner of a DNS resolution. */
-struct dns_requester {
+struct resolv_requester {
enum obj_type *owner; /* pointer to the owner (server or dns_srvrq) */
- struct dns_resolution *resolution; /* pointer to the owned DNS resolution */
+ struct resolv_resolution *resolution; /* pointer to the owned DNS resolution */
- int (*requester_cb)(struct dns_requester *, struct dns_counters *); /* requester callback for valid response */
- int (*requester_error_cb)(struct dns_requester *, int); /* requester callback, for error management */
+ int (*requester_cb)(struct resolv_requester *, struct dns_counters *); /* requester callback for valid response */
+ int (*requester_error_cb)(struct resolv_requester *, int); /* requester callback, for error management */
struct list list; /* requester list */
};
@@ -348,14 +348,14 @@
};
struct proxy;
-struct dns_srvrq {
+struct resolv_srvrq {
enum obj_type obj_type; /* object type == OBJ_TYPE_SRVRQ */
struct resolvers *resolvers; /* pointer to the resolvers structure used for this server template */
struct proxy *proxy; /* associated proxy */
char *name;
char *hostname_dn; /* server hostname in Domain Name format */
int hostname_dn_len; /* string length of the server hostname in Domain Name format */
- struct dns_requester *dns_requester; /* used to link to its DNS resolution */
+ struct resolv_requester *requester; /* used to link to its DNS resolution */
struct list list; /* Next SRV RQ for the same proxy */
};
diff --git a/include/haproxy/dns.h b/include/haproxy/dns.h
index 63aae56..260e319 100644
--- a/include/haproxy/dns.h
+++ b/include/haproxy/dns.h
@@ -29,8 +29,8 @@
extern unsigned int dns_failed_resolutions;
struct resolvers *find_resolvers_by_id(const char *id);
-struct dns_srvrq *find_srvrq_by_name(const char *name, struct proxy *px);
-struct dns_srvrq *new_dns_srvrq(struct server *srv, char *fqdn);
+struct resolv_srvrq *find_srvrq_by_name(const char *name, struct proxy *px);
+struct resolv_srvrq *new_resolv_srvrq(struct server *srv, char *fqdn);
int dns_str_to_dn_label(const char *str, int str_len, char *dn, int dn_len);
int dns_dn_label_to_str(const char *dn, int dn_len, char *str, int str_len);
@@ -43,8 +43,8 @@
void *owner);
int dns_link_resolution(void *requester, int requester_type, int requester_locked);
-void dns_unlink_resolution(struct dns_requester *requester);
-void dns_trigger_resolution(struct dns_requester *requester);
+void dns_unlink_resolution(struct resolv_requester *requester);
+void dns_trigger_resolution(struct resolv_requester *requester);
enum act_parse_ret dns_parse_do_resolve(const char **args, int *orig_arg, struct proxy *px, struct act_rule *rule, char **err);
int check_action_do_resolve(struct act_rule *rule, struct proxy *px, char **err);
diff --git a/include/haproxy/obj_type.h b/include/haproxy/obj_type.h
index 215bff4..4f6fe74 100644
--- a/include/haproxy/obj_type.h
+++ b/include/haproxy/obj_type.h
@@ -150,16 +150,16 @@
return __objt_conn(t);
}
-static inline struct dns_srvrq *__objt_dns_srvrq(enum obj_type *t)
+static inline struct resolv_srvrq *__objt_resolv_srvrq(enum obj_type *t)
{
- return container_of(t, struct dns_srvrq, obj_type);
+ return container_of(t, struct resolv_srvrq, obj_type);
}
-static inline struct dns_srvrq *objt_dns_srvrq(enum obj_type *t)
+static inline struct resolv_srvrq *objt_resolv_srvrq(enum obj_type *t)
{
if (!t || *t != OBJ_TYPE_SRVRQ)
return NULL;
- return __objt_dns_srvrq(t);
+ return __objt_resolv_srvrq(t);
}
static inline struct stream *__objt_stream(enum obj_type *t)
@@ -196,7 +196,7 @@
case OBJ_TYPE_APPLET: return __objt_applet(t);
case OBJ_TYPE_APPCTX: return __objt_appctx(t);
case OBJ_TYPE_CONN: return __objt_conn(t);
- case OBJ_TYPE_SRVRQ: return __objt_dns_srvrq(t);
+ case OBJ_TYPE_SRVRQ: return __objt_resolv_srvrq(t);
case OBJ_TYPE_CS: return __objt_cs(t);
case OBJ_TYPE_STREAM: return __objt_stream(t);
case OBJ_TYPE_CHECK: return __objt_check(t);
diff --git a/include/haproxy/server-t.h b/include/haproxy/server-t.h
index a0abbbf..85b6d93 100644
--- a/include/haproxy/server-t.h
+++ b/include/haproxy/server-t.h
@@ -292,7 +292,7 @@
struct check check; /* health-check specific configuration */
struct check agent; /* agent specific configuration */
- struct dns_requester *dns_requester; /* used to link a server to its DNS resolution */
+ struct resolv_requester *resolv_requester; /* used to link a server to its DNS resolution */
char *resolvers_id; /* resolvers section used by this server */
struct resolvers *resolvers; /* pointer to the resolvers structure used by this server */
char *lastaddr; /* the address string provided by the server-state file */
@@ -342,7 +342,7 @@
struct eb_root cids; /* QUIC connections IDs. */
#endif
#endif
- struct dns_srvrq *srvrq; /* Pointer representing the DNS SRV requeest, if any */
+ struct resolv_srvrq *srvrq; /* Pointer representing the DNS SRV requeest, if any */
struct {
const char *file; /* file where the section appears */
struct eb32_node id; /* place in the tree of used IDs */
diff --git a/include/haproxy/server.h b/include/haproxy/server.h
index a19d769..987a385 100644
--- a/include/haproxy/server.h
+++ b/include/haproxy/server.h
@@ -60,8 +60,8 @@
/* functions related to server name resolution */
int snr_update_srv_status(struct server *s, int has_no_ip);
const char *update_server_fqdn(struct server *server, const char *fqdn, const char *updater, int dns_locked);
-int snr_resolution_cb(struct dns_requester *requester, struct dns_counters *counters);
-int snr_resolution_error_cb(struct dns_requester *requester, int error_code);
+int snr_resolution_cb(struct resolv_requester *requester, struct dns_counters *counters);
+int snr_resolution_error_cb(struct resolv_requester *requester, int error_code);
struct server *snr_check_ip_callback(struct server *srv, void *ip, unsigned char *ip_family);
struct task *srv_cleanup_idle_connections(struct task *task, void *ctx, unsigned short state);
struct task *srv_cleanup_toremove_connections(struct task *task, void *context, unsigned short state);
diff --git a/include/haproxy/stream-t.h b/include/haproxy/stream-t.h
index 5d9d245..3b5fb75 100644
--- a/include/haproxy/stream-t.h
+++ b/include/haproxy/stream-t.h
@@ -185,12 +185,12 @@
/* Context */
struct {
- struct dns_requester *dns_requester; /* owner of the resolution */
+ struct resolv_requester *requester; /* owner of the resolution */
char *hostname_dn; /* hostname being resolve, in domain name format */
int hostname_dn_len; /* size of hostname_dn */
/* 4 unused bytes here */
struct act_rule *parent; /* rule which requested this resolution */
- } dns_ctx; /* context information for DNS resolution */
+ } resolv_ctx; /* context information for DNS resolution */
int tunnel_timeout;
};
diff --git a/src/action.c b/src/action.c
index a7e5a49..8292fe9 100644
--- a/src/action.c
+++ b/src/action.c
@@ -117,7 +117,7 @@
return 1;
}
-int act_resolution_cb(struct dns_requester *requester, struct dns_counters *counters)
+int act_resolution_cb(struct resolv_requester *requester, struct dns_counters *counters)
{
struct stream *stream;
@@ -133,7 +133,7 @@
return 0;
}
-int act_resolution_error_cb(struct dns_requester *requester, int error_code)
+int act_resolution_error_cb(struct resolv_requester *requester, int error_code)
{
struct stream *stream;
diff --git a/src/check.c b/src/check.c
index 5de867d..dd4a13a 100644
--- a/src/check.c
+++ b/src/check.c
@@ -680,7 +680,7 @@
* Let's trigger a DNS resolution if none are currently running.
*/
if (check->server)
- dns_trigger_resolution(check->server->dns_requester);
+ dns_trigger_resolution(check->server->resolv_requester);
}
else if (conn->flags & CO_FL_WAIT_L6_CONN) {
diff --git a/src/dns.c b/src/dns.c
index b517cc4..8f1fd49 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -46,13 +46,13 @@
struct list sec_resolvers = LIST_HEAD_INIT(sec_resolvers);
-struct list dns_srvrq_list = LIST_HEAD_INIT(dns_srvrq_list);
+struct list resolv_srvrq_list = LIST_HEAD_INIT(resolv_srvrq_list);
static THREAD_LOCAL uint64_t dns_query_id_seed = 0; /* random seed */
DECLARE_STATIC_POOL(resolv_answer_item_pool, "resolv_answer_item", sizeof(struct resolv_answer_item));
-DECLARE_STATIC_POOL(dns_resolution_pool, "dns_resolution", sizeof(struct dns_resolution));
-DECLARE_POOL(dns_requester_pool, "dns_requester", sizeof(struct dns_requester));
+DECLARE_STATIC_POOL(resolv_resolution_pool, "resolv_resolution", sizeof(struct resolv_resolution));
+DECLARE_POOL(resolv_requester_pool, "resolv_requester", sizeof(struct resolv_requester));
static unsigned int resolution_uuid = 1;
unsigned int dns_failed_resolutions = 0;
@@ -165,11 +165,11 @@
/* Returns a pointer on the SRV request matching the name <name> for the proxy
* <px>. NULL is returned if no match is found.
*/
-struct dns_srvrq *find_srvrq_by_name(const char *name, struct proxy *px)
+struct resolv_srvrq *find_srvrq_by_name(const char *name, struct proxy *px)
{
- struct dns_srvrq *srvrq;
+ struct resolv_srvrq *srvrq;
- list_for_each_entry(srvrq, &dns_srvrq_list, list) {
+ list_for_each_entry(srvrq, &resolv_srvrq_list, list) {
if (srvrq->proxy == px && strcmp(srvrq->name, name) == 0)
return srvrq;
}
@@ -178,10 +178,10 @@
/* Allocates a new SRVRQ for the given server with the name <fqdn>. It returns
* NULL if an error occurred. */
-struct dns_srvrq *new_dns_srvrq(struct server *srv, char *fqdn)
+struct resolv_srvrq *new_resolv_srvrq(struct server *srv, char *fqdn)
{
struct proxy *px = srv->proxy;
- struct dns_srvrq *srvrq = NULL;
+ struct resolv_srvrq *srvrq = NULL;
int fqdn_len, hostname_dn_len;
fqdn_len = strlen(fqdn);
@@ -208,7 +208,7 @@
proxy_type_str(px), px->id, srv->id);
goto err;
}
- LIST_ADDQ(&dns_srvrq_list, &srvrq->list);
+ LIST_ADDQ(&resolv_srvrq_list, &srvrq->list);
return srvrq;
err:
@@ -233,7 +233,7 @@
}
-static inline int dns_resolution_timeout(struct dns_resolution *res)
+static inline int dns_resolution_timeout(struct resolv_resolution *res)
{
return res->resolvers->timeout.resolve;
}
@@ -241,12 +241,12 @@
/* Updates a resolvers' task timeout for next wake up and queue it */
static void dns_update_resolvers_timeout(struct resolvers *resolvers)
{
- struct dns_resolution *res;
+ struct resolv_resolution *res;
int next;
next = tick_add(now_ms, resolvers->timeout.resolve);
if (!LIST_ISEMPTY(&resolvers->resolutions.curr)) {
- res = LIST_NEXT(&resolvers->resolutions.curr, struct dns_resolution *, list);
+ res = LIST_NEXT(&resolvers->resolutions.curr, struct resolv_resolution *, list);
next = MIN(next, tick_add(res->last_query, resolvers->timeout.retry));
}
@@ -353,7 +353,7 @@
/* Sends a DNS query to resolvers associated to a resolution. It returns 0 on
* success, -1 otherwise.
*/
-static int dns_send_query(struct dns_resolution *resolution)
+static int dns_send_query(struct resolv_resolution *resolution)
{
struct resolvers *resolvers = resolution->resolvers;
struct dns_nameserver *ns;
@@ -411,7 +411,7 @@
* skipped and -1 if an error occurred.
*/
static int
-dns_run_resolution(struct dns_resolution *resolution)
+dns_run_resolution(struct resolv_resolution *resolution)
{
struct resolvers *resolvers = resolution->resolvers;
int query_id, i;
@@ -457,10 +457,10 @@
}
/* Performs a name resolution for the requester <req> */
-void dns_trigger_resolution(struct dns_requester *req)
+void dns_trigger_resolution(struct resolv_requester *req)
{
struct resolvers *resolvers;
- struct dns_resolution *res;
+ struct resolv_resolution *res;
int exp;
if (!req || !req->resolution)
@@ -480,7 +480,7 @@
/* Resets some resolution parameters to initial values and also delete the query
* ID from the resolver's tree.
*/
-static void dns_reset_resolution(struct dns_resolution *resolution)
+static void dns_reset_resolution(struct resolv_resolution *resolution)
{
/* update resolution status */
resolution->step = RSLV_STEP_NONE;
@@ -593,13 +593,13 @@
/* Checks for any obsolete record, also identify any SRV request, and try to
* find a corresponding server.
*/
-static void dns_check_dns_response(struct dns_resolution *res)
+static void dns_check_dns_response(struct resolv_resolution *res)
{
struct resolvers *resolvers = res->resolvers;
- struct dns_requester *req, *reqback;
+ struct resolv_requester *req, *reqback;
struct resolv_answer_item *item, *itemback;
struct server *srv;
- struct dns_srvrq *srvrq;
+ struct resolv_srvrq *srvrq;
list_for_each_entry_safe(item, itemback, &res->response.answer_list, list) {
struct resolv_answer_item *ar_item = item->ar_item;
@@ -616,7 +616,7 @@
goto rm_obselete_item;
list_for_each_entry_safe(req, reqback, &res->requesters, list) {
- if ((srvrq = objt_dns_srvrq(req->owner)) == NULL)
+ if ((srvrq = objt_resolv_srvrq(req->owner)) == NULL)
continue;
/* Remove any associated server */
@@ -631,7 +631,7 @@
srv->hostname = NULL;
srv->hostname_dn = NULL;
srv->hostname_dn_len = 0;
- dns_unlink_resolution(srv->dns_requester);
+ dns_unlink_resolution(srv->resolv_requester);
}
HA_SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
}
@@ -652,7 +652,7 @@
/* Now process SRV records */
list_for_each_entry_safe(req, reqback, &res->requesters, list) {
- if ((srvrq = objt_dns_srvrq(req->owner)) == NULL)
+ if ((srvrq = objt_resolv_srvrq(req->owner)) == NULL)
continue;
/* Check if a server already uses that hostname */
@@ -749,7 +749,7 @@
* error found.
*/
static int dns_validate_dns_response(unsigned char *resp, unsigned char *bufend,
- struct dns_resolution *resolution, int max_answer_records)
+ struct resolv_resolution *resolution, int max_answer_records)
{
unsigned char *reader;
char *previous_dname, tmpname[DNS_MAX_NAME_SIZE];
@@ -1623,11 +1623,11 @@
*
* Returns an available resolution, NULL if none found.
*/
-static struct dns_resolution *dns_pick_resolution(struct resolvers *resolvers,
+static struct resolv_resolution *dns_pick_resolution(struct resolvers *resolvers,
char **hostname_dn, int hostname_dn_len,
int query_type)
{
- struct dns_resolution *res;
+ struct resolv_resolution *res;
if (!*hostname_dn)
goto from_pool;
@@ -1654,7 +1654,7 @@
from_pool:
/* No resolution could be found, so let's allocate a new one */
- res = pool_alloc(dns_resolution_pool);
+ res = pool_alloc(resolv_resolution_pool);
if (res) {
memset(res, 0, sizeof(*res));
res->resolvers = resolvers;
@@ -1680,9 +1680,9 @@
}
/* Releases a resolution from its requester(s) and move it back to the pool */
-static void dns_free_resolution(struct dns_resolution *resolution)
+static void dns_free_resolution(struct resolv_resolution *resolution)
{
- struct dns_requester *req, *reqback;
+ struct resolv_requester *req, *reqback;
struct resolv_answer_item *item, *itemback;
/* clean up configuration */
@@ -1705,19 +1705,19 @@
}
LIST_DEL(&resolution->list);
- pool_free(dns_resolution_pool, resolution);
+ pool_free(resolv_resolution_pool, resolution);
}
-/* Links a requester (a server or a dns_srvrq) with a resolution. It returns 0
+/* Links a requester (a server or a resolv_srvrq) with a resolution. It returns 0
* on success, -1 otherwise.
*/
int dns_link_resolution(void *requester, int requester_type, int requester_locked)
{
- struct dns_resolution *res = NULL;
- struct dns_requester *req;
+ struct resolv_resolution *res = NULL;
+ struct resolv_requester *req;
struct resolvers *resolvers;
struct server *srv = NULL;
- struct dns_srvrq *srvrq = NULL;
+ struct resolv_srvrq *srvrq = NULL;
struct stream *stream = NULL;
char **hostname_dn;
int hostname_dn_len, query_type;
@@ -1734,7 +1734,7 @@
break;
case OBJ_TYPE_SRVRQ:
- srvrq = (struct dns_srvrq *)requester;
+ srvrq = (struct resolv_srvrq *)requester;
hostname_dn = &srvrq->hostname_dn;
hostname_dn_len = srvrq->hostname_dn_len;
resolvers = srvrq->resolvers;
@@ -1743,10 +1743,10 @@
case OBJ_TYPE_STREAM:
stream = (struct stream *)requester;
- hostname_dn = &stream->dns_ctx.hostname_dn;
- hostname_dn_len = stream->dns_ctx.hostname_dn_len;
- resolvers = stream->dns_ctx.parent->arg.dns.resolvers;
- query_type = ((stream->dns_ctx.parent->arg.dns.dns_opts->family_prio == AF_INET)
+ hostname_dn = &stream->resolv_ctx.hostname_dn;
+ hostname_dn_len = stream->resolv_ctx.hostname_dn_len;
+ resolvers = stream->resolv_ctx.parent->arg.dns.resolvers;
+ query_type = ((stream->resolv_ctx.parent->arg.dns.dns_opts->family_prio == AF_INET)
? DNS_RTYPE_A
: DNS_RTYPE_AAAA);
break;
@@ -1761,17 +1761,17 @@
if (srv) {
if (!requester_locked)
HA_SPIN_LOCK(SERVER_LOCK, &srv->lock);
- if (srv->dns_requester == NULL) {
- if ((req = pool_alloc(dns_requester_pool)) == NULL) {
+ if (srv->resolv_requester == NULL) {
+ if ((req = pool_alloc(resolv_requester_pool)) == NULL) {
if (!requester_locked)
HA_SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
goto err;
}
req->owner = &srv->obj_type;
- srv->dns_requester = req;
+ srv->resolv_requester = req;
}
else
- req = srv->dns_requester;
+ req = srv->resolv_requester;
if (!requester_locked)
HA_SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
@@ -1779,27 +1779,27 @@
req->requester_error_cb = snr_resolution_error_cb;
}
else if (srvrq) {
- if (srvrq->dns_requester == NULL) {
- if ((req = pool_alloc(dns_requester_pool)) == NULL)
+ if (srvrq->requester == NULL) {
+ if ((req = pool_alloc(resolv_requester_pool)) == NULL)
goto err;
req->owner = &srvrq->obj_type;
- srvrq->dns_requester = req;
+ srvrq->requester = req;
}
else
- req = srvrq->dns_requester;
+ req = srvrq->requester;
req->requester_cb = snr_resolution_cb;
req->requester_error_cb = snr_resolution_error_cb;
}
else if (stream) {
- if (stream->dns_ctx.dns_requester == NULL) {
- if ((req = pool_alloc(dns_requester_pool)) == NULL)
+ if (stream->resolv_ctx.requester == NULL) {
+ if ((req = pool_alloc(resolv_requester_pool)) == NULL)
goto err;
req->owner = &stream->obj_type;
- stream->dns_ctx.dns_requester = req;
+ stream->resolv_ctx.requester = req;
}
else
- req = stream->dns_ctx.dns_requester;
+ req = stream->resolv_ctx.requester;
req->requester_cb = act_resolution_cb;
req->requester_error_cb = act_resolution_error_cb;
@@ -1821,10 +1821,10 @@
/* Removes a requester from a DNS resolution. It takes takes care of all the
* consequences. It also cleans up some parameters from the requester.
*/
-void dns_unlink_resolution(struct dns_requester *requester)
+void dns_unlink_resolution(struct resolv_requester *requester)
{
- struct dns_resolution *res;
- struct dns_requester *req;
+ struct resolv_resolution *res;
+ struct resolv_requester *req;
/* Nothing to do */
if (!requester || !requester->resolution)
@@ -1837,7 +1837,7 @@
/* We need to find another requester linked on this resolution */
if (!LIST_ISEMPTY(&res->requesters))
- req = LIST_NEXT(&res->requesters, struct dns_requester *, list);
+ req = LIST_NEXT(&res->requesters, struct resolv_requester *, list);
else {
dns_free_resolution(res);
return;
@@ -1850,12 +1850,12 @@
res->hostname_dn_len = __objt_server(req->owner)->hostname_dn_len;
break;
case OBJ_TYPE_SRVRQ:
- res->hostname_dn = __objt_dns_srvrq(req->owner)->hostname_dn;
- res->hostname_dn_len = __objt_dns_srvrq(req->owner)->hostname_dn_len;
+ res->hostname_dn = __objt_resolv_srvrq(req->owner)->hostname_dn;
+ res->hostname_dn_len = __objt_resolv_srvrq(req->owner)->hostname_dn_len;
break;
case OBJ_TYPE_STREAM:
- res->hostname_dn = __objt_stream(req->owner)->dns_ctx.hostname_dn;
- res->hostname_dn_len = __objt_stream(req->owner)->dns_ctx.hostname_dn_len;
+ res->hostname_dn = __objt_stream(req->owner)->resolv_ctx.hostname_dn;
+ res->hostname_dn_len = __objt_stream(req->owner)->resolv_ctx.hostname_dn_len;
break;
default:
res->hostname_dn = NULL;
@@ -1876,7 +1876,7 @@
struct dns_nameserver *ns;
struct dns_counters *tmpcounters;
struct resolvers *resolvers;
- struct dns_resolution *res;
+ struct resolv_resolution *res;
struct resolv_query_item *query;
unsigned char buf[DNS_MAX_UDP_MESSAGE + 1];
unsigned char *bufend;
@@ -1884,7 +1884,7 @@
int max_answer_records;
unsigned short query_id;
struct eb32_node *eb;
- struct dns_requester *req;
+ struct resolv_requester *req;
fd = dgram->t.sock.fd;
@@ -1941,7 +1941,7 @@
}
/* known query id means a resolution in progress */
- res = eb32_entry(eb, struct dns_resolution, qid);
+ res = eb32_entry(eb, struct resolv_resolution, qid);
/* number of responses received */
res->nb_responses++;
@@ -2074,7 +2074,7 @@
{
struct resolvers *resolvers;
struct dns_nameserver *ns;
- struct dns_resolution *res;
+ struct resolv_resolution *res;
int fd;
fd = dgram->t.sock.fd;
@@ -2135,7 +2135,7 @@
static struct task *dns_process_resolvers(struct task *t, void *context, unsigned short state)
{
struct resolvers *resolvers = context;
- struct dns_resolution *res, *resback;
+ struct resolv_resolution *res, *resback;
int exp;
HA_SPIN_LOCK(DNS_LOCK, &resolvers->lock);
@@ -2152,7 +2152,7 @@
* finishes in timeout we update its status and remove it from
* the list */
if (!res->try) {
- struct dns_requester *req;
+ struct resolv_requester *req;
/* Notify the result to the requesters */
if (!res->nb_responses)
@@ -2217,9 +2217,9 @@
{
struct resolvers *resolvers, *resolversback;
struct dns_nameserver *ns, *nsback;
- struct dns_resolution *res, *resback;
- struct dns_requester *req, *reqback;
- struct dns_srvrq *srvrq, *srvrqback;
+ struct resolv_resolution *res, *resback;
+ struct resolv_requester *req, *reqback;
+ struct resolv_srvrq *srvrq, *srvrqback;
list_for_each_entry_safe(resolvers, resolversback, &sec_resolvers, list) {
list_for_each_entry_safe(ns, nsback, &resolvers->nameservers, list) {
@@ -2236,7 +2236,7 @@
list_for_each_entry_safe(res, resback, &resolvers->resolutions.curr, list) {
list_for_each_entry_safe(req, reqback, &res->requesters, list) {
LIST_DEL(&req->list);
- pool_free(dns_requester_pool, req);
+ pool_free(resolv_requester_pool, req);
}
dns_free_resolution(res);
}
@@ -2244,7 +2244,7 @@
list_for_each_entry_safe(res, resback, &resolvers->resolutions.wait, list) {
list_for_each_entry_safe(req, reqback, &res->requesters, list) {
LIST_DEL(&req->list);
- pool_free(dns_requester_pool, req);
+ pool_free(resolv_requester_pool, req);
}
dns_free_resolution(res);
}
@@ -2256,7 +2256,7 @@
free(resolvers);
}
- list_for_each_entry_safe(srvrq, srvrqback, &dns_srvrq_list, list) {
+ list_for_each_entry_safe(srvrq, srvrqback, &resolv_srvrq_list, list) {
free(srvrq->name);
free(srvrq->hostname_dn);
LIST_DEL(&srvrq->list);
@@ -2639,15 +2639,15 @@
goto err;
- stream->dns_ctx.hostname_dn = strdup(hostname_dn);
- stream->dns_ctx.hostname_dn_len = hostname_dn_len;
- if (!stream->dns_ctx.hostname_dn)
+ stream->resolv_ctx.hostname_dn = strdup(hostname_dn);
+ stream->resolv_ctx.hostname_dn_len = hostname_dn_len;
+ if (!stream->resolv_ctx.hostname_dn)
goto err;
return 0;
err:
- free(stream->dns_ctx.hostname_dn); stream->dns_ctx.hostname_dn = NULL;
+ free(stream->resolv_ctx.hostname_dn); stream->resolv_ctx.hostname_dn = NULL;
dns_failed_resolutions += 1;
return -1;
}
@@ -2659,12 +2659,12 @@
enum act_return dns_action_do_resolve(struct act_rule *rule, struct proxy *px,
struct session *sess, struct stream *s, int flags)
{
- struct dns_resolution *resolution;
+ struct resolv_resolution *resolution;
struct sample *smp;
char *fqdn;
- struct dns_requester *req;
+ struct resolv_requester *req;
struct resolvers *resolvers;
- struct dns_resolution *res;
+ struct resolv_resolution *res;
int exp, locked = 0;
enum act_return ret = ACT_RET_CONT;
@@ -2672,8 +2672,8 @@
/* we have a response to our DNS resolution */
use_cache:
- if (s->dns_ctx.dns_requester && s->dns_ctx.dns_requester->resolution != NULL) {
- resolution = s->dns_ctx.dns_requester->resolution;
+ if (s->resolv_ctx.requester && s->resolv_ctx.requester->resolution != NULL) {
+ resolution = s->resolv_ctx.requester->resolution;
if (!locked) {
HA_SPIN_LOCK(DNS_LOCK, &resolvers->lock);
locked = 1;
@@ -2726,7 +2726,7 @@
if (action_prepare_for_resolution(s, fqdn) == -1)
goto end; /* on error, ignore the action */
- s->dns_ctx.parent = rule;
+ s->resolv_ctx.parent = rule;
HA_SPIN_LOCK(DNS_LOCK, &resolvers->lock);
locked = 1;
@@ -2734,7 +2734,7 @@
dns_link_resolution(s, OBJ_TYPE_STREAM, 0);
/* Check if there is a fresh enough response in the cache of our associated resolution */
- req = s->dns_ctx.dns_requester;
+ req = s->resolv_ctx.requester;
if (!req || !req->resolution)
goto release_requester; /* on error, ignore the action */
res = req->resolution;
@@ -2745,7 +2745,7 @@
goto use_cache;
}
- dns_trigger_resolution(s->dns_ctx.dns_requester);
+ dns_trigger_resolution(s->resolv_ctx.requester);
yield:
if (flags & ACT_OPT_FINAL)
@@ -2758,13 +2758,13 @@
return ret;
release_requester:
- free(s->dns_ctx.hostname_dn);
- s->dns_ctx.hostname_dn = NULL;
- s->dns_ctx.hostname_dn_len = 0;
- if (s->dns_ctx.dns_requester) {
- dns_unlink_resolution(s->dns_ctx.dns_requester);
- pool_free(dns_requester_pool, s->dns_ctx.dns_requester);
- s->dns_ctx.dns_requester = NULL;
+ free(s->resolv_ctx.hostname_dn);
+ s->resolv_ctx.hostname_dn = NULL;
+ s->resolv_ctx.hostname_dn_len = 0;
+ if (s->resolv_ctx.requester) {
+ dns_unlink_resolution(s->resolv_ctx.requester);
+ pool_free(resolv_requester_pool, s->resolv_ctx.requester);
+ s->resolv_ctx.requester = NULL;
}
goto end;
}
diff --git a/src/server.c b/src/server.c
index 45c38e0..25834ec 100644
--- a/src/server.c
+++ b/src/server.c
@@ -50,7 +50,7 @@
static void srv_update_status(struct server *s);
static void srv_update_state(struct server *srv, int version, char **params);
static int srv_apply_lastaddr(struct server *srv, int *err_code);
-static int srv_set_fqdn(struct server *srv, const char *fqdn, int dns_locked);
+static int srv_set_fqdn(struct server *srv, const char *fqdn, int resolv_locked);
static void srv_state_parse_line(char *buf, const int version, char **params, char **srv_params);
static int srv_state_get_version(FILE *f);
static void srv_cleanup_connections(struct server *srv);
@@ -2076,7 +2076,7 @@
if (fqdn[0] == '_') { /* SRV record */
/* Check if a SRV request already exists, and if not, create it */
if ((newsrv->srvrq = find_srvrq_by_name(fqdn, curproxy)) == NULL)
- newsrv->srvrq = new_dns_srvrq(newsrv, fqdn);
+ newsrv->srvrq = new_resolv_srvrq(newsrv, fqdn);
if (newsrv->srvrq == NULL) {
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
@@ -2961,7 +2961,7 @@
/* create or find a SRV resolution for this srv record */
if (srv->srvrq == NULL && (srv->srvrq = find_srvrq_by_name(srvrecord, srv->proxy)) == NULL)
- srv->srvrq = new_dns_srvrq(srv, srvrecord);
+ srv->srvrq = new_resolv_srvrq(srv, srvrecord);
if (srv->srvrq == NULL) {
chunk_appendf(msg, ", can't create or find SRV resolution '%s' for server '%s'", srvrecord, srv->id);
goto out;
@@ -3864,7 +3864,7 @@
int snr_update_srv_status(struct server *s, int has_no_ip)
{
struct resolvers *resolvers = s->resolvers;
- struct dns_resolution *resolution = s->dns_requester->resolution;
+ struct resolv_resolution *resolution = s->resolv_requester->resolution;
int exp;
/* If resolution is NULL we're dealing with SRV records Additional records */
@@ -3974,10 +3974,10 @@
*
* Must be called with server lock held
*/
-int snr_resolution_cb(struct dns_requester *requester, struct dns_counters *counters)
+int snr_resolution_cb(struct resolv_requester *requester, struct dns_counters *counters)
{
struct server *s = NULL;
- struct dns_resolution *resolution = NULL;
+ struct resolv_resolution *resolution = NULL;
void *serverip, *firstip;
short server_sin_family, firstip_sin_family;
int ret;
@@ -3988,7 +3988,7 @@
if (!s)
return 1;
- resolution = s->dns_requester->resolution;
+ resolution = s->resolv_requester->resolution;
/* initializing variables */
firstip = NULL; /* pointer to the first valid response found */
@@ -4073,7 +4073,7 @@
*
* Grabs the server's lock.
*/
-int snr_resolution_error_cb(struct dns_requester *requester, int error_code)
+int snr_resolution_error_cb(struct resolv_requester *requester, int error_code)
{
struct server *s;
@@ -4168,9 +4168,9 @@
*
* Must be called with the server lock held.
*/
-int srv_set_fqdn(struct server *srv, const char *hostname, int dns_locked)
+int srv_set_fqdn(struct server *srv, const char *hostname, int resolv_locked)
{
- struct dns_resolution *resolution;
+ struct resolv_resolution *resolution;
char *hostname_dn;
int hostname_len, hostname_dn_len;
@@ -4178,12 +4178,12 @@
if (!srv->resolvers)
return -1;
- if (!dns_locked)
+ if (!resolv_locked)
HA_SPIN_LOCK(DNS_LOCK, &srv->resolvers->lock);
/* run time DNS resolution was not active for this server
* and we can't enable it at run time for now.
*/
- if (!srv->dns_requester)
+ if (!srv->resolv_requester)
goto err;
chunk_reset(&trash);
@@ -4194,13 +4194,13 @@
if (hostname_dn_len == -1)
goto err;
- resolution = srv->dns_requester->resolution;
+ resolution = srv->resolv_requester->resolution;
if (resolution &&
resolution->hostname_dn &&
strcmp(resolution->hostname_dn, hostname_dn) == 0)
goto end;
- dns_unlink_resolution(srv->dns_requester);
+ dns_unlink_resolution(srv->resolv_requester);
free(srv->hostname);
free(srv->hostname_dn);
@@ -4217,12 +4217,12 @@
goto err;
end:
- if (!dns_locked)
+ if (!resolv_locked)
HA_SPIN_UNLOCK(DNS_LOCK, &srv->resolvers->lock);
return 0;
err:
- if (!dns_locked)
+ if (!resolv_locked)
HA_SPIN_UNLOCK(DNS_LOCK, &srv->resolvers->lock);
return -1;
}
@@ -4364,7 +4364,7 @@
/*
* Must be called with the server lock held.
*/
-const char *update_server_fqdn(struct server *server, const char *fqdn, const char *updater, int dns_locked)
+const char *update_server_fqdn(struct server *server, const char *fqdn, const char *updater, int resolv_locked)
{
struct buffer *msg;
@@ -4385,7 +4385,7 @@
chunk_appendf(msg, "%s/%s changed its FQDN from %s to %s",
server->proxy->id, server->id, server->hostname, fqdn);
- if (srv_set_fqdn(server, fqdn, dns_locked) < 0) {
+ if (srv_set_fqdn(server, fqdn, resolv_locked) < 0) {
chunk_reset(msg);
chunk_appendf(msg, "could not update %s/%s FQDN",
server->proxy->id, server->id);
diff --git a/src/stream.c b/src/stream.c
index 9a23903..96d6ea9 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -532,10 +532,10 @@
s->txn = NULL;
s->hlua = NULL;
- s->dns_ctx.dns_requester = NULL;
- s->dns_ctx.hostname_dn = NULL;
- s->dns_ctx.hostname_dn_len = 0;
- s->dns_ctx.parent = NULL;
+ s->resolv_ctx.requester = NULL;
+ s->resolv_ctx.hostname_dn = NULL;
+ s->resolv_ctx.hostname_dn_len = 0;
+ s->resolv_ctx.parent = NULL;
s->tunnel_timeout = TICK_ETERNITY;
@@ -667,17 +667,17 @@
s->txn = NULL;
}
- if (s->dns_ctx.dns_requester) {
- __decl_thread(struct resolvers *resolvers = s->dns_ctx.parent->arg.dns.resolvers);
+ if (s->resolv_ctx.requester) {
+ __decl_thread(struct resolvers *resolvers = s->resolv_ctx.parent->arg.dns.resolvers);
HA_SPIN_LOCK(DNS_LOCK, &resolvers->lock);
- free(s->dns_ctx.hostname_dn); s->dns_ctx.hostname_dn = NULL;
- s->dns_ctx.hostname_dn_len = 0;
- dns_unlink_resolution(s->dns_ctx.dns_requester);
+ free(s->resolv_ctx.hostname_dn); s->resolv_ctx.hostname_dn = NULL;
+ s->resolv_ctx.hostname_dn_len = 0;
+ dns_unlink_resolution(s->resolv_ctx.requester);
HA_SPIN_UNLOCK(DNS_LOCK, &resolvers->lock);
- pool_free(dns_requester_pool, s->dns_ctx.dns_requester);
- s->dns_ctx.dns_requester = NULL;
+ pool_free(resolv_requester_pool, s->resolv_ctx.requester);
+ s->resolv_ctx.requester = NULL;
}
flt_stream_stop(s);