Skip to contentSkip to conversation

IPv6:Check IPV6_MULTICAST_LOOP option value

RFC PATCH In review Shan Wei 2 participants 2 messages Jun 10, 2008

Subsystems (3)
lore
Share & tools
lore

Shan Wei

author
#0 lore raw

RFC PATCH 2/3 IPv6:Check IPV6_MULTICAST_LOOP option value

RFC3493 says, IPV6_MULTICAST_LOOP option can only be set with o or 1. when other valuse are set, the kernel should return an error of EINVAL.

In addition, the option should not be uesd by SOCK_STREAM type, same as IPV6_MULTICAST_IF, IPV6_MULTICAST_HOPS.

But the kernel doesn't check them.

---
 net/ipv6/ipv6_sockglue.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
net/ipv6/ipv6_sockglue.c +4 -0
index 26b83e5..3b45def 100644
@@ -456,8 +456,12 @@ done:
 		break;
 
 	case IPV6_MULTICAST_LOOP:
+		if (sk->sk_type == SOCK_STREAM)
+			goto e_inval;
 		if (optlen < sizeof(int))
 			goto e_inval;
+		if (val > 1 || val < 0)
+			goto e_inval;
 		np->mc_loop = valbool;
 		retv = 0;
 		break;
#1 lore raw

In article <[email protected]> (at Tue, 10 Jun 2008 15:51:19 +0800), Shan Wei <[email protected]> says:

Quoted 7 lines

RFC3493 says, IPV6_MULTICAST_LOOP option can only be set with o or 1. when other valuse are set, the kernel should return an error of EINVAL.

In addition, the option should not be uesd by SOCK_STREAM type, same as IPV6_MULTICAST_IF, IPV6_MULTICAST_HOPS.

But the kernel doesn't check them.

I'm goint to queue this with litle change.
Thanks.

--yoshfuji