Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Feb 2003 18:38:41 -0500
From:      Will Andrews <will@csociety.org>
To:        amanda-hackers@amanda.org
Cc:        sparc@freebsd.org
Subject:   [PATCH] Amanda is not 64-bit clean
Message-ID:  <200302191838.54706.will@csociety.org>

next in thread | raw e-mail | index | archive | help

--Boundary-03=_OWBV+agpiyL9td9
Content-Type: multipart/mixed;
  boundary="Boundary-01=_BWBV+8k6KRFb4j9"
Content-Transfer-Encoding: 7bit
Content-Description: signed data
Content-Disposition: inline

--Boundary-01=_BWBV+8k6KRFb4j9
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Description: body text
Content-Disposition: inline

Hi,

I have a FreeBSD/sparc64 (a standard Sun Blade 100) machine here. =20
I have installed Amanda 2.4.3 (from FreeBSD ports) as a client. =20
However, every time I run "amcheck -c" on the server, I get this=20
on the client:

[note: output below includes patches I made to=20
client-src/amandad.c and common-src/dgram.c for debugging=20
purposes -- I don't think there is a reason to post those.]

amandad: time 0.001: got packet from 0.0.0.0:
=2D-------
Amanda 2.4 REQ HANDLE 002-80380708 SEQ 1045640462
SECURITY USER amanda
SERVICE noop
OPTIONS features=3Dfffffeff9f00;
=2D-------

amandad: time 0.002: sending ack:
=2D---
Amanda 2.4 ACK HANDLE 002-80380708 SEQ 1045640462
=2D---

DSA: sendack()
amandad: dgram_send_addr: dst ip: 0.0.0.0
amandad: time 0.002: dgram_send_addr: sendto(0.0.0.0.0) failed:=20
Address family not supported by protocol family=20
DSA: sendack()
amandad: time 5.128: sending REP packet:
=2D---
Amanda 2.4 REP HANDLE 002-80380708 SEQ 1045640462
ERROR [addr 0.0.0.0: hostname lookup failed]
[..snipped for brevity..]

Trawling the source finds that this line is probably responsible=20
for the obviously bogus IP (common-src/dgram.c:dgram_recv()):

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

When one compiles Amanda with -Wall, it prints this message:

cc -DHAVE_CONFIG_H -I. -I. -I../config -I./../regex-src    -O=20
=2Dpipe  -Wall   -c `test -f dgram.c || echo './'`dgram.c
dgram.c: In function `dgram_recv':
dgram.c:292: warning: passing arg 6 of `recvfrom' from=20
incompatible pointer type

The attached patch fixes this problem by correctly describing=20
'addrlen' as a 'socklen_t'.  Not sure how portable that is, but=20
this is what's described in the man page, and it appears to be=20
used similarly on Solaris and Linux (but not in recvfrom()).

Patch attached to fix this problem.  Better patches solicited, if=20
any.  This one works great on my Blade 100 running FreeBSD.

Regards,
=2D-=20
wca (aka will@freebsd.org||andrewsw@purdue.edu)

--Boundary-01=_BWBV+8k6KRFb4j9
Content-Type: text/x-diff;
  charset="us-ascii";
  name="amanda-client-dgram.c.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="amanda-client-dgram.c.diff"

=2D-- common-src/dgram.c	Mon Apr  1 11:07:15 2002
+++ common-src/dgram.c.new	Wed Feb 19 17:54:03 2003
@@ -245,7 +245,7 @@
     struct timeval to;
     ssize_t size;
     int sock;
=2D    size_t addrlen;
+    socklen_t addrlen;
     int nfound;
     int save_errno;
=20

--Boundary-01=_BWBV+8k6KRFb4j9--

--Boundary-03=_OWBV+agpiyL9td9
Content-Type: application/pgp-signature
Content-Description: signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQA+VBWOF47idPgWcsURAr7mAKCMSYgHnTjyycMTYRhbN+X4bv+8HwCdGZw5
GeUY7hlVt5+NRxlCK1wK4YM=
=zP80
-----END PGP SIGNATURE-----

--Boundary-03=_OWBV+agpiyL9td9--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-sparc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302191838.54706.will>