Bug 72301 - DBus Spec: document "bind" for tcp/nonce-tcp transport
Summary: DBus Spec: document "bind" for tcp/nonce-tcp transport
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: 1.5
Hardware: Other All
: medium normal
Assignee: Havoc Pennington
QA Contact:
URL:
Whiteboard: review?
Keywords: patch
Depends on:
Blocks:
 
Reported: 2013-12-04 09:58 UTC by Chengwei Yang
Modified: 2014-01-06 16:31 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
[PATCH 1/3] DBus Spec: fix format a little (3.38 KB, patch)
2013-12-04 10:41 UTC, Chengwei Yang
Details | Splinter Review
[PATCH 2/3] DBus Spec: add document of bind for tcp/nonce-tcp transport (2.27 KB, patch)
2013-12-04 10:41 UTC, Chengwei Yang
Details | Splinter Review
[PATCH 3/3] DBus-daemon(1): clarify hostname of bind to avoid confusing (1.50 KB, patch)
2013-12-04 10:42 UTC, Chengwei Yang
Details | Splinter Review
[PATCH v2 1/3] DBus Spec: replace tab with 8 spaces (28.77 KB, patch)
2013-12-06 05:41 UTC, Chengwei Yang
Details | Splinter Review
[PATCH 2/4] DBus Spec: fix double quotes (1.74 KB, patch)
2013-12-06 05:41 UTC, Chengwei Yang
Details | Splinter Review
[PATCH 3/4] DBus Spec: add document of bind for tcp/nonce-tcp transport (2.09 KB, patch)
2013-12-06 05:42 UTC, Chengwei Yang
Details | Splinter Review
[PATCH 4/4] dbus-daemon(1): align document about "bind" with DBus Spec (1.49 KB, patch)
2013-12-06 05:42 UTC, Chengwei Yang
Details | Splinter Review
[PATCH v2 2/3] DBus Spec: add document of bind for tcp/nonce-tcp transport (2.09 KB, patch)
2013-12-10 02:15 UTC, Chengwei Yang
Details | Splinter Review
[PATCH v2 3/3] dbus-daemon(1): align document about "bind" with DBus Spec (1.60 KB, patch)
2013-12-10 02:16 UTC, Chengwei Yang
Details | Splinter Review

Description Chengwei Yang 2013-12-04 09:58:05 UTC
bind is a valid key for tcp/nonce-tcp transport, however, which only documented in dbus-daemon(1), should be documented in DBus Spec too.
Comment 1 Chengwei Yang 2013-12-04 10:41:17 UTC
Created attachment 90212 [details] [review]
[PATCH 1/3] DBus Spec: fix format a little

OK, the format of spec file is rather crazy, just fix a little part of
indent before add document for "bind".
Comment 2 Chengwei Yang 2013-12-04 10:41:50 UTC
Created attachment 90213 [details] [review]
[PATCH 2/3] DBus Spec: add document of bind for tcp/nonce-tcp  transport

tcp/nonce-tcp transport has a "bind" key, which can be specified a
hostname and will override hostname specified in "host" key.
Comment 3 Chengwei Yang 2013-12-04 10:42:26 UTC
Created attachment 90214 [details] [review]
[PATCH 3/3] DBus-daemon(1): clarify hostname of bind to avoid  confusing

At previous, I confused by below string in dbus-daemon(1)

    The specified host should be a valid name of the local machine or
    weird stuff will happen.

"The specified host" may also understand as "the hostname specified by
'host' key". Maybe this is a problem for me (English is my second
language), so to avoid the others got confused, let's clarify it as "The
specified hostname of bind".
Comment 4 Simon McVittie 2013-12-04 12:54:19 UTC
Comment on attachment 90212 [details] [review]
[PATCH 1/3] DBus Spec: fix format a little

Review of attachment 90212 [details] [review]:
-----------------------------------------------------------------

If you're changing the whitespace at all, I'd prefer 2 spaces per indent, which is as close as the D-Bus spec gets to consistency.
Comment 5 Simon McVittie 2013-12-04 13:01:55 UTC
Comment on attachment 90213 [details] [review]
[PATCH 2/3] DBus Spec: add document of bind for tcp/nonce-tcp  transport

Review of attachment 90213 [details] [review]:
-----------------------------------------------------------------

I think a better way to express this might be to merge my patch defining listenable/connectable addresses, and say something like this:

bind (string)
The IP address of one of the local machine's interfaces (most commonly <literal>127.0.0.1</literal>), or a DNS name that resolves to one of those IP addresses, or <literal>0.0.0.0</literal> to listen on all interfaces simultaneously. If not specified, the default is the same value as "host".

