Subject: amanda-dev-client broken on 64bit sparc platforms
To: None <>
From: Gert Doering <>
List: tech-pkg
Date: 12/04/2003 19:57:34

Setup: NetBSD 1.6.2_RC1 on Sparc64, 
       using amanda-dev from the most recent pkgsrc CVS 

The amanda server works on netbsd/sparc64 (mostly) fine - there are some
issues with disk size calculation, but overall, it works well.

The client (amandad) just refused to work.  This is unchanged since many
months.  The problem shows in the amandad debug file as this:

amandad: dgram_send_addr: sendto( failed: Address family not supported by protocol family

Nobody else seemed to be affected by it, so nobody fixed it :-) - thus I
started some debugging and hacking today, and found the problem.  In the
"amanda-dev-common" package, the file common-src/dgram.c contains the
code sequence (dgram_recv(), about line 250):

    size_t addrlen;
    addrlen = sizeof(struct sockaddr_in);
    size = recvfrom(sock, dgram->data, MAX_DGRAM, 0,
                    (struct sockaddr *)fromaddr, &addrlen);

on sparc64, size_t is a 64bit long.  recvfrom() expects a "socklen_t * "
as 6th argument, which is 32bit (unsigned int).  

So recvfrom() always finds a "0" in the high word, and never returns 
address data in "fromaddr".

Changing the declaration to

    socklen_t addrlen;

fixed the problem (unsurprisingly), and amandad works.

I'd send a patch, but I'm confused about the way the pkgsrc structure 
works for amanda-dev (amanda-dev-client, -server, -common, etc.
interacting) so I'd rather ask someone who understands this to 
verify and integrate this one-line change.

USENET is *not* the non-clickable part of WWW!
Gert Doering - Munich, Germany                   
fax: +49-89-35655025