Skip to contentSkip to conversation

Accept -1 for IPV6_TCLASS

PATCH In review Rémi Denis-Courmont 2 participants 2 messages Sep 3, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Accept -1 for IPV6_TCLASS

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.

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:

Signature · 5 lines
Rémi Denis-Courmont
http://www.remlab.net/

-- 
VGER BF report: U 0.93636
#1 lore raw

In article <[email protected]> (at Sun, 3 Sep 2006 10:28:30 +0300), Rémi Denis-Courmont <[email protected]> says:

Quoted 6 lines

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.

--yoshfuji

Signature · 1 line
VGER BF report: S 1