Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xrootd refuses to start if hostname begins with a number #159

Closed
wangd opened this issue Nov 12, 2014 · 3 comments
Closed

xrootd refuses to start if hostname begins with a number #159

wangd opened this issue Nov 12, 2014 · 3 comments
Assignees

Comments

@wangd
Copy link

wangd commented Nov 12, 2014

We are experimenting with running xrootd in a docker container, and have found that xrootd dislikes hostnames that begin with numerical digits. Inside the docker container, the hostname is configured as a (seemingly random) hexadecimal sequence, which began with the digit '3' in our instance. This triggered an error on xrootd startup: XrdConfig: unable to determine host name.

Going deeper, in src/Xrd/XrdConfig.cc:372, we see a call to new XrdNetAddr((int)0). The constructor for XrdNetAddr calls gethostname, then XrdNetAddr::Set, where the problem is triggered. On src/XrdNet/XrdNetAddr.cc:227, we see else if (*hSpec >= '0' && *hSpec <= '9'), which is used to detect whether the hostname is in a colon-hex or dotted decimal format. If true, inet_pton is called, passing the input address hSpec. inet_pton assumes that its input is in one of the two formats, or it returns 0. In this case, hSpec is filled by gethostname, which returns the generated hexadecimal hostname.

The correct behavior is probably to use a more sophisticated means of detecting the format of hSpec, so such hostnames can be passed to the last else branch.

@abh3
Copy link
Member

abh3 commented Nov 12, 2014

XRootD follows RFC 952 for host name conventions. RFC 952 specifically states

" A "name" (Net, Host, Gateway, or Domain name) is a text string up
to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus
sign (-), and period (.). Note that periods are only allowed when
they serve to delimit components of "domain style names". (See
RFC-921, "Domain Name System Implementation Schedule", for
background). No blank or space characters are permitted as part of a
name. No distinction is made between upper and lower case. The first
character must be an alpha character. "

Hence, the host name you provided is invalid if it starts with a non-alpha character. The full RFC can be found here: http://tools.ietf.org/html/rfc952

@abh3 abh3 closed this as completed Nov 12, 2014
@wangd
Copy link
Author

wangd commented Nov 12, 2014

Digits have been allowed as starting characters since 1989. Are you saying that xrootd rejects the relaxed restrictions indicated in RFC-1123? Please see section 2.1:

      The syntax of a legal Internet host name was specified in RFC-952
      [DNS:4].  One aspect of host name syntax is hereby changed: the
      restriction on the first character is relaxed to allow either a
      letter or a digit.  Host software MUST support this more liberal
      syntax.

      Host software MUST handle host names of up to 63 characters and
      SHOULD handle host names of up to 255 characters.

Full text: https://tools.ietf.org/html/rfc1123

@abh3
Copy link
Member

abh3 commented Nov 12, 2014

Alright, we missed RFC 1123 that relaxed the requirement. So, it's back on the fix list, sigh.

@abh3 abh3 reopened this Nov 12, 2014
@abh3 abh3 self-assigned this Nov 12, 2014
@abh3 abh3 closed this as completed in 06f2838 Sep 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants