summaryrefslogtreecommitdiffstats
path: root/net/ipv6/ipv6_sockglue.c
diff options
context:
space:
mode:
authorRemi Denis-Courmont <rdenis@simphalempin.com>2006-09-14 05:08:07 +0200
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-18 08:21:08 +0200
commitd0ee011f7290b51974e4d058cf4455a5ef91177d (patch)
treeacbf283e13a48a242ac255b88d0db4a68d122d0c /net/ipv6/ipv6_sockglue.c
parent[IPV6]: Fix tclass setting for raw sockets. (diff)
downloadlinux-d0ee011f7290b51974e4d058cf4455a5ef91177d.tar.xz
linux-d0ee011f7290b51974e4d058cf4455a5ef91177d.zip
[IPV6]: Accept -1 for IPV6_TCLASS
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--net/ipv6/ipv6_sockglue.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 43327264e69c..a5eaaf693abf 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -362,7 +362,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
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 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
case IPV6_TCLASS:
val = np->tclass;
+ if (val < 0)
+ val = 0;
break;
case IPV6_RECVTCLASS: