From: Radek =?ISO-8859-1?Q?Vok=E1l?= Date: Mon, 31 Oct 2005 10:08:32 +0000 Subject: Re: [LARTC] ip tunnel doesn't show warning or error Message-Id: <1130753312.3368.30.camel@localhost.localdomain> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============0165710884==" List-Id: References: <1130745593.3368.24.camel@localhost.localdomain> In-Reply-To: <1130745593.3368.24.camel@localhost.localdomain> To: lartc@vger.kernel.org --===============0165710884== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-WUlilTi8b72udd4cbqnp" --=-WUlilTi8b72udd4cbqnp Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, 2005-10-31 at 08:59 +0100, Radek Vok=C3=A1l wrote: > This is really strange behavior ..=20 >=20 > root@garfield ~# ip tunnel add testing123 mode ipip remote 192.168.1.1 > local 192.168.1.12 > root@garfield ~# ip tunnel show > .. > testing123: ip/ip remote 192.168.1.1 local 192.168.1.12 ttl inherit > root@garfield ~# ip tunnel add testingabc mode ipip remote 192.168.1.1 > local 192.168.1.12 > root@garfield ~# echo $? > 0 > root@garfield ~# ip tunnel show > .. > testing123: ip/ip remote 192.168.1.1 local 192.168.1.12 ttl inherit >=20 > I guess the second tunnel add should end up with an error, but ioctl > doesn't report anything on this ..=20 >=20 Here's small patch to show at least some warning --- iproute2-051007/ip/iptunnel.c.old 2005-02-10 19:31:18.000000000 +0100 +++ iproute2-051007/ip/iptunnel.c 2005-10-31 11:03:04.000000000 +0100 @@ -130,7 +130,8 @@ static int do_add_ioctl(int cmd, const c struct ifreq ifr; int fd; int err; - + char old_name[IFNAMSIZ]; + strncpy(old_name,p->name,IFNAMSIZ); if (cmd =3D=3D SIOCCHGTUNNEL && p->name[0]) strncpy(ifr.ifr_name, p->name, IFNAMSIZ); else @@ -138,6 +139,10 @@ static int do_add_ioctl(int cmd, const c ifr.ifr_ifru.ifru_data =3D (void*)p; fd =3D socket(AF_INET, SOCK_DGRAM, 0); err =3D ioctl(fd, cmd, &ifr); + if (strncmp(ifr.ifr_data,old_name,IFNAMSIZ)) { + fprintf(stderr,"Warning: Tunnel already exists (% s)\n",ifr.ifr_data); + } if (err) perror("ioctl"); close(fd); --=20 Radek Vok=C3=A1l --=-WUlilTi8b72udd4cbqnp Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBDZe0gpPtjDwJDWJMRAltFAJ0fleXPRVte8RlhBBZSiP5mrEJ4vgCg4gGz A+isCaZzgHREcqFORwSjTjI= =f26l -----END PGP SIGNATURE----- --=-WUlilTi8b72udd4cbqnp-- --===============0165710884== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc --===============0165710884==--