Skip to content

Commit d0c9070

Browse files
committed
fix(mdns): Remove strict mode as it's invalid
Strict mode was introduced to support "one-shot" queries (described in RFC6762/sec5.1) that are sent by lwip or dig. It was incorrectly assumed that responding to such queries violates the spec, as we have to repeat queries in responces, which is forbidden in RFC6762/sec6. It is however required to repeat query fields according to the Section 6.7. Legacy Unicast Responses: "it MUST repeat the query ID and the question given in the query message."
1 parent a8339e4 commit d0c9070

File tree

3 files changed

+0
-34
lines changed

3 files changed

+0
-34
lines changed

components/mdns/Kconfig

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,6 @@ menu "mDNS"
6464
Configures timeout for adding a new mDNS service. Adding a service
6565
fails if could not be completed within this time.
6666

67-
config MDNS_STRICT_MODE
68-
bool "mDNS strict mode"
69-
default "n"
70-
help
71-
Configures strict mode. Set this to 1 for the mDNS library to strictly follow the RFC6762:
72-
Currently the only strict feature: Do not repeat original questions in response packets
73-
(defined in RFC6762 sec. 6).
74-
Default configuration is 0, i.e. non-strict mode, since some implementations,
75-
such as lwIP mDNS resolver (used by standard POSIX API like getaddrinfo, gethostbyname)
76-
could not correctly resolve advertised names.
77-
7867
config MDNS_TIMER_PERIOD_MS
7968
int "mDNS timer period (ms)"
8069
range 10 10000

components/mdns/mdns.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,6 @@ static void _mdns_create_answer_from_parsed_packet(mdns_parsed_packet_t *parsed_
17281728
return;
17291729
}
17301730

1731-
#ifdef MDNS_REPEAT_QUERY_IN_RESPONSE
17321731
if (parsed_packet->src_port != MDNS_SERVICE_PORT && // Repeat the queries only for "One-Shot mDNS queries"
17331732
(q->type == MDNS_TYPE_ANY || q->type == MDNS_TYPE_A || q->type == MDNS_TYPE_AAAA)) {
17341733
mdns_out_question_t *out_question = malloc(sizeof(mdns_out_question_t));
@@ -1751,7 +1750,6 @@ static void _mdns_create_answer_from_parsed_packet(mdns_parsed_packet_t *parsed_
17511750
out_question->own_dynamic_memory = true;
17521751
queueToEnd(mdns_out_question_t, packet->questions, out_question);
17531752
}
1754-
#endif // MDNS_REPEAT_QUERY_IN_RESPONSE
17551753
if (q->unicast) {
17561754
unicast = true;
17571755
}

components/mdns/private_include/mdns_private.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,6 @@
2121
#define _mdns_dbg_printf(...) printf(__VA_ARGS__)
2222
#endif
2323

24-
/** mDNS strict mode: Set this to 1 for the mDNS library to strictly follow the RFC6762:
25-
* Strict features:
26-
* - to do not set original questions in response packets per RFC6762, sec 6
27-
*
28-
* The actual configuration is 0, i.e. non-strict mode, since some implementations,
29-
* such as lwIP mdns resolver (used by standard POSIX API like getaddrinfo, gethostbyname)
30-
* could not correctly resolve advertised names.
31-
*/
32-
#ifndef CONFIG_MDNS_STRICT_MODE
33-
#define MDNS_STRICT_MODE 0
34-
#else
35-
#define MDNS_STRICT_MODE 1
36-
#endif
37-
38-
#if !MDNS_STRICT_MODE
39-
/* mDNS responders sometimes repeat queries in responses
40-
* but according to RFC6762, sec 6: Responses MUST NOT contain
41-
* any item in question field */
42-
#define MDNS_REPEAT_QUERY_IN_RESPONSE 1
43-
#endif
44-
4524
/** Number of predefined interfaces */
4625
#ifndef CONFIG_MDNS_PREDEF_NETIF_STA
4726
#define CONFIG_MDNS_PREDEF_NETIF_STA 0

0 commit comments

Comments
 (0)