From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sun, 4 Aug 1996 17:00:35 -0400 From: scott@angora.cse.psu.edu scott@angora.cse.psu.edu Subject: No subject Topicbox-Message-UUID: 4a73198a-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19960804210035.sHZkwgYs9J4YveEzeEew8MD70BXTC8uCdNmWAGmQxjE@z> I've noticed that APE has some byte order problems in the bsd compatability code. The bsd interface uses network order exclusively, while the ape code sometimes assumed host order. There have already been some updates on this topic: enclosed are a few additional changes. One problem that isn't fixed is that gethostbyaddr calls gethostbyname with the ascii dotted-quad form of the network address. That's a good idea, except that the connection server only asks dns to return ip addresses, even though it returns the whole record if it came from ndb. gethostbyname could be modified to get the answer, but I think cs is a more appropriate place for it. diff inet_addr.c /n/cd/sys/src/ape/lib/bsd/inet_addr.c 50d49 < x = htonl(x); diff inet_ntoa.c /n/cd/sys/src/ape/lib/bsd/inet_ntoa.c 19c19 < x = ntohl(in.s_addr); --- > x = in.s_addr; diff gethostbyaddr.c /n/cd/sys/src/ape/lib/bsd/gethostbyaddr.c 23c23,24 < memcpy(&x.s_addr, addr, sizeof(x.s_addr)); --- > x.s_addr = (addr[0]<<24)|(addr[1]<<16)|(addr[2]<<8)|addr[3]; > diff gethostbyname.c /n/cd/sys/src/ape/lib/bsd/gethostbyname.c 98d97 < x = ntohl(x);