Extremely simple MDNS server for Linux. Much smaller and lighter weight than Avahi.
Primarily MDNS Hostname responder - i.e. run this, and any computer on your network can say ping your_hostname.local and it will resolve to your PC. Specifically, it uses whatever name is in your /etc/hostname
- Uses no CPU unless event requested.
- Only needs around 32kB RAM.
- Compiles to between 15-45kB
- Can run as a user or root.
- Zero config + Watches for
/etc/hostnamechanges. (Optionally: Can use -h to also watch for a host alias) - Works on IPv6
- This tool only replies to hostnames, so you can use
hostname.localbut not services, so you can't use it to find your printer. - This tool automatically perform both a
UNICAST-RESPONSEandMULTICAST-RESPONSE- whether true or not.
- To obviate need for avahi-daemon
- To provide an MDNS server on very simple systems
- To act as an educational tool for the following items
- Use of inotify to detect changes of
/etc/hostname - Use of
getifaddrsto iterate through all available interfaces - Use of
NETLINK_ROUTEandRTMGRP_IPV4_IFADDRandRTMGRP_IPV6_IFADDRto monitor for any new network interfaces or addresses. - Use of multicast in IPv4 and IPv6 to join a multicast group
- Use of
recvmsgto get the interface and address that a UDP packet is received on - Use of
optargto handle command-line parameters. - Use of
fork()andwait3()to handle workers. (Only used in DNS forwarding mode)
- Use of github workflows to build and test tool on Linux
- Makefile example for building .deb files
- Github workflow example for generating releases on new tags.
- How to use/install a basic man page
- build-essential (make + GCC + system headers)
make- or, optionally
make installto install it to /usr/local/bin/minimdnsd, and install the initd service
- Allow response to services (see original MDNS server here: https://github.com/cnlohr/esp82xx/blob/master/fwsrc/mdns.c)
- Keep it under or around 1k LoC
- Keep it < 32kB
.text
IPv6 is pain. this would have been a tiny fraction of its size if it weren't for IPv6.
Also IPv6 with MDNS is in a really sorry state, so I was barely able to test this with IPv6.
https://superuser.com/questions/1086954/how-do-i-use-mdns-for-ssh-6
And ping6 has a similar issue.
For code reviews: @GPSBabelDeveloper, @probonopd