ws2_32: Use the routing table information for gethostbyname('self') if the magic IP would otherwise be returned.

Erich Hoover ehoover at mines.edu
Sun Oct 11 19:24:30 CDT 2009


On Sun, Oct 11, 2009 at 6:01 PM, Vitaliy Margolen
<wine-devel at kievinfo.com>wrote:

> Kai Blin wrote:
> > On Saturday 10 October 2009 22:52:48 Vitaliy Margolen wrote:
> >
> >>> Changelog:
> >>>     ws2_32: Use the routing table information for
> >>> gethostbyname('self') if the magic IP would otherwise be returned.
> >> Thanks for the patch, however there are few issues with it.
> >>
> >> Why do you return a list of IP addresses from WS2_get_local_ips if you
> need
> >> only one? Just get the one with the lowest metric and return it.
> >>
> >> I think it would be better
> >
> > That's not what Windows does, though. Windows returns the full list.
> >
> Got you, then what the patch does is still can be improved.
>
> Since patch using WS2_get_local_ips() in one place only return something
> you
> can just pass directly to the app, not something that needs duplicating and
> then freeing.
>

When I was first testing that's actually what I coded this routine to do,
but the documentation indicates that the hostent returned by gethostbyname
is not supposed to be freed by the application.  I assumed that part of the
purpose of the WS_dup_he was to unify returning hostents so that (at some
point down the line) the old memory allocated for them could be freed when
there's a new call.

Erich Hoover
ehoover at mines.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20091011/3d89233c/attachment.htm>


More information about the wine-devel mailing list