Re: Compile/install fails for V2.02

Matthias Bethke <[email protected]> Tue, 9 Sep 2003 16:34:37 +0800
Newsgroups gmane.network.freeswan.user,gmane.network.freeswan.devel
Message-ID <[email protected]>
--jq0ap7NbKX2Kqbes
Content-Type: multipart/mixed; boundary="tKW2IUtsqtDRztdT"
Content-Disposition: inline

--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Sam,
on Tuesday, 2003-09-09 at 01:35:35, you wrote:
> > However, I found several warnings that
> > had to do with potential signed/unsigned problems (which is by far the
> > majority of all warnings I get compiling a kernel BTW), such as the
> > typical int loop counter being compared to a size_t. I wonder what kind
> > of Linux system this does *not* throw a warning on!? RedHat, apparently?
>=20
> Yes. I do not get those errors when compiling 2.02 for any recent Redhat=
=20
> kernel (7, 8, or 9) or for 2.4.22 on a RedHat system. It's got to do with=
 GCC=20
> 3.3:
>=20
> http://lists.freeswan.org/pipermail/users/2003-May/020729.html

Yuck! I had noticed once that they packaged a prerelease compiler with
the distro, but had forgotten about it already. Even more because this
didn't look like a compiler problem to me at all.=20
Well, downgrading the compiler doesn't look unproblematic either, judging
from the posts, so I think I'll give the 3.3.1 release a try.

> However, given some other posts on Design, I thought we might have adjust=
ed=20
> spi.c to stop this. Can you post a full transcript of these warnings to=
=20
> [email protected]? If fixable, if would be nice to have it so for=
=20
> 2.03.

It's only a handful of places, and I have just compiled a diff to the
plain 2.02 version. Maybe this will do it already, but at least it shows
where warnings come up.

> Incidentally, I know that, many people use Kurt Garloff's SuSE RPMs:
>=20
> http://www.suse.de/~garloff/linux/FreeSWAN/

Thanks for the link, I'll give them a try! I tried SuSE's packages
first, but as their kernel module comes as source only and already gave
me some problems compiling it, I thought I might as well get the
complete source for the latest version. But then there's the various
patches that I haven't applied to the source yet...

> In the 2.x series,=20
>=20
> interfaces=3D%defaultroute
>=20
> is assumed.=20

Ah...I seem to remember seeing something about this in the docs, but as
I hadn't come so far yet...
I just configured a connection, and at least this side seems to be
working fine. Haven't gotten the wireless client installed yet though.

> > [default route] Maybe one should configure the whole thing
> > before starting it, instead of the other way round like the installation
> > guide says?=20
>=20
> Most machines do have a default route, so in this case, the intent is to =
get=20
> FreeS/WAN up and running so that the ipsec verify checks work. However,=
=20
> you've got a good point; without being able to use %defaultroute, you'll =
get=20
> a patch of errors and a report that pluto isn't running.=20

Maybe it should just be mentioned in the installation guide that if
there is moaning about %defaultroute, you should just add one for
testing.
Or something along the lines of

if test `ip route | awk '{print $1;}' | grep default`; then
	echo "Warning: no default route, adding dummy"
	route add default lo
	DELETEROUTELATER=3D1
fi

in one of the setup scripts.

> > I've never seen /sbin/consoletype before, is this a Redhatism? Anyway,
> > it's nothing serious.=20
>=20
> I believe it is (the man page reports RedHat, Inc). It's only used to tes=
t for=20
> whether we should emit the answers in glorious ANSI color.

