Skip to content

Commit

Permalink
getsockopt(): add support for SO_DOMAIN
Browse files Browse the repository at this point in the history
This socket option at the SOL_SOCKET level contains the socket
domain value (e.g. AF_INET or AF_INET6).
  • Loading branch information
francescolavra committed Jul 18, 2023
1 parent f84141b commit 78181b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/net/netsyscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/unix/system_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 78181b5

Please sign in to comment.