I assume the purpose here is that if you're doing remote TCP on a machine with addresses 10.0.0.1 and 10.11.12.13, you can tell the dbus-daemon to listen on

tcp:host=10.0.0.1,bind=0.0.0.0

and it will report a "recommended" connectable address like

tcp:host=10.0.0.1,port=51423

but clients that try to connect to tcp:host=10.11.12.13,port=51423 would also connect successfully?

::: doc/dbus-specification.xml
@@ +3128,5 @@
> +           <entry>(string)</entry>
> +           <entry>hostname to bind to, which will override the "host" option
> +            specifying what address to bind to, without changing the address
> +            reported by the bus. The bind option can also take a special name
> +            '*' to cause the bus to listen on all local address (INADDR_ANY).

Is the special treatment of "*" something that is hard-coded in libdbus, or is it a quirk of the OS resolver?

If it's hard-coded in libdbus, fine.

If it's an OS resolver feature ("getent hosts '*'" happens to return "0.0.0.0" on that platform), we shouldn't document or recommend it.
Comment 6 Simon McVittie 2013-12-04 13:05:49 UTC
Comment on attachment 90214 [details] [review]
[PATCH 3/3] DBus-daemon(1): clarify hostname of bind to avoid  confusing

Review of attachment 90214 [details] [review]:
-----------------------------------------------------------------

::: doc/dbus-daemon.1.xml.in
@@ +396,5 @@
>  the host option specifying what address to bind to, without changing
>  the address reported by the bus. The bind option can also take a
>  special name '*' to cause the bus to listen on all local address
> +(INADDR_ANY). The specified hostname of bind should be a valid
> +name of the local machine or it will fail.</para>

As in my review of the previous patch, I think the emphasis should be on IP addresses: the value for "bind" is either 0.0.0.0 to listen on all addresses, or one of the machine's IP addresses (typically 127.0.0.1 to listen on the loopback interface), or a hostname (or maybe use "DNS name" if you prefer to avoid the word "host" here) that will resolve to one of the machine's addresses.
Comment 7 Chengwei Yang 2013-12-06 04:58:45 UTC
(In reply to comment #4)
> Comment on attachment 90212 [details] [review] [review]
> [PATCH 1/3] DBus Spec: fix format a little
> 
> Review of attachment 90212 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> If you're changing the whitespace at all, I'd prefer 2 spaces per indent,
> which is as close as the D-Bus spec gets to consistency.

I was trying to find a tool to format dbus-specification.xml, however, xmllint and tidy doesn't only just do indent, which also change the other part I do not expected.

So I'd like to left the indent problem but replace '\t' with 8 spaces and another issue I found with tidy is four double quotes (") isn't in english format, here is (“”)
Comment 8 Chengwei Yang 2013-12-06 05:07:54 UTC
(In reply to comment #5)
> Comment on attachment 90213 [details] [review] [review]
> [PATCH 2/3] DBus Spec: add document of bind for tcp/nonce-tcp  transport
> 
> Review of attachment 90213 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> I think a better way to express this might be to merge my patch defining
> listenable/connectable addresses, and say something like this:

Sure, I remember I did r+ on that patch?

> 
> bind (string)
> The IP address of one of the local machine's interfaces (most commonly
> <literal>127.0.0.1</literal>), or a DNS name that resolves to one of those
> IP addresses, or <literal>0.0.0.0</literal> to listen on all interfaces
> simultaneously. If not specified, the default is the same value as "host".
> 
> I assume the purpose here is that if you're doing remote TCP on a machine
> with addresses 10.0.0.1 and 10.11.12.13, you can tell the dbus-daemon to
> listen on
> 
> tcp:host=10.0.0.1,bind=0.0.0.0
> 
> and it will report a "recommended" connectable address like
> 
> tcp:host=10.0.0.1,port=51423
> 
> but clients that try to connect to tcp:host=10.11.12.13,port=51423 would
> also connect successfully?

Didn't test in real environment, but I think this is correct, giving that it's the same as a system with a loopback address and a local NIC setup.

> 
> ::: doc/dbus-specification.xml
> @@ +3128,5 @@
> > +           <entry>(string)</entry>
> > +           <entry>hostname to bind to, which will override the "host" option
> > +            specifying what address to bind to, without changing the address
> > +            reported by the bus. The bind option can also take a special name
> > +            '*' to cause the bus to listen on all local address (INADDR_ANY).
> 
> Is the special treatment of "*" something that is hard-coded in libdbus, or
> is it a quirk of the OS resolver?

For key "bind", it's hard-coded in libdbus, so I think we should document it in DBus Spec, in a way prefer to 0.0.0.0

> 
> If it's hard-coded in libdbus, fine.
> 
> If it's an OS resolver feature ("getent hosts '*'" happens to return
> "0.0.0.0" on that platform), we shouldn't document or recommend it.
Comment 9 Chengwei Yang 2013-12-06 05:41:09 UTC
Created attachment 90331 [details] [review]
[PATCH v2 1/3] DBus Spec: replace tab with 8 spaces
Comment 10 Chengwei Yang 2013-12-06 05:41:38 UTC
Created attachment 90332 [details] [review]
[PATCH 2/4] DBus Spec: fix double quotes
Comment 11 Chengwei Yang 2013-12-06 05:42:22 UTC
Created attachment 90333 [details] [review]
[PATCH 3/4] DBus Spec: add document of bind for tcp/nonce-tcp  transport
Comment 12 Chengwei Yang 2013-12-06 05:42:47 UTC
Created attachment 90335 [details] [review]
[PATCH 4/4] dbus-daemon(1): align document about "bind" with DBus  Spec
Comment 13 Simon McVittie 2013-12-06 13:13:12 UTC
Comment on attachment 90332 [details] [review]
[PATCH 2/4] DBus Spec: fix double quotes

