raw sockets: make creating them a privileged operation

This commit is contained in:
Matheus
2026-09-14 14:03:39 -03:00
parent d1cc050d76
commit cdee765643
3 changed files with 8 additions and 3 deletions
+7
View File
@@ -1,5 +1,6 @@
#include <kernel/syscalls.h>
#include <kernel/abi.h>
#include <kernel/auth.h>
#include <kernel/sock.h>
#include <errno.h>
@@ -48,6 +49,12 @@ syscallret_t syscall_socket(context_t *, int domain, int type, int protocol) {
return ret;
}
if (socktype == SOCKET_TYPE_RAW_STRIPPED) {
ret.errno = auth_network_check(&current_thread()->proc->cred, AUTH_ACTIONS_NETWORK_CREATERAW, NULL, NULL);
if (ret.errno)
return ret;
}
socket_t *socket = socket_create(socktype, protocol);
if (socket == NULL) {
ret.errno = ENOMEM;