Changeset 20c82e3 in mainline
- Timestamp:
- 2017-09-04T15:49:07Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 42f61f01
- Parents:
- 1ddbf81
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/dnsrsrv/dns_msg.c
r1ddbf81 r20c82e3 77 77 return ENOMEM; 78 78 79 str_cpy( (*dstr)+ s1, nsize - s1, suff);79 str_cpy(nstr + s1, nsize - s1, suff); 80 80 81 81 *dstr = nstr; … … 195 195 break; 196 196 197 if (!first) {198 rc = dns_dstr_ext(&name, ".");199 if (rc != EOK) {200 rc = ENOMEM;201 goto error;202 }203 }204 205 197 if ((lsize & 0xc0) == 0xc0) { 206 198 /* Pointer */ … … 233 225 * the message continues 234 226 */ 235 *eoff = eptr; 227 if (*eoff == 0) 228 *eoff = eptr; 236 229 237 230 bp = pdu->data + ptr; … … 243 236 rc = EINVAL; 244 237 goto error; 238 } 239 240 if (!first) { 241 rc = dns_dstr_ext(&name, "."); 242 if (rc != EOK) { 243 rc = ENOMEM; 244 goto error; 245 } 245 246 } 246 247 … … 413 414 rc = dns_name_decode(pdu, boff, &rr->name, &name_eoff); 414 415 if (rc != EOK) { 415 log_msg(LOG_DEFAULT, LVL_DEBUG, " Error decoding name");416 log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: error decoding name"); 416 417 free(rr); 417 418 return ENOMEM; … … 421 422 free(rr->name); 422 423 free(rr); 424 log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: error name_off"); 423 425 return EINVAL; 424 426 } … … 430 432 free(rr->name); 431 433 free(rr); 434 log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: error bsz"); 432 435 return EINVAL; 433 436 } … … 445 448 bsz -= sizeof(uint32_t); 446 449 450 log_msg(LOG_DEFAULT, LVL_DEBUG2, "dns_rr_decode: rtype=0x%x, rclass=0x%x, ttl=0x%x", 451 rr->rtype, rr->rclass, rr->ttl ); 452 447 453 rdlength = dns_uint16_t_decode(bp, bsz); 448 454 bp += sizeof(uint16_t); … … 452 458 free(rr->name); 453 459 free(rr); 460 log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: Error rdlength %zu > bsz %zu", rdlength, bsz); 454 461 return EINVAL; 455 462 } 456 463 457 464 rr->rdata_size = rdlength; 458 rr->rdata = calloc(1, sizeof(rdlength)); 465 log_msg(LOG_DEFAULT, LVL_DEBUG2, "dns_rr_decode: rdlength=%zu", rdlength); 466 rr->rdata = calloc(1, rdlength); 459 467 if (rr->rdata == NULL) { 460 468 free(rr->name); 461 469 free(rr); 470 log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: Error memory"); 462 471 return ENOMEM; 463 472 } … … 470 479 *eoff = bp - pdu->data; 471 480 *retrr = rr; 481 log_msg(LOG_DEFAULT, LVL_DEBUG2, "dns_rr_decode: done"); 472 482 return EOK; 473 483 } … … 586 596 memcpy(msg->pdu.data, data, size); 587 597 msg->pdu.size = size; 588 log_msg(LOG_DEFAULT, LVL_ NOTE, "dns_message_decode: pdu->data = %p, "598 log_msg(LOG_DEFAULT, LVL_DEBUG2, "dns_message_decode: pdu->data = %p, " 589 599 "pdu->size=%zu", msg->pdu.data, msg->pdu.size); 590 600 … … 605 615 606 616 qd_count = uint16_t_be2host(hdr->qd_count); 617 log_msg(LOG_DEFAULT, LVL_DEBUG2, "qd_count=%zu", qd_count); 618 607 619 608 620 for (i = 0; i < qd_count; i++) { … … 618 630 619 631 an_count = uint16_t_be2host(hdr->an_count); 632 log_msg(LOG_DEFAULT, LVL_DEBUG2, "an_count=%zu", an_count); 620 633 621 634 for (i = 0; i < an_count; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.