From 78181b5db67612e9923f753ff082a22e1e7e76b0 Mon Sep 17 00:00:00 2001 From: Francesco Lavra Date: Mon, 17 Jul 2023 10:34:15 +0200 Subject: [PATCH] getsockopt(): add support for SO_DOMAIN This socket option at the SOL_SOCKET level contains the socket domain value (e.g. AF_INET or AF_INET6). --- src/net/netsyscall.c | 3 +++ src/unix/system_structs.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/net/netsyscall.c b/src/net/netsyscall.c index d4c6e1ed4..5b5c98e2a 100755 --- a/src/net/netsyscall.c +++ b/src/net/netsyscall.c @@ -2494,6 +2494,9 @@ static sysreturn netsock_getsockopt(struct sock *sock, int level, case SO_PROTOCOL: ret_optval.val = s->sock.type == SOCK_STREAM ? IP_PROTO_TCP : IP_PROTO_UDP; break; + case SO_DOMAIN: + ret_optval.val = s->sock.domain; + break; default: goto unimplemented; } diff --git a/src/unix/system_structs.h b/src/unix/system_structs.h index 9c00dffa7..8cd5da98e 100644 --- a/src/unix/system_structs.h +++ b/src/unix/system_structs.h @@ -833,6 +833,7 @@ struct io_uring_params { #define SO_TIMESTAMP 29 #define SO_ACCEPTCONN 30 #define SO_PROTOCOL 38 +#define SO_DOMAIN 39 #define IP_TOS 1 #define IP_TTL 2