[IPV6]: Do not change protocol for raw IPv6 sockets.
authorDenis V. Lunev <den@openvz.org>
Wed, 4 Jun 2008 11:49:06 +0000 (15:49 +0400)
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Wed, 4 Jun 2008 19:02:37 +0000 (04:02 +0900)
It is not allowed to change underlying protocol for
   int fd = socket(PF_INET6, SOCK_RAW, IPPROTO_UDP);

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
net/ipv6/ipv6_sockglue.c

index 3eef8e5b3636ef1ba4d80d455619555dbbaa6109..1afe210d62861a295af673fcc0e3bad1d925a553 100644 (file)
@@ -161,6 +161,9 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
                        struct ipv6_txoptions *opt;
                        struct sk_buff *pktopt;
 
+                       if (sk->sk_type == SOCK_RAW)
+                               break;
+
                        if (sk->sk_protocol != IPPROTO_UDP &&
                            sk->sk_protocol != IPPROTO_UDPLITE &&
                            sk->sk_protocol != IPPROTO_TCP)