net/dns: Fix DNS answer RR computation
- Remove a routine that erroneously computes an answer RR value: dns_answer_rdlength. - Change: dns_unpack_answer_rdlength -> dns_answer_rdlength. - Change: htonl -> ntohl in the dns_answer_ttl routine. Change-Id: I8b5a16f63560d3e23dd38cb7339b6e232bb706ea Signed-off-by: Flavio Santes <flavio.santes@intel.com>
This commit is contained in:
parent
86e6a5d00a
commit
87fc47e1fe
@ -143,7 +143,7 @@ int dns_unpack_answer(struct dns_msg_t *dns_msg, int dname_ptr, uint32_t *ttl)
|
||||
/* TTL value */
|
||||
*ttl = dns_answer_ttl(DNS_COMMON_UINT_SIZE, answer);
|
||||
pos = dns_msg->answer_offset + DNS_ANSWER_MIN_SIZE;
|
||||
len = dns_unpack_answer_rdlength(DNS_COMMON_UINT_SIZE, answer);
|
||||
len = dns_answer_rdlength(DNS_COMMON_UINT_SIZE, answer);
|
||||
|
||||
switch (dns_answer_type(DNS_COMMON_UINT_SIZE, answer)) {
|
||||
case DNS_RR_TYPE_A:
|
||||
|
||||
@ -220,15 +220,10 @@ static inline int dns_answer_class(uint16_t dname_size, uint8_t *answer)
|
||||
|
||||
static inline int dns_answer_ttl(uint16_t dname_size, uint8_t *answer)
|
||||
{
|
||||
return htonl(UNALIGNED_GET((uint32_t *)(answer + dname_size + 4)));
|
||||
return ntohl(UNALIGNED_GET((uint32_t *)(answer + dname_size + 4)));
|
||||
}
|
||||
|
||||
static inline int dns_answer_rdlength(uint16_t dname_size, uint8_t *answer)
|
||||
{
|
||||
return htons(UNALIGNED_GET((uint16_t *)(answer + dname_size + 8)));
|
||||
}
|
||||
|
||||
static inline int dns_unpack_answer_rdlength(uint16_t dname_size,
|
||||
static inline int dns_answer_rdlength(uint16_t dname_size,
|
||||
uint8_t *answer)
|
||||
{
|
||||
return ntohs(UNALIGNED_GET((uint16_t *)(answer + dname_size + 8)));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user