gethostbyname / resolv.conf

I have in mind that question was asked before, but I can’t remember.

We are currently using TCPIP5.0 and we have a tcp-server application
answering some request by clients. The QNX nodes are properly setup in
/etc/hosts like
192.168.75.71 QNX01
192.168.75.72 QNX02
192.168.75.73 QNX03
192.168.75.74 QNX04
192.168.75.75 QNX05

The client connects to the server by calling gethostbyname(“QNX05”) and it
works.
Now we want to have access to the internet as well.
So we added a default route with ‘route add 0.0.0.0 gateway’ and configured
the resolv.conf like
nameserver serverip1
nameserver serverip2
lookup file bind <— this should look for names first in /etc/hosts and
second using the nameservers.

Now the problem starts: gethostbyname(“QNX05”) is not able to connect to
server anymore.
nslookup QNX05 shows that /etc/hosts ist ignored and QNX05 can not be
resolved by a nameserver (correct: I would wonder if so).
nslookup www.qnx.com works correct.

Why is gethostbyname not working ?
(We tried with the dot notation instead of the name and this worked, i.e.
gethostbyname(“192.168.75.75”)).
ping works for both, i. e.ping QNX05 is correct.

Do i have a configuration problem ?
Please help

Michael Liebig <ml@solquest.de> wrote:

Now we want to have access to the internet as well.
So we added a default route with ‘route add 0.0.0.0 gateway’ and configured
the resolv.conf like
nameserver serverip1
nameserver serverip2
lookup file bind <— this should look for names first in /etc/hosts and
second using the nameservers.

Try putting the “lookup file bind” first in the resolv.conf file.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

I did before, same result …

“David Gibbs” <dagibbs@qnx.com> schrieb im Newsbeitrag
news:ad048v$6bs$1@nntp.qnx.com

Michael Liebig <> ml@solquest.de> > wrote:
Now we want to have access to the internet as well.
So we added a default route with ‘route add 0.0.0.0 gateway’ and
configured
the resolv.conf like
nameserver serverip1
nameserver serverip2
lookup file bind <— this should look for names first in /etc/hosts and
second using the nameservers.

Try putting the “lookup file bind” first in the resolv.conf file.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

thought this is a known issue, am surprised tcpip5 hasn’t fixed it.
frank

Michael Liebig <ml@solquest.de> wrote:

I did before, same result …

“David Gibbs” <> dagibbs@qnx.com> > schrieb im Newsbeitrag
news:ad048v$6bs$> 1@nntp.qnx.com> …
Michael Liebig <> ml@solquest.de> > wrote:
Now we want to have access to the internet as well.
So we added a default route with ‘route add 0.0.0.0 gateway’ and
configured
the resolv.conf like
nameserver serverip1
nameserver serverip2
lookup file bind <— this should look for names first in /etc/hosts and
second using the nameservers.

Try putting the “lookup file bind” first in the resolv.conf file.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Sorry guys, i was wrong. It is correct that we use Tcpip5.0. But not the
Tcpip5.0 toolkit, because we always got error messages saying some data
types (like int8_t, uint8_t, etc.) are not definded. Even the making of the
the example code in /usr/demo/src/socket shows the same effect. Is anyone
using the version 5.0 Toolkit? What am i missing here ?

<fliu@bb.vipstage.com> schrieb im Newsbeitrag
news:ad0fo0$n05$1@inn.qnx.com

thought this is a known issue, am surprised tcpip5 hasn’t fixed it.
frank

Michael Liebig <> ml@solquest.de> > wrote:
I did before, same result …

“David Gibbs” <> dagibbs@qnx.com> > schrieb im Newsbeitrag
news:ad048v$6bs$> 1@nntp.qnx.com> …
Michael Liebig <> ml@solquest.de> > wrote:
Now we want to have access to the internet as well.
So we added a default route with ‘route add 0.0.0.0 gateway’ and
configured
the resolv.conf like
nameserver serverip1
nameserver serverip2
lookup file bind <— this should look for names first in /etc/hosts
and
second using the nameservers.

Try putting the “lookup file bind” first in the resolv.conf file.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Michael Liebig <ml@solquest.de> wrote:

