Skip to content

Commit d1872d7

Browse files
toonstdanieldegrasse
authored andcommitted
net: mdns: make net_buf size configurable
for longer DNS-SD text records and instance names we need a bigger buffer Signed-off-by: Toon Stegen <toon@toostsolutions.be>
1 parent 35a1093 commit d1872d7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

subsys/net/lib/dns/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ config MDNS_RESPONDER
206206

207207
if MDNS_RESPONDER
208208

209+
config MDNS_RESOLVER_BUF_SIZE
210+
int "Size of the net_buf pool buffers"
211+
default 512
212+
help
213+
For larger DNS SD TXT records and long service instance names, bigger buffers are necessary
214+
209215
config MDNS_RESPONDER_TTL
210216
int "Time-to-Live of returned DNS name"
211217
default 600

subsys/net/lib/dns/mdns_responder.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ static int setup_dst_addr(int sock, sa_family_t family,
115115
#define DNS_RESOLVER_BUF_CTR (DNS_RESOLVER_MIN_BUF + \
116116
CONFIG_MDNS_RESOLVER_ADDITIONAL_BUF_CTR)
117117

118+
#define MDNS_RESOLVER_BUF_SIZE CONFIG_MDNS_RESOLVER_BUF_SIZE
118119
NET_BUF_POOL_DEFINE(mdns_msg_pool, DNS_RESOLVER_BUF_CTR,
119-
DNS_RESOLVER_MAX_BUF_SIZE, 0, NULL);
120+
MDNS_RESOLVER_BUF_SIZE, 0, NULL);
120121

121122
static void create_ipv6_addr(struct sockaddr_in6 *addr)
122123
{
@@ -595,7 +596,7 @@ static int dns_read(int sock,
595596
int queries;
596597
int ret;
597598

598-
data_len = MIN(len, DNS_RESOLVER_MAX_BUF_SIZE);
599+
data_len = MIN(len, MDNS_RESOLVER_BUF_SIZE);
599600

600601
/* Store the DNS query name into a temporary net_buf, which will be
601602
* eventually used to send a response

0 commit comments

Comments
 (0)