Open Bug 461543 Opened 16 years ago Updated 2 years ago

Add a function that returns the IP addresses of the local host

Categories

(NSPR :: NSPR, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: wtc, Unassigned)

Details

Many people have asked in the NSPR newsgroup how to get the IP addresses (note the plural) of the local host. We should add a function that returns this information. Without this function, they have to resort to calling PR_GetSystemInfo to get the local hostname, and then calling PR_GetHostByName to get the IP addresses of the local hostname. The proper way is to call the BSD function getifaddrs or its equivalent on other platforms. There is some code along that line in prnetdb.c: http://mxr.mozilla.org/nspr/source/nsprpub/pr/src/misc/prnetdb.c#201 This function should have flags to filter out adddresses that are not useful in some scenarios, such as the loopback addresses and the IPv6 link local addresses.
Assignee: wtc → nspr
If this method is to be added to NSPR, it should work on all supported NSPR platforms, and it should return all the IP addresses (plural).
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.