]> Pileus Git - ~andy/linux/commitdiff
[NET]: Fix IP_ADD/DROP_MEMBERSHIP to handle only connectionless
authorFlavio Leitner <fleitner@redhat.com>
Sat, 25 Aug 2007 05:16:39 +0000 (22:16 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 27 Aug 2007 01:35:35 +0000 (18:35 -0700)
Fix IP[V6]_ADD_MEMBERSHIP and IP[V6]_DROP_MEMBERSHIP to
return -EPROTO for connection oriented sockets.

Signed-off-by: Flavio Leitner <fleitner@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_sockglue.c
net/ipv6/ipv6_sockglue.c

index 4d544573f48adb373e9553141702250a350e3f4e..6b420aedcdcf55a5578eed3a07c4f54f4ffdb7fd 100644 (file)
@@ -625,6 +625,10 @@ static int do_ip_setsockopt(struct sock *sk, int level,
        {
                struct ip_mreqn mreq;
 
+               err = -EPROTO;
+               if (inet_sk(sk)->is_icsk)
+                       break;
+
                if (optlen < sizeof(struct ip_mreq))
                        goto e_inval;
                err = -EFAULT;
index 761a910f4f9717754cdb3d6280bda31de43bb125..6b038aa72e88b51fe77554bc4cab65af072ef2e8 100644 (file)
@@ -554,6 +554,10 @@ done:
        {
                struct ipv6_mreq mreq;
 
+               retv = -EPROTO;
+               if (inet_sk(sk)->is_icsk)
+                       break;
+
                retv = -EFAULT;
                if (copy_from_user(&mreq, optval, sizeof(struct ipv6_mreq)))
                        break;