× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Based on your reply, it sounds like this is a FAQ, so I apologize for
posting it.

Yeah, here it is in the Midrange.com FAQ: http://faq.midrange.com/index.pl?file=59

Here's a related discussion from earlier in the week:
http://archive.midrange.com/midrange-l/200508/threads.html#01506

Here's the discussion from August 16th (started by Dwayne Allison) where the same thing was asked (note that you participated in this discussion!)
http://archive.midrange.com/midrange-l/200508/threads.html#00833

Here's my description of why I wouldn't use DNS to solve the problem, from August 17th:
http://archive.midrange.com/midrange-l/200508/msg00936.html

And that's just within the past month on this particular mailing list :) So, yeah, it's a FAQ. :)

But, I don't mind you posting it again, it's obviously that it's something that people don't understand, so I thought I'd give a more verbose answer this time.


Since the tool could be running in shops with many iSeries and the
WebService consumer (i.e. Tivoli) needs to differentiate between different
iSeries somehow, CBE needs to have the IP tag field populated by our tool.
Based on these requirements, I'd say it falls under "auditing and like"
definition from your post (i.e. system management and tracking).

I agree.


I realize that iSeries can have many network interfaces, but we can't put them all in, only one. I looked at your code and it looks like you're using ioctl calls to get info on each interface. This seems like the "right" approach, but how do we pick one of the interfaces? Is there a naming convention for the Ethernet line interfaces? I think that's the one we'd want, right? I mean what would be the point of putting loopback or dial-up interface address? Ethernet lines are more likely to be used in their internal LAN.

Yep, that's the problem... and I think you're probably approaching it the best way that you can. gethostname() is the right API to find out what the system operator considers the "canonical name" of the system. The IP address that it corresponds to SHOULD be the "One True IP Address" of the system.

Unfortunately, there are a lot of scenarios where this won't work.

The most obvious -- a situation where they've set up an internal network that doesn't use domain names. They do everything directly by IP address -- in that situation, there won't be a domain name to look up to get the IP address.

Or, they may have a bogus hostname set up for their system. Very little relies on the host name that's configured under CHGTCPDMN, so it may not be correct. In this case, gethostname() will return something, but gethostbyname() may fail, or worse, if they used the name of another computer, it may give you wrong information.

Of course, the fix is relatively simple... just tell whomever is installing the software that they have to have a valid hostname set up with CHGTCPDMN and that it should resolve to the IP address. If not, tell them to change their host name search priority to *LOCAL and put the host in the hosts table.

But, that's the problem with th gethostname/gethostbyname solution, it relies on the user to have their system configured properly, and to be using DNS. Unfortunately, it's probably your best option. It's the way that Sendmail does it, if that means anything to you.

Other than that, all you can really do is have a configuration option where the system operator tells you which interface to extract the info from.

Presently, we have gethostname-gethostbyname-inet_ntoa working in our
development environment by selecting first element of the h_addr_list array,
but as you say, what are the guarantees of it working in all environments.
I don't know how likely they're to have hosts table or DNS setup. I'd think
if they're running something like Tivoli, they'd need something like that,
wouldn't they?

I know absolutely nothing about Tivoli. I'm not even sure what it is. I've been to Tivoli Gardens in Italy, but I don't think that's what you mean :)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.