One question about getaddrinfo invoked in _dbus_listen_tcp_socket

Thiago Macieira thiago at kde.org
Fri Sep 30 16:29:28 UTC 2016


On sexta-feira, 30 de setembro de 2016 09:58:02 PDT Elvis Qin wrote:
> First of all, don't use TCP.
> 
> <Elvis>
> For different machine I need use TCP.

You do need TCP, but then you shouldn't use D-Bus. Don't use D-Bus over TCP: 
it has no encryption, no authentication, so anyone can connect and pretend to 
be anyone else.

If you need RPC across a network, please find another solution besides D-Bus 
over TCP.

> Second, please read up on the recent case of exploit on Jeep cars. Hint: it
> was caused by dbus-daemon used on TCP.
> 
> Third, 123456 is not a valid port number. That's probably why getaddrinfo
> is failing.
> 
> <Elvis>
> 
> This port 123456 is just one example. I Know getaddrinfo ai_flags usage for
> network socket.

You should choose a valid port for your example.

> You know
> 
> Uclibc define this 2 flags
> 
> # define AI_PASSIVE     0x0001  /* Socket address is intended for `bind'.
> */
> 
> # define AI_ADDRCONFIG  0x0020  /* Use configuration of this host to
> choose returned
> address type..  */
> 
> 
> 
> My concern, this file you already define *AI_ADDRCONFIG = 0 not Linux
> standard in dbus-sysdeps-unix.c source code line 98.*

That's not what the code is.

#ifndef AI_ADDRCONFIG
#define AI_ADDRCONFIG 0
#endif


> *hints.ai_flags = AI_ADDRCONFIG | AI_PASSIVE;   ==== > actually if
> AL_ADDRCONFIG is not 0x0020 but 0, this ai_flags still is AI_PASSIVE.*

No, it isn't.

> *By the way, suppose if all the linux interface is not UP maybe not
> created at all. I think this getaddrinfo MUST failed with EAI_NONAME =
> -2.*

I have never tested in that condition. It's possible.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center



More information about the dbus mailing list