Giter Site home page Giter Site logo

minimdnsd's Introduction

minimdnsd (MDNS server)

Extremely simple MDNS server for Linux. Much smaller and lighter weight than Avahi.

⚠️ This has not been battle hardened, or even thoroughly checked ⚠️

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/hostname changes. (Optionally: Can use -h to also watch for a host alias)
  • Works on IPv6

⚠️ Caveats ⚠️

  • This tool only replies to hostnames, so you can use hostname.local but not services, so you can't use it to find your printer.
  • This tool assumes UNICAST-RESPONSE - whether true or not. I am unaware of any MDNS clients that don't know how to accept it and it's tidier to just force UNICAST-RESPONSE.

General Motivation

  1. To obviate need for avahi-daemon
  2. To provide an MDNS server on very simple systems
  3. To act as an educational tool for the following items

To demonstrate the following:

  1. Use of inotify to detect changes of /etc/hostname
  2. Use of getifaddrs to iterate through all available interfaces
  3. Use of NETLINK_ROUTE and RTMGRP_IPV4_IFADDR and RTMGRP_IPV6_IFADDR to monitor for any new network interfaces or addresses.
  4. Use of multicast in IPv4 and IPv6 to join a multicast group
  5. Use of recvmsg to get the interface and address that a UDP packet is received on
  6. Use of optarg to handle command-line parameters.
  7. Use of fork() and wait3() to handle workers. (Only used in DNS forwarding mode)

And for general housekeeping:

  1. Use of github workflows to build and test tool on Linux
  2. Makefile example for building .deb files
  3. Github workflow example for generating releases on new tags.
  4. How to use/install a basic man page

Building

Prerequisits

  • build-essential (make + GCC + system headers)

Build process

  • make
  • or, optionally make install to install it to /usr/local/bin/minimdnsd, and install the initd service

Long-Term

Things I learned

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.

Thanks

For code reviews: @GPSBabelDeveloper, @probonopd

minimdnsd's People

Contributors

cnlohr avatar probonopd avatar forslund avatar

Stargazers

 avatar Rick Bassham avatar Enrico Marchesin avatar  avatar Alan Mimms avatar Jantje19 avatar Ian Smith avatar casjay avatar  avatar Richard Osterloh avatar  avatar Jj! avatar Lorenz avatar Ilya_MZP avatar Gutem avatar Andrey Kovalev avatar Samy Francelet avatar  avatar Erasmus Cedernaes avatar Jimmy Hedman avatar Mtv Europe avatar  avatar  avatar Jan Graichen avatar Benjamin DeCamp avatar  avatar Jonathan Dahan avatar  avatar  avatar Paweł Gronowski avatar JinGen Lim avatar  avatar Omar Rizwan avatar Victor Suarez Rovere avatar Julian K. avatar  avatar Valtteri Koskivuori avatar Sergii Skorokhodov avatar Chinmay Pendharkar avatar Tomas Bosek avatar  avatar le Duc Banal avatar Jason Graham avatar John Torakis avatar  avatar Jack Wilsdon avatar Robin Moalic avatar samy kamkar avatar  avatar  avatar Trevor Rudolph avatar  avatar  avatar whstudio123 avatar Jevin Sweval avatar Sandalots avatar Devon 'fire' Adkisson avatar Chris Hemingway avatar Davidson Francis avatar

Watchers

Jevin Sweval avatar  avatar  avatar

minimdnsd's Issues

Doesn't seem to listen on IPv6 multicast address

Sending AAAA queries to the multicast address ff02::fb doesn't work, but sending to any of the unicast addresses makes it respond with that unicast address.

Sending to multicast address:

23:25:55.829464 IP6 fd12:3456:789a:bcde:d9e0:d7f9:c40f:6297.5353 > ff02::fb.5353: 0 AAAA (QM)? suxhost.local. (31)
23:25:56.830988 IP6 fd12:3456:789a:bcde:d9e0:d7f9:c40f:6297.5353 > ff02::fb.5353: 0 AAAA (QM)? suxhost.local. (31)
23:25:58.833740 IP6 fd12:3456:789a:bcde:d9e0:d7f9:c40f:6297.5353 > ff02::fb.5353: 0 AAAA (QM)? suxhost.local. (31)

Sending to unicast address:

23:26:40.855217 IP6 fd12:3456:789a:bcde:7a18:91c0:c6d8:90f2.58009 > fd12:3456:789a:bcde:be24:11ff:fec8:646.5353: 60633+ [1au] AAAA (QM)? suxhost.local. (54)
23:26:40.857751 IP6 fd12:3456:789a:bcde:be24:11ff:fec8:646.5353 > fd12:3456:789a:bcde:7a18:91c0:c6d8:90f2.58009: 55788*- [0q] 1/0/0 (Cache flush) AAAA fd12:3456:789a:bcde:be24:11ff:fec8:646 (53)

Resolve AAAA over IPv4 returns multicast address as IPv4-mapped IPv6 address

When resolving an AAAA record over IPv4 it returns the multicast address (224.0.0.251) as an IPv4-mapped IPv6 addres (::ffff:224.0.0.251).

22:59:20.130533 IP 192.168.2.23.5353 > 224.0.0.251.5353: 0 AAAA (QM)? suxhost.local. (31)
22:59:20.133211 IP 192.168.2.24.5353 > 192.168.2.23.5353: 0*- [0q] 1/0/0 (Cache flush) AAAA ::ffff:224.0.0.251 (53)

It should instead return all IPv6-addresses on that interface.

Advertise services to the network

The main point of Zeroconf (for me, anyways) is to announce services to the network, e.g., a web server can announce its existence to other devices on the network. Is this possible/planned for minimdnsd?

Is that what is meant by

Allow response to services

?

My main use cases would be all kinds of embedded boxes with, e.g., sshd on them, which I would like to be advertised to the local network so that I don't have to remember their hostnames nor find out their IP addresses.

Write Init Script

For when using make install - it should also install an init script

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.