Skip to contentSkip to conversation

ipv6: Set mcast_hops to IPV6_DEFAULT_MCASTHOPS when -1 was given.

PATCH Applied Li Wei 2 participants 2 messages Nov 28, 2011

Subsystems (3)
lore
Share & tools
lore

Li Wei

author
#0 lore raw

PATCH 1/1 ipv6: Set mcast_hops to IPV6_DEFAULT_MCASTHOPS when -1 was given.

We need to set np->mcast_hops to it's default value at this moment otherwise when we use it and found it's value is -1, the logic to get default hop limit doesn't take multicast into account and will return wrong hop limit(IPV6_DEFAULT_HOPLIMIT) which is for unicast.

---
 net/ipv6/ipv6_sockglue.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv6/ipv6_sockglue.c +1 -1
index c99e3ee..26cb08c 100644
@@ -503,7 +503,7 @@ done:
 			goto e_inval;
 		if (val > 255 || val < -1)
 			goto e_inval;
-		np->mcast_hops = val;
+		np->mcast_hops = (val == -1 ? IPV6_DEFAULT_MCASTHOPS : val);
 		retv = 0;
 		break;
 
Signature · 1 line
1.7.3.2
maintainer Applied
#1 lore raw

From: Li Wei <[email protected]>
Date: Mon, 28 Nov 2011 15:33:34 +0800

Quoted 6 lines

We need to set np->mcast_hops to it's default value at this moment otherwise when we use it and found it's value is -1, the logic to get default hop limit doesn't take multicast into account and will return wrong hop limit(IPV6_DEFAULT_HOPLIMIT) which is for unicast.

Applied, thank you.