default tcp host

Daniel P. Berrange dan at
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></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,</listen>
     Bind to & advertize that
         ->  tcp:port=123,

 -  <listen>tcp:port=123,,advertize=</listen>
     Bind to & 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,</listen>
     Bind to all addrresses, but advertize
         -> tcp:port=123,

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

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

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

|=-            GPG key:       -=|
|=-       Perl modules:              -=|
|=-           Projects:               -=|
|=-   berrange at  -  Daniel Berrange  -  dan at    -=|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : 

More information about the dbus mailing list