Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 01 Sep 2004 15:16:26 +0200
From:      Alexander Wittig <a_wittig@web.de>
To:        alfred@freebsd.org
Cc:        ports@FreeBSD.org
Subject:   small contribution to net/mDNSResponder
Message-ID:  <4135CBAA.5080902@web.de>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------010900000605080005030003
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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 ;-)

--------------010900000605080005030003
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
 name="mDNSResponderPosix.conf"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mDNSResponderPosix.conf"

# 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

--------------010900000605080005030003
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
 name="mDNSResponderPosix.sh"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mDNSResponderPosix.sh"

#!/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"

--------------010900000605080005030003
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
 name="Responder.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Responder.c.diff"

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.

--------------010900000605080005030003--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4135CBAA.5080902>