small contribution to net/mDNSResponder

Alexander Wittig a_wittig at web.de
Wed Sep 1 06:16:31 PDT 2004


Hi there

I tried to set up a daap server yesterday (for Apples iTunes) and I 
couldn't get net/howl working from the ports. so I compiled audio/daapd 
without Howl and used net/mDNSResponder as mentioned in the daapd readme.
That readme states that one should call mDNSResponder with some command 
line parameters to have it announce the existence of the daap server to 
the other Rendezvous-aware members of the .local network. This way has 
some disadvantages: (1) You can only announce one single service, (2) 
you have to start it manually.

To overcome those problems I wrote a startup script for the 
mDNSResponderPosix binary. It uses the new rc.d framework (thus depends 
on sysutil/rc_subr) and supports a config file that can hold any number 
of services to be announced. To allow comments in the config file I had 
to make a small change in the source code of mDNSResponderPosix.

I included my Config (you may want to delete the actual service 
definitions and only use the samples on top), the rc.d script, and a 
diff of the mDNSposix/Responder.c file in the mDNSResponder source tree 
(version 62) with this email.
Maybe you want to include it in the port so that other users who want to 
set up a system similar to mine can do so easily.

Cheers,
Alex

BTW: What is mdnsd (installed by the mDNSResponder port) good for? It 
doesn't seem to have a man page or config file nor did I find anything 
in the Apple documentation. Also it didn't want to announce my daap 
server, so had to just kick it ;-)
-------------- next part --------------
# mDNSResponderPosix configuration File
#
# This file contains the services to be announced to other Rendezvous aware 
# machines on the .local network
# 
# Entries constist of four consecutive lines as follows:
# NAME OF SERVICE
# TYPE OF SERVICE (and, if different from .local, the domain seperated by a space)
# TXT RECORD (short description of service)
# PORT OF SERVICE
#
# Example (announce existence of Apache to the .my_local world):
# My Webserver
# _http._tcp. .my_local.
# This is my Apache server
# 80
#


MP3-Server
_daap._tcp.
Alex MP3-Server
3689

Lokaler Webserver
_http._tcp.
Lokaler Webserver auf Server
80

MySQL Datenbank
_mysql._tcp.
MySQL Datenbank auf Server
3306

SSH Serverzugang
_ssh._tcp.
SSH Serverzugang (VORSICHT)
22

NTP Zeitserver
_ntp._udp.
NTP Zeitserver auf Server
123
-------------- next part --------------
#!/bin/sh

# PROVIDE: mDNSResponderPosix
# REQUIRE: DAEMON
# KEYWORD: FreeBSD shutdown

# Define these mDNSResponderPosix_* variables in one of these files:
#       /etc/rc.conf
#       /etc/rc.conf.local
#       /etc/rc.conf.d/mDNSResponderPosix
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
mDNSResponderPosix_enable="YES"
mDNSResponderPosix_flags=""

. /usr/local/etc/rc.subr

name="mDNSResponderPosix"
rcvar=`set_rcvar`

prefix=/usr/local
logdir=/var/log

mDNSResponderPosixBin="${prefix}/bin/mDNSResponderPosix"
mDNSResponderPosixCfg="${prefix}/etc/mDNSResponderPosix.conf"
mDNSResponderPosixLog="${logdir}/mDNSResponderPosix.log"

required_files="${mDNSResponderPosixCfg}"

command="${mDNSResponderPosixBin}"
command_args="-b -f ${mDNSResponderPosixCfg} ${mDNSResponderPosix_flags} >> ${mDNSResponderPosixLog} 2>&1"

load_rc_config $name
run_rc_command "$1"
-------------- next part --------------
652a653,657
>                 // Skip comments
>                 if( ch == '#' || ch == ';' )
>                         do {
>                                 ch = fgetc( fp );
>                         } while( ch != EOF && ch != '\n' && ch != '\r' );
658c663
<             // Read three lines, check them for validity, and register the service.
---
>             // Read four lines, check them for validity, and register the service.


More information about the freebsd-ports mailing list