default tcp host

Daniel P. Berrange dan at berrange.com
Thu Jun 14 12:03:01 PDT 2007


On Thu, Jun 14, 2007 at 05:15:07PM -0400, Ray Strode wrote:
> Hi,
> 
> >We could explicitly call gethostname() to retrieve the local hosts'
> >primary name & put that into the address in the INADDR_ANY scenario
> >which is basically what X does for DISPLAY env IIRC.
> That's a bad idea because gethostname() returns what the host calls
> itself, not necessarily what others call the host.  The two match
> sometimes, but they are different things, and they don't always match.
> 
> Also, think about the hostname, "localhost" ...

Forgot about that, so gethostname() is really not a viable option.

We basically have the situation where there's no way to reliably figure
out what hostname we should advertise to non-local clients. So for 
Havoc's use case of advertising DBus daemon via Avahi we definitely
need the administrator to define the hostname advertized as part of
the address.

Havoc's current code which adds the all_interfaces=true flag to the 
<listen> element and requires the admin to define the hostname
there as the value to be advertised. That would work in the simple
case, however, you may have multiple <listen> elements but only have
a single hostname that needs advertizing (if you're listening on 
specific subset of IP addresses for a given hostname), or have only
one <listen> element but need to advertize multiple hostnames (if you
are listening on INADDR_ANY, but have multiple interfaces each with
different IP address / hostname). 

Another option is to have a separate some separate XML element where you
detail what hostnames to advertise <advertise>foo.example.com</advertise>
if no explicit host is provided (the INADDR_ANY case).

Or perhaps add an extra field to the <listen> tag listing hostnames
that should be used after binding. eg. So some example <listen> tags 
and the corresponding output by --print-address

 -  <listen>tcp:port=123</listen>
     Bind to all addresses, don't advertize any hostname
         ->  tcp:port=123

 -  <listen>tcp:port=123,host=foo.example.com</listen>
     Bind to foo.example.com & advertize that
         ->  tcp:port=123,host=foo.example.com

 -  <listen>tcp:port=123,host=foo.example.com,advertize=</listen>
     Bind to foo.example.com & don't advertize any hostname
         ->  tcp:port=123

 -  <listen>tcp:port=123,host=123.453.25.255</listen>
     Bind to 123.453.25.255 & advertize that
         ->  tcp:port=123,host=123.453.25.255

 -  <listen>tcp:port=123,advertize=foo.example.com</listen>
     Bind to all addrresses, but advertize foo.example.com
         -> tcp:port=123,host=foo.example.com

 -  <listen>tcp:port=123,host=foo.example.com,advertize=bar.example.com</listen>
     Bind to bar.example.com, but advertize foo.example.com
     (foo is a local nick name, but bar is the canonical name)
         -> tcp:port=123,host=bar.example.com

 -  <listen>tcp:port=123,advertize=bar.example.com,foo.example.com</listen>
     Bind to all addresses, advertize both bar & foo.example.com
         -> tcp:port=123,host=bar.example.com;tcp:port=123,host=foo.example.com

Maybe there's other options which work more effectively based on the
way Avahi stuff is to interact with DBus daemon ?

Regards,
Dan.
-- 
|=-            GPG key: http://www.berrange.com/~dan/gpgkey.txt       -=|
|=-       Perl modules: http://search.cpan.org/~danberr/              -=|
|=-           Projects: http://freshmeat.net/~danielpb/               -=|
|=-   berrange at redhat.com  -  Daniel Berrange  -  dan at berrange.com    -=|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/dbus/attachments/20070614/19036f88/attachment.pgp 


More information about the dbus mailing list