Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Oct 1999 09:12:18 -0700
From:      bmah@CA.Sandia.GOV (Bruce A. Mah)
To:        Wim Livens <livensw@rc.bel.alcatel.be>
Cc:        freebsd-net@FreeBSD.ORG
Subject:   Re: IP_TOS on raw socket 
Message-ID:  <199910081612.JAA71227@nimitz.ca.sandia.gov>
In-Reply-To: Your message of "Fri, 08 Oct 1999 16:09:55 %2B0200." <19991008160955.A1671@rc.bel.alcatel.be> 

next in thread | previous in thread | raw e-mail | index | archive | help
--==_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




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