Review of attachment 90332 [details] [review]:
-----------------------------------------------------------------

r-, no need for this. U+201C LEFT DOUBLE QUOTATION MARK and U+201D RIGHT DOUBLE QUOTATION MARK are correct English (formally, more correct than U+0022 QUOTATION MARK), and are fine to use for anything that isn't special syntax (e.g. U+0022 is the only non-misleading quote mark for C/C++ string syntax).

They're also annoying to type (Shift+AltGr (Compose), Shift+2 ("), Shift+Comma (<) on my UK X11 keyboard layout), so people who aren't pedantic about Unicode don't usually bother :-)
Comment 14 Simon McVittie 2013-12-06 13:14:15 UTC
Comment on attachment 90331 [details] [review]
[PATCH v2 1/3] DBus Spec: replace tab with 8 spaces

Review of attachment 90331 [details] [review]:
-----------------------------------------------------------------

This is OK to a point, although it does break "git blame" and similar tools.
Comment 15 Simon McVittie 2013-12-06 13:17:10 UTC
Comment on attachment 90333 [details] [review]
[PATCH 3/4] DBus Spec: add document of bind for tcp/nonce-tcp  transport

Review of attachment 90333 [details] [review]:
-----------------------------------------------------------------

::: doc/dbus-specification.xml
@@ +3125,5 @@
>            </row>
>            <row>
> +           <entry>bind</entry>
> +           <entry>(string)</entry>
> +           <entry>The IP address of one of the local machine's interfaces

You don't actually say what it *does* here. :-)

Perhaps something like this?

Used in a listenable address to configure the interface
on which the server will listen: either the IP address
of [... the rest of what you said ...]

@@ +3205,5 @@
>            </row>
>            <row>
> +           <entry>bind</entry>
> +           <entry>(string)</entry>
> +           <entry>The IP address of one of the local machine's interfaces

How about just saying "the same as for tcp: addresses" for nonce-tcp: addresses?

(There's not enough context in the diff to tell which is which - I'm assuming tcp: comes first.)
Comment 16 Simon McVittie 2013-12-06 13:17:54 UTC
Comment on attachment 90335 [details] [review]
[PATCH 4/4] dbus-daemon(1): align document about "bind" with DBus  Spec

Review of attachment 90335 [details] [review]:
-----------------------------------------------------------------

::: doc/dbus-daemon.1.xml.in
@@ +392,4 @@
>  <para>Example: &lt;listen&gt;tcp:host=localhost,port=0&lt;/listen&gt;</para>
>  
>  
> +<para>tcp/nonce-tcp addresses also allow a bind=hostname option,

Again, you're saying this is allowed but haven't actually said what it does.
Comment 17 Chengwei Yang 2013-12-10 02:15:46 UTC
Created attachment 90546 [details] [review]
[PATCH v2 2/3] DBus Spec: add document of bind for tcp/nonce-tcp  transport
Comment 18 Chengwei Yang 2013-12-10 02:16:20 UTC
Created attachment 90547 [details] [review]
[PATCH v2 3/3] dbus-daemon(1): align document about "bind" with DBus  Spec
Comment 19 Simon McVittie 2014-01-06 16:31:27 UTC
Fixed in git for 1.7.10, thanks


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.