Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions subsys/net/lib/dns/mdns_responder.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,22 @@ static inline bool mdns_iface_is_enabled(struct net_if *iface)
#if defined(CONFIG_NET_IPV4)
static struct mdns_responder_context v4_ctx[MAX_IPV4_IFACE_COUNT];

/* The socket service dispatcher keeps a pointer to the poll fd array passed at
* registration (and reuses it when a peer dispatcher is unregistered), so it
* must outlive init_listener(). Keep it at file scope for that reason.
*/
static struct zsock_pollfd ipv4_fds[MAX_IPV4_IFACE_COUNT];

NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(v4_svc, dns_dispatcher_svc_handler,
MDNS_V4_SVC_POLL_COUNT);
#endif

#if defined(CONFIG_NET_IPV6)
static struct mdns_responder_context v6_ctx[MAX_IPV6_IFACE_COUNT];

/* See the ipv4_fds comment above: the dispatcher retains this pointer. */
static struct zsock_pollfd ipv6_fds[MAX_IPV6_IFACE_COUNT];

NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC(v6_svc, dns_dispatcher_svc_handler,
MDNS_V6_SVC_POLL_COUNT);
#endif
Expand Down Expand Up @@ -1638,9 +1647,9 @@ static int init_listener(void)

#if defined(CONFIG_NET_IPV6)
/* Because there is only one IPv6 socket service context for all
* IPv6 sockets, we must collect the sockets in one place.
* IPv6 sockets, we must collect the sockets in one place (ipv6_fds,
* defined at file scope).
*/
struct zsock_pollfd ipv6_fds[MAX_IPV6_IFACE_COUNT];
struct net_sockaddr_in6 local_addr6;
int v6;

Expand Down Expand Up @@ -1750,7 +1759,6 @@ static int init_listener(void)
#endif /* CONFIG_NET_IPV6 */

#if defined(CONFIG_NET_IPV4)
struct zsock_pollfd ipv4_fds[MAX_IPV4_IFACE_COUNT];
struct net_sockaddr_in local_addr4;
int v4;

Expand Down
Loading