netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Accept -1 for IPV6_TCLASS
@ 2006-09-03  7:28 Rémi Denis-Courmont
  2006-09-03 10:07 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 2+ messages in thread
From: Rémi Denis-Courmont @ 2006-09-03  7:28 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev

	Hello,

This patch should add support for -1 as "default" IPv6 traffic class, as 
specified in IETF RFC3542 §6.5. Within the kernel, it seems tclass < 0 
is already handled, but setsockopt, getsockopt and recvmsg calls won't 
accept it from userland.

Signed-off-by: Remi Denis-Courmont <rdenis@simphalempin.com>

diff -Nru linux-2.6.18-rc5-git6.orig/net/ipv6/datagram.c 
linux-2.6.18-rc5-git6/net/ipv6/datagram.c
--- linux-2.6.18-rc5-git6.orig/net/ipv6/datagram.c	2006-03-20 
07:53:29.000000000 +0200
+++ linux-2.6.18-rc5-git6/net/ipv6/datagram.c	2006-09-03 
09:42:03.000000000 +0300
@@ -696,7 +696,7 @@
 			}
 
 			tc = *(int *)CMSG_DATA(cmsg);
-			if (tc < 0 || tc > 0xff)
+			if (tc < -1 || tc > 0xff)
 				goto exit_f;
 
 			err = 0;
diff -Nru linux-2.6.18-rc5-git6.orig/net/ipv6/ipv6_sockglue.c 
linux-2.6.18-rc5-git6/net/ipv6/ipv6_sockglue.c
--- linux-2.6.18-rc5-git6.orig/net/ipv6/ipv6_sockglue.c	2006-09-03 
09:47:10.000000000 +0300
+++ linux-2.6.18-rc5-git6/net/ipv6/ipv6_sockglue.c	2006-09-03 
09:41:31.000000000 +0300
@@ -362,7 +362,7 @@
 		break;
 
 	case IPV6_TCLASS:
-		if (val < 0 || val > 0xff)
+		if (val < -1 || val > 0xff)
 			goto e_inval;
 		np->tclass = val;
 		retv = 0;
@@ -947,6 +947,8 @@
 
 	case IPV6_TCLASS:
 		val = np->tclass;
+		if (val < 0)
+			val = 0;
 		break;
 
 	case IPV6_RECVTCLASS:


-- 
Rémi Denis-Courmont
http://www.remlab.net/

-- 
VGER BF report: U 0.93636

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Accept -1 for IPV6_TCLASS
  2006-09-03  7:28 [PATCH] Accept -1 for IPV6_TCLASS Rémi Denis-Courmont
@ 2006-09-03 10:07 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 0 replies; 2+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2006-09-03 10:07 UTC (permalink / raw)
  To: davem, rdenis; +Cc: netdev, yoshfuji

In article <200609031028.31236@auguste.remlab.net> (at Sun, 3 Sep 2006 10:28:30 +0300), Rémi Denis-Courmont <rdenis@simphalempin.com> says:

> This patch should add support for -1 as "default" IPv6 traffic class, as 
> specified in IETF RFC3542 §6.5. Within the kernel, it seems tclass < 0 
> is already handled, but setsockopt, getsockopt and recvmsg calls won't 
> accept it from userland.
> 
> Signed-off-by: Remi Denis-Courmont <rdenis@simphalempin.com>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

--yoshfuji

-- 
VGER BF report: S 1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-03 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-03  7:28 [PATCH] Accept -1 for IPV6_TCLASS Rémi Denis-Courmont
2006-09-03 10:07 ` YOSHIFUJI Hideaki / 吉藤英明

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).