Re: problem mounting two servers


Subject: Re: problem mounting two servers
From: Thomas Kaiser (Thomas.Kaiser@phg-online.de)
Date: Mon Sep 10 2001 - 17:25:44 EDT


On Mon, 10 Sep 2001 15:31:00 -0400 (EDT), charlie wood wrote:

> First, I checked the hexadecimal host ID on both servers with the command:
>
> hostid
>
> ...they were identical, which indicated that I was on to the problem.

I did some quick research:

With AFP 2.2 the FPGetSrvrInfo command has been changed. Now it supports a
serveršs unique identifier: 16 byte ServerSignature ("a 16-byte number that
uniquely identifies the server" -- page 50, AFP Specs Version 2.1/2.2 -->
http://developer.apple.com/techpubs/macos8/pdf/ASAppleTalkFiling2.1_2.2.pdf)

ASun has implemented this in netatalk-1.4b2+asun-2.0a7 (take a look at
<http://www.umich.edu/~rsug/netatalk/archive/admins/1997/0070.html>)

It would be interesting whether afpd creates this Server Signature from
hostid's output, the first entry in the hosts file or from somewhere else?

If I compare the sources of 1.4b2+asun-2.1.3 and 1.5pre7 it seems the
relevant lines in etc/afpd/status.c haven't changed:

|  /* 16-byte signature consists of copies of the hostid */
| #if defined(BSD4_4) && defined(USE_GETHOSTID)
|  mib[0] = CTL_KERN;
|  mib[1] = KERN_HOSTID;
|  len = sizeof(hostid);
|  sysctl(mib, 2, &hostid, &len, NULL, 0);
| #else /* BSD4_4 && USE_GETHOSTID */
|  hostid = gethostid();
| #endif /* BSD4_4 && USE_GETHOSTID */
|  if (!hostid) {
|  if (dsi)
|  hostid = dsi->server.sin_addr.s_addr;
|  else {
|  struct hostent *host;

|  if ((host = gethostbyname(hostname)))
|  hostid = ((struct in_addr *) host->h_addr)->s_addr;
|  }
|  }

|  /* it turns out that a server signature screws up separate
|  * servers running on the same machine. to work around that,
|  * i add in an increment */
|  hostid += id;
|  id++;
|  for (i = 0; i < 16; i += sizeof(hostid)) {
|  memcpy(data, &hostid, sizeof(hostid));
|  data += sizeof(hostid);
|  }

I'm not a programmer, so I'm not sure, when hostid will be used and when
'gethostbyname'. Any help appreceated.

Regards,

Thomas



This archive was generated by hypermail 2b28 : Sun Oct 14 2001 - 03:04:52 EDT