---------------------------------------------------------------------
NAMESERVICE PLUGIN FOR OLSRD
by Bruno Randolf <bruno.randolf@4g-systems.biz>
---------------------------------------------------------------------

a simple DNS replacement for OLSR networks

this plugin distributes host name information over OLSR
and writes a file in /etc/hosts format. this file can be 
used to resolve hostnames on the local system and/or be
read by a DNS server like "dnsmasq", to make the names 
available via ordinary DNS to other clients as well.

the default location of the hosts file is
"/var/run/hosts_olsr" on unixes
"C:\WINDOWS\hosts_olsr" on windows


---------------------------------------------------------------------
PLUGIN PARAMETERS (PlParam)
---------------------------------------------------------------------

PlParam "name" "my-name.mesh"

	the name of this OLSR node (main address).
	can be specified multiple times for different names.


PlParam "IP.ADDR" "another-name.mesh"

	a name for a specified IP address.
	the IP address has to be either from one of the olsr 
	interfaces or within a HNA network we announce.
	can be specified multiple times.


PlParam "hosts-file" "/path/to/hosts_file"

	which file to write to (usually /etc/hosts).
	(default: /var/run/hosts_olsr)


PlParam "interval" "SEC"

	interval for sending NAME messages in seconds.
	(default: 120 - 2 minutes)


PlParam "timeout" "SEC"

	validity time for received NAME messages in seconds.
	(default: 3600 - 1 hour)


PlParam "suffix" ".olsr"

	local suffix which is appended to all received names.
	(default: "")
	

PlParam "add-hosts" "/path/to/file"

	copy contents of this additional hosts file to output file.
	this is practical if you alreay use your /etc/hosts file.


PlParam "dns-server" "IP.ADDR"
	anounce that this IP has a full (upstream) DNS server. if 
	IP.ADDR is not specified (""), the main address is used.
	nodes which don't know a nameserver will automatically use
	this nameserver.


PlParam "resolv-file" "/path/to/resolv.conf"
	path to resolv.conf file (usually /etc/resolv.conf)
	if set, an the upstream nameserver annonced by another node
	in the network is written to this file


---------------------------------------------------------------------
SAMPLE CONFIG
---------------------------------------------------------------------

add in /etc/olsrd.conf:

LoadPlugin "olsrd_nameservice.so.0.2"
{
	PlParam "name" "thisismyname.mesh"
	PlParam "hosts-file" "/etc/hosts"
	PlParam "resolv-file" "/etc/resolv.conf"
}


---------------------------------------------------------------------
USING THE NAME INFORMATION
---------------------------------------------------------------------

to use the name information distributed by the plugin actually for
name resolution you can do one of the following.

UNIX VARIANTS:

* overwrite /etc/hosts
	be sure you have nothing in /etc/hosts which you still need and
	configure the plugin with PlParam "filename" "/etc/hosts"
	
* link /etc/hosts (only on unix variants)
	ln -s /var/run/hosts_olsr /etc/hosts
	
* use dnsmasq
	if you want to make the names available via ordinary DNS
	you can use dnsmasq to read the hosts file and serve it to
	users. add the following to dnsmasq.conf and restart dnsmasq
	addn-hosts=/var/run/hosts_olsr
	
WINDOWS:

* overwrite C:\WINDOWS\system32\drivers\etc\hosts
	be sure you have nothing in the file which you still need 
	and configure the plugin with
	PlParam "filename" "C:\WINDOWS\system32\drivers\etc\hosts"
	

---------------------------------------------------------------------
TODO
---------------------------------------------------------------------
  
 * implement a small DNS server into the plugin?
 * or make dynamic DNS updates for bind?

---------------------------------------------------------------------
EOF / 17.03.2005