If it doesn't do anything more magic than checking $TERM, maybe an
explicit check like in `dircolors' would do:

case "$TERM" in
	linux|linux-c|mach-color|console|con132x25|con132x30|con132x43|con132x60|c=
on80x25|con80x28|con80x30|con80x43|con80x50|con80x60|dtterm|xterm|xterm-col=
or|xterm-debian|rxvt|screen|screen-w|vt100|Eterm)
	# we have color
	;;
	*)
	# we don't :(
	;;
esac

> Thank you for the informative report! The testing team has been smacked f=
or=20
> letting the "Checking for RSA private key" error(s) sneak through. Fixes =
have=20
> already been committed, and will appear in the next snapshot.

Thanks a lot for the fast reply!

kind regards
	Matthias


--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="FreeSWAN-2.0.2-warnings.diff"
Content-Transfer-Encoding: quoted-printable

*** ./programs/eroute/eroute.c	Thu Jan 30 10:33:07 2003
--- ../freeswan-2.02-patch/./programs/eroute/eroute.c	Tue Sep  9 14:59:11 2=
003
***************
*** 651,657 ****
  	if((error =3D write(pfkey_sock,
  			  pfkey_msg,
  			  pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)) !=3D
! 	   pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN) {
  		fprintf(stderr, "%s: pfkey write failed, returning %d with errno=3D%d.\=
n",
  			program_name, error, errno);
  		pfkey_extensions_free(extensions);
--- 651,657 ----
  	if((error =3D write(pfkey_sock,
  			  pfkey_msg,
  			  pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)) !=3D
! 	   (ssize_t)(pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)) {
  		fprintf(stderr, "%s: pfkey write failed, returning %d with errno=3D%d.\=
n",
  			program_name, error, errno);
  		pfkey_extensions_free(extensions);
*** ./programs/klipsdebug/klipsdebug.c	Thu Jan 30 10:33:07 2003
--- ../freeswan-2.02-patch/./programs/klipsdebug/klipsdebug.c	Tue Sep  9 15=
:00:47 2003
***************
*** 374,380 ****
  	if((error =3D write(pfkey_sock,
  			  pfkey_msg,
  			  pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)) !=3D
! 	   pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN) {
  		fprintf(stderr,
  			"%s: pfkey write failed, tried to write %u octets, returning %d with e=
rrno=3D%d.\n",
  			program_name,
--- 374,380 ----
  	if((error =3D write(pfkey_sock,
  			  pfkey_msg,
  			  pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)) !=3D
! 	   (ssize_t)(pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)) {
  		fprintf(stderr,
  			"%s: pfkey write failed, tried to write %u octets, returning %d with e=
rrno=3D%d.\n",
  			program_name,
*** ./programs/pf_key/pf_key.c	Wed Oct  9 11:12:05 2002
--- ../freeswan-2.02-patch/./programs/pf_key/pf_key.c	Tue Sep  9 15:03:07 2=
003
***************
*** 88,94 ****
  	}
  	if(write(pfkey_sock, pfkey_msg,
  		 pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN) !=3D
! 	   pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN) {
  		/* cleanup code here */
  		fprintf(stderr, "%s: Trouble writing to channel PF_KEY.\n", progname);
  		pfkey_extensions_free(extensions);
--- 88,94 ----
  	}
  	if(write(pfkey_sock, pfkey_msg,
  		 pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN) !=3D
! 	   (ssize_t)(pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)) {
  		/* cleanup code here */
  		fprintf(stderr, "%s: Trouble writing to channel PF_KEY.\n", progname);
  		pfkey_extensions_free(extensions);
***************
*** 113,119 ****
  main(int argc, char *argv[])
  {
  	int opt;
! 	int readlen;
  	unsigned char pfkey_buf[256];
  	struct sadb_msg *msg;
  	int fork_after_register;
--- 113,119 ----
  main(int argc, char *argv[])
  {
  	int opt;
! 	ssize_t readlen;
  	unsigned char pfkey_buf[256];
  	struct sadb_msg *msg;
  	int fork_after_register;
***************
*** 227,233 ****
  		msg =3D (struct sadb_msg *)pfkey_buf;
=20=20=09=09
  		/* first, see if we got enough for an sadb_msg */
! 		if(readlen < sizeof(struct sadb_msg)) {
  			printf("%s: runt packet of size: %d (<%lu)\n",
  			       progname, readlen, (unsigned long)sizeof(struct sadb_msg));
  			continue;
--- 227,233 ----
  		msg =3D (struct sadb_msg *)pfkey_buf;
=20=20=09=09
  		/* first, see if we got enough for an sadb_msg */
! 		if((size_t)readlen < sizeof(struct sadb_msg)) {
  			printf("%s: runt packet of size: %d (<%lu)\n",
  			       progname, readlen, (unsigned long)sizeof(struct sadb_msg));
  			continue;
***************
*** 245,251 ****
  		       msg->sadb_msg_satype,
  		       satype2name(msg->sadb_msg_satype));
=20=20=09=09
! 		if(readlen !=3D msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)
  		{
  			printf("%s: packet size read from socket=3D%d doesn't equal sadb_msg_l=
en %d * %u; message not decoded\n",
  			       progname,
--- 245,251 ----
  		       msg->sadb_msg_satype,
  		       satype2name(msg->sadb_msg_satype));
=20=20=09=09
! 		if((size_t)readlen !=3D msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)
  		{
  			printf("%s: packet size read from socket=3D%d doesn't equal sadb_msg_l=
en %d * %u; message not decoded\n",
  			       progname,
*** ./programs/rsasigkey/rsasigkey.c	Fri Jun  6 12:19:32 2003
--- ../freeswan-2.02-patch/./programs/rsasigkey/rsasigkey.c	Tue Sep  9 15:0=
5:15 2003
***************
*** 395,402 ****
  	}
=20=20
  	len =3D mpz_sizeinbase(var, 2);
! 	assert(len =3D=3D nbits || len =3D=3D nbits+1);
! 	if (len =3D=3D nbits+1) {
  		report("carry out occurred (!), retrying...");
  		mpz_clear(var);
  		initprime(var, nbits, eval);
--- 395,402 ----
  	}
=20=20
  	len =3D mpz_sizeinbase(var, 2);
! 	assert(len =3D=3D (size_t)nbits || len =3D=3D (size_t)(nbits+1));
! 	if (len =3D=3D (size_t)(nbits+1)) {
  		report("carry out occurred (!), retrying...");
  		mpz_clear(var);
  		initprime(var, nbits, eval);
*** ./programs/spi/spi.c	Sun Jun  8 00:42:10 2003
--- ../freeswan-2.02-patch/./programs/spi/spi.c	Tue Sep  9 14:57:12 2003
***************
*** 1471,1477 ****
  			pfkey_msg =3D (struct sadb_msg *)pfkey_buf;
=20=20=09=09=09
  			/* first, see if we got enough for an sadb_msg */
! 			if(readlen < sizeof(struct sadb_msg)) {
  				if(debug) {
  					printf("%s: runt packet of size: %ld (<%lu)\n",
  					       program_name, (long)readlen, (unsigned long)sizeof(struct sad=
b_msg));
--- 1471,1477 ----
  			pfkey_msg =3D (struct sadb_msg *)pfkey_buf;
=20=20=09=09=09
  			/* first, see if we got enough for an sadb_msg */
! 			if((size_t)readlen < sizeof(struct sadb_msg)) {
  				if(debug) {
  					printf("%s: runt packet of size: %ld (<%lu)\n",
  					       program_name, (long)readlen, (unsigned long)sizeof(struct sad=
b_msg));
*** ./programs/spigrp/spigrp.c	Thu Jan 30 10:33:07 2003
--- ../freeswan-2.02-patch/./programs/spigrp/spigrp.c	Tue Sep  9 14:59:40 2=
003
***************
*** 428,434 ****
  		if((error =3D write(pfkey_sock,
  				  pfkey_msg,
  				  pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)) !=3D
! 		   pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN) {
  			fprintf(stderr, "%s: pfkey write failed, returning %d with errno=3D%d.=
\n",
  				program_name, error, errno);
  			pfkey_extensions_free(extensions);
--- 428,434 ----
  		if((error =3D write(pfkey_sock,
  				  pfkey_msg,
  				  pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)) !=3D
! 		   (ssize_t)(pfkey_msg->sadb_msg_len * IPSEC_PFKEYv2_ALIGN)) {
  			fprintf(stderr, "%s: pfkey write failed, returning %d with errno=3D%d.=
\n",
  				program_name, error, errno);
  			pfkey_extensions_free(extensions);

--tKW2IUtsqtDRztdT--

--jq0ap7NbKX2Kqbes
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iQEVAwUBP12Qna/BjwuQz4OJAQGrOgf5AZYljSmmmjdhTtA+MvmO0fzC9PCKKvTx
hAI5cR82ZKe+UI1MESy7k7rwQisXmISzUA1gGpsqsUwny+nodT3E5jeiVUocbNjl
8DdrM4xaCSTEe+CvcY6Gzu9DqhUAuq9HAyjdm6mr7InyEFc4bKLnSJuPFHm7e3Yw
knowWld595y0wIJaVpudDn7f+H71OeU0gLuSbiQbD+iOxr0kTIKD0q+GhEBlAJpx
NdPuZCVTY7Xl6/ksee4tVdalaqywciPFQpcH3JWm7Y2fAFMY7bqyT2L2NtruLzwT
b3HE/Bn6Ip8IkZGgsiJCPvuFw6VK/XpN2ocwJD1lBICCeP5FYCvZaw==
=YQG/
-----END PGP SIGNATURE-----

--jq0ap7NbKX2Kqbes--