History

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/

Chenbo Feng committed 9 years ago

Commit 5daab9d1 parent c42cb9814 files · +34 −0Browse files

Unified · Split

14 files
  1. arch/alpha/include/uapi/asm/socket.h +2 −0
  2. arch/avr32/include/uapi/asm/socket.h +2 −0
  3. arch/frv/include/uapi/asm/socket.h +2 −0
  4. arch/ia64/include/uapi/asm/socket.h +2 −0
  5. arch/m32r/include/uapi/asm/socket.h +2 −0
  6. arch/mips/include/uapi/asm/socket.h +2 −0
  7. arch/mn10300/include/uapi/asm/socket.h +2 −0
  8. arch/parisc/include/uapi/asm/socket.h +2 −0
  9. arch/powerpc/include/uapi/asm/socket.h +2 −0
  10. arch/s390/include/uapi/asm/socket.h +2 −0
  11. arch/sparc/include/uapi/asm/socket.h +2 −0
  12. arch/xtensa/include/uapi/asm/socket.h +2 −0
  13. include/uapi/asm-generic/socket.h +2 −0
  14. net/core/sock.c +8 −0
arch/alpha/include/uapi/asm/socket.h+2−0
@@ -103,4 +103,6 @@ · 102 unmodified lines
103 103
104#define SO_INCOMING_NAPI_ID 56104#define SO_INCOMING_NAPI_ID 56
105 105
106#define SO_COOKIE 57
107
106#endif /* _UAPI_ASM_SOCKET_H */108#endif /* _UAPI_ASM_SOCKET_H */
arch/avr32/include/uapi/asm/socket.h+2−0
@@ -96,4 +96,6 @@ · 95 unmodified lines
96 96
97#define SO_INCOMING_NAPI_ID 5697#define SO_INCOMING_NAPI_ID 56
98 98
99#define SO_COOKIE 57
100
99#endif /* _UAPI__ASM_AVR32_SOCKET_H */101#endif /* _UAPI__ASM_AVR32_SOCKET_H */
arch/frv/include/uapi/asm/socket.h+2−0
@@ -96,5 +96,7 @@ · 95 unmodified lines
96 96
97#define SO_INCOMING_NAPI_ID 5697#define SO_INCOMING_NAPI_ID 56
98 98
99#define SO_COOKIE 57
100
99#endif /* _ASM_SOCKET_H */101#endif /* _ASM_SOCKET_H */
100 102
arch/ia64/include/uapi/asm/socket.h+2−0
@@ -105,4 +105,6 @@ · 104 unmodified lines
105 105
106#define SO_INCOMING_NAPI_ID 56106#define SO_INCOMING_NAPI_ID 56
107 107
108#define SO_COOKIE 57
109
108#endif /* _ASM_IA64_SOCKET_H */110#endif /* _ASM_IA64_SOCKET_H */
arch/m32r/include/uapi/asm/socket.h+2−0
@@ -96,4 +96,6 @@ · 95 unmodified lines
96 96
97#define SO_INCOMING_NAPI_ID 5697#define SO_INCOMING_NAPI_ID 56
98 98
99#define SO_COOKIE 57
100
99#endif /* _ASM_M32R_SOCKET_H */101#endif /* _ASM_M32R_SOCKET_H */
arch/mips/include/uapi/asm/socket.h+2−0
@@ -114,4 +114,6 @@ · 113 unmodified lines
114 114
115#define SO_INCOMING_NAPI_ID 56115#define SO_INCOMING_NAPI_ID 56
116 116
117#define SO_COOKIE 57
118
117#endif /* _UAPI_ASM_SOCKET_H */119#endif /* _UAPI_ASM_SOCKET_H */
arch/mn10300/include/uapi/asm/socket.h+2−0
@@ -96,4 +96,6 @@ · 95 unmodified lines
96 96
97#define SO_INCOMING_NAPI_ID 5697#define SO_INCOMING_NAPI_ID 56
98 98
99#define SO_COOKIE 57
100
99#endif /* _ASM_SOCKET_H */101#endif /* _ASM_SOCKET_H */
arch/parisc/include/uapi/asm/socket.h+2−0
@@ -95,4 +95,6 @@ · 94 unmodified lines
95 95
96#define SO_INCOMING_NAPI_ID 0x403196#define SO_INCOMING_NAPI_ID 0x4031
97 97
98#define SO_COOKIE 0x4032
99
98#endif /* _UAPI_ASM_SOCKET_H */100#endif /* _UAPI_ASM_SOCKET_H */
arch/powerpc/include/uapi/asm/socket.h+2−0
@@ -103,4 +103,6 @@ · 102 unmodified lines
103 103
104#define SO_INCOMING_NAPI_ID 56104#define SO_INCOMING_NAPI_ID 56
105 105
106#define SO_COOKIE 57
107
106#endif /* _ASM_POWERPC_SOCKET_H */108#endif /* _ASM_POWERPC_SOCKET_H */
arch/s390/include/uapi/asm/socket.h+2−0
@@ -102,4 +102,6 @@ · 101 unmodified lines
102 102
103#define SO_INCOMING_NAPI_ID 56103#define SO_INCOMING_NAPI_ID 56
104 104
105#define SO_COOKIE 57
106
105#endif /* _ASM_SOCKET_H */107#endif /* _ASM_SOCKET_H */
arch/sparc/include/uapi/asm/socket.h+2−0
@@ -92,6 +92,8 @@ · 91 unmodified lines
92 92
93#define SO_INCOMING_NAPI_ID 0x003a93#define SO_INCOMING_NAPI_ID 0x003a
94 94
95#define SO_COOKIE 0x003b
96
95/* Security levels - as per NRL IPv6 - don't actually do anything */97/* Security levels - as per NRL IPv6 - don't actually do anything */
96#define SO_SECURITY_AUTHENTICATION 0x500198#define SO_SECURITY_AUTHENTICATION 0x5001
97#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x500299#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
arch/xtensa/include/uapi/asm/socket.h+2−0
@@ -107,4 +107,6 @@ · 106 unmodified lines
107 107
108#define SO_INCOMING_NAPI_ID 56108#define SO_INCOMING_NAPI_ID 56
109 109
110#define SO_COOKIE 57
111
110#endif /* _XTENSA_SOCKET_H */112#endif /* _XTENSA_SOCKET_H */
include/uapi/asm-generic/socket.h+2−0
@@ -98,4 +98,6 @@ · 97 unmodified lines
98 98
99#define SO_INCOMING_NAPI_ID 5699#define SO_INCOMING_NAPI_ID 56
100 100
101#define SO_COOKIE 57
102
101#endif /* __ASM_GENERIC_SOCKET_H */103#endif /* __ASM_GENERIC_SOCKET_H */
net/core/sock.c+8−0
@@ -1083,6 +1083,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, · 1082 unmodified lines
1083 1083
1084 union {1084 union {
1085 int val;1085 int val;
1086 u64 val64;
1086 struct linger ling;1087 struct linger ling;
1087 struct timeval tm;1088 struct timeval tm;
1088 } v;1089 } v;
@@ -1340,6 +1341,13 @@ int sock_getsockopt(struct socket *sock, int level, int optname, · 251 unmodified lines
1340 break;1341 break;
1341#endif1342#endif
1342 1343
1344 case SO_COOKIE:
1345 lv = sizeof(u64);
1346 if (len < lv)
1347 return -EINVAL;
1348 v.val64 = sock_gen_cookie(sk);
1349 break;
1350
1343 default:1351 default:
1344 /* We implement the SO_SNDLOWAT etc to not be settable1352 /* We implement the SO_SNDLOWAT etc to not be settable
1345 * (1003.1g 7).1353 * (1003.1g 7).

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t