From owner-freebsd-hackers Tue Aug 29 22:11:42 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.uni-bielefeld.de (mail2.uni-bielefeld.de [129.70.4.90]) by hub.freebsd.org (Postfix) with ESMTP id 2CCAC37B42C for ; Tue, 29 Aug 2000 22:11:34 -0700 (PDT) Received: from frolic.no-support.loc (ppp36-335.hrz.uni-bielefeld.de [129.70.37.79]) by mail.uni-bielefeld.de (Sun Internet Mail Server sims.4.0.2000.05.17.04.13.p6) with ESMTP id <0G03002I0AF684@mail.uni-bielefeld.de> for freebsd-hackers@FreeBSD.ORG; Wed, 30 Aug 2000 07:11:32 +0200 (MET DST) Received: (from bjoern@localhost) by frolic.no-support.loc (8.9.3/8.9.3) id FAA03945; Wed, 30 Aug 2000 05:30:00 +0200 (CEST envelope-from bjoern) Date: Wed, 30 Aug 2000 05:30:00 +0200 From: Bjoern Fischer Subject: Re: socket option IP_MULTICAST_LOOP has no effect? In-reply-to: ; from vmukkama@gmu.edu on Tue, Aug 29, 2000 at 03:56:25PM -0400 To: Vinod Mukkamala Cc: freebsd-hackers@FreeBSD.ORG Message-id: <20000830052959.C873@frolic.no-support.loc> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-disposition: inline Content-transfer-encoding: quoted-printable User-Agent: Mutt/1.2.4i References: Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Aug 29, 2000 at 03:56:25PM -0400, Vinod Mukkamala wrote: > For some reason setsockopt function takes in the a address of a char > as the 4th argument only. [code example typos corrected] >=20 > int tmp =3D 0; // to disable loop back > setsockopt(s, > IPPROTO_IP, > IP_MULTICAST_LOOP, > (char *)&tmp, > sizeof(tmp)); >=20 > and it didn't work...=20 >=20 > but=20 >=20 > char tmp =3D 0; // to disable loop back > setsockopt(s, > IPPROTO_IP, > IP_MULTICAST_LOOP, > (char *)&tmp, > sizeof(tmp)); >=20 > works perfectly fine.=20 Thank you a lot for your help, I will try this as soon as possible, but there's something weird: case IP_MULTICAST_LOOP: /* * Set the loopback flag for outgoing multicast packets. * Must be zero or one. The original multicast API required a * char argument, which is inconsistent with the rest * of the socket API. We allow either a char or an int. */ if (sopt->sopt_valsize =3D=3D 1) { u_char loop; error =3D sooptcopyin(sopt, &loop, 1, 1); if (error) break; imo->imo_multicast_loop =3D !!loop; } else { u_int loop; error =3D sooptcopyin(sopt, &loop, sizeof loop, sizeof loop); if (error) break; imo->imo_multicast_loop =3D !!loop; } break; This piece of code is out of FreeBSD 4-STABLE's kernel source. As you see it should deal with both: ints *and* chars. The code seems to be correct, so I wonder why it's not working with ints. Bj=F6rn Fischer --=20 -----BEGIN GEEK CODE BLOCK----- GCS d--(+) s++: a- C+++(-) UB++++OSI++++$ P+++(-) L---(++) !E W- N+ o>+ K- !w !O !M !V PS++ PE- PGP++ t+++ !5 X++ tv- b+++ D++ G e+ h-- y+=20 ------END GEEK CODE BLOCK------ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message