Revising this one after quite some time, I looked at the code and the $HN(...) variable is supposed to work with `gethostname()`, being related to hostname value.
The proposed change to use `gethostbyname()` in the result from `gethostname()` is changing the purpose, because I thing there can be situations when the dns result has something else in the `h->h_name` than the value of local hostname.
@lazedo: so maybe we should look at what you actually need to get, instead of changing the behaviour of $HN().
Is it the full domain based on local IP? For what you need it (only for logs or use in sip uri, ...)?
Maybe a new var or field to this var has to be added.