aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bluetooth/bluetooth.h18
-rw-r--r--include/net/bluetooth/hci.h135
-rw-r--r--include/net/bluetooth/hci_core.h134
-rw-r--r--include/net/bluetooth/l2cap.h36
-rw-r--r--include/net/bluetooth/mgmt.h99
-rw-r--r--include/net/cfg80211.h38
-rw-r--r--include/net/dcbnl.h4
-rw-r--r--include/net/flow_keys.h1
-rw-r--r--include/net/if_inet6.h1
-rw-r--r--include/net/inet_sock.h6
-rw-r--r--include/net/inet_timewait_sock.h3
-rw-r--r--include/net/ip.h14
-rw-r--r--include/net/ipv6.h62
-rw-r--r--include/net/mac80211.h71
-rw-r--r--include/net/mac802154.h19
-rw-r--r--include/net/neighbour.h1
-rw-r--r--include/net/netfilter/nf_tables.h6
-rw-r--r--include/net/netns/ieee802154_6lowpan.h2
-rw-r--r--include/net/netns/ipv6.h1
-rw-r--r--include/net/rtnetlink.h1
-rw-r--r--include/net/sctp/command.h39
-rw-r--r--include/net/sctp/sctp.h22
-rw-r--r--include/net/sctp/structs.h7
-rw-r--r--include/net/sctp/ulpevent.h14
-rw-r--r--include/net/sock.h45
-rw-r--r--include/net/tcp.h58
-rw-r--r--include/net/udp.h29
-rw-r--r--include/net/udp_tunnel.h32
-rw-r--r--include/net/vxlan.h2
29 files changed, 707 insertions, 193 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 904777c1cd24..373000de610d 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -260,15 +260,15 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
260 260
261/* Skb helpers */ 261/* Skb helpers */
262struct l2cap_ctrl { 262struct l2cap_ctrl {
263 unsigned int sframe:1, 263 __u8 sframe:1,
264 poll:1, 264 poll:1,
265 final:1, 265 final:1,
266 fcs:1, 266 fcs:1,
267 sar:2, 267 sar:2,
268 super:2; 268 super:2;
269 __u16 reqseq; 269 __u16 reqseq;
270 __u16 txseq; 270 __u16 txseq;
271 __u8 retries; 271 __u8 retries;
272}; 272};
273 273
274struct hci_dev; 274struct hci_dev;
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 16587dcd6a91..a01236e2df13 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -81,10 +81,54 @@
81 81
82/* HCI device quirks */ 82/* HCI device quirks */
83enum { 83enum {
84 /* When this quirk is set, the HCI Reset command is send when
85 * closing the transport instead of when opening it.
86 *
87 * This quirk must be set before hci_register_dev is called.
88 */
84 HCI_QUIRK_RESET_ON_CLOSE, 89 HCI_QUIRK_RESET_ON_CLOSE,
90
91 /* When this quirk is set, the device is turned into a raw-only
92 * device and it will stay in unconfigured state.
93 *
94 * This quirk must be set before hci_register_dev is called.
95 */
85 HCI_QUIRK_RAW_DEVICE, 96 HCI_QUIRK_RAW_DEVICE,
97
98 /* When this quirk is set, the buffer sizes reported by
99 * HCI Read Buffer Size command are corrected if invalid.
100 *
101 * This quirk must be set before hci_register_dev is called.
102 */
86 HCI_QUIRK_FIXUP_BUFFER_SIZE, 103 HCI_QUIRK_FIXUP_BUFFER_SIZE,
104
105 /* When this quirk is set, then no stored link key handling
106 * is performed. This is mainly due to the fact that the
107 * HCI Delete Stored Link Key command is advertised, but
108 * not supported.
109 *
110 * This quirk must be set before hci_register_dev is called.
111 */
87 HCI_QUIRK_BROKEN_STORED_LINK_KEY, 112 HCI_QUIRK_BROKEN_STORED_LINK_KEY,
113
114 /* When this quirk is set, an external configuration step
115 * is required and will be indicated with the controller
116 * configuation.
117 *
118 * This quirk can be set before hci_register_dev is called or
119 * during the hdev->setup vendor callback.
120 */
121 HCI_QUIRK_EXTERNAL_CONFIG,
122
123 /* When this quirk is set, the public Bluetooth address
124 * initially reported by HCI Read BD Address command
125 * is considered invalid. Controller configuration is
126 * required before this device can be used.
127 *
128 * This quirk can be set before hci_register_dev is called or
129 * during the hdev->setup vendor callback.
130 */
131 HCI_QUIRK_INVALID_BDADDR,
88}; 132};
89 133
90/* HCI device flags */ 134/* HCI device flags */
@@ -104,24 +148,34 @@ enum {
104 HCI_RESET, 148 HCI_RESET,
105}; 149};
106 150
151/* BR/EDR and/or LE controller flags: the flags defined here should represent
152 * states configured via debugfs for debugging and testing purposes only.
153 */
154enum {
155 HCI_DUT_MODE,
156 HCI_FORCE_SC,
157 HCI_FORCE_STATIC_ADDR,
158};
159
107/* 160/*
108 * BR/EDR and/or LE controller flags: the flags defined here should represent 161 * BR/EDR and/or LE controller flags: the flags defined here should represent
109 * states from the controller. 162 * states from the controller.
110 */ 163 */
111enum { 164enum {
112 HCI_SETUP, 165 HCI_SETUP,
166 HCI_CONFIG,
113 HCI_AUTO_OFF, 167 HCI_AUTO_OFF,
114 HCI_RFKILLED, 168 HCI_RFKILLED,
115 HCI_MGMT, 169 HCI_MGMT,
116 HCI_PAIRABLE, 170 HCI_PAIRABLE,
117 HCI_SERVICE_CACHE, 171 HCI_SERVICE_CACHE,
118 HCI_DEBUG_KEYS, 172 HCI_KEEP_DEBUG_KEYS,
119 HCI_DUT_MODE, 173 HCI_USE_DEBUG_KEYS,
120 HCI_FORCE_SC,
121 HCI_FORCE_STATIC_ADDR,
122 HCI_UNREGISTER, 174 HCI_UNREGISTER,
175 HCI_UNCONFIGURED,
123 HCI_USER_CHANNEL, 176 HCI_USER_CHANNEL,
124 177 HCI_EXT_CONFIGURED,
178 HCI_LE_ADV,
125 HCI_LE_SCAN, 179 HCI_LE_SCAN,
126 HCI_SSP_ENABLED, 180 HCI_SSP_ENABLED,
127 HCI_SC_ENABLED, 181 HCI_SC_ENABLED,
@@ -139,7 +193,6 @@ enum {
139 HCI_PERIODIC_INQ, 193 HCI_PERIODIC_INQ,
140 HCI_FAST_CONNECTABLE, 194 HCI_FAST_CONNECTABLE,
141 HCI_BREDR_ENABLED, 195 HCI_BREDR_ENABLED,
142 HCI_6LOWPAN_ENABLED,
143 HCI_LE_SCAN_INTERRUPTED, 196 HCI_LE_SCAN_INTERRUPTED,
144}; 197};
145 198
@@ -147,7 +200,7 @@ enum {
147 * or the HCI device is closed. 200 * or the HCI device is closed.
148 */ 201 */
149#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \ 202#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
150 BIT(HCI_FAST_CONNECTABLE)) 203 BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV))
151 204
152/* HCI ioctl defines */ 205/* HCI ioctl defines */
153#define HCIDEVUP _IOW('H', 201, int) 206#define HCIDEVUP _IOW('H', 201, int)
@@ -185,6 +238,7 @@ enum {
185#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 238#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
186#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */ 239#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */
187#define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */ 240#define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */
241#define HCI_LE_AUTOCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
188 242
189/* HCI data types */ 243/* HCI data types */
190#define HCI_COMMAND_PKT 0x01 244#define HCI_COMMAND_PKT 0x01
@@ -301,6 +355,10 @@ enum {
301#define LMP_HOST_LE_BREDR 0x04 355#define LMP_HOST_LE_BREDR 0x04
302#define LMP_HOST_SC 0x08 356#define LMP_HOST_SC 0x08
303 357
358/* LE features */
359#define HCI_LE_CONN_PARAM_REQ_PROC 0x02
360#define HCI_LE_PING 0x10
361
304/* Connection modes */ 362/* Connection modes */
305#define HCI_CM_ACTIVE 0x0000 363#define HCI_CM_ACTIVE 0x0000
306#define HCI_CM_HOLD 0x0001 364#define HCI_CM_HOLD 0x0001
@@ -347,17 +405,9 @@ enum {
347#define HCI_LK_CHANGED_COMBINATION 0x06 405#define HCI_LK_CHANGED_COMBINATION 0x06
348#define HCI_LK_UNAUTH_COMBINATION_P256 0x07 406#define HCI_LK_UNAUTH_COMBINATION_P256 0x07
349#define HCI_LK_AUTH_COMBINATION_P256 0x08 407#define HCI_LK_AUTH_COMBINATION_P256 0x08
350/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
351#define HCI_SMP_STK 0x80
352#define HCI_SMP_STK_SLAVE 0x81
353#define HCI_SMP_LTK 0x82
354#define HCI_SMP_LTK_SLAVE 0x83
355
356/* Long Term Key types */
357#define HCI_LTK_UNAUTH 0x00
358#define HCI_LTK_AUTH 0x01
359 408
360/* ---- HCI Error Codes ---- */ 409/* ---- HCI Error Codes ---- */
410#define HCI_ERROR_UNKNOWN_CONN_ID 0x02
361#define HCI_ERROR_AUTH_FAILURE 0x05 411#define HCI_ERROR_AUTH_FAILURE 0x05
362#define HCI_ERROR_MEMORY_EXCEEDED 0x07 412#define HCI_ERROR_MEMORY_EXCEEDED 0x07
363#define HCI_ERROR_CONNECTION_TIMEOUT 0x08 413#define HCI_ERROR_CONNECTION_TIMEOUT 0x08
@@ -367,6 +417,7 @@ enum {
367#define HCI_ERROR_REMOTE_POWER_OFF 0x15 417#define HCI_ERROR_REMOTE_POWER_OFF 0x15
368#define HCI_ERROR_LOCAL_HOST_TERM 0x16 418#define HCI_ERROR_LOCAL_HOST_TERM 0x16
369#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 419#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
420#define HCI_ERROR_INVALID_LL_PARAMS 0x1E
370#define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c 421#define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c
371 422
372/* Flow control modes */ 423/* Flow control modes */
@@ -536,6 +587,11 @@ struct hci_cp_read_remote_version {
536 __le16 handle; 587 __le16 handle;
537} __packed; 588} __packed;
538 589
590#define HCI_OP_READ_CLOCK_OFFSET 0x041f
591struct hci_cp_read_clock_offset {
592 __le16 handle;
593} __packed;
594
539#define HCI_OP_SETUP_SYNC_CONN 0x0428 595#define HCI_OP_SETUP_SYNC_CONN 0x0428
540struct hci_cp_setup_sync_conn { 596struct hci_cp_setup_sync_conn {
541 __le16 handle; 597 __le16 handle;
@@ -1085,6 +1141,18 @@ struct hci_rp_read_rssi {
1085 __s8 rssi; 1141 __s8 rssi;
1086} __packed; 1142} __packed;
1087 1143
1144#define HCI_OP_READ_CLOCK 0x1407
1145struct hci_cp_read_clock {
1146 __le16 handle;
1147 __u8 which;
1148} __packed;
1149struct hci_rp_read_clock {
1150 __u8 status;
1151 __le16 handle;
1152 __le32 clock;
1153 __le16 accuracy;
1154} __packed;
1155
1088#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 1156#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
1089struct hci_rp_read_local_amp_info { 1157struct hci_rp_read_local_amp_info {
1090 __u8 status; 1158 __u8 status;
@@ -1291,6 +1359,23 @@ struct hci_rp_le_read_supported_states {
1291 __u8 le_states[8]; 1359 __u8 le_states[8];
1292} __packed; 1360} __packed;
1293 1361
1362#define HCI_OP_LE_CONN_PARAM_REQ_REPLY 0x2020
1363struct hci_cp_le_conn_param_req_reply {
1364 __le16 handle;
1365 __le16 interval_min;
1366 __le16 interval_max;
1367 __le16 latency;
1368 __le16 timeout;
1369 __le16 min_ce_len;
1370 __le16 max_ce_len;
1371} __packed;
1372
1373#define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY 0x2021
1374struct hci_cp_le_conn_param_req_neg_reply {
1375 __le16 handle;
1376 __u8 reason;
1377} __packed;
1378
1294/* ---- HCI Events ---- */ 1379/* ---- HCI Events ---- */
1295#define HCI_EV_INQUIRY_COMPLETE 0x01 1380#define HCI_EV_INQUIRY_COMPLETE 0x01
1296 1381
@@ -1670,6 +1755,15 @@ struct hci_ev_le_conn_complete {
1670 __u8 clk_accurancy; 1755 __u8 clk_accurancy;
1671} __packed; 1756} __packed;
1672 1757
1758#define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03
1759struct hci_ev_le_conn_update_complete {
1760 __u8 status;
1761 __le16 handle;
1762 __le16 interval;
1763 __le16 latency;
1764 __le16 supervision_timeout;
1765} __packed;
1766
1673#define HCI_EV_LE_LTK_REQ 0x05 1767#define HCI_EV_LE_LTK_REQ 0x05
1674struct hci_ev_le_ltk_req { 1768struct hci_ev_le_ltk_req {
1675 __le16 handle; 1769 __le16 handle;
@@ -1677,6 +1771,15 @@ struct hci_ev_le_ltk_req {
1677 __le16 ediv; 1771 __le16 ediv;
1678} __packed; 1772} __packed;
1679 1773
1774#define HCI_EV_LE_REMOTE_CONN_PARAM_REQ 0x06
1775struct hci_ev_le_remote_conn_param_req {
1776 __le16 handle;
1777 __le16 interval_min;
1778 __le16 interval_max;
1779 __le16 latency;
1780 __le16 timeout;
1781} __packed;
1782
1680/* Advertising report event types */ 1783/* Advertising report event types */
1681#define LE_ADV_IND 0x00 1784#define LE_ADV_IND 0x00
1682#define LE_ADV_DIRECT_IND 0x01 1785#define LE_ADV_DIRECT_IND 0x01
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index b386bf17e6c2..e69c2b08c0c6 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -71,6 +71,7 @@ struct discovery_state {
71 bdaddr_t last_adv_addr; 71 bdaddr_t last_adv_addr;
72 u8 last_adv_addr_type; 72 u8 last_adv_addr_type;
73 s8 last_adv_rssi; 73 s8 last_adv_rssi;
74 u32 last_adv_flags;
74 u8 last_adv_data[HCI_MAX_AD_LENGTH]; 75 u8 last_adv_data[HCI_MAX_AD_LENGTH];
75 u8 last_adv_data_len; 76 u8 last_adv_data_len;
76}; 77};
@@ -170,6 +171,8 @@ struct hci_dev {
170 __u8 bus; 171 __u8 bus;
171 __u8 dev_type; 172 __u8 dev_type;
172 bdaddr_t bdaddr; 173 bdaddr_t bdaddr;
174 bdaddr_t setup_addr;
175 bdaddr_t public_addr;
173 bdaddr_t random_addr; 176 bdaddr_t random_addr;
174 bdaddr_t static_addr; 177 bdaddr_t static_addr;
175 __u8 adv_addr_type; 178 __u8 adv_addr_type;
@@ -203,10 +206,13 @@ struct hci_dev {
203 __u16 le_scan_window; 206 __u16 le_scan_window;
204 __u16 le_conn_min_interval; 207 __u16 le_conn_min_interval;
205 __u16 le_conn_max_interval; 208 __u16 le_conn_max_interval;
209 __u16 le_conn_latency;
210 __u16 le_supv_timeout;
206 __u16 discov_interleaved_timeout; 211 __u16 discov_interleaved_timeout;
207 __u16 conn_info_min_age; 212 __u16 conn_info_min_age;
208 __u16 conn_info_max_age; 213 __u16 conn_info_max_age;
209 __u8 ssp_debug_mode; 214 __u8 ssp_debug_mode;
215 __u32 clock;
210 216
211 __u16 devid_source; 217 __u16 devid_source;
212 __u16 devid_vendor; 218 __u16 devid_vendor;
@@ -273,7 +279,7 @@ struct hci_dev {
273 279
274 struct delayed_work service_cache; 280 struct delayed_work service_cache;
275 281
276 struct timer_list cmd_timer; 282 struct delayed_work cmd_timer;
277 283
278 struct work_struct rx_work; 284 struct work_struct rx_work;
279 struct work_struct cmd_work; 285 struct work_struct cmd_work;
@@ -299,6 +305,7 @@ struct hci_dev {
299 305
300 struct list_head mgmt_pending; 306 struct list_head mgmt_pending;
301 struct list_head blacklist; 307 struct list_head blacklist;
308 struct list_head whitelist;
302 struct list_head uuids; 309 struct list_head uuids;
303 struct list_head link_keys; 310 struct list_head link_keys;
304 struct list_head long_term_keys; 311 struct list_head long_term_keys;
@@ -307,6 +314,7 @@ struct hci_dev {
307 struct list_head le_white_list; 314 struct list_head le_white_list;
308 struct list_head le_conn_params; 315 struct list_head le_conn_params;
309 struct list_head pend_le_conns; 316 struct list_head pend_le_conns;
317 struct list_head pend_le_reports;
310 318
311 struct hci_dev_stats stat; 319 struct hci_dev_stats stat;
312 320
@@ -318,6 +326,7 @@ struct hci_dev {
318 326
319 struct rfkill *rfkill; 327 struct rfkill *rfkill;
320 328
329 unsigned long dbg_flags;
321 unsigned long dev_flags; 330 unsigned long dev_flags;
322 331
323 struct delayed_work le_scan_disable; 332 struct delayed_work le_scan_disable;
@@ -339,6 +348,7 @@ struct hci_dev {
339 int (*setup)(struct hci_dev *hdev); 348 int (*setup)(struct hci_dev *hdev);
340 int (*send)(struct hci_dev *hdev, struct sk_buff *skb); 349 int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
341 void (*notify)(struct hci_dev *hdev, unsigned int evt); 350 void (*notify)(struct hci_dev *hdev, unsigned int evt);
351 int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
342}; 352};
343 353
344#define HCI_PHY_HANDLE(handle) (handle & 0xff) 354#define HCI_PHY_HANDLE(handle) (handle & 0xff)
@@ -366,7 +376,6 @@ struct hci_conn {
366 __u8 features[HCI_MAX_PAGES][8]; 376 __u8 features[HCI_MAX_PAGES][8];
367 __u16 pkt_type; 377 __u16 pkt_type;
368 __u16 link_policy; 378 __u16 link_policy;
369 __u32 link_mode;
370 __u8 key_type; 379 __u8 key_type;
371 __u8 auth_type; 380 __u8 auth_type;
372 __u8 sec_level; 381 __u8 sec_level;
@@ -377,20 +386,26 @@ struct hci_conn {
377 __u32 passkey_notify; 386 __u32 passkey_notify;
378 __u8 passkey_entered; 387 __u8 passkey_entered;
379 __u16 disc_timeout; 388 __u16 disc_timeout;
389 __u16 conn_timeout;
380 __u16 setting; 390 __u16 setting;
381 __u16 le_conn_min_interval; 391 __u16 le_conn_min_interval;
382 __u16 le_conn_max_interval; 392 __u16 le_conn_max_interval;
393 __u16 le_conn_interval;
394 __u16 le_conn_latency;
395 __u16 le_supv_timeout;
383 __s8 rssi; 396 __s8 rssi;
384 __s8 tx_power; 397 __s8 tx_power;
385 __s8 max_tx_power; 398 __s8 max_tx_power;
386 unsigned long flags; 399 unsigned long flags;
387 400
401 __u32 clock;
402 __u16 clock_accuracy;
403
388 unsigned long conn_info_timestamp; 404 unsigned long conn_info_timestamp;
389 405
390 __u8 remote_cap; 406 __u8 remote_cap;
391 __u8 remote_auth; 407 __u8 remote_auth;
392 __u8 remote_id; 408 __u8 remote_id;
393 bool flush_key;
394 409
395 unsigned int sent; 410 unsigned int sent;
396 411
@@ -407,7 +422,6 @@ struct hci_conn {
407 struct hci_dev *hdev; 422 struct hci_dev *hdev;
408 void *l2cap_data; 423 void *l2cap_data;
409 void *sco_data; 424 void *sco_data;
410 void *smp_conn;
411 struct amp_mgr *amp_mgr; 425 struct amp_mgr *amp_mgr;
412 426
413 struct hci_conn *link; 427 struct hci_conn *link;
@@ -428,15 +442,19 @@ struct hci_chan {
428 442
429struct hci_conn_params { 443struct hci_conn_params {
430 struct list_head list; 444 struct list_head list;
445 struct list_head action;
431 446
432 bdaddr_t addr; 447 bdaddr_t addr;
433 u8 addr_type; 448 u8 addr_type;
434 449
435 u16 conn_min_interval; 450 u16 conn_min_interval;
436 u16 conn_max_interval; 451 u16 conn_max_interval;
452 u16 conn_latency;
453 u16 supervision_timeout;
437 454
438 enum { 455 enum {
439 HCI_AUTO_CONN_DISABLED, 456 HCI_AUTO_CONN_DISABLED,
457 HCI_AUTO_CONN_REPORT,
440 HCI_AUTO_CONN_ALWAYS, 458 HCI_AUTO_CONN_ALWAYS,
441 HCI_AUTO_CONN_LINK_LOSS, 459 HCI_AUTO_CONN_LINK_LOSS,
442 } auto_connect; 460 } auto_connect;
@@ -501,8 +519,8 @@ struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
501 int state); 519 int state);
502void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, 520void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
503 struct inquiry_entry *ie); 521 struct inquiry_entry *ie);
504bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data, 522u32 hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
505 bool name_known, bool *ssp); 523 bool name_known);
506void hci_inquiry_cache_flush(struct hci_dev *hdev); 524void hci_inquiry_cache_flush(struct hci_dev *hdev);
507 525
508/* ----- HCI Connections ----- */ 526/* ----- HCI Connections ----- */
@@ -520,7 +538,13 @@ enum {
520 HCI_CONN_AES_CCM, 538 HCI_CONN_AES_CCM,
521 HCI_CONN_POWER_SAVE, 539 HCI_CONN_POWER_SAVE,
522 HCI_CONN_REMOTE_OOB, 540 HCI_CONN_REMOTE_OOB,
523 HCI_CONN_6LOWPAN, 541 HCI_CONN_FLUSH_KEY,
542 HCI_CONN_MASTER,
543 HCI_CONN_ENCRYPT,
544 HCI_CONN_AUTH,
545 HCI_CONN_SECURE,
546 HCI_CONN_FIPS,
547 HCI_CONN_STK_ENCRYPT,
524}; 548};
525 549
526static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) 550static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
@@ -681,7 +705,8 @@ void hci_chan_list_flush(struct hci_conn *conn);
681struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle); 705struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
682 706
683struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, 707struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
684 u8 dst_type, u8 sec_level, u8 auth_type); 708 u8 dst_type, u8 sec_level, u16 conn_timeout,
709 bool master);
685struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst, 710struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
686 u8 sec_level, u8 auth_type); 711 u8 sec_level, u8 auth_type);
687struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, 712struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
@@ -825,30 +850,25 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);
825int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); 850int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
826int hci_inquiry(void __user *arg); 851int hci_inquiry(void __user *arg);
827 852
828struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, 853struct bdaddr_list *hci_bdaddr_list_lookup(struct list_head *list,
829 bdaddr_t *bdaddr, u8 type); 854 bdaddr_t *bdaddr, u8 type);
830int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 855int hci_bdaddr_list_add(struct list_head *list, bdaddr_t *bdaddr, u8 type);
831int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 856int hci_bdaddr_list_del(struct list_head *list, bdaddr_t *bdaddr, u8 type);
832 857void hci_bdaddr_list_clear(struct list_head *list);
833struct bdaddr_list *hci_white_list_lookup(struct hci_dev *hdev,
834 bdaddr_t *bdaddr, u8 type);
835void hci_white_list_clear(struct hci_dev *hdev);
836int hci_white_list_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
837int hci_white_list_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
838 858
839struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev, 859struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev,
840 bdaddr_t *addr, u8 addr_type); 860 bdaddr_t *addr, u8 addr_type);
841int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type, 861struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev,
842 u8 auto_connect, u16 conn_min_interval, 862 bdaddr_t *addr, u8 addr_type);
843 u16 conn_max_interval); 863int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
864 u8 auto_connect);
844void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); 865void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
845void hci_conn_params_clear(struct hci_dev *hdev); 866void hci_conn_params_clear_all(struct hci_dev *hdev);
867void hci_conn_params_clear_disabled(struct hci_dev *hdev);
846 868
847struct bdaddr_list *hci_pend_le_conn_lookup(struct hci_dev *hdev, 869struct hci_conn_params *hci_pend_le_action_lookup(struct list_head *list,
848 bdaddr_t *addr, u8 addr_type); 870 bdaddr_t *addr,
849void hci_pend_le_conn_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); 871 u8 addr_type);
850void hci_pend_le_conn_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
851void hci_pend_le_conns_clear(struct hci_dev *hdev);
852 872
853void hci_update_background_scan(struct hci_dev *hdev); 873void hci_update_background_scan(struct hci_dev *hdev);
854 874
@@ -856,8 +876,9 @@ void hci_uuids_clear(struct hci_dev *hdev);
856 876
857void hci_link_keys_clear(struct hci_dev *hdev); 877void hci_link_keys_clear(struct hci_dev *hdev);
858struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 878struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
859int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, 879struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn,
860 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); 880 bdaddr_t *bdaddr, u8 *val, u8 type,
881 u8 pin_len, bool *persistent);
861struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand, 882struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand,
862 bool master); 883 bool master);
863struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, 884struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
@@ -1021,7 +1042,7 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
1021 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) 1042 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
1022 return; 1043 return;
1023 1044
1024 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 1045 encrypt = test_bit(HCI_CONN_ENCRYPT, &conn->flags) ? 0x01 : 0x00;
1025 l2cap_security_cfm(conn, status, encrypt); 1046 l2cap_security_cfm(conn, status, encrypt);
1026 1047
1027 if (conn->security_cfm_cb) 1048 if (conn->security_cfm_cb)
@@ -1062,7 +1083,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
1062 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) 1083 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
1063 return; 1084 return;
1064 1085
1065 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 1086 encrypt = test_bit(HCI_CONN_ENCRYPT, &conn->flags) ? 0x01 : 0x00;
1066 1087
1067 read_lock(&hci_cb_list_lock); 1088 read_lock(&hci_cb_list_lock);
1068 list_for_each_entry(cb, &hci_cb_list, list) { 1089 list_for_each_entry(cb, &hci_cb_list, list) {
@@ -1147,7 +1168,7 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
1147 1168
1148static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type) 1169static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type)
1149{ 1170{
1150 if (addr_type != 0x01) 1171 if (addr_type != ADDR_LE_DEV_RANDOM)
1151 return false; 1172 return false;
1152 1173
1153 if ((bdaddr->b[5] & 0xc0) == 0x40) 1174 if ((bdaddr->b[5] & 0xc0) == 0x40)
@@ -1156,6 +1177,18 @@ static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type)
1156 return false; 1177 return false;
1157} 1178}
1158 1179
1180static inline bool hci_is_identity_address(bdaddr_t *addr, u8 addr_type)
1181{
1182 if (addr_type == ADDR_LE_DEV_PUBLIC)
1183 return true;
1184
1185 /* Check for Random Static address type */
1186 if ((addr->b[5] & 0xc0) == 0xc0)
1187 return true;
1188
1189 return false;
1190}
1191
1159static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev, 1192static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev,
1160 bdaddr_t *bdaddr, u8 addr_type) 1193 bdaddr_t *bdaddr, u8 addr_type)
1161{ 1194{
@@ -1165,6 +1198,27 @@ static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev,
1165 return hci_find_irk_by_rpa(hdev, bdaddr); 1198 return hci_find_irk_by_rpa(hdev, bdaddr);
1166} 1199}
1167 1200
1201static inline int hci_check_conn_params(u16 min, u16 max, u16 latency,
1202 u16 to_multiplier)
1203{
1204 u16 max_latency;
1205
1206 if (min > max || min < 6 || max > 3200)
1207 return -EINVAL;
1208
1209 if (to_multiplier < 10 || to_multiplier > 3200)
1210 return -EINVAL;
1211
1212 if (max >= to_multiplier * 8)
1213 return -EINVAL;
1214
1215 max_latency = (to_multiplier * 8 / max) - 1;
1216 if (latency > 499 || latency > max_latency)
1217 return -EINVAL;
1218
1219 return 0;
1220}
1221
1168int hci_register_cb(struct hci_cb *hcb); 1222int hci_register_cb(struct hci_cb *hcb);
1169int hci_unregister_cb(struct hci_cb *hcb); 1223int hci_unregister_cb(struct hci_cb *hcb);
1170 1224
@@ -1227,6 +1281,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
1227#define DISCOV_BREDR_INQUIRY_LEN 0x08 1281#define DISCOV_BREDR_INQUIRY_LEN 0x08
1228 1282
1229int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 1283int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
1284int mgmt_new_settings(struct hci_dev *hdev);
1230void mgmt_index_added(struct hci_dev *hdev); 1285void mgmt_index_added(struct hci_dev *hdev);
1231void mgmt_index_removed(struct hci_dev *hdev); 1286void mgmt_index_removed(struct hci_dev *hdev);
1232void mgmt_set_powered_failed(struct hci_dev *hdev, int err); 1287void mgmt_set_powered_failed(struct hci_dev *hdev, int err);
@@ -1234,7 +1289,6 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered);
1234void mgmt_discoverable_timeout(struct hci_dev *hdev); 1289void mgmt_discoverable_timeout(struct hci_dev *hdev);
1235void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); 1290void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
1236void mgmt_connectable(struct hci_dev *hdev, u8 connectable); 1291void mgmt_connectable(struct hci_dev *hdev, u8 connectable);
1237void mgmt_advertising(struct hci_dev *hdev, u8 advertising);
1238void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 1292void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
1239void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1293void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1240 bool persistent); 1294 bool persistent);
@@ -1281,18 +1335,18 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
1281 u8 *randomizer192, u8 *hash256, 1335 u8 *randomizer192, u8 *hash256,
1282 u8 *randomizer256, u8 status); 1336 u8 *randomizer256, u8 status);
1283void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1337void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1284 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, 1338 u8 addr_type, u8 *dev_class, s8 rssi, u32 flags,
1285 u8 ssp, u8 *eir, u16 eir_len, u8 *scan_rsp, 1339 u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len);
1286 u8 scan_rsp_len);
1287void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1340void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1288 u8 addr_type, s8 rssi, u8 *name, u8 name_len); 1341 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
1289void mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1342void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1290int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1291int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1292void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent); 1343void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent);
1293void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk); 1344void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk);
1294void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk, 1345void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
1295 bool persistent); 1346 bool persistent);
1347void mgmt_new_conn_param(struct hci_dev *hdev, bdaddr_t *bdaddr,
1348 u8 bdaddr_type, u8 store_hint, u16 min_interval,
1349 u16 max_interval, u16 latency, u16 timeout);
1296void mgmt_reenable_advertising(struct hci_dev *hdev); 1350void mgmt_reenable_advertising(struct hci_dev *hdev);
1297void mgmt_smp_complete(struct hci_conn *conn, bool complete); 1351void mgmt_smp_complete(struct hci_conn *conn, bool complete);
1298 1352
@@ -1324,8 +1378,8 @@ struct hci_sec_filter {
1324#define hci_req_lock(d) mutex_lock(&d->req_lock) 1378#define hci_req_lock(d) mutex_lock(&d->req_lock)
1325#define hci_req_unlock(d) mutex_unlock(&d->req_lock) 1379#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
1326 1380
1327void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, 1381u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency,
1328 u16 latency, u16 to_multiplier); 1382 u16 to_multiplier);
1329void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand, 1383void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
1330 __u8 ltk[16]); 1384 __u8 ltk[16]);
1331 1385
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 4abdcb220e3a..e0c6a9abdb62 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -137,7 +137,6 @@ struct l2cap_conninfo {
137#define L2CAP_FC_L2CAP 0x02 137#define L2CAP_FC_L2CAP 0x02
138#define L2CAP_FC_CONNLESS 0x04 138#define L2CAP_FC_CONNLESS 0x04
139#define L2CAP_FC_A2MP 0x08 139#define L2CAP_FC_A2MP 0x08
140#define L2CAP_FC_6LOWPAN 0x3e /* reserved and temporary value */
141 140
142/* L2CAP Control Field bit masks */ 141/* L2CAP Control Field bit masks */
143#define L2CAP_CTRL_SAR 0xC000 142#define L2CAP_CTRL_SAR 0xC000
@@ -579,7 +578,7 @@ struct l2cap_chan {
579 struct list_head global_l; 578 struct list_head global_l;
580 579
581 void *data; 580 void *data;
582 struct l2cap_ops *ops; 581 const struct l2cap_ops *ops;
583 struct mutex lock; 582 struct mutex lock;
584}; 583};
585 584
@@ -600,7 +599,12 @@ struct l2cap_ops {
600 void (*set_shutdown) (struct l2cap_chan *chan); 599 void (*set_shutdown) (struct l2cap_chan *chan);
601 long (*get_sndtimeo) (struct l2cap_chan *chan); 600 long (*get_sndtimeo) (struct l2cap_chan *chan);
602 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 601 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
602 unsigned long hdr_len,
603 unsigned long len, int nb); 603 unsigned long len, int nb);
604 int (*memcpy_fromiovec) (struct l2cap_chan *chan,
605 unsigned char *kdata,
606 struct iovec *iov,
607 int len);
604}; 608};
605 609
606struct l2cap_conn { 610struct l2cap_conn {
@@ -856,6 +860,31 @@ static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
856 return 0; 860 return 0;
857} 861}
858 862
863static inline int l2cap_chan_no_memcpy_fromiovec(struct l2cap_chan *chan,
864 unsigned char *kdata,
865 struct iovec *iov,
866 int len)
867{
868 /* Following is safe since for compiler definitions of kvec and
869 * iovec are identical, yielding the same in-core layout and alignment
870 */
871 struct kvec *vec = (struct kvec *)iov;
872
873 while (len > 0) {
874 if (vec->iov_len) {
875 int copy = min_t(unsigned int, len, vec->iov_len);
876 memcpy(kdata, vec->iov_base, copy);
877 len -= copy;
878 kdata += copy;
879 vec->iov_base += copy;
880 vec->iov_len -= copy;
881 }
882 vec++;
883 }
884
885 return 0;
886}
887
859extern bool disable_ertm; 888extern bool disable_ertm;
860 889
861int l2cap_init_sockets(void); 890int l2cap_init_sockets(void);
@@ -872,8 +901,7 @@ struct l2cap_chan *l2cap_chan_create(void);
872void l2cap_chan_close(struct l2cap_chan *chan, int reason); 901void l2cap_chan_close(struct l2cap_chan *chan, int reason);
873int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, 902int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
874 bdaddr_t *dst, u8 dst_type); 903 bdaddr_t *dst, u8 dst_type);
875int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, 904int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len);
876 u32 priority);
877void l2cap_chan_busy(struct l2cap_chan *chan, int busy); 905void l2cap_chan_busy(struct l2cap_chan *chan, int busy);
878int l2cap_chan_check_security(struct l2cap_chan *chan); 906int l2cap_chan_check_security(struct l2cap_chan *chan);
879void l2cap_chan_set_defaults(struct l2cap_chan *chan); 907void l2cap_chan_set_defaults(struct l2cap_chan *chan);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index bcffc9ae0c89..623d5203c592 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -97,6 +97,7 @@ struct mgmt_rp_read_index_list {
97#define MGMT_SETTING_SECURE_CONN 0x00000800 97#define MGMT_SETTING_SECURE_CONN 0x00000800
98#define MGMT_SETTING_DEBUG_KEYS 0x00001000 98#define MGMT_SETTING_DEBUG_KEYS 0x00001000
99#define MGMT_SETTING_PRIVACY 0x00002000 99#define MGMT_SETTING_PRIVACY 0x00002000
100#define MGMT_SETTING_CONFIGURATION 0x00004000
100 101
101#define MGMT_OP_READ_INFO 0x0004 102#define MGMT_OP_READ_INFO 0x0004
102#define MGMT_READ_INFO_SIZE 0 103#define MGMT_READ_INFO_SIZE 0
@@ -424,6 +425,76 @@ struct mgmt_rp_get_conn_info {
424 __s8 max_tx_power; 425 __s8 max_tx_power;
425} __packed; 426} __packed;
426 427
428#define MGMT_OP_GET_CLOCK_INFO 0x0032
429struct mgmt_cp_get_clock_info {
430 struct mgmt_addr_info addr;
431} __packed;
432#define MGMT_GET_CLOCK_INFO_SIZE MGMT_ADDR_INFO_SIZE
433struct mgmt_rp_get_clock_info {
434 struct mgmt_addr_info addr;
435 __le32 local_clock;
436 __le32 piconet_clock;
437 __le16 accuracy;
438} __packed;
439
440#define MGMT_OP_ADD_DEVICE 0x0033
441struct mgmt_cp_add_device {
442 struct mgmt_addr_info addr;
443 __u8 action;
444} __packed;
445#define MGMT_ADD_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
446
447#define MGMT_OP_REMOVE_DEVICE 0x0034
448struct mgmt_cp_remove_device {
449 struct mgmt_addr_info addr;
450} __packed;
451#define MGMT_REMOVE_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
452
453struct mgmt_conn_param {
454 struct mgmt_addr_info addr;
455 __le16 min_interval;
456 __le16 max_interval;
457 __le16 latency;
458 __le16 timeout;
459} __packed;
460
461#define MGMT_OP_LOAD_CONN_PARAM 0x0035
462struct mgmt_cp_load_conn_param {
463 __le16 param_count;
464 struct mgmt_conn_param params[0];
465} __packed;
466#define MGMT_LOAD_CONN_PARAM_SIZE 2
467
468#define MGMT_OP_READ_UNCONF_INDEX_LIST 0x0036
469#define MGMT_READ_UNCONF_INDEX_LIST_SIZE 0
470struct mgmt_rp_read_unconf_index_list {
471 __le16 num_controllers;
472 __le16 index[0];
473} __packed;
474
475#define MGMT_OPTION_EXTERNAL_CONFIG 0x00000001
476#define MGMT_OPTION_PUBLIC_ADDRESS 0x00000002
477
478#define MGMT_OP_READ_CONFIG_INFO 0x0037
479#define MGMT_READ_CONFIG_INFO_SIZE 0
480struct mgmt_rp_read_config_info {
481 __le16 manufacturer;
482 __le32 supported_options;
483 __le32 missing_options;
484} __packed;
485
486#define MGMT_OP_SET_EXTERNAL_CONFIG 0x0038
487struct mgmt_cp_set_external_config {
488 __u8 config;
489} __packed;
490#define MGMT_SET_EXTERNAL_CONFIG_SIZE 1
491
492#define MGMT_OP_SET_PUBLIC_ADDRESS 0x0039
493struct mgmt_cp_set_public_address {
494 bdaddr_t bdaddr;
495} __packed;
496#define MGMT_SET_PUBLIC_ADDRESS_SIZE 6
497
427#define MGMT_EV_CMD_COMPLETE 0x0001 498#define MGMT_EV_CMD_COMPLETE 0x0001
428struct mgmt_ev_cmd_complete { 499struct mgmt_ev_cmd_complete {
429 __le16 opcode; 500 __le16 opcode;
@@ -522,6 +593,7 @@ struct mgmt_ev_auth_failed {
522 593
523#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01 594#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01
524#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02 595#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02
596#define MGMT_DEV_FOUND_NOT_CONNECTABLE 0x04
525 597
526#define MGMT_EV_DEVICE_FOUND 0x0012 598#define MGMT_EV_DEVICE_FOUND 0x0012
527struct mgmt_ev_device_found { 599struct mgmt_ev_device_found {
@@ -578,3 +650,30 @@ struct mgmt_ev_new_csrk {
578 __u8 store_hint; 650 __u8 store_hint;
579 struct mgmt_csrk_info key; 651 struct mgmt_csrk_info key;
580} __packed; 652} __packed;
653
654#define MGMT_EV_DEVICE_ADDED 0x001a
655struct mgmt_ev_device_added {
656 struct mgmt_addr_info addr;
657 __u8 action;
658} __packed;
659
660#define MGMT_EV_DEVICE_REMOVED 0x001b
661struct mgmt_ev_device_removed {
662 struct mgmt_addr_info addr;
663} __packed;
664
665#define MGMT_EV_NEW_CONN_PARAM 0x001c
666struct mgmt_ev_new_conn_param {
667 struct mgmt_addr_info addr;
668 __u8 store_hint;
669 __le16 min_interval;
670 __le16 max_interval;
671 __le16 latency;
672 __le16 timeout;
673} __packed;
674
675#define MGMT_EV_UNCONF_INDEX_ADDED 0x001d
676
677#define MGMT_EV_UNCONF_INDEX_REMOVED 0x001e
678
679#define MGMT_EV_NEW_CONFIG_OPTIONS 0x001f
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index e46c437944f7..0a080c4de275 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2266,10 +2266,6 @@ struct cfg80211_qos_map {
2266 * 2266 *
2267 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 2267 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
2268 * 2268 *
2269 * @set_ringparam: Set tx and rx ring sizes.
2270 *
2271 * @get_ringparam: Get tx and rx ring current and maximum sizes.
2272 *
2273 * @tdls_mgmt: Transmit a TDLS management frame. 2269 * @tdls_mgmt: Transmit a TDLS management frame.
2274 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). 2270 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
2275 * 2271 *
@@ -2278,16 +2274,6 @@ struct cfg80211_qos_map {
2278 * 2274 *
2279 * @set_noack_map: Set the NoAck Map for the TIDs. 2275 * @set_noack_map: Set the NoAck Map for the TIDs.
2280 * 2276 *
2281 * @get_et_sset_count: Ethtool API to get string-set count.
2282 * See @ethtool_ops.get_sset_count
2283 *
2284 * @get_et_stats: Ethtool API to get a set of u64 stats.
2285 * See @ethtool_ops.get_ethtool_stats
2286 *
2287 * @get_et_strings: Ethtool API to get a set of strings to describe stats
2288 * and perhaps other supported types of ethtool data-sets.
2289 * See @ethtool_ops.get_strings
2290 *
2291 * @get_channel: Get the current operating channel for the virtual interface. 2277 * @get_channel: Get the current operating channel for the virtual interface.
2292 * For monitor interfaces, it should return %NULL unless there's a single 2278 * For monitor interfaces, it should return %NULL unless there's a single
2293 * current monitoring channel. 2279 * current monitoring channel.
@@ -2315,7 +2301,12 @@ struct cfg80211_qos_map {
2315 * reliability. This operation can not fail. 2301 * reliability. This operation can not fail.
2316 * @set_coalesce: Set coalesce parameters. 2302 * @set_coalesce: Set coalesce parameters.
2317 * 2303 *
2318 * @channel_switch: initiate channel-switch procedure (with CSA) 2304 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
2305 * responsible for veryfing if the switch is possible. Since this is
2306 * inherently tricky driver may decide to disconnect an interface later
2307 * with cfg80211_stop_iface(). This doesn't mean driver can accept
2308 * everything. It should do it's best to verify requests and reject them
2309 * as soon as possible.
2319 * 2310 *
2320 * @set_qos_map: Set QoS mapping information to the driver 2311 * @set_qos_map: Set QoS mapping information to the driver
2321 * 2312 *
@@ -2503,10 +2494,6 @@ struct cfg80211_ops {
2503 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 2494 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
2504 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 2495 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
2505 2496
2506 int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx);
2507 void (*get_ringparam)(struct wiphy *wiphy,
2508 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
2509
2510 int (*sched_scan_start)(struct wiphy *wiphy, 2497 int (*sched_scan_start)(struct wiphy *wiphy,
2511 struct net_device *dev, 2498 struct net_device *dev,
2512 struct cfg80211_sched_scan_request *request); 2499 struct cfg80211_sched_scan_request *request);
@@ -2518,7 +2505,7 @@ struct cfg80211_ops {
2518 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2505 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2519 const u8 *peer, u8 action_code, u8 dialog_token, 2506 const u8 *peer, u8 action_code, u8 dialog_token,
2520 u16 status_code, u32 peer_capability, 2507 u16 status_code, u32 peer_capability,
2521 const u8 *buf, size_t len); 2508 bool initiator, const u8 *buf, size_t len);
2522 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 2509 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
2523 const u8 *peer, enum nl80211_tdls_operation oper); 2510 const u8 *peer, enum nl80211_tdls_operation oper);
2524 2511
@@ -2529,13 +2516,6 @@ struct cfg80211_ops {
2529 struct net_device *dev, 2516 struct net_device *dev,
2530 u16 noack_map); 2517 u16 noack_map);
2531 2518
2532 int (*get_et_sset_count)(struct wiphy *wiphy,
2533 struct net_device *dev, int sset);
2534 void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
2535 struct ethtool_stats *stats, u64 *data);
2536 void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
2537 u32 sset, u8 *data);
2538
2539 int (*get_channel)(struct wiphy *wiphy, 2519 int (*get_channel)(struct wiphy *wiphy,
2540 struct wireless_dev *wdev, 2520 struct wireless_dev *wdev,
2541 struct cfg80211_chan_def *chandef); 2521 struct cfg80211_chan_def *chandef);
@@ -4843,6 +4823,10 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
4843 */ 4823 */
4844void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); 4824void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
4845 4825
4826
4827/* ethtool helper */
4828void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
4829
4846/* Logging, debugging and troubleshooting/diagnostic helpers. */ 4830/* Logging, debugging and troubleshooting/diagnostic helpers. */
4847 4831
4848/* wiphy_printk helpers, similar to dev_printk */ 4832/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index a975edf21b22..597b88a94332 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -81,8 +81,8 @@ struct dcbnl_rtnl_ops {
81 void (*setbcncfg)(struct net_device *, int, u32); 81 void (*setbcncfg)(struct net_device *, int, u32);
82 void (*getbcnrp)(struct net_device *, int, u8 *); 82 void (*getbcnrp)(struct net_device *, int, u8 *);
83 void (*setbcnrp)(struct net_device *, int, u8); 83 void (*setbcnrp)(struct net_device *, int, u8);
84 u8 (*setapp)(struct net_device *, u8, u16, u8); 84 int (*setapp)(struct net_device *, u8, u16, u8);
85 u8 (*getapp)(struct net_device *, u8, u16); 85 int (*getapp)(struct net_device *, u8, u16);
86 u8 (*getfeatcfg)(struct net_device *, int, u8 *); 86 u8 (*getfeatcfg)(struct net_device *, int, u8 *);
87 u8 (*setfeatcfg)(struct net_device *, int, u8); 87 u8 (*setfeatcfg)(struct net_device *, int, u8);
88 88
diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
index fbefdca5e283..6667a054763a 100644
--- a/include/net/flow_keys.h
+++ b/include/net/flow_keys.h
@@ -29,4 +29,5 @@ struct flow_keys {
29 29
30bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow); 30bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow);
31__be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto); 31__be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto);
32u32 flow_hash_from_keys(struct flow_keys *keys);
32#endif 33#endif
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index b4956a5fcc3f..d07b1a64b4e7 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -205,6 +205,7 @@ struct inet6_dev {
205 struct timer_list rs_timer; 205 struct timer_list rs_timer;
206 __u8 rs_probes; 206 __u8 rs_probes;
207 207
208 __u8 addr_gen_mode;
208 unsigned long tstamp; /* ipv6InterfaceTable update timestamp */ 209 unsigned long tstamp; /* ipv6InterfaceTable update timestamp */
209 struct rcu_head rcu; 210 struct rcu_head rcu;
210}; 211};
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index b1edf17bec01..a829b77523cf 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -88,8 +88,10 @@ struct inet_request_sock {
88 acked : 1, 88 acked : 1,
89 no_srccheck: 1; 89 no_srccheck: 1;
90 kmemcheck_bitfield_end(flags); 90 kmemcheck_bitfield_end(flags);
91 struct ip_options_rcu *opt; 91 union {
92 struct sk_buff *pktopts; 92 struct ip_options_rcu *opt;
93 struct sk_buff *pktopts;
94 };
93 u32 ir_mark; 95 u32 ir_mark;
94}; 96};
95 97
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 61474ea02152..6c566034e26d 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -108,6 +108,7 @@ struct inet_timewait_sock {
108#define tw_family __tw_common.skc_family 108#define tw_family __tw_common.skc_family
109#define tw_state __tw_common.skc_state 109#define tw_state __tw_common.skc_state
110#define tw_reuse __tw_common.skc_reuse 110#define tw_reuse __tw_common.skc_reuse
111#define tw_ipv6only __tw_common.skc_ipv6only
111#define tw_bound_dev_if __tw_common.skc_bound_dev_if 112#define tw_bound_dev_if __tw_common.skc_bound_dev_if
112#define tw_node __tw_common.skc_nulls_node 113#define tw_node __tw_common.skc_nulls_node
113#define tw_bind_node __tw_common.skc_bind_node 114#define tw_bind_node __tw_common.skc_bind_node
@@ -131,7 +132,7 @@ struct inet_timewait_sock {
131 __be16 tw_sport; 132 __be16 tw_sport;
132 kmemcheck_bitfield_begin(flags); 133 kmemcheck_bitfield_begin(flags);
133 /* And these are ours. */ 134 /* And these are ours. */
134 unsigned int tw_ipv6only : 1, 135 unsigned int tw_pad0 : 1, /* 1 bit hole */
135 tw_transparent : 1, 136 tw_transparent : 1,
136 tw_flowlabel : 20, 137 tw_flowlabel : 20,
137 tw_pad : 2, /* 2 bits hole */ 138 tw_pad : 2, /* 2 bits hole */
diff --git a/include/net/ip.h b/include/net/ip.h
index 0e795df05ec9..2e8f055989c3 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -31,6 +31,7 @@
31#include <net/route.h> 31#include <net/route.h>
32#include <net/snmp.h> 32#include <net/snmp.h>
33#include <net/flow.h> 33#include <net/flow.h>
34#include <net/flow_keys.h>
34 35
35struct sock; 36struct sock;
36 37
@@ -353,6 +354,19 @@ static inline __wsum inet_compute_pseudo(struct sk_buff *skb, int proto)
353 skb->len, proto, 0); 354 skb->len, proto, 0);
354} 355}
355 356
357static inline void inet_set_txhash(struct sock *sk)
358{
359 struct inet_sock *inet = inet_sk(sk);
360 struct flow_keys keys;
361
362 keys.src = inet->inet_saddr;
363 keys.dst = inet->inet_daddr;
364 keys.port16[0] = inet->inet_sport;
365 keys.port16[1] = inet->inet_dport;
366
367 sk->sk_txhash = flow_hash_from_keys(&keys);
368}
369
356/* 370/*
357 * Map a multicast IP onto multicast MAC for type ethernet. 371 * Map a multicast IP onto multicast MAC for type ethernet.
358 */ 372 */
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 574337fe72dd..a25017247457 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -19,6 +19,7 @@
19#include <net/if_inet6.h> 19#include <net/if_inet6.h>
20#include <net/ndisc.h> 20#include <net/ndisc.h>
21#include <net/flow.h> 21#include <net/flow.h>
22#include <net/flow_keys.h>
22#include <net/snmp.h> 23#include <net/snmp.h>
23 24
24#define SIN6_LEN_RFC2133 24 25#define SIN6_LEN_RFC2133 24
@@ -557,24 +558,29 @@ static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 initval)
557static inline bool ipv6_addr_loopback(const struct in6_addr *a) 558static inline bool ipv6_addr_loopback(const struct in6_addr *a)
558{ 559{
559#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 560#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
560 const unsigned long *ul = (const unsigned long *)a; 561 const __be64 *be = (const __be64 *)a;
561 562
562 return (ul[0] | (ul[1] ^ cpu_to_be64(1))) == 0UL; 563 return (be[0] | (be[1] ^ cpu_to_be64(1))) == 0UL;
563#else 564#else
564 return (a->s6_addr32[0] | a->s6_addr32[1] | 565 return (a->s6_addr32[0] | a->s6_addr32[1] |
565 a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0; 566 a->s6_addr32[2] | (a->s6_addr32[3] ^ cpu_to_be32(1))) == 0;
566#endif 567#endif
567} 568}
568 569
570/*
571 * Note that we must __force cast these to unsigned long to make sparse happy,
572 * since all of the endian-annotated types are fixed size regardless of arch.
573 */
569static inline bool ipv6_addr_v4mapped(const struct in6_addr *a) 574static inline bool ipv6_addr_v4mapped(const struct in6_addr *a)
570{ 575{
571 return ( 576 return (
572#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 577#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
573 *(__be64 *)a | 578 *(unsigned long *)a |
574#else 579#else
575 (a->s6_addr32[0] | a->s6_addr32[1]) | 580 (__force unsigned long)(a->s6_addr32[0] | a->s6_addr32[1]) |
576#endif 581#endif
577 (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0UL; 582 (__force unsigned long)(a->s6_addr32[2] ^
583 cpu_to_be32(0x0000ffff))) == 0UL;
578} 584}
579 585
580/* 586/*
@@ -684,6 +690,50 @@ static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6,
684 return hlimit; 690 return hlimit;
685} 691}
686 692
693#if IS_ENABLED(CONFIG_IPV6)
694static inline void ip6_set_txhash(struct sock *sk)
695{
696 struct inet_sock *inet = inet_sk(sk);
697 struct ipv6_pinfo *np = inet6_sk(sk);
698 struct flow_keys keys;
699
700 keys.src = (__force __be32)ipv6_addr_hash(&np->saddr);
701 keys.dst = (__force __be32)ipv6_addr_hash(&sk->sk_v6_daddr);
702 keys.port16[0] = inet->inet_sport;
703 keys.port16[1] = inet->inet_dport;
704
705 sk->sk_txhash = flow_hash_from_keys(&keys);
706}
707
708static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
709 __be32 flowlabel, bool autolabel)
710{
711 if (!flowlabel && (autolabel || net->ipv6.sysctl.auto_flowlabels)) {
712 __be32 hash;
713
714 hash = skb_get_hash(skb);
715
716 /* Since this is being sent on the wire obfuscate hash a bit
717 * to minimize possbility that any useful information to an
718 * attacker is leaked. Only lower 20 bits are relevant.
719 */
720 hash ^= hash >> 12;
721
722 flowlabel = hash & IPV6_FLOWLABEL_MASK;
723 }
724
725 return flowlabel;
726}
727#else
728static inline void ip6_set_txhash(struct sock *sk) { }
729static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
730 __be32 flowlabel, bool autolabel)
731{
732 return flowlabel;
733}
734#endif
735
736
687/* 737/*
688 * Header manipulation 738 * Header manipulation
689 */ 739 */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 421b6ecb4b2c..9ce5cb17ed82 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -754,20 +754,25 @@ struct ieee80211_tx_info {
754}; 754};
755 755
756/** 756/**
757 * struct ieee80211_sched_scan_ies - scheduled scan IEs 757 * struct ieee80211_scan_ies - descriptors for different blocks of IEs
758 * 758 *
759 * This structure is used to pass the appropriate IEs to be used in scheduled 759 * This structure is used to point to different blocks of IEs in HW scan
760 * scans for all bands. It contains both the IEs passed from the userspace 760 * and scheduled scan. These blocks contain the IEs passed by userspace
761 * and the ones generated by mac80211. 761 * and the ones generated by mac80211.
762 * 762 *
763 * @ie: array with the IEs for each supported band 763 * @ies: pointers to band specific IEs.
764 * @len: array with the total length of the IEs for each band 764 * @len: lengths of band_specific IEs.
765 * @common_ies: IEs for all bands (especially vendor specific ones)
766 * @common_ie_len: length of the common_ies
765 */ 767 */
766struct ieee80211_sched_scan_ies { 768struct ieee80211_scan_ies {
767 u8 *ie[IEEE80211_NUM_BANDS]; 769 const u8 *ies[IEEE80211_NUM_BANDS];
768 size_t len[IEEE80211_NUM_BANDS]; 770 size_t len[IEEE80211_NUM_BANDS];
771 const u8 *common_ies;
772 size_t common_ie_len;
769}; 773};
770 774
775
771static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb) 776static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
772{ 777{
773 return (struct ieee80211_tx_info *)skb->cb; 778 return (struct ieee80211_tx_info *)skb->cb;
@@ -1601,11 +1606,8 @@ struct ieee80211_tx_control {
1601 * is not enabled the default action is to disconnect when getting the 1606 * is not enabled the default action is to disconnect when getting the
1602 * CSA frame. 1607 * CSA frame.
1603 * 1608 *
1604 * @IEEE80211_HW_CHANGE_RUNNING_CHANCTX: The hardware can change a 1609 * @IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS: The HW supports scanning on all bands
1605 * channel context on-the-fly. This is needed for channel switch 1610 * in one command, mac80211 doesn't have to run separate scans per band.
1606 * on single-channel hardware. It can also be used as an
1607 * optimization in certain channel switch cases with
1608 * multi-channel.
1609 */ 1611 */
1610enum ieee80211_hw_flags { 1612enum ieee80211_hw_flags {
1611 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1613 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1637,7 +1639,8 @@ enum ieee80211_hw_flags {
1637 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, 1639 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
1638 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, 1640 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27,
1639 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28, 1641 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28,
1640 IEEE80211_HW_CHANGE_RUNNING_CHANCTX = 1<<29, 1642 /* bit 29 unused */
1643 IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS = 1<<30,
1641}; 1644};
1642 1645
1643/** 1646/**
@@ -1764,6 +1767,19 @@ struct ieee80211_hw {
1764}; 1767};
1765 1768
1766/** 1769/**
1770 * struct ieee80211_scan_request - hw scan request
1771 *
1772 * @ies: pointers different parts of IEs (in req.ie)
1773 * @req: cfg80211 request.
1774 */
1775struct ieee80211_scan_request {
1776 struct ieee80211_scan_ies ies;
1777
1778 /* Keep last */
1779 struct cfg80211_scan_request req;
1780};
1781
1782/**
1767 * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy 1783 * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
1768 * 1784 *
1769 * @wiphy: the &struct wiphy which we want to query 1785 * @wiphy: the &struct wiphy which we want to query
@@ -2764,6 +2780,15 @@ enum ieee80211_roc_type {
2764 * mac80211 will transmit the frame right away. 2780 * mac80211 will transmit the frame right away.
2765 * The callback is optional and can (should!) sleep. 2781 * The callback is optional and can (should!) sleep.
2766 * 2782 *
2783 * @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending
2784 * a TDLS discovery-request, we expect a reply to arrive on the AP's
2785 * channel. We must stay on the channel (no PSM, scan, etc.), since a TDLS
2786 * setup-response is a direct packet not buffered by the AP.
2787 * mac80211 will call this function just before the transmission of a TDLS
2788 * discovery-request. The recommended period of protection is at least
2789 * 2 * (DTIM period).
2790 * The callback is optional and can sleep.
2791 *
2767 * @add_chanctx: Notifies device driver about new channel context creation. 2792 * @add_chanctx: Notifies device driver about new channel context creation.
2768 * @remove_chanctx: Notifies device driver about channel context destruction. 2793 * @remove_chanctx: Notifies device driver about channel context destruction.
2769 * @change_chanctx: Notifies device driver about channel context changes that 2794 * @change_chanctx: Notifies device driver about channel context changes that
@@ -2865,13 +2890,13 @@ struct ieee80211_ops {
2865 void (*set_default_unicast_key)(struct ieee80211_hw *hw, 2890 void (*set_default_unicast_key)(struct ieee80211_hw *hw,
2866 struct ieee80211_vif *vif, int idx); 2891 struct ieee80211_vif *vif, int idx);
2867 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2892 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2868 struct cfg80211_scan_request *req); 2893 struct ieee80211_scan_request *req);
2869 void (*cancel_hw_scan)(struct ieee80211_hw *hw, 2894 void (*cancel_hw_scan)(struct ieee80211_hw *hw,
2870 struct ieee80211_vif *vif); 2895 struct ieee80211_vif *vif);
2871 int (*sched_scan_start)(struct ieee80211_hw *hw, 2896 int (*sched_scan_start)(struct ieee80211_hw *hw,
2872 struct ieee80211_vif *vif, 2897 struct ieee80211_vif *vif,
2873 struct cfg80211_sched_scan_request *req, 2898 struct cfg80211_sched_scan_request *req,
2874 struct ieee80211_sched_scan_ies *ies); 2899 struct ieee80211_scan_ies *ies);
2875 int (*sched_scan_stop)(struct ieee80211_hw *hw, 2900 int (*sched_scan_stop)(struct ieee80211_hw *hw,
2876 struct ieee80211_vif *vif); 2901 struct ieee80211_vif *vif);
2877 void (*sw_scan_start)(struct ieee80211_hw *hw); 2902 void (*sw_scan_start)(struct ieee80211_hw *hw);
@@ -2981,6 +3006,9 @@ struct ieee80211_ops {
2981 void (*mgd_prepare_tx)(struct ieee80211_hw *hw, 3006 void (*mgd_prepare_tx)(struct ieee80211_hw *hw,
2982 struct ieee80211_vif *vif); 3007 struct ieee80211_vif *vif);
2983 3008
3009 void (*mgd_protect_tdls_discover)(struct ieee80211_hw *hw,
3010 struct ieee80211_vif *vif);
3011
2984 int (*add_chanctx)(struct ieee80211_hw *hw, 3012 int (*add_chanctx)(struct ieee80211_hw *hw,
2985 struct ieee80211_chanctx_conf *ctx); 3013 struct ieee80211_chanctx_conf *ctx);
2986 void (*remove_chanctx)(struct ieee80211_hw *hw, 3014 void (*remove_chanctx)(struct ieee80211_hw *hw,
@@ -4815,4 +4843,17 @@ int ieee80211_parse_p2p_noa(const struct ieee80211_p2p_noa_attr *attr,
4815 */ 4843 */
4816void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf); 4844void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
4817 4845
4846/**
4847 * ieee80211_tdls_oper - request userspace to perform a TDLS operation
4848 * @vif: virtual interface
4849 * @peer: the peer's destination address
4850 * @oper: the requested TDLS operation
4851 * @reason_code: reason code for the operation, valid for TDLS teardown
4852 * @gfp: allocation flags
4853 *
4854 * See cfg80211_tdls_oper_request().
4855 */
4856void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer,
4857 enum nl80211_tdls_operation oper,
4858 u16 reason_code, gfp_t gfp);
4818#endif /* MAC80211_H */ 4859#endif /* MAC80211_H */
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index a591053cae63..2e67cdd19cdc 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -80,6 +80,25 @@ struct ieee802154_dev {
80#define IEEE802154_HW_OMIT_CKSUM 0x00000001 80#define IEEE802154_HW_OMIT_CKSUM 0x00000001
81/* Indicates that receiver will autorespond with ACK frames. */ 81/* Indicates that receiver will autorespond with ACK frames. */
82#define IEEE802154_HW_AACK 0x00000002 82#define IEEE802154_HW_AACK 0x00000002
83/* Indicates that transceiver will support transmit power setting. */
84#define IEEE802154_HW_TXPOWER 0x00000004
85/* Indicates that transceiver will support listen before transmit. */
86#define IEEE802154_HW_LBT 0x00000008
87/* Indicates that transceiver will support cca mode setting. */
88#define IEEE802154_HW_CCA_MODE 0x00000010
89/* Indicates that transceiver will support cca ed level setting. */
90#define IEEE802154_HW_CCA_ED_LEVEL 0x00000020
91/* Indicates that transceiver will support csma (max_be, min_be, csma retries)
92 * settings. */
93#define IEEE802154_HW_CSMA_PARAMS 0x00000040
94/* Indicates that transceiver will support ARET frame retries setting. */
95#define IEEE802154_HW_FRAME_RETRIES 0x00000080
96
97/* This groups the most common CSMA support fields into one. */
98#define IEEE802154_HW_CSMA (IEEE802154_HW_CCA_MODE | \
99 IEEE802154_HW_CCA_ED_LEVEL | \
100 IEEE802154_HW_CSMA_PARAMS | \
101 IEEE802154_HW_FRAME_RETRIES)
83 102
84/* struct ieee802154_ops - callbacks from mac802154 to the driver 103/* struct ieee802154_ops - callbacks from mac802154 to the driver
85 * 104 *
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 7277caf3743d..47f425464f84 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -203,7 +203,6 @@ struct neigh_table {
203 void (*proxy_redo)(struct sk_buff *skb); 203 void (*proxy_redo)(struct sk_buff *skb);
204 char *id; 204 char *id;
205 struct neigh_parms parms; 205 struct neigh_parms parms;
206 /* HACK. gc_* should follow parms without a gap! */
207 int gc_interval; 206 int gc_interval;
208 int gc_thresh1; 207 int gc_thresh1;
209 int gc_thresh2; 208 int gc_thresh2;
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 7ee6ce6564ae..713b0b88bd5a 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -503,9 +503,9 @@ enum nft_chain_flags {
503 * @net: net namespace that this chain belongs to 503 * @net: net namespace that this chain belongs to
504 * @table: table that this chain belongs to 504 * @table: table that this chain belongs to
505 * @handle: chain handle 505 * @handle: chain handle
506 * @flags: bitmask of enum nft_chain_flags
507 * @use: number of jump references to this chain 506 * @use: number of jump references to this chain
508 * @level: length of longest path to this chain 507 * @level: length of longest path to this chain
508 * @flags: bitmask of enum nft_chain_flags
509 * @name: name of the chain 509 * @name: name of the chain
510 */ 510 */
511struct nft_chain { 511struct nft_chain {
@@ -514,9 +514,9 @@ struct nft_chain {
514 struct net *net; 514 struct net *net;
515 struct nft_table *table; 515 struct nft_table *table;
516 u64 handle; 516 u64 handle;
517 u8 flags; 517 u32 use;
518 u16 use;
519 u16 level; 518 u16 level;
519 u8 flags;
520 char name[NFT_CHAIN_MAXNAMELEN]; 520 char name[NFT_CHAIN_MAXNAMELEN];
521}; 521};
522 522
diff --git a/include/net/netns/ieee802154_6lowpan.h b/include/net/netns/ieee802154_6lowpan.h
index 079030c853d8..e2070960bac0 100644
--- a/include/net/netns/ieee802154_6lowpan.h
+++ b/include/net/netns/ieee802154_6lowpan.h
@@ -16,7 +16,7 @@ struct netns_sysctl_lowpan {
16struct netns_ieee802154_lowpan { 16struct netns_ieee802154_lowpan {
17 struct netns_sysctl_lowpan sysctl; 17 struct netns_sysctl_lowpan sysctl;
18 struct netns_frags frags; 18 struct netns_frags frags;
19 u16 max_dsize; 19 int max_dsize;
20}; 20};
21 21
22#endif 22#endif
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 19d3446e59d2..eade27adecf3 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -28,6 +28,7 @@ struct netns_sysctl_ipv6 {
28 int ip6_rt_mtu_expires; 28 int ip6_rt_mtu_expires;
29 int ip6_rt_min_advmss; 29 int ip6_rt_min_advmss;
30 int flowlabel_consistency; 30 int flowlabel_consistency;
31 int auto_flowlabels;
31 int icmpv6_time; 32 int icmpv6_time;
32 int anycast_src_echo_reply; 33 int anycast_src_echo_reply;
33 int fwmark_reflect; 34 int fwmark_reflect;
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 72240e5ac2c4..e21b9f9653c0 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -136,6 +136,7 @@ void rtnl_af_unregister(struct rtnl_af_ops *ops);
136 136
137struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]); 137struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
138struct net_device *rtnl_create_link(struct net *net, char *ifname, 138struct net_device *rtnl_create_link(struct net *net, char *ifname,
139 unsigned char name_assign_type,
139 const struct rtnl_link_ops *ops, 140 const struct rtnl_link_ops *ops,
140 struct nlattr *tb[]); 141 struct nlattr *tb[]);
141int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm); 142int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm);
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 4b7cd695e431..f22538e68245 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -118,6 +118,7 @@ typedef enum {
118#define SCTP_MAX_NUM_COMMANDS 14 118#define SCTP_MAX_NUM_COMMANDS 14
119 119
120typedef union { 120typedef union {
121 void *zero_all; /* Set to NULL to clear the entire union */
121 __s32 i32; 122 __s32 i32;
122 __u32 u32; 123 __u32 u32;
123 __be32 be32; 124 __be32 be32;
@@ -154,7 +155,7 @@ typedef union {
154static inline sctp_arg_t \ 155static inline sctp_arg_t \
155SCTP_## name (type arg) \ 156SCTP_## name (type arg) \
156{ sctp_arg_t retval;\ 157{ sctp_arg_t retval;\
157 memset(&retval, 0, sizeof(sctp_arg_t));\ 158 retval.zero_all = NULL;\
158 retval.elt = arg;\ 159 retval.elt = arg;\
159 return retval;\ 160 return retval;\
160} 161}
@@ -191,7 +192,7 @@ static inline sctp_arg_t SCTP_NOFORCE(void)
191static inline sctp_arg_t SCTP_NULL(void) 192static inline sctp_arg_t SCTP_NULL(void)
192{ 193{
193 sctp_arg_t retval; 194 sctp_arg_t retval;
194 memset(&retval, 0, sizeof(sctp_arg_t)); 195 retval.zero_all = NULL;
195 return retval; 196 return retval;
196} 197}
197 198
@@ -202,27 +203,49 @@ typedef struct {
202 203
203typedef struct { 204typedef struct {
204 sctp_cmd_t cmds[SCTP_MAX_NUM_COMMANDS]; 205 sctp_cmd_t cmds[SCTP_MAX_NUM_COMMANDS];
205 __u8 next_free_slot; 206 sctp_cmd_t *last_used_slot;
206 __u8 next_cmd; 207 sctp_cmd_t *next_cmd;
207} sctp_cmd_seq_t; 208} sctp_cmd_seq_t;
208 209
209 210
210/* Initialize a block of memory as a command sequence. 211/* Initialize a block of memory as a command sequence.
211 * Return 0 if the initialization fails. 212 * Return 0 if the initialization fails.
212 */ 213 */
213int sctp_init_cmd_seq(sctp_cmd_seq_t *seq); 214static inline int sctp_init_cmd_seq(sctp_cmd_seq_t *seq)
215{
216 /* cmds[] is filled backwards to simplify the overflow BUG() check */
217 seq->last_used_slot = seq->cmds + SCTP_MAX_NUM_COMMANDS;
218 seq->next_cmd = seq->last_used_slot;
219 return 1; /* We always succeed. */
220}
221
214 222
215/* Add a command to an sctp_cmd_seq_t. 223/* Add a command to an sctp_cmd_seq_t.
216 * 224 *
217 * Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above 225 * Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above
218 * to wrap data which goes in the obj argument. 226 * to wrap data which goes in the obj argument.
219 */ 227 */
220void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj); 228static inline void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb,
229 sctp_arg_t obj)
230{
231 sctp_cmd_t *cmd = seq->last_used_slot - 1;
232
233 BUG_ON(cmd < seq->cmds);
234
235 cmd->verb = verb;
236 cmd->obj = obj;
237 seq->last_used_slot = cmd;
238}
221 239
222/* Return the next command structure in an sctp_cmd_seq. 240/* Return the next command structure in an sctp_cmd_seq.
223 * Return NULL at the end of the sequence. 241 * Return NULL at the end of the sequence.
224 */ 242 */
225sctp_cmd_t *sctp_next_cmd(sctp_cmd_seq_t *seq); 243static inline sctp_cmd_t *sctp_next_cmd(sctp_cmd_seq_t *seq)
244{
245 if (seq->next_cmd <= seq->last_used_slot)
246 return NULL;
226 247
227#endif /* __net_sctp_command_h__ */ 248 return --seq->next_cmd;
249}
228 250
251#endif /* __net_sctp_command_h__ */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 8e4de46c052e..90c1cccd164d 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -109,6 +109,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
109 struct sctp_association *asoc); 109 struct sctp_association *asoc);
110extern struct percpu_counter sctp_sockets_allocated; 110extern struct percpu_counter sctp_sockets_allocated;
111int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *); 111int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
112struct sk_buff *sctp_skb_recv_datagram(struct sock *, int, int, int *);
112 113
113/* 114/*
114 * sctp/primitive.c 115 * sctp/primitive.c
@@ -388,27 +389,6 @@ static inline int sctp_list_single_entry(struct list_head *head)
388 return (head->next != head) && (head->next == head->prev); 389 return (head->next != head) && (head->next == head->prev);
389} 390}
390 391
391/* Generate a random jitter in the range of -50% ~ +50% of input RTO. */
392static inline __s32 sctp_jitter(__u32 rto)
393{
394 static __u32 sctp_rand;
395 __s32 ret;
396
397 /* Avoid divide by zero. */
398 if (!rto)
399 rto = 1;
400
401 sctp_rand += jiffies;
402 sctp_rand ^= (sctp_rand << 12);
403 sctp_rand ^= (sctp_rand >> 20);
404
405 /* Choose random number from 0 to rto, then move to -50% ~ +50%
406 * of rto.
407 */
408 ret = sctp_rand % rto - (rto >> 1);
409 return ret;
410}
411
412/* Break down data chunks at this point. */ 392/* Break down data chunks at this point. */
413static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu) 393static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
414{ 394{
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index f38588bf3462..7741d1b66967 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -207,7 +207,9 @@ struct sctp_sock {
207 struct sctp_paddrparams paddrparam; 207 struct sctp_paddrparams paddrparam;
208 struct sctp_event_subscribe subscribe; 208 struct sctp_event_subscribe subscribe;
209 struct sctp_assocparams assocparams; 209 struct sctp_assocparams assocparams;
210
210 int user_frag; 211 int user_frag;
212
211 __u32 autoclose; 213 __u32 autoclose;
212 __u8 nodelay; 214 __u8 nodelay;
213 __u8 disable_fragments; 215 __u8 disable_fragments;
@@ -215,6 +217,8 @@ struct sctp_sock {
215 __u8 frag_interleave; 217 __u8 frag_interleave;
216 __u32 adaptation_ind; 218 __u32 adaptation_ind;
217 __u32 pd_point; 219 __u32 pd_point;
220 __u8 recvrcvinfo;
221 __u8 recvnxtinfo;
218 222
219 atomic_t pd_mode; 223 atomic_t pd_mode;
220 /* Receive to here while partial delivery is in effect. */ 224 /* Receive to here while partial delivery is in effect. */
@@ -1919,7 +1923,8 @@ struct sctp_chunk *sctp_get_ecne_prepend(struct sctp_association *asoc);
1919/* A convenience structure to parse out SCTP specific CMSGs. */ 1923/* A convenience structure to parse out SCTP specific CMSGs. */
1920typedef struct sctp_cmsgs { 1924typedef struct sctp_cmsgs {
1921 struct sctp_initmsg *init; 1925 struct sctp_initmsg *init;
1922 struct sctp_sndrcvinfo *info; 1926 struct sctp_sndrcvinfo *srinfo;
1927 struct sctp_sndinfo *sinfo;
1923} sctp_cmsgs_t; 1928} sctp_cmsgs_t;
1924 1929
1925/* Structure for tracking memory objects */ 1930/* Structure for tracking memory objects */
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index daacb32b55b5..cccdcfd14973 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -129,7 +129,12 @@ struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event(
129 const struct sctp_association *asoc, gfp_t gfp); 129 const struct sctp_association *asoc, gfp_t gfp);
130 130
131void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, 131void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
132 struct msghdr *); 132 struct msghdr *);
133void sctp_ulpevent_read_rcvinfo(const struct sctp_ulpevent *event,
134 struct msghdr *);
135void sctp_ulpevent_read_nxtinfo(const struct sctp_ulpevent *event,
136 struct msghdr *, struct sock *sk);
137
133__u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event); 138__u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event);
134 139
135/* Is this event type enabled? */ 140/* Is this event type enabled? */
@@ -155,10 +160,3 @@ static inline int sctp_ulpevent_is_enabled(const struct sctp_ulpevent *event,
155} 160}
156 161
157#endif /* __sctp_ulpevent_h__ */ 162#endif /* __sctp_ulpevent_h__ */
158
159
160
161
162
163
164
diff --git a/include/net/sock.h b/include/net/sock.h
index 07b7fcd60d80..28f734601b50 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -181,7 +181,8 @@ struct sock_common {
181 unsigned short skc_family; 181 unsigned short skc_family;
182 volatile unsigned char skc_state; 182 volatile unsigned char skc_state;
183 unsigned char skc_reuse:4; 183 unsigned char skc_reuse:4;
184 unsigned char skc_reuseport:4; 184 unsigned char skc_reuseport:1;
185 unsigned char skc_ipv6only:1;
185 int skc_bound_dev_if; 186 int skc_bound_dev_if;
186 union { 187 union {
187 struct hlist_node skc_bind_node; 188 struct hlist_node skc_bind_node;
@@ -272,6 +273,7 @@ struct cg_proto;
272 * @sk_rcvtimeo: %SO_RCVTIMEO setting 273 * @sk_rcvtimeo: %SO_RCVTIMEO setting
273 * @sk_sndtimeo: %SO_SNDTIMEO setting 274 * @sk_sndtimeo: %SO_SNDTIMEO setting
274 * @sk_rxhash: flow hash received from netif layer 275 * @sk_rxhash: flow hash received from netif layer
276 * @sk_txhash: computed flow hash for use on transmit
275 * @sk_filter: socket filtering instructions 277 * @sk_filter: socket filtering instructions
276 * @sk_protinfo: private area, net family specific, when not using slab 278 * @sk_protinfo: private area, net family specific, when not using slab
277 * @sk_timer: sock cleanup timer 279 * @sk_timer: sock cleanup timer
@@ -317,6 +319,7 @@ struct sock {
317#define sk_state __sk_common.skc_state 319#define sk_state __sk_common.skc_state
318#define sk_reuse __sk_common.skc_reuse 320#define sk_reuse __sk_common.skc_reuse
319#define sk_reuseport __sk_common.skc_reuseport 321#define sk_reuseport __sk_common.skc_reuseport
322#define sk_ipv6only __sk_common.skc_ipv6only
320#define sk_bound_dev_if __sk_common.skc_bound_dev_if 323#define sk_bound_dev_if __sk_common.skc_bound_dev_if
321#define sk_bind_node __sk_common.skc_bind_node 324#define sk_bind_node __sk_common.skc_bind_node
322#define sk_prot __sk_common.skc_prot 325#define sk_prot __sk_common.skc_prot
@@ -345,6 +348,7 @@ struct sock {
345#ifdef CONFIG_RPS 348#ifdef CONFIG_RPS
346 __u32 sk_rxhash; 349 __u32 sk_rxhash;
347#endif 350#endif
351 __u32 sk_txhash;
348#ifdef CONFIG_NET_RX_BUSY_POLL 352#ifdef CONFIG_NET_RX_BUSY_POLL
349 unsigned int sk_napi_id; 353 unsigned int sk_napi_id;
350 unsigned int sk_ll_usec; 354 unsigned int sk_ll_usec;
@@ -656,6 +660,20 @@ static inline void sk_add_bind_node(struct sock *sk,
656#define sk_for_each_bound(__sk, list) \ 660#define sk_for_each_bound(__sk, list) \
657 hlist_for_each_entry(__sk, list, sk_bind_node) 661 hlist_for_each_entry(__sk, list, sk_bind_node)
658 662
663/**
664 * sk_nulls_for_each_entry_offset - iterate over a list at a given struct offset
665 * @tpos: the type * to use as a loop cursor.
666 * @pos: the &struct hlist_node to use as a loop cursor.
667 * @head: the head for your list.
668 * @offset: offset of hlist_node within the struct.
669 *
670 */
671#define sk_nulls_for_each_entry_offset(tpos, pos, head, offset) \
672 for (pos = (head)->first; \
673 (!is_a_nulls(pos)) && \
674 ({ tpos = (typeof(*tpos) *)((void *)pos - offset); 1;}); \
675 pos = pos->next)
676
659static inline struct user_namespace *sk_user_ns(struct sock *sk) 677static inline struct user_namespace *sk_user_ns(struct sock *sk)
660{ 678{
661 /* Careful only use this in a context where these parameters 679 /* Careful only use this in a context where these parameters
@@ -1730,8 +1748,8 @@ sk_dst_get(struct sock *sk)
1730 1748
1731 rcu_read_lock(); 1749 rcu_read_lock();
1732 dst = rcu_dereference(sk->sk_dst_cache); 1750 dst = rcu_dereference(sk->sk_dst_cache);
1733 if (dst) 1751 if (dst && !atomic_inc_not_zero(&dst->__refcnt))
1734 dst_hold(dst); 1752 dst = NULL;
1735 rcu_read_unlock(); 1753 rcu_read_unlock();
1736 return dst; 1754 return dst;
1737} 1755}
@@ -1768,9 +1786,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst)
1768static inline void 1786static inline void
1769sk_dst_set(struct sock *sk, struct dst_entry *dst) 1787sk_dst_set(struct sock *sk, struct dst_entry *dst)
1770{ 1788{
1771 spin_lock(&sk->sk_dst_lock); 1789 struct dst_entry *old_dst;
1772 __sk_dst_set(sk, dst); 1790
1773 spin_unlock(&sk->sk_dst_lock); 1791 sk_tx_queue_clear(sk);
1792 old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst);
1793 dst_release(old_dst);
1774} 1794}
1775 1795
1776static inline void 1796static inline void
@@ -1782,9 +1802,7 @@ __sk_dst_reset(struct sock *sk)
1782static inline void 1802static inline void
1783sk_dst_reset(struct sock *sk) 1803sk_dst_reset(struct sock *sk)
1784{ 1804{
1785 spin_lock(&sk->sk_dst_lock); 1805 sk_dst_set(sk, NULL);
1786 __sk_dst_reset(sk);
1787 spin_unlock(&sk->sk_dst_lock);
1788} 1806}
1789 1807
1790struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); 1808struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
@@ -1978,6 +1996,14 @@ static inline void sock_poll_wait(struct file *filp,
1978 } 1996 }
1979} 1997}
1980 1998
1999static inline void skb_set_hash_from_sk(struct sk_buff *skb, struct sock *sk)
2000{
2001 if (sk->sk_txhash) {
2002 skb->l4_hash = 1;
2003 skb->hash = sk->sk_txhash;
2004 }
2005}
2006
1981/* 2007/*
1982 * Queue a received datagram if it will fit. Stream and sequenced 2008 * Queue a received datagram if it will fit. Stream and sequenced
1983 * protocols can't normally use this as they need to fit buffers in 2009 * protocols can't normally use this as they need to fit buffers in
@@ -1992,6 +2018,7 @@ static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
1992 skb_orphan(skb); 2018 skb_orphan(skb);
1993 skb->sk = sk; 2019 skb->sk = sk;
1994 skb->destructor = sock_wfree; 2020 skb->destructor = sock_wfree;
2021 skb_set_hash_from_sk(skb, sk);
1995 /* 2022 /*
1996 * We used to take a refcount on sk, but following operation 2023 * We used to take a refcount on sk, but following operation
1997 * is enough to guarantee sk_free() wont free this sock until 2024 * is enough to guarantee sk_free() wont free this sock until
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 06a3023080c0..0aeb2eb749dc 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -493,14 +493,8 @@ static inline u32 tcp_cookie_time(void)
493 493
494u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th, 494u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th,
495 u16 *mssp); 495 u16 *mssp);
496__u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mss); 496__u32 cookie_v4_init_sequence(struct sock *sk, const struct sk_buff *skb,
497#else 497 __u16 *mss);
498static inline __u32 cookie_v4_init_sequence(struct sock *sk,
499 struct sk_buff *skb,
500 __u16 *mss)
501{
502 return 0;
503}
504#endif 498#endif
505 499
506__u32 cookie_init_timestamp(struct request_sock *req); 500__u32 cookie_init_timestamp(struct request_sock *req);
@@ -516,13 +510,6 @@ u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph,
516 const struct tcphdr *th, u16 *mssp); 510 const struct tcphdr *th, u16 *mssp);
517__u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, 511__u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb,
518 __u16 *mss); 512 __u16 *mss);
519#else
520static inline __u32 cookie_v6_init_sequence(struct sock *sk,
521 struct sk_buff *skb,
522 __u16 *mss)
523{
524 return 0;
525}
526#endif 513#endif
527/* tcp_output.c */ 514/* tcp_output.c */
528 515
@@ -941,7 +928,7 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
941/* Use define here intentionally to get WARN_ON location shown at the caller */ 928/* Use define here intentionally to get WARN_ON location shown at the caller */
942#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) 929#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out)
943 930
944void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); 931void tcp_enter_cwr(struct sock *sk);
945__u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst); 932__u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst);
946 933
947/* The maximum number of MSS of available cwnd for which TSO defers 934/* The maximum number of MSS of available cwnd for which TSO defers
@@ -1106,7 +1093,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
1106 req->cookie_ts = 0; 1093 req->cookie_ts = 0;
1107 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq; 1094 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
1108 tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1; 1095 tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
1109 tcp_rsk(req)->snt_synack = 0; 1096 tcp_rsk(req)->snt_synack = tcp_time_stamp;
1110 req->mss = rx_opt->mss_clamp; 1097 req->mss = rx_opt->mss_clamp;
1111 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0; 1098 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;
1112 ireq->tstamp_ok = rx_opt->tstamp_ok; 1099 ireq->tstamp_ok = rx_opt->tstamp_ok;
@@ -1586,6 +1573,11 @@ int tcp4_proc_init(void);
1586void tcp4_proc_exit(void); 1573void tcp4_proc_exit(void);
1587#endif 1574#endif
1588 1575
1576int tcp_rtx_synack(struct sock *sk, struct request_sock *req);
1577int tcp_conn_request(struct request_sock_ops *rsk_ops,
1578 const struct tcp_request_sock_ops *af_ops,
1579 struct sock *sk, struct sk_buff *skb);
1580
1589/* TCP af-specific functions */ 1581/* TCP af-specific functions */
1590struct tcp_sock_af_ops { 1582struct tcp_sock_af_ops {
1591#ifdef CONFIG_TCP_MD5SIG 1583#ifdef CONFIG_TCP_MD5SIG
@@ -1603,6 +1595,7 @@ struct tcp_sock_af_ops {
1603}; 1595};
1604 1596
1605struct tcp_request_sock_ops { 1597struct tcp_request_sock_ops {
1598 u16 mss_clamp;
1606#ifdef CONFIG_TCP_MD5SIG 1599#ifdef CONFIG_TCP_MD5SIG
1607 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk, 1600 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk,
1608 struct request_sock *req); 1601 struct request_sock *req);
@@ -1612,8 +1605,39 @@ struct tcp_request_sock_ops {
1612 const struct request_sock *req, 1605 const struct request_sock *req,
1613 const struct sk_buff *skb); 1606 const struct sk_buff *skb);
1614#endif 1607#endif
1608 void (*init_req)(struct request_sock *req, struct sock *sk,
1609 struct sk_buff *skb);
1610#ifdef CONFIG_SYN_COOKIES
1611 __u32 (*cookie_init_seq)(struct sock *sk, const struct sk_buff *skb,
1612 __u16 *mss);
1613#endif
1614 struct dst_entry *(*route_req)(struct sock *sk, struct flowi *fl,
1615 const struct request_sock *req,
1616 bool *strict);
1617 __u32 (*init_seq)(const struct sk_buff *skb);
1618 int (*send_synack)(struct sock *sk, struct dst_entry *dst,
1619 struct flowi *fl, struct request_sock *req,
1620 u16 queue_mapping, struct tcp_fastopen_cookie *foc);
1621 void (*queue_hash_add)(struct sock *sk, struct request_sock *req,
1622 const unsigned long timeout);
1615}; 1623};
1616 1624
1625#ifdef CONFIG_SYN_COOKIES
1626static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops,
1627 struct sock *sk, struct sk_buff *skb,
1628 __u16 *mss)
1629{
1630 return ops->cookie_init_seq(sk, skb, mss);
1631}
1632#else
1633static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops,
1634 struct sock *sk, struct sk_buff *skb,
1635 __u16 *mss)
1636{
1637 return 0;
1638}
1639#endif
1640
1617int tcpv4_offload_init(void); 1641int tcpv4_offload_init(void);
1618 1642
1619void tcp_v4_init(void); 1643void tcp_v4_init(void);
diff --git a/include/net/udp.h b/include/net/udp.h
index 68a1fefe3dfe..70f941368ace 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -176,6 +176,35 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
176 int (*)(const struct sock *, const struct sock *), 176 int (*)(const struct sock *, const struct sock *),
177 unsigned int hash2_nulladdr); 177 unsigned int hash2_nulladdr);
178 178
179static inline __be16 udp_flow_src_port(struct net *net, struct sk_buff *skb,
180 int min, int max, bool use_eth)
181{
182 u32 hash;
183
184 if (min >= max) {
185 /* Use default range */
186 inet_get_local_port_range(net, &min, &max);
187 }
188
189 hash = skb_get_hash(skb);
190 if (unlikely(!hash) && use_eth) {
191 /* Can't find a normal hash, caller has indicated an Ethernet
192 * packet so use that to compute a hash.
193 */
194 hash = jhash(skb->data, 2 * ETH_ALEN,
195 (__force u32) skb->protocol);
196 }
197
198 /* Since this is being sent on the wire obfuscate hash a bit
199 * to minimize possbility that any useful information to an
200 * attacker is leaked. Only upper 16 bits are relevant in the
201 * computation for 16 bit port value.
202 */
203 hash ^= hash << 16;
204
205 return htons((((u64) hash * (max - min)) >> 32) + min);
206}
207
179/* net/ipv4/udp.c */ 208/* net/ipv4/udp.c */
180void udp_v4_early_demux(struct sk_buff *skb); 209void udp_v4_early_demux(struct sk_buff *skb);
181int udp_get_port(struct sock *sk, unsigned short snum, 210int udp_get_port(struct sock *sk, unsigned short snum,
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h
new file mode 100644
index 000000000000..ffd69cbded35
--- /dev/null
+++ b/include/net/udp_tunnel.h
@@ -0,0 +1,32 @@
1#ifndef __NET_UDP_TUNNEL_H
2#define __NET_UDP_TUNNEL_H
3
4struct udp_port_cfg {
5 u8 family;
6
7 /* Used only for kernel-created sockets */
8 union {
9 struct in_addr local_ip;
10#if IS_ENABLED(CONFIG_IPV6)
11 struct in6_addr local_ip6;
12#endif
13 };
14
15 union {
16 struct in_addr peer_ip;
17#if IS_ENABLED(CONFIG_IPV6)
18 struct in6_addr peer_ip6;
19#endif
20 };
21
22 __be16 local_udp_port;
23 __be16 peer_udp_port;
24 unsigned int use_udp_checksums:1,
25 use_udp6_tx_checksums:1,
26 use_udp6_rx_checksums:1;
27};
28
29int udp_sock_create(struct net *net, struct udp_port_cfg *cfg,
30 struct socket **sockp);
31
32#endif
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 12196ce661d9..d5f59f3fc35d 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -45,8 +45,6 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
45 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, 45 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
46 __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); 46 __be16 src_port, __be16 dst_port, __be32 vni, bool xnet);
47 47
48__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb);
49
50/* IP header + UDP + VXLAN + Ethernet header */ 48/* IP header + UDP + VXLAN + Ethernet header */
51#define VXLAN_HEADROOM (20 + 8 + 8 + 14) 49#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
52/* IPv6 header + UDP + VXLAN + Ethernet header */ 50/* IPv6 header + UDP + VXLAN + Ethernet header */