mdns: Revert answer count patch

Answers written to outpackets can be additional answers
or normal answers to questions.
This commit is contained in:
Erik Ekman 2016-09-09 17:04:12 +02:00
parent f38705c38c
commit 4a73bcbc65

View File

@ -1008,9 +1008,6 @@ mdns_add_answer(struct mdns_outpacket *reply, struct mdns_domain *domain, u16_t
/* Write rd_length after when we know the answer size */ /* Write rd_length after when we know the answer size */
field16 = htons(reply->write_offset - answer_offset); field16 = htons(reply->write_offset - answer_offset);
res = pbuf_take_at(reply->pbuf, &field16, sizeof(field16), rdlen_offset); res = pbuf_take_at(reply->pbuf, &field16, sizeof(field16), rdlen_offset);
if (res == ERR_OK) {
reply->answers++;
}
return res; return res;
} }
@ -1298,12 +1295,14 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
if (res != ERR_OK) { if (res != ERR_OK) {
goto cleanup; goto cleanup;
} }
outpkt->answers++;
} }
if (outpkt->host_replies & REPLY_HOST_PTR_V4) { if (outpkt->host_replies & REPLY_HOST_PTR_V4) {
res = mdns_add_hostv4_ptr_answer(outpkt, outpkt->cache_flush, outpkt->netif); res = mdns_add_hostv4_ptr_answer(outpkt, outpkt->cache_flush, outpkt->netif);
if (res != ERR_OK) { if (res != ERR_OK) {
goto cleanup; goto cleanup;
} }
outpkt->answers++;
} }
#endif #endif
#if LWIP_IPV6 #if LWIP_IPV6
@ -1315,6 +1314,7 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
if (res != ERR_OK) { if (res != ERR_OK) {
goto cleanup; goto cleanup;
} }
outpkt->answers++;
} }
} }
} }
@ -1327,6 +1327,7 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
if (res != ERR_OK) { if (res != ERR_OK) {
goto cleanup; goto cleanup;
} }
outpkt->answers++;
} }
addrindex++; addrindex++;
rev_addrs >>= 1; rev_addrs >>= 1;
@ -1346,6 +1347,7 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
if (res != ERR_OK) { if (res != ERR_OK) {
goto cleanup; goto cleanup;
} }
outpkt->answers++;
} }
if (outpkt->serv_replies[i] & REPLY_SERVICE_NAME_PTR) { if (outpkt->serv_replies[i] & REPLY_SERVICE_NAME_PTR) {
@ -1353,6 +1355,7 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
if (res != ERR_OK) { if (res != ERR_OK) {
goto cleanup; goto cleanup;
} }
outpkt->answers++;
} }
if (outpkt->serv_replies[i] & REPLY_SERVICE_SRV) { if (outpkt->serv_replies[i] & REPLY_SERVICE_SRV) {
@ -1360,6 +1363,7 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
if (res != ERR_OK) { if (res != ERR_OK) {
goto cleanup; goto cleanup;
} }
outpkt->answers++;
} }
if (outpkt->serv_replies[i] & REPLY_SERVICE_TXT) { if (outpkt->serv_replies[i] & REPLY_SERVICE_TXT) {
@ -1367,6 +1371,7 @@ mdns_send_outpacket(struct mdns_outpacket *outpkt)
if (res != ERR_OK) { if (res != ERR_OK) {
goto cleanup; goto cleanup;
} }
outpkt->answers++;
} }
} }