default tcp host

Havoc Pennington hp at redhat.com
Wed Jun 13 12:51:35 PDT 2007


Right now if you dbus_server_listen("tcp:port=0") it listens on localhost.

But there's no way right now to listen on INADDR_ANY (all local interfaces).

If we made a missing host= mean INADDR_ANY instead of localhost, there 
would be a problem however; the DBusServer would not have any way to 
report its own address. (Right? I'm not exactly an expert here.)

So here is a proposal, that we add to the tcp: address format the flag
   all_interfaces=true|false

Which would mean to bind to INADDR_ANY (I believe that is equivalent to 
not binding at all, just listen()).

The host= field would continue to default to localhost if missing, and 
will be the host the server will report if asked for its address.

So basically if you say tcp:host=foo,port=0,all_interfaces=true then the 
server will report its address as tcp:host=foo,port=something and will 
in fact be listening on all local interfaces. If you say 
all_interfaces=false, then the server will only listen on the host that 
was specified. This can remain the default, so back compat would not be 
affected.

I'll poke at implementing this now and maybe some obvious problem with 
it will emerge.

Havoc





More information about the dbus mailing list