Skip to content

Commit

Permalink
[NET]: Fix IP_ADD/DROP_MEMBERSHIP to handle only connectionless
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Flavio Leitner authored and David S. Miller committed Aug 27, 2007
1 parent 36d98d3 commit a96fb49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/ipv4/ip_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions net/ipv6/ipv6_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
{
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;
Expand Down

0 comments on commit a96fb49

Please sign in to comment.