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 <[EMAIL PROTECTED]>

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
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to