aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index fd9876087651..b433b1ed203d 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -70,7 +70,11 @@
70#define SOCK_DEBUG(sk, msg...) do { if ((sk) && sock_flag((sk), SOCK_DBG)) \ 70#define SOCK_DEBUG(sk, msg...) do { if ((sk) && sock_flag((sk), SOCK_DBG)) \
71 printk(KERN_DEBUG msg); } while (0) 71 printk(KERN_DEBUG msg); } while (0)
72#else 72#else
73#define SOCK_DEBUG(sk, msg...) do { } while (0) 73/* Validate arguments and do nothing */
74static void inline int __attribute__ ((format (printf, 2, 3)))
75SOCK_DEBUG(struct sock *sk, const char *msg, ...)
76{
77}
74#endif 78#endif
75 79
76/* This is the per-socket lock. The spinlock provides a synchronization 80/* This is the per-socket lock. The spinlock provides a synchronization
@@ -151,6 +155,7 @@ struct sock_common {
151 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 155 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
152 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 156 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
153 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 157 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
158 * @sk_gso_max_size: Maximum GSO segment size to build
154 * @sk_lingertime: %SO_LINGER l_linger setting 159 * @sk_lingertime: %SO_LINGER l_linger setting
155 * @sk_backlog: always used with the per-socket spinlock held 160 * @sk_backlog: always used with the per-socket spinlock held
156 * @sk_callback_lock: used with the callbacks in the end of this struct 161 * @sk_callback_lock: used with the callbacks in the end of this struct
@@ -237,6 +242,7 @@ struct sock {
237 gfp_t sk_allocation; 242 gfp_t sk_allocation;
238 int sk_route_caps; 243 int sk_route_caps;
239 int sk_gso_type; 244 int sk_gso_type;
245 unsigned int sk_gso_max_size;
240 int sk_rcvlowat; 246 int sk_rcvlowat;
241 unsigned long sk_flags; 247 unsigned long sk_flags;
242 unsigned long sk_lingertime; 248 unsigned long sk_lingertime;
@@ -498,6 +504,7 @@ extern int sk_wait_data(struct sock *sk, long *timeo);
498struct request_sock_ops; 504struct request_sock_ops;
499struct timewait_sock_ops; 505struct timewait_sock_ops;
500struct inet_hashinfo; 506struct inet_hashinfo;
507struct raw_hashinfo;
501 508
502/* Networking protocol blocks we attach to sockets. 509/* Networking protocol blocks we attach to sockets.
503 * socket layer -> transport layer interface 510 * socket layer -> transport layer interface
@@ -580,7 +587,11 @@ struct proto {
580 struct request_sock_ops *rsk_prot; 587 struct request_sock_ops *rsk_prot;
581 struct timewait_sock_ops *twsk_prot; 588 struct timewait_sock_ops *twsk_prot;
582 589
583 struct inet_hashinfo *hashinfo; 590 union {
591 struct inet_hashinfo *hashinfo;
592 struct hlist_head *udp_hash;
593 struct raw_hashinfo *raw_hash;
594 } h;
584 595
585 struct module *owner; 596 struct module *owner;
586 597
@@ -850,6 +861,7 @@ extern struct sock *sk_alloc(struct net *net, int family,
850 gfp_t priority, 861 gfp_t priority,
851 struct proto *prot); 862 struct proto *prot);
852extern void sk_free(struct sock *sk); 863extern void sk_free(struct sock *sk);
864extern void sk_release_kernel(struct sock *sk);
853extern struct sock *sk_clone(const struct sock *sk, 865extern struct sock *sk_clone(const struct sock *sk,
854 const gfp_t priority); 866 const gfp_t priority);
855 867
@@ -1333,6 +1345,18 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
1333} 1345}
1334#endif 1346#endif
1335 1347
1348/*
1349 * Kernel sockets, f.e. rtnl or icmp_socket, are a part of a namespace.
1350 * They should not hold a referrence to a namespace in order to allow
1351 * to stop it.
1352 * Sockets after sk_change_net should be released using sk_release_kernel
1353 */
1354static inline void sk_change_net(struct sock *sk, struct net *net)
1355{
1356 put_net(sk->sk_net);
1357 sk->sk_net = net;
1358}
1359
1336extern void sock_enable_timestamp(struct sock *sk); 1360extern void sock_enable_timestamp(struct sock *sk);
1337extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1361extern int sock_get_timestamp(struct sock *, struct timeval __user *);
1338extern int sock_get_timestampns(struct sock *, struct timespec __user *); 1362extern int sock_get_timestampns(struct sock *, struct timespec __user *);