diff options
author | Remi Denis-Courmont <rdenis@simphalempin.com> | 2006-09-13 23:08:07 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-18 02:21:08 -0400 |
commit | d0ee011f7290b51974e4d058cf4455a5ef91177d (patch) | |
tree | acbf283e13a48a242ac255b88d0db4a68d122d0c /net | |
parent | e012d51cbc41c5e603d7850c82acb0dad9e450dd (diff) |
[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 'net')
-rw-r--r-- | net/ipv6/datagram.c | 2 | ||||
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 99a6eb23378b..3b55b4c8e2d1 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -696,7 +696,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, | |||
696 | } | 696 | } |
697 | 697 | ||
698 | tc = *(int *)CMSG_DATA(cmsg); | 698 | tc = *(int *)CMSG_DATA(cmsg); |
699 | if (tc < 0 || tc > 0xff) | 699 | if (tc < -1 || tc > 0xff) |
700 | goto exit_f; | 700 | goto exit_f; |
701 | 701 | ||
702 | err = 0; | 702 | err = 0; |
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, | |||
362 | break; | 362 | break; |
363 | 363 | ||
364 | case IPV6_TCLASS: | 364 | case IPV6_TCLASS: |
365 | if (val < 0 || val > 0xff) | 365 | if (val < -1 || val > 0xff) |
366 | goto e_inval; | 366 | goto e_inval; |
367 | np->tclass = val; | 367 | np->tclass = val; |
368 | retv = 0; | 368 | retv = 0; |
@@ -947,6 +947,8 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
947 | 947 | ||
948 | case IPV6_TCLASS: | 948 | case IPV6_TCLASS: |
949 | val = np->tclass; | 949 | val = np->tclass; |
950 | if (val < 0) | ||
951 | val = 0; | ||
950 | break; | 952 | break; |
951 | 953 | ||
952 | case IPV6_RECVTCLASS: | 954 | case IPV6_RECVTCLASS: |