MINOR: fix the return type for dns_response_get_query_id() function

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>
This commit is contained in:
Thiago Farina 2016-01-20 23:46:34 +01:00 committed by Willy Tarreau
parent bb107185d1
commit b1af23ebea
2 changed files with 2 additions and 2 deletions

View 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_update_resolvers_timeout(struct dns_resolvers *resolvers);
void dns_reset_resolution(struct dns_resolution *resolution); void dns_reset_resolution(struct dns_resolution *resolution);
int dns_check_resolution_queue(struct dns_resolvers *resolvers); 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 #endif // _PROTO_DNS_H

View File

@ -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 * 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 */ /* read the query id from the response */
return resp[0] * 256 + resp[1]; return resp[0] * 256 + resp[1];