Go to the documentation of this file.
22 #include <linux/random.h>
23 #include <linux/wait.h>
24 #include <linux/fcntl.h>
35 #define SOCK_ASYNC_NOSPACE 0
36 #define SOCK_ASYNC_WAITDATA 1
37 #define SOCK_NOSPACE 2
38 #define SOCK_PASSCRED 3
39 #define SOCK_PASSSEC 4
40 #define SOCK_EXTERNALLY_ALLOCATED 5
42 #ifndef ARCH_HAS_SOCKET_TYPES
68 #define SOCK_MAX (SOCK_PACKET + 1)
71 #define SOCK_TYPE_MASK 0xf
74 #define SOCK_CLOEXEC O_CLOEXEC
76 #define SOCK_NONBLOCK O_NONBLOCK
136 int sockaddr_len,
int flags);
143 int *sockaddr_len,
int peer);
155 int optname,
char __user *optval,
unsigned int optlen);
160 int optname,
char __user *optval,
unsigned int optlen);
178 #define DECLARE_SOCKADDR(type, dst, src) \
179 type dst = ({ __sockaddr_check_size(sizeof(*dst)); (type) src; })
217 #define sockfd_put(sock) fput(sock->file)
220 #define net_ratelimited_function(function, ...) \
222 if (net_ratelimit()) \
223 function(__VA_ARGS__); \
226 #define net_emerg_ratelimited(fmt, ...) \
227 net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__)
228 #define net_alert_ratelimited(fmt, ...) \
229 net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__)
230 #define net_crit_ratelimited(fmt, ...) \
231 net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__)
232 #define net_err_ratelimited(fmt, ...) \
233 net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__)
234 #define net_notice_ratelimited(fmt, ...) \
235 net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__)
236 #define net_warn_ratelimited(fmt, ...) \
237 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
238 #define net_info_ratelimited(fmt, ...) \
239 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
240 #define net_dbg_ratelimited(fmt, ...) \
241 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
243 #define net_random() random32()
244 #define net_srandom(seed) srandom32((__force u32)seed)
247 struct kvec *vec,
size_t num,
size_t len);
249 struct kvec *vec,
size_t num,
250 size_t len,
int flags);
258 int addrlen,
int flags);
264 char *optval,
int *optlen);
266 char *optval,
unsigned int optlen);
273 #define MODULE_ALIAS_NETPROTO(proto) \
274 MODULE_ALIAS("net-pf-" __stringify(proto))
276 #define MODULE_ALIAS_NET_PF_PROTO(pf, proto) \
277 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto))
279 #define MODULE_ALIAS_NET_PF_PROTO_TYPE(pf, proto, type) \
280 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \
281 "-type-" __stringify(type))
283 #define MODULE_ALIAS_NET_PF_PROTO_NAME(pf, proto, name) \
284 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \