Ticket #800 (closed defect: fixed)
Change in IP address selection algorithm (the pj_gethostip() function)
|Reported by:||bennylp||Owned by:||bennylp|
|Backport to 1.x milestone:||Backported:|
Currently the pj_gethostip() function gets the IP address from the following algorithm:
- get the IP of the hostname
- if IP is not usable, get the default interface
- if failed, get the first interface
- if failed, return loopback address
Note: failed or not-usable means the query failed or the returned IP address is loopback IP or other non-usable IP.
One of the problem with above approach is sometimes a "good" IP address is returned from the step 1, but the IP is not usable (for example, the interface is down).
A better solution perhaps is to list all the addresses above, give them some weight, and return the one with the "best" value.