Subject: amanda-dev-client broken on 64bit sparc platforms
To: None <tech-pkg@netbsd.org>
From: Gert Doering <gert@greenie.muc.de>
List: tech-pkg
Date: 12/04/2003 19:57:34
Hi,

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(0.0.0.0.0) 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.

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert@greenie.muc.de
fax: +49-89-35655025                        gert@net.informatik.tu-muenchen.de