aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bluetooth/rfcomm.h12
-rw-r--r--include/net/cfg80211.h5
-rw-r--r--include/net/netfilter/nf_conntrack.h4
-rw-r--r--include/net/phonet/pn_dev.h1
-rw-r--r--include/net/rose.h2
-rw-r--r--include/net/sock.h101
-rw-r--r--include/net/tcp.h5
7 files changed, 113 insertions, 17 deletions
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 80072611d26..c274993234e 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -355,7 +355,17 @@ struct rfcomm_dev_list_req {
355}; 355};
356 356
357int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg); 357int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
358
359#ifdef CONFIG_BT_RFCOMM_TTY
358int rfcomm_init_ttys(void); 360int rfcomm_init_ttys(void);
359void rfcomm_cleanup_ttys(void); 361void rfcomm_cleanup_ttys(void);
360 362#else
363static inline int rfcomm_init_ttys(void)
364{
365 return 0;
366}
367static inline void rfcomm_cleanup_ttys(void)
368{
369}
370#endif
361#endif /* __RFCOMM_H */ 371#endif /* __RFCOMM_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1a21895b732..d1892d66701 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -979,6 +979,10 @@ struct cfg80211_ops {
979 * channels at a later time. This can be used for devices which do not 979 * channels at a later time. This can be used for devices which do not
980 * have calibration information gauranteed for frequencies or settings 980 * have calibration information gauranteed for frequencies or settings
981 * outside of its regulatory domain. 981 * outside of its regulatory domain.
982 * @disable_beacon_hints: enable this if your driver needs to ensure that
983 * passive scan flags and beaconing flags may not be lifted by cfg80211
984 * due to regulatory beacon hints. For more information on beacon
985 * hints read the documenation for regulatory_hint_found_beacon()
982 * @reg_notifier: the driver's regulatory notification callback 986 * @reg_notifier: the driver's regulatory notification callback
983 * @regd: the driver's regulatory domain, if one was requested via 987 * @regd: the driver's regulatory domain, if one was requested via
984 * the regulatory_hint() API. This can be used by the driver 988 * the regulatory_hint() API. This can be used by the driver
@@ -1004,6 +1008,7 @@ struct wiphy {
1004 1008
1005 bool custom_regulatory; 1009 bool custom_regulatory;
1006 bool strict_regulatory; 1010 bool strict_regulatory;
1011 bool disable_beacon_hints;
1007 1012
1008 enum cfg80211_signal_type signal_type; 1013 enum cfg80211_signal_type signal_type;
1009 1014
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index a632689b61b..cbdd6284996 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -258,8 +258,8 @@ static inline bool nf_ct_kill(struct nf_conn *ct)
258/* Update TCP window tracking data when NAT mangles the packet */ 258/* Update TCP window tracking data when NAT mangles the packet */
259extern void nf_conntrack_tcp_update(const struct sk_buff *skb, 259extern void nf_conntrack_tcp_update(const struct sk_buff *skb,
260 unsigned int dataoff, 260 unsigned int dataoff,
261 struct nf_conn *ct, 261 struct nf_conn *ct, int dir,
262 int dir); 262 s16 offset);
263 263
264/* Fake conntrack entry for untracked connections */ 264/* Fake conntrack entry for untracked connections */
265extern struct nf_conn nf_conntrack_untracked; 265extern struct nf_conn nf_conntrack_untracked;
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index 5054dc5ea2c..29d12673661 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -45,6 +45,7 @@ int phonet_address_add(struct net_device *dev, u8 addr);
45int phonet_address_del(struct net_device *dev, u8 addr); 45int phonet_address_del(struct net_device *dev, u8 addr);
46u8 phonet_address_get(struct net_device *dev, u8 addr); 46u8 phonet_address_get(struct net_device *dev, u8 addr);
47int phonet_address_lookup(struct net *net, u8 addr); 47int phonet_address_lookup(struct net *net, u8 addr);
48void phonet_address_notify(int event, struct net_device *dev, u8 addr);
48 49
49#define PN_NO_ADDR 0xff 50#define PN_NO_ADDR 0xff
50 51
diff --git a/include/net/rose.h b/include/net/rose.h
index cbd5364b2c8..5ba9f02731e 100644
--- a/include/net/rose.h
+++ b/include/net/rose.h
@@ -156,7 +156,7 @@ extern int sysctl_rose_maximum_vcs;
156extern int sysctl_rose_window_size; 156extern int sysctl_rose_window_size;
157extern int rosecmp(rose_address *, rose_address *); 157extern int rosecmp(rose_address *, rose_address *);
158extern int rosecmpm(rose_address *, rose_address *, unsigned short); 158extern int rosecmpm(rose_address *, rose_address *, unsigned short);
159extern const char *rose2asc(const rose_address *); 159extern char *rose2asc(char *buf, const rose_address *);
160extern struct sock *rose_find_socket(unsigned int, struct rose_neigh *); 160extern struct sock *rose_find_socket(unsigned int, struct rose_neigh *);
161extern void rose_kill_by_neigh(struct rose_neigh *); 161extern void rose_kill_by_neigh(struct rose_neigh *);
162extern unsigned int rose_new_lci(struct rose_neigh *); 162extern unsigned int rose_new_lci(struct rose_neigh *);
diff --git a/include/net/sock.h b/include/net/sock.h
index 352f06bbd7a..950409dcec3 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -54,6 +54,7 @@
54 54
55#include <linux/filter.h> 55#include <linux/filter.h>
56#include <linux/rculist_nulls.h> 56#include <linux/rculist_nulls.h>
57#include <linux/poll.h>
57 58
58#include <asm/atomic.h> 59#include <asm/atomic.h>
59#include <net/dst.h> 60#include <net/dst.h>
@@ -103,15 +104,15 @@ struct net;
103 104
104/** 105/**
105 * struct sock_common - minimal network layer representation of sockets 106 * struct sock_common - minimal network layer representation of sockets
107 * @skc_node: main hash linkage for various protocol lookup tables
108 * @skc_nulls_node: main hash linkage for UDP/UDP-Lite protocol
109 * @skc_refcnt: reference count
110 * @skc_hash: hash value used with various protocol lookup tables
106 * @skc_family: network address family 111 * @skc_family: network address family
107 * @skc_state: Connection state 112 * @skc_state: Connection state
108 * @skc_reuse: %SO_REUSEADDR setting 113 * @skc_reuse: %SO_REUSEADDR setting
109 * @skc_bound_dev_if: bound device index if != 0 114 * @skc_bound_dev_if: bound device index if != 0
110 * @skc_node: main hash linkage for various protocol lookup tables
111 * @skc_nulls_node: main hash linkage for UDP/UDP-Lite protocol
112 * @skc_bind_node: bind hash linkage for various protocol lookup tables 115 * @skc_bind_node: bind hash linkage for various protocol lookup tables
113 * @skc_refcnt: reference count
114 * @skc_hash: hash value used with various protocol lookup tables
115 * @skc_prot: protocol handlers inside a network family 116 * @skc_prot: protocol handlers inside a network family
116 * @skc_net: reference to the network namespace of this socket 117 * @skc_net: reference to the network namespace of this socket
117 * 118 *
@@ -119,17 +120,21 @@ struct net;
119 * for struct sock and struct inet_timewait_sock. 120 * for struct sock and struct inet_timewait_sock.
120 */ 121 */
121struct sock_common { 122struct sock_common {
122 unsigned short skc_family; 123 /*
123 volatile unsigned char skc_state; 124 * first fields are not copied in sock_copy()
124 unsigned char skc_reuse; 125 */
125 int skc_bound_dev_if;
126 union { 126 union {
127 struct hlist_node skc_node; 127 struct hlist_node skc_node;
128 struct hlist_nulls_node skc_nulls_node; 128 struct hlist_nulls_node skc_nulls_node;
129 }; 129 };
130 struct hlist_node skc_bind_node;
131 atomic_t skc_refcnt; 130 atomic_t skc_refcnt;
131
132 unsigned int skc_hash; 132 unsigned int skc_hash;
133 unsigned short skc_family;
134 volatile unsigned char skc_state;
135 unsigned char skc_reuse;
136 int skc_bound_dev_if;
137 struct hlist_node skc_bind_node;
133 struct proto *skc_prot; 138 struct proto *skc_prot;
134#ifdef CONFIG_NET_NS 139#ifdef CONFIG_NET_NS
135 struct net *skc_net; 140 struct net *skc_net;
@@ -207,15 +212,17 @@ struct sock {
207 * don't add nothing before this first member (__sk_common) --acme 212 * don't add nothing before this first member (__sk_common) --acme
208 */ 213 */
209 struct sock_common __sk_common; 214 struct sock_common __sk_common;
215#define sk_node __sk_common.skc_node
216#define sk_nulls_node __sk_common.skc_nulls_node
217#define sk_refcnt __sk_common.skc_refcnt
218
219#define sk_copy_start __sk_common.skc_hash
220#define sk_hash __sk_common.skc_hash
210#define sk_family __sk_common.skc_family 221#define sk_family __sk_common.skc_family
211#define sk_state __sk_common.skc_state 222#define sk_state __sk_common.skc_state
212#define sk_reuse __sk_common.skc_reuse 223#define sk_reuse __sk_common.skc_reuse
213#define sk_bound_dev_if __sk_common.skc_bound_dev_if 224#define sk_bound_dev_if __sk_common.skc_bound_dev_if
214#define sk_node __sk_common.skc_node
215#define sk_nulls_node __sk_common.skc_nulls_node
216#define sk_bind_node __sk_common.skc_bind_node 225#define sk_bind_node __sk_common.skc_bind_node
217#define sk_refcnt __sk_common.skc_refcnt
218#define sk_hash __sk_common.skc_hash
219#define sk_prot __sk_common.skc_prot 226#define sk_prot __sk_common.skc_prot
220#define sk_net __sk_common.skc_net 227#define sk_net __sk_common.skc_net
221 kmemcheck_bitfield_begin(flags); 228 kmemcheck_bitfield_begin(flags);
@@ -1241,6 +1248,74 @@ static inline int sk_has_allocations(const struct sock *sk)
1241 return sk_wmem_alloc_get(sk) || sk_rmem_alloc_get(sk); 1248 return sk_wmem_alloc_get(sk) || sk_rmem_alloc_get(sk);
1242} 1249}
1243 1250
1251/**
1252 * sk_has_sleeper - check if there are any waiting processes
1253 * @sk: socket
1254 *
1255 * Returns true if socket has waiting processes
1256 *
1257 * The purpose of the sk_has_sleeper and sock_poll_wait is to wrap the memory
1258 * barrier call. They were added due to the race found within the tcp code.
1259 *
1260 * Consider following tcp code paths:
1261 *
1262 * CPU1 CPU2
1263 *
1264 * sys_select receive packet
1265 * ... ...
1266 * __add_wait_queue update tp->rcv_nxt
1267 * ... ...
1268 * tp->rcv_nxt check sock_def_readable
1269 * ... {
1270 * schedule ...
1271 * if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
1272 * wake_up_interruptible(sk->sk_sleep)
1273 * ...
1274 * }
1275 *
1276 * The race for tcp fires when the __add_wait_queue changes done by CPU1 stay
1277 * in its cache, and so does the tp->rcv_nxt update on CPU2 side. The CPU1
1278 * could then endup calling schedule and sleep forever if there are no more
1279 * data on the socket.
1280 *
1281 * The sk_has_sleeper is always called right after a call to read_lock, so we
1282 * can use smp_mb__after_lock barrier.
1283 */
1284static inline int sk_has_sleeper(struct sock *sk)
1285{
1286 /*
1287 * We need to be sure we are in sync with the
1288 * add_wait_queue modifications to the wait queue.
1289 *
1290 * This memory barrier is paired in the sock_poll_wait.
1291 */
1292 smp_mb__after_lock();
1293 return sk->sk_sleep && waitqueue_active(sk->sk_sleep);
1294}
1295
1296/**
1297 * sock_poll_wait - place memory barrier behind the poll_wait call.
1298 * @filp: file
1299 * @wait_address: socket wait queue
1300 * @p: poll_table
1301 *
1302 * See the comments in the sk_has_sleeper function.
1303 */
1304static inline void sock_poll_wait(struct file *filp,
1305 wait_queue_head_t *wait_address, poll_table *p)
1306{
1307 if (p && wait_address) {
1308 poll_wait(filp, wait_address, p);
1309 /*
1310 * We need to be sure we are in sync with the
1311 * socket flags modification.
1312 *
1313 * This memory barrier is paired in the sk_has_sleeper.
1314 */
1315 smp_mb();
1316 }
1317}
1318
1244/* 1319/*
1245 * Queue a received datagram if it will fit. Stream and sequenced 1320 * Queue a received datagram if it will fit. Stream and sequenced
1246 * protocols can't normally use this as they need to fit buffers in 1321 * protocols can't normally use this as they need to fit buffers in
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 19f4150f4d4..88af8430647 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1425,6 +1425,11 @@ struct tcp_request_sock_ops {
1425#ifdef CONFIG_TCP_MD5SIG 1425#ifdef CONFIG_TCP_MD5SIG
1426 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk, 1426 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk,
1427 struct request_sock *req); 1427 struct request_sock *req);
1428 int (*calc_md5_hash) (char *location,
1429 struct tcp_md5sig_key *md5,
1430 struct sock *sk,
1431 struct request_sock *req,
1432 struct sk_buff *skb);
1428#endif 1433#endif
1429}; 1434};
1430 1435