Bug 177362 - [netinet] [patch] Wrong control used to return TOS
Summary: [netinet] [patch] Wrong control used to return TOS
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.4-BETA1
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-25 04:10 UTC by marka
Modified: 2017-12-31 22:27 UTC (History)
0 users

See Also:


Attachments
file.diff (429 bytes, patch)
2013-03-25 04:10 UTC, marka
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description marka 2013-03-25 04:10:00 UTC
	TOS is return using wrong control.  It should be IP_TOS, IPPROTO_IP
	not IP_RECVTOS, IPPROTO_IP.  The latter is the flag to turn returning
	the value on or off.

	Compare with TCLASS in IPv6.  The value is returned using 
	IPPROTO_IPV6 and IPV6_TCLASS not IPPROTO_IPV6 and IPV6_RECVTCLASS.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2013-03-27 01:45:58 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

Over to maintainer(s).
Comment 2 Michael Tuexen freebsd_committer 2013-03-27 09:45:48 UTC
It was not done by accident. The returned cmsg_type is IP_RECVTOS =
instead of
IP_TOS to keep it consistent with the handling of the IP_RECVTTL socket =
option.
I found it more important to be consistent within the same protocol =
family
than across different ones.
I think that unfortunately IP_RECVTOS is not defined in any standard.

Best regards
Michael=
Comment 3 marka 2013-03-27 11:54:06 UTC
In message <25EB2335-645C-42ED-B90A-6D07A33280DB@freebsd.org>, Michael Tuexen w
rites:
> It was not done by accident. The returned cmsg_type is IP_RECVTOS instead 
> of IP_TOS to keep it consistent with the handling of the IP_RECVTTL socket 
> option.
> I found it more important to be consistent within the same protocol family
> than across different ones.
> I think that unfortunately IP_RECVTOS is not defined in any standard.
> 
> Best regards
> Michael

And Linux uses IP_TOS to return the value.

-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: marka@isc.org
Comment 4 Michael Tuexen freebsd_committer 2013-03-27 12:16:30 UTC
On Mar 27, 2013, at 12:54 PM, Mark Andrews wrote:

>=20
> In message <25EB2335-645C-42ED-B90A-6D07A33280DB@freebsd.org>, Michael =
Tuexen w
> rites:
>> It was not done by accident. The returned cmsg_type is IP_RECVTOS =
instead=20
>> of IP_TOS to keep it consistent with the handling of the IP_RECVTTL =
socket=20
>> option.
>> I found it more important to be consistent within the same protocol =
family
>> than across different ones.
>> I think that unfortunately IP_RECVTOS is not defined in any standard.
>>=20
>> Best regards
>> Michael
>=20
> And Linux uses IP_TOS to return the value.
... which is consistent with the IP_RECVTTL socket option on Linux, =
where it returns
a cmsg with cmsg_type IP_TTL, which is also different from how this is =
handled in
FreeBSD.

I think Solaris uses for IPv4 socket options the same cmsg_type
as the optname for the socket option to enable the reception of the =
cmsg.

So it looks like there is no standard here, Linux, FreeBSD and Solaris
are each consistent with itself, but Linux does it differently from
FreeBSD and Solaris.

Best regards
Michael
>=20
> --=20
> Mark Andrews, ISC
> 1 Seymour St., Dundas Valley, NSW 2117, Australia
> PHONE: +61 2 9871 4742                 INTERNET: marka@isc.org
>=20
Comment 5 Hiren Panchasara freebsd_committer 2013-05-07 05:42:42 UTC
State Changed
From-To: open->feedback

tuexen@ does not see a need for code change. 
Waiting for submitter feedback.
Comment 6 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:11 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped