ipv6: Check IPV6_MULTICAST_LOOP option value.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Wed, 11 Jun 2008 18:14:51 +0000 (03:14 +0900)
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Thu, 12 Jun 2008 00:19:09 +0000 (09:19 +0900)
Only 0 and 1 are valid for IPV6_MULTICAST_LOOP socket option,
and we should return an error of EINVAL otherwise, per RFC3493.

Based on patch from Shan Wei <shanwei@cn.fujitsu.com>.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
net/ipv6/ipv6_sockglue.c

index ce794d6acb708a4d78765e00a039a0b27a3bc7b5..9a3697172d5e47c966eaf7c5bd05e80f365101f9 100644 (file)
@@ -458,6 +458,8 @@ done:
        case IPV6_MULTICAST_LOOP:
                if (optlen < sizeof(int))
                        goto e_inval;
+               if (val != valbool)
+                       goto e_inval;
                np->mc_loop = valbool;
                retv = 0;
                break;