Re: [g-a-devel]gnopernicus network code ...



On Thu, 2002-09-05 at 15:30, Michael Meeks wrote:

>     h = gethostbyname(brlip);
...

> 	But 
> 
> struct sockaddr_in remote_braille_addr;
> 
> 	In linc we turn on IPv6 resolution if we can, and it's not a good idea
> to turn it off. The h->h_length will then be a 16 bytes, and the
> h_addr_list[0] member a struct sockaddr_in6 - so you start scribbling
> all over addresses nearby.

Also, in trying to track down a seemingly-myseterious failure of
brlmonitor on my system, which depended on whether gnopernicus was run
as root, I have discovered a general issue with "gethostbyname()".

It would appear that gethostbyname is not reliable in the IPv6
environment, and as Michael infers, if linc (used by gnome) is being
used in an IPv6 context it appears to break subsequent calls to
gethostbyname() which use IP addresses rather than hostnames.  

The gethostbyname() man pages don't warn you about this but looking at
posts to some other mailing lists about this, the short answer appears
to be "don't use gethostbyname() with IPv4 addresses in an IPv6
environment".  So I think the best answer will either involve removing
calls to gethostbyname() from gnopernicus, or making sure
gethostbyname() is not called with numeric IP addresses, but only with
hostnames.

Since this will take some effort anyway, perhaps this would be a good
time as Michael suggests to take advantage of some 'linc' API which
should handle the various protocol issues more transparently, and might
be less work than hand-coding the various cases into the braille I/O
code.

Otherwise you might find the article on converting IPv4 apps to IPv6 at
the following URI useful:
http://www-106.ibm.com/developerworks/web/library/wa-ipv6.html?dwzone=web

Note that the problem with gethostbyname() is not explicitly called out
in this article, it assumes you are calling it with a "name" argument
rather than an IPv4-style address.

best regards,

Bill




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]