[PATCH 2/2] inet6: Set default traffic class

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Gerrit Renker
Date: Sunday, August 9, 2009 - 11:12 am

This patch addresses:
 * assigning -1 to np->tclass as it is currently done is not very meaningful,
   since it turns into 0xff;
 * RFC 3542, 6.5 allows -1 for clearing the sticky IPV6_TCLASS option
   and specifies -1 to mean "use kernel default":
   - RFC 2460, 7. requires that the default traffic class must be zero for
     all 8 bits,
   - this is consistent with RFC 2474, 4.1 which recommends a default PHB of 0,
     in combination with a value of the ECN field of "non-ECT" (RFC 3168, 5.).

This patch changes the meaning of -1 from assigning 255 to mean the RFC 2460
default, which at the same time allows to satisfy clearing the sticky TCLASS
option as per RFC 3542, 6.5.

(When passing -1 as ancillary data, the fallback remains np->tclass, which
 has either been set via socket options, or contains the default value.)

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
 net/ipv6/ipv6_sockglue.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -315,6 +315,9 @@ static int do_ipv6_setsockopt(struct soc
 			goto e_inval;
 		if (val < -1 || val > 0xff)
 			goto e_inval;
+		/* RFC 3542, 6.5: default traffic class of 0x0 */
+		if (val == -1)
+			val = 0;
 		np->tclass = val;
 		retv = 0;
 		break;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[Resent][PATCH 1/2] inet6: Conversion from u8 to int, Gerrit Renker, (Sun Aug 9, 11:12 am)
[PATCH 2/2] inet6: Set default traffic class, Gerrit Renker, (Sun Aug 9, 11:12 am)
Re: [Resent][PATCH 1/2] inet6: Conversion from u8 to int, =?iso-8859-1?q?R=E9m ..., (Sun Aug 9, 11:33 pm)
Re: [Resent][PATCH 1/2] inet6: Conversion from u8 to int, ext Gerrit Renker, (Mon Aug 10, 12:08 am)