From owner-freebsd-net Fri Oct 8 9:12:48 1999 Delivered-To: freebsd-net@freebsd.org Received: from nimitz.ca.sandia.gov (nimitz.ca.sandia.gov [146.246.243.56]) by hub.freebsd.org (Postfix) with ESMTP id 37C2114FC2 for ; Fri, 8 Oct 1999 09:12:41 -0700 (PDT) (envelope-from bmah@nimitz.ca.sandia.gov) Received: (from bmah@localhost) by nimitz.ca.sandia.gov (8.9.3/8.9.3) id JAA71227; Fri, 8 Oct 1999 09:12:18 -0700 (PDT) Message-Id: <199910081612.JAA71227@nimitz.ca.sandia.gov> X-Mailer: exmh version 2.1.0 09/18/1999 To: Wim Livens Cc: freebsd-net@FreeBSD.ORG Subject: Re: IP_TOS on raw socket In-Reply-To: Your message of "Fri, 08 Oct 1999 16:09:55 +0200." <19991008160955.A1671@rc.bel.alcatel.be> From: bmah@CA.Sandia.GOV (Bruce A. Mah) Reply-To: bmah@CA.Sandia.GOV X-Face: g~c`.{#4q0"(V*b#g[i~rXgm*w;:nMfz%_RZLma)UgGN&=j`5vXoU^@n5v4:OO)c["!w)nD/!!~e4Sj7LiT'6*wZ83454H""lb{CC%T37O!!'S$S&D}sem7I[A 2V%N&+ X-Url: http://www.ca.sandia.gov/~bmah/ Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==_Exmh_-167196902P"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit Date: Fri, 08 Oct 1999 09:12:18 -0700 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --==_Exmh_-167196902P Content-Type: text/plain; charset=us-ascii If memory serves me right, Wim Livens wrote: > I've noticed that the IP_TOS socket option doesn't work on raw > sockets. There is no error returned and the TOS is stored in the > protocol control block but when the packet headers are constructed, a > hardcoded zero is put (instead of inp->inp_ip_tos). > > Is there any specific reason for this or is this a bug ? I don't know the answer to this question, but it does seem a little odd. TCP/IP Illustrated Volume 2 [1] has no comment on this issue (p. 1056): The TOS is set to 0 and the TTL to 255....[this] differs from UDP and TCP where the process had the capabillity of setting the IP_TTL and IP_TOS socket options. While I was looking through rip_output I noticed something else odd...it seems that if the user process tries to send a larger-than-MTU raw packet, rip_output seems to generate an error, rather than allow a fragment to be generated. This sounds like an attempt at better security, but I'm curious about this also. I used IP_HDRINCL when I needed to tweak the TOS and TTL bytes for raw packets (mostly because some older OSs didn't allow one to actually set them via setsockopt) so you might keep that in mind if portability is an issue. However, see cautions documented on p. 657 of UNIX Network Programming (second edition), Volume 1 about byte-ordering of fields in the IP packet. Bruce. [1] RIP WRS --==_Exmh_-167196902P Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 5.0i for non-commercial use MessageID: RhV1Rni9kgq76vyHrTF3bbxd+73khube iQA/AwUBN/4X4tjKMXFboFLDEQJO5gCg2qqAPfb0RMn+MkkUYRjVx1UV+wQAoNcv 4ZhIcsoqikNahtoU1iWIn2PM =8dem -----END PGP SIGNATURE----- --==_Exmh_-167196902P-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message