Sorry guys, i was wrong. It is correct that we use Tcpip5.0. But not the
Tcpip5.0 toolkit, because we always got error messages saying some data
types (like int8_t, uint8_t, etc.) are not definded. Even the making of the
the example code in /usr/demo/src/socket shows the same effect. Is anyone
using the version 5.0 Toolkit? What am i missing here ?

just tried it:
cd /usr/demo/src/socket
make clean
make
all compiles fine.

something is probably serously wrong for your installation.

frank

fliu@bb.vipstage.com> > schrieb im Newsbeitrag
news:ad0fo0$n05$> 1@inn.qnx.com> …
thought this is a known issue, am surprised tcpip5 hasn’t fixed it.
frank

Michael Liebig <> ml@solquest.de> > wrote:
I did before, same result …

“David Gibbs” <> dagibbs@qnx.com> > schrieb im Newsbeitrag
news:ad048v$6bs$> 1@nntp.qnx.com> …
Michael Liebig <> ml@solquest.de> > wrote:
Now we want to have access to the internet as well.
So we added a default route with ‘route add 0.0.0.0 gateway’ and
configured
the resolv.conf like
nameserver serverip1
nameserver serverip2
lookup file bind <— this should look for names first in /etc/hosts
and
second using the nameservers.

Try putting the “lookup file bind” first in the resolv.conf file.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

“Michael Liebig” <ml@solquest.de> wrote in message
news:ad2r87$gtb$1@inn.qnx.com

Sorry guys, i was wrong. It is correct that we use Tcpip5.0. But not the
Tcpip5.0 toolkit, because we always got error messages saying some data
types (like int8_t, uint8_t, etc.) are not definded. Even the making of
the
the example code in /usr/demo/src/socket shows the same effect. Is anyone
using the version 5.0 Toolkit? What am i missing here ?

uint8_t, uint16_t and uint32_t are defined in /usr/include/inttypes.h
afair this header was added in 4.25 toolkit in some patch. but maybe i’m
wrong and it was added in 5.x toolkit.

// wbr

Michael Liebig <ml@solquest.de> wrote:

Sorry guys, i was wrong. It is correct that we use Tcpip5.0. But not the
Tcpip5.0 toolkit, because we always got error messages saying some data
types (like int8_t, uint8_t, etc.) are not definded. Even the making of the
the example code in /usr/demo/src/socket shows the same effect. Is anyone
using the version 5.0 Toolkit? What am i missing here ?

I spent some time and did some experiments. I can actually
reproduce your problem, by NOT following the tcpip5 installation
instructions.

At this point, if you still need help, please let me know and I do
provide consulting service.

Frank

Ok, thanks to all. Found the problem:

/usr/include/inttypes.h is linked to
/usr/watcom/10.6/usr/sys/include/types.h

I did not install the Watcom C Compiler Patch B. In this patch the types.h
was changed. So i compiled all my application stuff successfully against
Tcpip5.0,

but: same error: gethostbyname still returns NULL if i have a default route
added and lookup file bind in my resolv.conf.
Any ideas?

<fliu@bb.vipstage.com> schrieb im Newsbeitrag
news:ad4cmd$kkt$1@inn.qnx.com

Michael Liebig <> ml@solquest.de> > wrote:
Sorry guys, i was wrong. It is correct that we use Tcpip5.0. But not the
Tcpip5.0 toolkit, because we always got error messages saying some data
types (like int8_t, uint8_t, etc.) are not definded. Even the making of
the
the example code in /usr/demo/src/socket shows the same effect. Is
anyone
using the version 5.0 Toolkit? What am i missing here ?

I spent some time and did some experiments. I can actually
reproduce your problem, by NOT following the tcpip5 installation
instructions.

At this point, if you still need help, please let me know and I do
provide consulting service.

Frank

Michael Liebig <ml@solquest.de> wrote:

but: same error: gethostbyname still returns NULL if i have a default route
added and lookup file bind in my resolv.conf.
Any ideas?

hm, apparently you didn’t read my first post in this thread about
the bug :slight_smile:
the fix should be simple but I will leave it to qssl to comment.

Frank