Skip to content

Commit

Permalink
ipv6: Set mcast_hops to IPV6_DEFAULT_MCASTHOPS when -1 was given.
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Li Wei <lw@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Li Wei authored and David S. Miller committed Nov 28, 2011
1 parent 5cac98d commit 2a38e6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv6/ipv6_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
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;

Expand Down

0 comments on commit 2a38e6d

Please sign in to comment.