mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 08:02:56 +00:00
New getsockopt option to get socket cookie
Introduce a new getsockopt operation to retrieve the socket cookie for a specific socket based on the socket fd. It returns a unique non-decreasing cookie for each socket. Tested: https://android-review.googlesource.com/#/c/358163/ Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Chenbo Feng <fengc@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c42cb98cfd
commit
5daab9db7b
14 changed files with 34 additions and 0 deletions
|
@ -1083,6 +1083,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
|
|||
|
||||
union {
|
||||
int val;
|
||||
u64 val64;
|
||||
struct linger ling;
|
||||
struct timeval tm;
|
||||
} v;
|
||||
|
@ -1340,6 +1341,13 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
|
|||
break;
|
||||
#endif
|
||||
|
||||
case SO_COOKIE:
|
||||
lv = sizeof(u64);
|
||||
if (len < lv)
|
||||
return -EINVAL;
|
||||
v.val64 = sock_gen_cookie(sk);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* We implement the SO_SNDLOWAT etc to not be settable
|
||||
* (1003.1g 7).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue