Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP #11496

Merged
merged 1 commit into from Feb 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions rpcs3/Emu/Cell/lv2/sys_net.cpp
Expand Up @@ -3050,6 +3050,7 @@ error_code sys_net_bnet_setsockopt(ppu_thread& ppu, s32 s, s32 level, s32 optnam
const void* native_val = &native_int;
::socklen_t native_len = sizeof(int);
::linger native_linger;
::ip_mreq native_mreq;

#ifdef _WIN32
u32 native_timeo;
Expand Down Expand Up @@ -3261,13 +3262,16 @@ error_code sys_net_bnet_setsockopt(ppu_thread& ppu, s32 s, s32 level, s32 optnam
break;
}
case SYS_NET_IP_ADD_MEMBERSHIP:
{
native_opt = IP_ADD_MEMBERSHIP;
break;
}
case SYS_NET_IP_DROP_MEMBERSHIP:
{
native_opt = IP_DROP_MEMBERSHIP;
if (optlen < sizeof(sys_net_ip_mreq))
return SYS_NET_EINVAL;

native_opt = optname == SYS_NET_IP_ADD_MEMBERSHIP ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP;
native_val = &native_mreq;
native_len = sizeof(::ip_mreq);
native_mreq.imr_interface.s_addr = std::bit_cast<u32>(reinterpret_cast<sys_net_ip_mreq*>(optval_buf.data())->imr_interface);
native_mreq.imr_multiaddr.s_addr = std::bit_cast<u32>(reinterpret_cast<sys_net_ip_mreq*>(optval_buf.data())->imr_multiaddr);
break;
}
case SYS_NET_IP_TTLCHK:
Expand Down