relibc: extend getsockopt to handle IPPROTO_IP and IPPROTO_IPV6
Previously only SOL_SOCKET and IPPROTO_TCP levels were handled by the socket scheme. Now IPPROTO_IP and IPPROTO_IPV6 levels also forward to the socket scheme via SocketCall::GetSockOpt, removing the ENOSYS fallthrough for these common socket option levels. Cross-referenced with Linux 7.1 net/ipv4/ip_sockglue.c and net/ipv6/ipv6_sockglue.c which implement IP/UDP/ICMP level getsockopt handlers.
This commit is contained in:
@@ -789,6 +789,22 @@ impl PalSocket for Sys {
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
crate::header::netinet_in::IPPROTO_IP as c_int
|
||||
| crate::header::netinet_in::IPPROTO_IPV6 as c_int => {
|
||||
let metadata = [SocketCall::GetSockOpt as u64, option_name as u64];
|
||||
let payload =
|
||||
unsafe { slice::from_raw_parts_mut(option_value as *mut u8, option_len) };
|
||||
let call_flags = CallFlags::empty();
|
||||
unsafe {
|
||||
*option_len_ptr = redox_rt::sys::sys_call_ro(
|
||||
socket as usize,
|
||||
payload,
|
||||
CallFlags::empty(),
|
||||
&metadata,
|
||||
)? as socklen_t;
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user