| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "nacl_io/socket/udp_node.h" | 5 #include "nacl_io/socket/udp_node.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 return 0; | 429 return 0; |
| 430 } | 430 } |
| 431 case IPV6_JOIN_GROUP: { | 431 case IPV6_JOIN_GROUP: { |
| 432 const struct ipv6_mreq* mreq = | 432 const struct ipv6_mreq* mreq = |
| 433 static_cast<const struct ipv6_mreq*>(optval); | 433 static_cast<const struct ipv6_mreq*>(optval); |
| 434 struct sockaddr_in6 sin = {0}; | 434 struct sockaddr_in6 sin = {0}; |
| 435 sin.sin6_family = AF_INET6; | 435 sin.sin6_family = AF_INET6; |
| 436 memcpy(&sin.sin6_addr, &mreq->ipv6mr_multiaddr, sizeof(struct in6_addr)); | 436 memcpy(&sin.sin6_addr, &mreq->ipv6mr_multiaddr, sizeof(struct in6_addr)); |
| 437 | 437 |
| 438 PP_Resource net_addr = SockAddrIn6ToResource(&sin, sizeof(sin)); | 438 PP_Resource net_addr = SockAddrIn6ToResource(&sin, sizeof(sin)); |
| 439 int32_t error = UDPInterface()->LeaveGroup(socket_resource_, net_addr, | 439 int32_t error = UDPInterface()->JoinGroup(socket_resource_, net_addr, |
| 440 PP_BlockUntilComplete()); | 440 PP_BlockUntilComplete()); |
| 441 return PPERROR_TO_ERRNO(error); | 441 return PPERROR_TO_ERRNO(error); |
| 442 } | 442 } |
| 443 case IPV6_LEAVE_GROUP: { | 443 case IPV6_LEAVE_GROUP: { |
| 444 const struct ipv6_mreq* mreq = | 444 const struct ipv6_mreq* mreq = |
| 445 static_cast<const struct ipv6_mreq*>(optval); | 445 static_cast<const struct ipv6_mreq*>(optval); |
| 446 struct sockaddr_in6 sin = {0}; | 446 struct sockaddr_in6 sin = {0}; |
| 447 sin.sin6_family = AF_INET6; | 447 sin.sin6_family = AF_INET6; |
| 448 memcpy(&sin.sin6_addr, &mreq->ipv6mr_multiaddr, sizeof(struct in6_addr)); | 448 memcpy(&sin.sin6_addr, &mreq->ipv6mr_multiaddr, sizeof(struct in6_addr)); |
| 449 | 449 |
| 450 PP_Resource net_addr = SockAddrIn6ToResource(&sin, sizeof(sin)); | 450 PP_Resource net_addr = SockAddrIn6ToResource(&sin, sizeof(sin)); |
| 451 int32_t error = UDPInterface()->LeaveGroup(socket_resource_, net_addr, | 451 int32_t error = UDPInterface()->LeaveGroup(socket_resource_, net_addr, |
| 452 PP_BlockUntilComplete()); | 452 PP_BlockUntilComplete()); |
| 453 return PPERROR_TO_ERRNO(error); | 453 return PPERROR_TO_ERRNO(error); |
| 454 } | 454 } |
| 455 default: { break; } | 455 default: { break; } |
| 456 } | 456 } |
| 457 | 457 |
| 458 return SocketNode::SetSockOptIPV6(optname, optval, len); | 458 return SocketNode::SetSockOptIPV6(optname, optval, len); |
| 459 } | 459 } |
| 460 | 460 |
| 461 } // namespace nacl_io | 461 } // namespace nacl_io |
| OLD | NEW |