Changes in uspace/srv/net/dnsrsrv/dns_msg.c [20c82e3:b5f716b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/dnsrsrv/dns_msg.c
r20c82e3 rb5f716b 77 77 return ENOMEM; 78 78 79 str_cpy( nstr+ s1, nsize - s1, suff);79 str_cpy((*dstr) + 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 197 205 if ((lsize & 0xc0) == 0xc0) { 198 206 /* Pointer */ … … 225 233 * the message continues 226 234 */ 227 if (*eoff == 0) 228 *eoff = eptr; 235 *eoff = eptr; 229 236 230 237 bp = pdu->data + ptr; … … 236 243 rc = EINVAL; 237 244 goto error; 238 }239 240 if (!first) {241 rc = dns_dstr_ext(&name, ".");242 if (rc != EOK) {243 rc = ENOMEM;244 goto error;245 }246 245 } 247 246 … … 414 413 rc = dns_name_decode(pdu, boff, &rr->name, &name_eoff); 415 414 if (rc != EOK) { 416 log_msg(LOG_DEFAULT, LVL_DEBUG, " dns_rr_decode: error decoding name");415 log_msg(LOG_DEFAULT, LVL_DEBUG, "Error decoding name"); 417 416 free(rr); 418 417 return ENOMEM; … … 422 421 free(rr->name); 423 422 free(rr); 424 log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: error name_off");425 423 return EINVAL; 426 424 } … … 432 430 free(rr->name); 433 431 free(rr); 434 log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: error bsz");435 432 return EINVAL; 436 433 } … … 448 445 bsz -= sizeof(uint32_t); 449 446 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 453 447 rdlength = dns_uint16_t_decode(bp, bsz); 454 448 bp += sizeof(uint16_t); … … 458 452 free(rr->name); 459 453 free(rr); 460 log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: Error rdlength %zu > bsz %zu", rdlength, bsz);461 454 return EINVAL; 462 455 } 463 456 464 457 rr->rdata_size = rdlength; 465 log_msg(LOG_DEFAULT, LVL_DEBUG2, "dns_rr_decode: rdlength=%zu", rdlength); 466 rr->rdata = calloc(1, rdlength); 458 rr->rdata = calloc(1, sizeof(rdlength)); 467 459 if (rr->rdata == NULL) { 468 460 free(rr->name); 469 461 free(rr); 470 log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: Error memory");471 462 return ENOMEM; 472 463 } … … 479 470 *eoff = bp - pdu->data; 480 471 *retrr = rr; 481 log_msg(LOG_DEFAULT, LVL_DEBUG2, "dns_rr_decode: done");482 472 return EOK; 483 473 } … … 596 586 memcpy(msg->pdu.data, data, size); 597 587 msg->pdu.size = size; 598 log_msg(LOG_DEFAULT, LVL_ DEBUG2, "dns_message_decode: pdu->data = %p, "588 log_msg(LOG_DEFAULT, LVL_NOTE, "dns_message_decode: pdu->data = %p, " 599 589 "pdu->size=%zu", msg->pdu.data, msg->pdu.size); 600 590 … … 615 605 616 606 qd_count = uint16_t_be2host(hdr->qd_count); 617 log_msg(LOG_DEFAULT, LVL_DEBUG2, "qd_count=%zu", qd_count);618 619 607 620 608 for (i = 0; i < qd_count; i++) { … … 630 618 631 619 an_count = uint16_t_be2host(hdr->an_count); 632 log_msg(LOG_DEFAULT, LVL_DEBUG2, "an_count=%zu", an_count);633 620 634 621 for (i = 0; i < an_count; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.