Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - bug: hostname: (7 Items)
   
bug: hostname  
Hello

Hostname must be FQDN.
If I set hostname in FQDN, some subsystems (qnet) are not working
RE: hostname  
re: hostname

qnet uses (and changes) _CS_HOSTNAME and _CS_DOMAIN - see confstr()

If _CS_DOMAIN is not set, qnet will set it to be "net.intra"
and if _CS_HOSTNAME is not set, qnet will manufacture a
unique ASCII string based upon the 24 bits of the ethernet 
mac address which might look like "EA632C16".

--
aboyd
Re: RE: hostname  
> 
> re: hostname
> 
> qnet uses (and changes) _CS_HOSTNAME and _CS_DOMAIN - see confstr()
> 
> If _CS_DOMAIN is not set, qnet will set it to be "net.intra"
> and if _CS_HOSTNAME is not set, qnet will manufacture a
> unique ASCII string based upon the 24 bits of the ethernet 
> mac address which might look like "EA632C16".
> 
> --
> aboyd


if _CS_DOMAIN set example.org and _CS_HOSTNAME set qnx.example.org (FQDN), qnet uses qnx.example.org.example.org
RE: RE: hostname  
> if _CS_DOMAIN set example.org and 
> _CS_HOSTNAME set qnx.example.org (FQDN), 
> qnet uses qnx.example.org.example.org

Right - looking at the qnet source, I'm 
pretty sure that you're going to have to 
setconf _CS_HOSTNAME with the hostname, and 
setconf _CS_DOMAIN with the domain.

If you're being passed a FQDN then I think
you are going to have to parse it into the 
separate pieces.  I might suggest using
the strchr() library function call like this:

void parse_fqdn(char *fqdn)
{
    char *hostname, *domain;

    domain = strchr(fqdn,".");
    domain[0] = 0;  // overwrite dot after hostname
    domain++;
 
    hostname=fqdn;

    confstr(_CS_SET | _CS_HOSTNAME, hostname);
    confstr(_CS_SET | _CS_DOMAIN, domain);
}

a strdup of the fqdn would be a nice touch.

Typing this in, I feel a touch of nostalgia - 
this is like an interview question, fresh
out of school  :-)

P.S.  (threadjack warning) I have a MUCH better 
interview question!

--
aboyd
Re: RE: RE: hostname  
No, no, no.

_CS_HOSTNAME should be fqdn!

$ getconf _CS_HOSTNAME                 
qnx.example.org
$ getconf _CS_DOMAIN                
example.org
$ uname -a
QNX qnx.example.org 6.4.1 2009/05/20-17:35:56EDT x86pc x86
$ hostname 
qnx.example.org
$ hostname -s
qnx
$ sloginfo | grep example.org
Aug 06 13:09:06    7    15     0 qnet(QOS): nd_change_notify(): Node Up:   nd 0 qnx.example.org.example.org
Aug 06 13:09:06    7    15     0 qnet(L4): lr_verify_my_name_and_domain(): starting resolution of our hostname qnx.
example.org.example.org to ensure unique

where the error occurred?
Re: RE: RE: hostname  
From some quick web searches, it appears that the behaviour of hostname is system specific with regards to FQDN.  See, 
for example, this posting

http://www.unixguide.net/network/socketfaq/2.24.shtml


   R.
RE: RE: RE: hostname  
Thx Rob.  I am reluctanct to create a PR for this
because I am still unsure that our current behaviour
is incorrect.

--
aboyd