From 456f80b754ebd0bd74e02c7febdf461c6b573b7a Mon Sep 17 00:00:00 2001 From: Jiacheng Guo Date: Fri, 3 Dec 2021 17:50:57 +0800 Subject: [PATCH] mdns: always send A/AAAA records in announcements --- components/mdns/mdns.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c index 351b5c1695..81108eb455 100644 --- a/components/mdns/mdns.c +++ b/components/mdns/mdns.c @@ -1837,7 +1837,6 @@ static mdns_tx_packet_t * _mdns_create_announce_packet(mdns_if_t tcpip_if, mdns_ */ static mdns_tx_packet_t * _mdns_create_announce_from_probe(mdns_tx_packet_t * probe) { - mdns_tx_packet_t * packet = _mdns_alloc_packet_default(probe->tcpip_if, probe->ip_protocol); if (!packet) { return NULL; @@ -1854,6 +1853,12 @@ static mdns_tx_packet_t * _mdns_create_announce_from_probe(mdns_tx_packet_t * pr _mdns_free_tx_packet(packet); return NULL; } + mdns_host_item_t *host = mdns_get_host_item(s->service->hostname); + if (!_mdns_alloc_answer(&packet->answers, MDNS_TYPE_A, NULL, host, true, false) + || !_mdns_alloc_answer(&packet->answers, MDNS_TYPE_AAAA, NULL, host, true, false)) { + _mdns_free_tx_packet(packet); + return NULL; + } } else if (s->type == MDNS_TYPE_A || s->type == MDNS_TYPE_AAAA) { if (!_mdns_alloc_answer(&packet->answers, s->type, NULL, s->host, true, false)) {