lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [patch #8755] Multicast DNS responder support


From: Erik Ekman
Subject: [lwip-devel] [patch #8755] Multicast DNS responder support
Date: Wed, 30 Sep 2015 14:54:15 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0

URL:
  <http://savannah.nongnu.org/patch/?8755>

                 Summary: Multicast DNS responder support
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: yarrick
            Submitted on: Wed 30 Sep 2015 02:54:13 PM GMT
                Category: DNS
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

Here comes my summer project..

Creating as a patch since task #10240 was closed.

I have built an implementation of multicast DNS and DNS Service Discovery to
enable an lwIP node to publish its name, IP addresses and services to the
local network over IPv4 and/or IPv6.

---------

Basic API usage:

Activate MDNS responder on a netif:
mdns_resp_add_netif(struct netif *netif, char *hostname, u32_t dns_ttl)

If this returns successfully, the netif will join
the multicast groups and any MDNS requests sent unicast or multicast to port
5353 will be handled:
- <hostname>.local type A, AAAA or ANY returns relevant IP addresses
- Reverse lookups (PTR in-addr.arpa, ip6.arpa) of netif addresses
  returns <hostname>.local

Then add a service:
mdns_resp_add_service(struct netif *netif, char *name, char *service,
    u16_t proto, u16_t port, u32_t dns_ttl,
    service_get_txt_fn_t txt_fn, void *txt_userdata);

If this call returns successfully, the following MDNS will be handled:
- _services._dns-sd._udp.local type PTR returns <service>.<proto>.local
- <service>.<proto>.local type PTR returns <name>.<service>.<proto>.local
- <name>.<service>.<proto>.local type SRV returns hostname and port of
service
- <name>.<service>.<proto>.local type TXT builds text strings by calling
txt_fn with the supplied userdata.


---------
The code attempts to minimize dynamic memory allocation and instead uses
objects on the stack. It should use less than 1kB stack. 

I have tried to keep the code standards, but might have missed something so
give me comments on what needs to be fixed. It is quite a lot of code, I can
break it up in a few commits if needed. 

I moved the interesting defines out from dns.c into a dns_common.h includefile
so the info does not have to be duplicated. The DNS parsing/generation in
dns.c was not enough, so I have built new code for that. Maybe this new code
can become a shared base for an update of dns.c.

I have written tests on DNS parsing and name compression so far, but not yet
on the packet handling.

I will keep working on this code, to add conflict resolution and such things
to follow most of the RFC requirements.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 30 Sep 2015 02:54:13 PM GMT  Name:
0001-Add-Multicast-DNS-responder.patch  Size: 115kB   By: yarrick

<http://savannah.nongnu.org/patch/download.php?file_id=35016>
-------------------------------------------------------
Date: Wed 30 Sep 2015 02:54:13 PM GMT  Name:
0001-contrib-Multicast-DNS-update-unittest-makefile.patch  Size: 2kB   By:
yarrick

<http://savannah.nongnu.org/patch/download.php?file_id=35017>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8755>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]