This is part of the NetBSD project for the Google Summer of code. Google gives to computer science students the opportunity to develop open source code, under the guide of important open source organization like NetBSD.
"NetBSD is a free, secure, and highly portable Unix-like Open Source operating system available for many platforms, from 64-bit, Opteron machines and desktop systems to handheld and embedded devices. Its clean design and advanced features make it excellent in both production and research environments, and it is user-supported with complete source."
The goal of this project is to add zeroconf support to NetBSD. The project is divided in two parts.The first part consists in writing a daemon which autoconfigure IPv4 link-local address for a network interface, if there is no DHCP server and no manual configuration. The second part is about developing a library for multicast DNS, which is used to resolve local network host name and discover available services in network where there is no DNS server.
finished, start library design phase
- 2005-07-01: Design phase finished, start coding
- 2005-06-24: Project accepted, started design phase for zeroconfd daemon
Specifications about this topics are found at this links:
Other operating systems already implements these features. There is an open source implementation howl of the daemon, the and the DNS library. It does not fully support IPv6 and does not fit well with NetBSD. Apple implementation, instead, is found here. But we like much more NetBSD licensed code. :-)
zeroconfd deamon should interact with
I've put in the project directory a modified version of dhclient-script.
When on an interface the dhclient fails in acquiring or in renewing a lease
it adds that interface to the ones which the daemon runs on.
responderd daemon implements the multicast DNS specification.
It reads the resource records to announce from a file and then waits and
listen on every multicast interface for queries it can answer. It also
makes the query for every application on the host it is running on. There
will be 2 interfaces: a syncronous one through gethostbyname/getnameinfo,
and an asyncronous based on a callback system.
The cache is implemented with a binary tree using functions tsearch tfind tdelete. The key of every element is the a string made up of the domain name and the number of the type of the record. Every element is actually a list since there could be more than one resource records with the same name and type according to the specification.
There is a struct event_lists with a five lists of events.
A zc_event is simply a
with all the necessary data
for the event.
The event handling took me more than I expected. Now it wont't be very difficult
to implement this library, since in
unix_sock.c there are already
the function to communicate with the unix socket. I've made a little test
program mdns_query to test it a little bit.
As you can see,
dns.c is made of function which operates on the
different types of resource records. I've not implemented the function to
handle txt records, because I wanted to have a working responderd before the
end and I was running out of time.
When we add a record to the cache we must schedule an event so that elements would be deleted from the cache when expired.
I've code a very simple and lame parser for the configuration file, not to waste
time and to concentrate to the dns and events stuff. The parser could be borrowed