Skip to content

Commit

Permalink
Merge pull request #1081 from Dennisbonke/sockopt
Browse files Browse the repository at this point in the history
sysdeps/managarm: Stub some more {get,set}sockopt calls
  • Loading branch information
Geertiebear authored Jun 10, 2024
2 parents d772b43 + 653e55e commit 8beb05f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions sysdeps/managarm/generic/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ int sys_getsockopt(int fd, int layer, int number,
mlibc::infoLogger() << "\e[31mmlibc: getsockopt() call with SOL_SOCKET and SO_SNDBUF is unimplemented\e[39m" << frg::endlog;
*(int *)buffer = 4096;
return 0;
}else if(layer == SOL_SOCKET && number == SO_RCVBUF) {
mlibc::infoLogger() << "\e[31mmlibc: getsockopt() call with SOL_SOCKET and SO_RCVBUF is unimplemented\e[39m" << frg::endlog;
*(int *)buffer = 4096;
return 0;
}else if(layer == SOL_SOCKET && number == SO_TYPE) {
mlibc::infoLogger() << "\e[31mmlibc: getsockopt() call with SOL_SOCKET and SO_TYPE is unimplemented, hardcoding SOCK_STREAM\e[39m" << frg::endlog;
*(int *)buffer = SOCK_STREAM;
Expand All @@ -303,6 +307,18 @@ int sys_getsockopt(int fd, int layer, int number,
mlibc::infoLogger() << "\e[31mmlibc: getsockopt() call with SOL_SOCKET and SO_LINGER is unimplemented, hardcoding 0\e[39m" << frg::endlog;
*(int *)buffer = 0;
return 0;
}else if(layer == SOL_SOCKET && number == SO_PEERSEC) {
mlibc::infoLogger() << "\e[31mmlibc: getsockopt() call with SOL_SOCKET and SO_PEERSEC is unimplemented, hardcoding 0\e[39m" << frg::endlog;
*(int *)buffer = 0;
return 0;
}else if(layer == SOL_SOCKET && number == SO_PEERGROUPS) {
mlibc::infoLogger() << "\e[31mmlibc: getsockopt() call with SOL_SOCKET and SO_PEERGROUPS is unimplemented, hardcoding 0\e[39m" << frg::endlog;
*(int *)buffer = 0;
return 0;
}else if(layer == SOL_SOCKET && number == SO_ACCEPTCONN) {
mlibc::infoLogger() << "\e[31mmlibc: getsockopt() call with SOL_SOCKET and SO_ACCEPTCONN is unimplemented, hardcoding 1\e[39m" << frg::endlog;
*(int *)buffer = 1;
return 0;
}else{
mlibc::panicLogger() << "\e[31mmlibc: Unexpected getsockopt() call, layer: " << layer << " number: " << number << "\e[39m" << frg::endlog;
__builtin_unreachable();
Expand Down Expand Up @@ -468,6 +484,9 @@ int sys_setsockopt(int fd, int layer, int number,
}else if(layer == SOL_SOCKET && number == SO_SNDBUF) {
mlibc::infoLogger() << "\e[31mmlibc: setsockopt() call with SOL_SOCKET and SO_SNDBUF is unimplemented\e[39m" << frg::endlog;
return 0;
}else if(layer == SOL_SOCKET && number == SO_SNDBUFFORCE) {
mlibc::infoLogger() << "\e[31mmlibc: setsockopt() call with SOL_SOCKET and SO_SNDBUFFORCE is unimplemented\e[39m" << frg::endlog;
return 0;
}else if(layer == SOL_SOCKET && number == SO_KEEPALIVE) {
mlibc::infoLogger() << "\e[31mmlibc: setsockopt() call with SOL_SOCKET and SO_KEEPALIVE is unimplemented\e[39m" << frg::endlog;
return 0;
Expand Down Expand Up @@ -501,6 +520,9 @@ int sys_setsockopt(int fd, int layer, int number,
}else if(layer == IPPROTO_TCP && number == TCP_KEEPCNT) {
mlibc::infoLogger() << "\e[31mmlibc: setsockopt() call with IPPROTO_TCP and TCP_KEEPCNT is unimplemented\e[39m" << frg::endlog;
return 0;
}else if(layer == SOL_NETLINK && number == NETLINK_ADD_MEMBERSHIP) {
mlibc::infoLogger() << "\e[31mmlibc: setsockopt() call with SOL_NETLINK and NETLINK_ADD_MEMBERSHIP is unimplemented\e[39m" << frg::endlog;
return 0;
}else{
mlibc::panicLogger() << "\e[31mmlibc: Unexpected setsockopt() call, layer: " << layer << " number: " << number << "\e[39m" << frg::endlog;
__builtin_unreachable();
Expand Down

0 comments on commit 8beb05f

Please sign in to comment.