]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: fix the return type for dns_response_get_query_id() function
authorThiago Farina <tfarina@chromium.org>
Wed, 20 Jan 2016 22:46:34 +0000 (23:46 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 20 Jan 2016 22:51:24 +0000 (23:51 +0100)
This function should return a 16-bit type as that is the type for
dns header id.
Also because it is doing an uint16 unpack big-endian operation.

Backport: can be backported to 1.6

Signed-off-by: Thiago Farina <tfarina@chromium.org>
Signed-off-by: Baptiste Assmann <bedis9@gmail.com>
include/proto/dns.h
src/dns.c

index 80887e86c32260b185e8243a1fe0fad8d6872ecd..4ccbfa0c7b05402df3133236e39ff66dd80cfa5e 100644 (file)
@@ -44,6 +44,6 @@ void dns_print_current_resolutions(struct dns_resolvers *resolvers);
 void dns_update_resolvers_timeout(struct dns_resolvers *resolvers);
 void dns_reset_resolution(struct dns_resolution *resolution);
 int dns_check_resolution_queue(struct dns_resolvers *resolvers);
-int dns_response_get_query_id(unsigned char *resp);
+unsigned short dns_response_get_query_id(unsigned char *resp);
 
 #endif // _PROTO_DNS_H
index 1348be3d971c34f3bb3937114097abea45260661..0d8d305c6dacd2d2e17ca4f34dd57e5f98ae1faf 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -796,7 +796,7 @@ int dns_get_ip_from_response(unsigned char *resp, unsigned char *resp_end,
 /*
  * returns the query id contained in a DNS response
  */
-int dns_response_get_query_id(unsigned char *resp)
+unsigned short dns_response_get_query_id(unsigned char *resp)
 {
        /* read the query id from the response */
        return resp[0] * 256 + resp[1];