diff options
Diffstat (limited to 'include/net')
49 files changed, 1067 insertions, 292 deletions
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h index f7d372b7d4ff..79b530fb2c4d 100644 --- a/include/net/6lowpan.h +++ b/include/net/6lowpan.h | |||
| @@ -54,6 +54,7 @@ | |||
| 54 | #define __6LOWPAN_H__ | 54 | #define __6LOWPAN_H__ |
| 55 | 55 | ||
| 56 | #include <net/ipv6.h> | 56 | #include <net/ipv6.h> |
| 57 | #include <net/net_namespace.h> | ||
| 57 | 58 | ||
| 58 | #define UIP_802154_SHORTADDR_LEN 2 /* compressed ipv6 address length */ | 59 | #define UIP_802154_SHORTADDR_LEN 2 /* compressed ipv6 address length */ |
| 59 | #define UIP_IPH_LEN 40 /* ipv6 fixed header size */ | 60 | #define UIP_IPH_LEN 40 /* ipv6 fixed header size */ |
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 933a9f22a05f..f679877bb601 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
| @@ -306,11 +306,6 @@ static inline void addrconf_addr_solict_mult(const struct in6_addr *addr, | |||
| 306 | htonl(0xFF000000) | addr->s6_addr32[3]); | 306 | htonl(0xFF000000) | addr->s6_addr32[3]); |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr) | ||
| 310 | { | ||
| 311 | return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000); | ||
| 312 | } | ||
| 313 | |||
| 314 | static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) | 309 | static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) |
| 315 | { | 310 | { |
| 316 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 | 311 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 |
diff --git a/include/net/af_ieee802154.h b/include/net/af_ieee802154.h index f79ae2aa76d6..085940f7eeec 100644 --- a/include/net/af_ieee802154.h +++ b/include/net/af_ieee802154.h | |||
| @@ -57,6 +57,14 @@ struct sockaddr_ieee802154 { | |||
| 57 | /* get/setsockopt */ | 57 | /* get/setsockopt */ |
| 58 | #define SOL_IEEE802154 0 | 58 | #define SOL_IEEE802154 0 |
| 59 | 59 | ||
| 60 | #define WPAN_WANTACK 0 | 60 | #define WPAN_WANTACK 0 |
| 61 | #define WPAN_SECURITY 1 | ||
| 62 | #define WPAN_SECURITY_LEVEL 2 | ||
| 63 | |||
| 64 | #define WPAN_SECURITY_DEFAULT 0 | ||
| 65 | #define WPAN_SECURITY_OFF 1 | ||
| 66 | #define WPAN_SECURITY_ON 2 | ||
| 67 | |||
| 68 | #define WPAN_SECURITY_LEVEL_DEFAULT (-1) | ||
| 61 | 69 | ||
| 62 | #endif | 70 | #endif |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index be150cf8cd43..16587dcd6a91 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -367,6 +367,7 @@ enum { | |||
| 367 | #define HCI_ERROR_REMOTE_POWER_OFF 0x15 | 367 | #define HCI_ERROR_REMOTE_POWER_OFF 0x15 |
| 368 | #define HCI_ERROR_LOCAL_HOST_TERM 0x16 | 368 | #define HCI_ERROR_LOCAL_HOST_TERM 0x16 |
| 369 | #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 | 369 | #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 |
| 370 | #define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c | ||
| 370 | 371 | ||
| 371 | /* Flow control modes */ | 372 | /* Flow control modes */ |
| 372 | #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 | 373 | #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 |
| @@ -1053,6 +1054,17 @@ struct hci_cp_write_page_scan_activity { | |||
| 1053 | __le16 window; | 1054 | __le16 window; |
| 1054 | } __packed; | 1055 | } __packed; |
| 1055 | 1056 | ||
| 1057 | #define HCI_OP_READ_TX_POWER 0x0c2d | ||
| 1058 | struct hci_cp_read_tx_power { | ||
| 1059 | __le16 handle; | ||
| 1060 | __u8 type; | ||
| 1061 | } __packed; | ||
| 1062 | struct hci_rp_read_tx_power { | ||
| 1063 | __u8 status; | ||
| 1064 | __le16 handle; | ||
| 1065 | __s8 tx_power; | ||
| 1066 | } __packed; | ||
| 1067 | |||
| 1056 | #define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46 | 1068 | #define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46 |
| 1057 | struct hci_rp_read_page_scan_type { | 1069 | struct hci_rp_read_page_scan_type { |
| 1058 | __u8 status; | 1070 | __u8 status; |
| @@ -1063,6 +1075,16 @@ struct hci_rp_read_page_scan_type { | |||
| 1063 | #define PAGE_SCAN_TYPE_STANDARD 0x00 | 1075 | #define PAGE_SCAN_TYPE_STANDARD 0x00 |
| 1064 | #define PAGE_SCAN_TYPE_INTERLACED 0x01 | 1076 | #define PAGE_SCAN_TYPE_INTERLACED 0x01 |
| 1065 | 1077 | ||
| 1078 | #define HCI_OP_READ_RSSI 0x1405 | ||
| 1079 | struct hci_cp_read_rssi { | ||
| 1080 | __le16 handle; | ||
| 1081 | } __packed; | ||
| 1082 | struct hci_rp_read_rssi { | ||
| 1083 | __u8 status; | ||
| 1084 | __le16 handle; | ||
| 1085 | __s8 rssi; | ||
| 1086 | } __packed; | ||
| 1087 | |||
| 1066 | #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 | 1088 | #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 |
| 1067 | struct hci_rp_read_local_amp_info { | 1089 | struct hci_rp_read_local_amp_info { |
| 1068 | __u8 status; | 1090 | __u8 status; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 5f8bc05694ac..b386bf17e6c2 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -68,6 +68,11 @@ struct discovery_state { | |||
| 68 | struct list_head unknown; /* Name state not known */ | 68 | struct list_head unknown; /* Name state not known */ |
| 69 | struct list_head resolve; /* Name needs to be resolved */ | 69 | struct list_head resolve; /* Name needs to be resolved */ |
| 70 | __u32 timestamp; | 70 | __u32 timestamp; |
| 71 | bdaddr_t last_adv_addr; | ||
| 72 | u8 last_adv_addr_type; | ||
| 73 | s8 last_adv_rssi; | ||
| 74 | u8 last_adv_data[HCI_MAX_AD_LENGTH]; | ||
| 75 | u8 last_adv_data_len; | ||
| 71 | }; | 76 | }; |
| 72 | 77 | ||
| 73 | struct hci_conn_hash { | 78 | struct hci_conn_hash { |
| @@ -140,6 +145,10 @@ struct oob_data { | |||
| 140 | /* Default LE RPA expiry time, 15 minutes */ | 145 | /* Default LE RPA expiry time, 15 minutes */ |
| 141 | #define HCI_DEFAULT_RPA_TIMEOUT (15 * 60) | 146 | #define HCI_DEFAULT_RPA_TIMEOUT (15 * 60) |
| 142 | 147 | ||
| 148 | /* Default min/max age of connection information (1s/3s) */ | ||
| 149 | #define DEFAULT_CONN_INFO_MIN_AGE 1000 | ||
| 150 | #define DEFAULT_CONN_INFO_MAX_AGE 3000 | ||
| 151 | |||
| 143 | struct amp_assoc { | 152 | struct amp_assoc { |
| 144 | __u16 len; | 153 | __u16 len; |
| 145 | __u16 offset; | 154 | __u16 offset; |
| @@ -194,6 +203,9 @@ struct hci_dev { | |||
| 194 | __u16 le_scan_window; | 203 | __u16 le_scan_window; |
| 195 | __u16 le_conn_min_interval; | 204 | __u16 le_conn_min_interval; |
| 196 | __u16 le_conn_max_interval; | 205 | __u16 le_conn_max_interval; |
| 206 | __u16 discov_interleaved_timeout; | ||
| 207 | __u16 conn_info_min_age; | ||
| 208 | __u16 conn_info_max_age; | ||
| 197 | __u8 ssp_debug_mode; | 209 | __u8 ssp_debug_mode; |
| 198 | 210 | ||
| 199 | __u16 devid_source; | 211 | __u16 devid_source; |
| @@ -368,8 +380,13 @@ struct hci_conn { | |||
| 368 | __u16 setting; | 380 | __u16 setting; |
| 369 | __u16 le_conn_min_interval; | 381 | __u16 le_conn_min_interval; |
| 370 | __u16 le_conn_max_interval; | 382 | __u16 le_conn_max_interval; |
| 383 | __s8 rssi; | ||
| 384 | __s8 tx_power; | ||
| 385 | __s8 max_tx_power; | ||
| 371 | unsigned long flags; | 386 | unsigned long flags; |
| 372 | 387 | ||
| 388 | unsigned long conn_info_timestamp; | ||
| 389 | |||
| 373 | __u8 remote_cap; | 390 | __u8 remote_cap; |
| 374 | __u8 remote_auth; | 391 | __u8 remote_auth; |
| 375 | __u8 remote_id; | 392 | __u8 remote_id; |
| @@ -1204,8 +1221,8 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event); | |||
| 1204 | */ | 1221 | */ |
| 1205 | #define DISCOV_LE_SCAN_WIN 0x12 | 1222 | #define DISCOV_LE_SCAN_WIN 0x12 |
| 1206 | #define DISCOV_LE_SCAN_INT 0x12 | 1223 | #define DISCOV_LE_SCAN_INT 0x12 |
| 1207 | #define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240) | 1224 | #define DISCOV_LE_TIMEOUT 10240 /* msec */ |
| 1208 | #define DISCOV_INTERLEAVED_TIMEOUT msecs_to_jiffies(5120) | 1225 | #define DISCOV_INTERLEAVED_TIMEOUT 5120 /* msec */ |
| 1209 | #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 | 1226 | #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 |
| 1210 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 | 1227 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 |
| 1211 | 1228 | ||
| @@ -1265,7 +1282,8 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192, | |||
| 1265 | u8 *randomizer256, u8 status); | 1282 | u8 *randomizer256, u8 status); |
| 1266 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1283 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
| 1267 | u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, | 1284 | u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, |
| 1268 | u8 ssp, u8 *eir, u16 eir_len); | 1285 | u8 ssp, u8 *eir, u16 eir_len, u8 *scan_rsp, |
| 1286 | u8 scan_rsp_len); | ||
| 1269 | void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1287 | void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
| 1270 | u8 addr_type, s8 rssi, u8 *name, u8 name_len); | 1288 | u8 addr_type, s8 rssi, u8 *name, u8 name_len); |
| 1271 | void mgmt_discovering(struct hci_dev *hdev, u8 discovering); | 1289 | void mgmt_discovering(struct hci_dev *hdev, u8 discovering); |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index d4b571c2f9fd..bcffc9ae0c89 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
| @@ -181,6 +181,9 @@ struct mgmt_cp_load_link_keys { | |||
| 181 | } __packed; | 181 | } __packed; |
| 182 | #define MGMT_LOAD_LINK_KEYS_SIZE 3 | 182 | #define MGMT_LOAD_LINK_KEYS_SIZE 3 |
| 183 | 183 | ||
| 184 | #define MGMT_LTK_UNAUTHENTICATED 0x00 | ||
| 185 | #define MGMT_LTK_AUTHENTICATED 0x01 | ||
| 186 | |||
| 184 | struct mgmt_ltk_info { | 187 | struct mgmt_ltk_info { |
| 185 | struct mgmt_addr_info addr; | 188 | struct mgmt_addr_info addr; |
| 186 | __u8 type; | 189 | __u8 type; |
| @@ -409,6 +412,18 @@ struct mgmt_cp_load_irks { | |||
| 409 | } __packed; | 412 | } __packed; |
| 410 | #define MGMT_LOAD_IRKS_SIZE 2 | 413 | #define MGMT_LOAD_IRKS_SIZE 2 |
| 411 | 414 | ||
| 415 | #define MGMT_OP_GET_CONN_INFO 0x0031 | ||
| 416 | struct mgmt_cp_get_conn_info { | ||
| 417 | struct mgmt_addr_info addr; | ||
| 418 | } __packed; | ||
| 419 | #define MGMT_GET_CONN_INFO_SIZE MGMT_ADDR_INFO_SIZE | ||
| 420 | struct mgmt_rp_get_conn_info { | ||
| 421 | struct mgmt_addr_info addr; | ||
| 422 | __s8 rssi; | ||
| 423 | __s8 tx_power; | ||
| 424 | __s8 max_tx_power; | ||
| 425 | } __packed; | ||
| 426 | |||
| 412 | #define MGMT_EV_CMD_COMPLETE 0x0001 | 427 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
| 413 | struct mgmt_ev_cmd_complete { | 428 | struct mgmt_ev_cmd_complete { |
| 414 | __le16 opcode; | 429 | __le16 opcode; |
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index 2611cc389d7d..578b83127af1 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
| @@ -173,7 +173,7 @@ struct rfcomm_dlc { | |||
| 173 | struct sk_buff_head tx_queue; | 173 | struct sk_buff_head tx_queue; |
| 174 | struct timer_list timer; | 174 | struct timer_list timer; |
| 175 | 175 | ||
| 176 | spinlock_t lock; | 176 | struct mutex lock; |
| 177 | unsigned long state; | 177 | unsigned long state; |
| 178 | unsigned long flags; | 178 | unsigned long flags; |
| 179 | atomic_t refcnt; | 179 | atomic_t refcnt; |
| @@ -244,8 +244,8 @@ int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); | |||
| 244 | void rfcomm_dlc_accept(struct rfcomm_dlc *d); | 244 | void rfcomm_dlc_accept(struct rfcomm_dlc *d); |
| 245 | struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel); | 245 | struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel); |
| 246 | 246 | ||
| 247 | #define rfcomm_dlc_lock(d) spin_lock(&d->lock) | 247 | #define rfcomm_dlc_lock(d) mutex_lock(&d->lock) |
| 248 | #define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) | 248 | #define rfcomm_dlc_unlock(d) mutex_unlock(&d->lock) |
| 249 | 249 | ||
| 250 | static inline void rfcomm_dlc_hold(struct rfcomm_dlc *d) | 250 | static inline void rfcomm_dlc_hold(struct rfcomm_dlc *d) |
| 251 | { | 251 | { |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index f3539a15c411..e46c437944f7 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -109,6 +109,13 @@ enum ieee80211_band { | |||
| 109 | * channel as the control or any of the secondary channels. | 109 | * channel as the control or any of the secondary channels. |
| 110 | * This may be due to the driver or due to regulatory bandwidth | 110 | * This may be due to the driver or due to regulatory bandwidth |
| 111 | * restrictions. | 111 | * restrictions. |
| 112 | * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY | ||
| 113 | * @IEEE80211_CHAN_GO_CONCURRENT: see %NL80211_FREQUENCY_ATTR_GO_CONCURRENT | ||
| 114 | * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted | ||
| 115 | * on this channel. | ||
| 116 | * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted | ||
| 117 | * on this channel. | ||
| 118 | * | ||
| 112 | */ | 119 | */ |
| 113 | enum ieee80211_channel_flags { | 120 | enum ieee80211_channel_flags { |
| 114 | IEEE80211_CHAN_DISABLED = 1<<0, | 121 | IEEE80211_CHAN_DISABLED = 1<<0, |
| @@ -120,6 +127,10 @@ enum ieee80211_channel_flags { | |||
| 120 | IEEE80211_CHAN_NO_OFDM = 1<<6, | 127 | IEEE80211_CHAN_NO_OFDM = 1<<6, |
| 121 | IEEE80211_CHAN_NO_80MHZ = 1<<7, | 128 | IEEE80211_CHAN_NO_80MHZ = 1<<7, |
| 122 | IEEE80211_CHAN_NO_160MHZ = 1<<8, | 129 | IEEE80211_CHAN_NO_160MHZ = 1<<8, |
| 130 | IEEE80211_CHAN_INDOOR_ONLY = 1<<9, | ||
| 131 | IEEE80211_CHAN_GO_CONCURRENT = 1<<10, | ||
| 132 | IEEE80211_CHAN_NO_20MHZ = 1<<11, | ||
| 133 | IEEE80211_CHAN_NO_10MHZ = 1<<12, | ||
| 123 | }; | 134 | }; |
| 124 | 135 | ||
| 125 | #define IEEE80211_CHAN_NO_HT40 \ | 136 | #define IEEE80211_CHAN_NO_HT40 \ |
| @@ -330,8 +341,8 @@ struct vif_params { | |||
| 330 | * @seq_len: length of @seq. | 341 | * @seq_len: length of @seq. |
| 331 | */ | 342 | */ |
| 332 | struct key_params { | 343 | struct key_params { |
| 333 | u8 *key; | 344 | const u8 *key; |
| 334 | u8 *seq; | 345 | const u8 *seq; |
| 335 | int key_len; | 346 | int key_len; |
| 336 | int seq_len; | 347 | int seq_len; |
| 337 | u32 cipher; | 348 | u32 cipher; |
| @@ -441,10 +452,13 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, | |||
| 441 | * cfg80211_chandef_dfs_required - checks if radar detection is required | 452 | * cfg80211_chandef_dfs_required - checks if radar detection is required |
| 442 | * @wiphy: the wiphy to validate against | 453 | * @wiphy: the wiphy to validate against |
| 443 | * @chandef: the channel definition to check | 454 | * @chandef: the channel definition to check |
| 444 | * Return: 1 if radar detection is required, 0 if it is not, < 0 on error | 455 | * @iftype: the interface type as specified in &enum nl80211_iftype |
| 456 | * Returns: | ||
| 457 | * 1 if radar detection is required, 0 if it is not, < 0 on error | ||
| 445 | */ | 458 | */ |
| 446 | int cfg80211_chandef_dfs_required(struct wiphy *wiphy, | 459 | int cfg80211_chandef_dfs_required(struct wiphy *wiphy, |
| 447 | const struct cfg80211_chan_def *chandef); | 460 | const struct cfg80211_chan_def *chandef, |
| 461 | enum nl80211_iftype iftype); | ||
| 448 | 462 | ||
| 449 | /** | 463 | /** |
| 450 | * ieee80211_chandef_rate_flags - returns rate flags for a channel | 464 | * ieee80211_chandef_rate_flags - returns rate flags for a channel |
| @@ -654,7 +668,6 @@ struct cfg80211_acl_data { | |||
| 654 | * @p2p_opp_ps: P2P opportunistic PS | 668 | * @p2p_opp_ps: P2P opportunistic PS |
| 655 | * @acl: ACL configuration used by the drivers which has support for | 669 | * @acl: ACL configuration used by the drivers which has support for |
| 656 | * MAC address based access control | 670 | * MAC address based access control |
| 657 | * @radar_required: set if radar detection is required | ||
| 658 | */ | 671 | */ |
| 659 | struct cfg80211_ap_settings { | 672 | struct cfg80211_ap_settings { |
| 660 | struct cfg80211_chan_def chandef; | 673 | struct cfg80211_chan_def chandef; |
| @@ -672,7 +685,6 @@ struct cfg80211_ap_settings { | |||
| 672 | u8 p2p_ctwindow; | 685 | u8 p2p_ctwindow; |
| 673 | bool p2p_opp_ps; | 686 | bool p2p_opp_ps; |
| 674 | const struct cfg80211_acl_data *acl; | 687 | const struct cfg80211_acl_data *acl; |
| 675 | bool radar_required; | ||
| 676 | }; | 688 | }; |
| 677 | 689 | ||
| 678 | /** | 690 | /** |
| @@ -682,8 +694,10 @@ struct cfg80211_ap_settings { | |||
| 682 | * | 694 | * |
| 683 | * @chandef: defines the channel to use after the switch | 695 | * @chandef: defines the channel to use after the switch |
| 684 | * @beacon_csa: beacon data while performing the switch | 696 | * @beacon_csa: beacon data while performing the switch |
| 685 | * @counter_offset_beacon: offset for the counter within the beacon (tail) | 697 | * @counter_offsets_beacon: offsets of the counters within the beacon (tail) |
| 686 | * @counter_offset_presp: offset for the counter within the probe response | 698 | * @counter_offsets_presp: offsets of the counters within the probe response |
| 699 | * @n_counter_offsets_beacon: number of csa counters the beacon (tail) | ||
| 700 | * @n_counter_offsets_presp: number of csa counters in the probe response | ||
| 687 | * @beacon_after: beacon data to be used on the new channel | 701 | * @beacon_after: beacon data to be used on the new channel |
| 688 | * @radar_required: whether radar detection is required on the new channel | 702 | * @radar_required: whether radar detection is required on the new channel |
| 689 | * @block_tx: whether transmissions should be blocked while changing | 703 | * @block_tx: whether transmissions should be blocked while changing |
| @@ -692,7 +706,10 @@ struct cfg80211_ap_settings { | |||
| 692 | struct cfg80211_csa_settings { | 706 | struct cfg80211_csa_settings { |
| 693 | struct cfg80211_chan_def chandef; | 707 | struct cfg80211_chan_def chandef; |
| 694 | struct cfg80211_beacon_data beacon_csa; | 708 | struct cfg80211_beacon_data beacon_csa; |
| 695 | u16 counter_offset_beacon, counter_offset_presp; | 709 | const u16 *counter_offsets_beacon; |
| 710 | const u16 *counter_offsets_presp; | ||
| 711 | unsigned int n_counter_offsets_beacon; | ||
| 712 | unsigned int n_counter_offsets_presp; | ||
| 696 | struct cfg80211_beacon_data beacon_after; | 713 | struct cfg80211_beacon_data beacon_after; |
| 697 | bool radar_required; | 714 | bool radar_required; |
| 698 | bool block_tx; | 715 | bool block_tx; |
| @@ -856,36 +873,38 @@ int cfg80211_check_station_change(struct wiphy *wiphy, | |||
| 856 | * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled | 873 | * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled |
| 857 | * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled | 874 | * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled |
| 858 | * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled | 875 | * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled |
| 876 | * @STATION_INFO_EXPECTED_THROUGHPUT: @expected_throughput filled | ||
| 859 | */ | 877 | */ |
| 860 | enum station_info_flags { | 878 | enum station_info_flags { |
| 861 | STATION_INFO_INACTIVE_TIME = 1<<0, | 879 | STATION_INFO_INACTIVE_TIME = BIT(0), |
| 862 | STATION_INFO_RX_BYTES = 1<<1, | 880 | STATION_INFO_RX_BYTES = BIT(1), |
| 863 | STATION_INFO_TX_BYTES = 1<<2, | 881 | STATION_INFO_TX_BYTES = BIT(2), |
| 864 | STATION_INFO_LLID = 1<<3, | 882 | STATION_INFO_LLID = BIT(3), |
| 865 | STATION_INFO_PLID = 1<<4, | 883 | STATION_INFO_PLID = BIT(4), |
| 866 | STATION_INFO_PLINK_STATE = 1<<5, | 884 | STATION_INFO_PLINK_STATE = BIT(5), |
| 867 | STATION_INFO_SIGNAL = 1<<6, | 885 | STATION_INFO_SIGNAL = BIT(6), |
| 868 | STATION_INFO_TX_BITRATE = 1<<7, | 886 | STATION_INFO_TX_BITRATE = BIT(7), |
| 869 | STATION_INFO_RX_PACKETS = 1<<8, | 887 | STATION_INFO_RX_PACKETS = BIT(8), |
| 870 | STATION_INFO_TX_PACKETS = 1<<9, | 888 | STATION_INFO_TX_PACKETS = BIT(9), |
| 871 | STATION_INFO_TX_RETRIES = 1<<10, | 889 | STATION_INFO_TX_RETRIES = BIT(10), |
| 872 | STATION_INFO_TX_FAILED = 1<<11, | 890 | STATION_INFO_TX_FAILED = BIT(11), |
| 873 | STATION_INFO_RX_DROP_MISC = 1<<12, | 891 | STATION_INFO_RX_DROP_MISC = BIT(12), |
| 874 | STATION_INFO_SIGNAL_AVG = 1<<13, | 892 | STATION_INFO_SIGNAL_AVG = BIT(13), |
| 875 | STATION_INFO_RX_BITRATE = 1<<14, | 893 | STATION_INFO_RX_BITRATE = BIT(14), |
| 876 | STATION_INFO_BSS_PARAM = 1<<15, | 894 | STATION_INFO_BSS_PARAM = BIT(15), |
| 877 | STATION_INFO_CONNECTED_TIME = 1<<16, | 895 | STATION_INFO_CONNECTED_TIME = BIT(16), |
| 878 | STATION_INFO_ASSOC_REQ_IES = 1<<17, | 896 | STATION_INFO_ASSOC_REQ_IES = BIT(17), |
| 879 | STATION_INFO_STA_FLAGS = 1<<18, | 897 | STATION_INFO_STA_FLAGS = BIT(18), |
| 880 | STATION_INFO_BEACON_LOSS_COUNT = 1<<19, | 898 | STATION_INFO_BEACON_LOSS_COUNT = BIT(19), |
| 881 | STATION_INFO_T_OFFSET = 1<<20, | 899 | STATION_INFO_T_OFFSET = BIT(20), |
| 882 | STATION_INFO_LOCAL_PM = 1<<21, | 900 | STATION_INFO_LOCAL_PM = BIT(21), |
| 883 | STATION_INFO_PEER_PM = 1<<22, | 901 | STATION_INFO_PEER_PM = BIT(22), |
| 884 | STATION_INFO_NONPEER_PM = 1<<23, | 902 | STATION_INFO_NONPEER_PM = BIT(23), |
| 885 | STATION_INFO_RX_BYTES64 = 1<<24, | 903 | STATION_INFO_RX_BYTES64 = BIT(24), |
| 886 | STATION_INFO_TX_BYTES64 = 1<<25, | 904 | STATION_INFO_TX_BYTES64 = BIT(25), |
| 887 | STATION_INFO_CHAIN_SIGNAL = 1<<26, | 905 | STATION_INFO_CHAIN_SIGNAL = BIT(26), |
| 888 | STATION_INFO_CHAIN_SIGNAL_AVG = 1<<27, | 906 | STATION_INFO_CHAIN_SIGNAL_AVG = BIT(27), |
| 907 | STATION_INFO_EXPECTED_THROUGHPUT = BIT(28), | ||
| 889 | }; | 908 | }; |
| 890 | 909 | ||
| 891 | /** | 910 | /** |
| @@ -1007,6 +1026,8 @@ struct sta_bss_parameters { | |||
| 1007 | * @local_pm: local mesh STA power save mode | 1026 | * @local_pm: local mesh STA power save mode |
| 1008 | * @peer_pm: peer mesh STA power save mode | 1027 | * @peer_pm: peer mesh STA power save mode |
| 1009 | * @nonpeer_pm: non-peer mesh STA power save mode | 1028 | * @nonpeer_pm: non-peer mesh STA power save mode |
| 1029 | * @expected_throughput: expected throughput in kbps (including 802.11 headers) | ||
| 1030 | * towards this station. | ||
| 1010 | */ | 1031 | */ |
| 1011 | struct station_info { | 1032 | struct station_info { |
| 1012 | u32 filled; | 1033 | u32 filled; |
| @@ -1045,6 +1066,8 @@ struct station_info { | |||
| 1045 | enum nl80211_mesh_power_mode peer_pm; | 1066 | enum nl80211_mesh_power_mode peer_pm; |
| 1046 | enum nl80211_mesh_power_mode nonpeer_pm; | 1067 | enum nl80211_mesh_power_mode nonpeer_pm; |
| 1047 | 1068 | ||
| 1069 | u32 expected_throughput; | ||
| 1070 | |||
| 1048 | /* | 1071 | /* |
| 1049 | * Note: Add a new enum station_info_flags value for each new field and | 1072 | * Note: Add a new enum station_info_flags value for each new field and |
| 1050 | * use it to check which fields are initialized. | 1073 | * use it to check which fields are initialized. |
| @@ -1052,6 +1075,19 @@ struct station_info { | |||
| 1052 | }; | 1075 | }; |
| 1053 | 1076 | ||
| 1054 | /** | 1077 | /** |
| 1078 | * cfg80211_get_station - retrieve information about a given station | ||
| 1079 | * @dev: the device where the station is supposed to be connected to | ||
| 1080 | * @mac_addr: the mac address of the station of interest | ||
| 1081 | * @sinfo: pointer to the structure to fill with the information | ||
| 1082 | * | ||
| 1083 | * Returns 0 on success and sinfo is filled with the available information | ||
| 1084 | * otherwise returns a negative error code and the content of sinfo has to be | ||
| 1085 | * considered undefined. | ||
| 1086 | */ | ||
| 1087 | int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, | ||
| 1088 | struct station_info *sinfo); | ||
| 1089 | |||
| 1090 | /** | ||
| 1055 | * enum monitor_flags - monitor flags | 1091 | * enum monitor_flags - monitor flags |
| 1056 | * | 1092 | * |
| 1057 | * Monitor interface configuration flags. Note that these must be the bits | 1093 | * Monitor interface configuration flags. Note that these must be the bits |
| @@ -1152,7 +1188,7 @@ struct bss_parameters { | |||
| 1152 | int use_cts_prot; | 1188 | int use_cts_prot; |
| 1153 | int use_short_preamble; | 1189 | int use_short_preamble; |
| 1154 | int use_short_slot_time; | 1190 | int use_short_slot_time; |
| 1155 | u8 *basic_rates; | 1191 | const u8 *basic_rates; |
| 1156 | u8 basic_rates_len; | 1192 | u8 basic_rates_len; |
| 1157 | int ap_isolate; | 1193 | int ap_isolate; |
| 1158 | int ht_opmode; | 1194 | int ht_opmode; |
| @@ -1682,10 +1718,10 @@ struct cfg80211_disassoc_request { | |||
| 1682 | * @ht_capa_mask: The bits of ht_capa which are to be used. | 1718 | * @ht_capa_mask: The bits of ht_capa which are to be used. |
| 1683 | */ | 1719 | */ |
| 1684 | struct cfg80211_ibss_params { | 1720 | struct cfg80211_ibss_params { |
| 1685 | u8 *ssid; | 1721 | const u8 *ssid; |
| 1686 | u8 *bssid; | 1722 | const u8 *bssid; |
| 1687 | struct cfg80211_chan_def chandef; | 1723 | struct cfg80211_chan_def chandef; |
| 1688 | u8 *ie; | 1724 | const u8 *ie; |
| 1689 | u8 ssid_len, ie_len; | 1725 | u8 ssid_len, ie_len; |
| 1690 | u16 beacon_interval; | 1726 | u16 beacon_interval; |
| 1691 | u32 basic_rates; | 1727 | u32 basic_rates; |
| @@ -1794,8 +1830,8 @@ struct cfg80211_bitrate_mask { | |||
| 1794 | * @pmkid: The PMK material itself. | 1830 | * @pmkid: The PMK material itself. |
| 1795 | */ | 1831 | */ |
| 1796 | struct cfg80211_pmksa { | 1832 | struct cfg80211_pmksa { |
| 1797 | u8 *bssid; | 1833 | const u8 *bssid; |
| 1798 | u8 *pmkid; | 1834 | const u8 *pmkid; |
| 1799 | }; | 1835 | }; |
| 1800 | 1836 | ||
| 1801 | /** | 1837 | /** |
| @@ -1810,7 +1846,7 @@ struct cfg80211_pmksa { | |||
| 1810 | * memory, free @mask only! | 1846 | * memory, free @mask only! |
| 1811 | */ | 1847 | */ |
| 1812 | struct cfg80211_pkt_pattern { | 1848 | struct cfg80211_pkt_pattern { |
| 1813 | u8 *mask, *pattern; | 1849 | const u8 *mask, *pattern; |
| 1814 | int pattern_len; | 1850 | int pattern_len; |
| 1815 | int pkt_offset; | 1851 | int pkt_offset; |
| 1816 | }; | 1852 | }; |
| @@ -1974,6 +2010,8 @@ struct cfg80211_update_ft_ies_params { | |||
| 1974 | * @len: buffer length | 2010 | * @len: buffer length |
| 1975 | * @no_cck: don't use cck rates for this frame | 2011 | * @no_cck: don't use cck rates for this frame |
| 1976 | * @dont_wait_for_ack: tells the low level not to wait for an ack | 2012 | * @dont_wait_for_ack: tells the low level not to wait for an ack |
| 2013 | * @n_csa_offsets: length of csa_offsets array | ||
| 2014 | * @csa_offsets: array of all the csa offsets in the frame | ||
| 1977 | */ | 2015 | */ |
| 1978 | struct cfg80211_mgmt_tx_params { | 2016 | struct cfg80211_mgmt_tx_params { |
| 1979 | struct ieee80211_channel *chan; | 2017 | struct ieee80211_channel *chan; |
| @@ -1983,6 +2021,8 @@ struct cfg80211_mgmt_tx_params { | |||
| 1983 | size_t len; | 2021 | size_t len; |
| 1984 | bool no_cck; | 2022 | bool no_cck; |
| 1985 | bool dont_wait_for_ack; | 2023 | bool dont_wait_for_ack; |
| 2024 | int n_csa_offsets; | ||
| 2025 | const u16 *csa_offsets; | ||
| 1986 | }; | 2026 | }; |
| 1987 | 2027 | ||
| 1988 | /** | 2028 | /** |
| @@ -2278,6 +2318,10 @@ struct cfg80211_qos_map { | |||
| 2278 | * @channel_switch: initiate channel-switch procedure (with CSA) | 2318 | * @channel_switch: initiate channel-switch procedure (with CSA) |
| 2279 | * | 2319 | * |
| 2280 | * @set_qos_map: Set QoS mapping information to the driver | 2320 | * @set_qos_map: Set QoS mapping information to the driver |
| 2321 | * | ||
| 2322 | * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the | ||
| 2323 | * given interface This is used e.g. for dynamic HT 20/40 MHz channel width | ||
| 2324 | * changes during the lifetime of the BSS. | ||
| 2281 | */ | 2325 | */ |
| 2282 | struct cfg80211_ops { | 2326 | struct cfg80211_ops { |
| 2283 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); | 2327 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); |
| @@ -2320,28 +2364,29 @@ struct cfg80211_ops { | |||
| 2320 | 2364 | ||
| 2321 | 2365 | ||
| 2322 | int (*add_station)(struct wiphy *wiphy, struct net_device *dev, | 2366 | int (*add_station)(struct wiphy *wiphy, struct net_device *dev, |
| 2323 | u8 *mac, struct station_parameters *params); | 2367 | const u8 *mac, |
| 2368 | struct station_parameters *params); | ||
| 2324 | int (*del_station)(struct wiphy *wiphy, struct net_device *dev, | 2369 | int (*del_station)(struct wiphy *wiphy, struct net_device *dev, |
| 2325 | u8 *mac); | 2370 | const u8 *mac); |
| 2326 | int (*change_station)(struct wiphy *wiphy, struct net_device *dev, | 2371 | int (*change_station)(struct wiphy *wiphy, struct net_device *dev, |
| 2327 | u8 *mac, struct station_parameters *params); | 2372 | const u8 *mac, |
| 2373 | struct station_parameters *params); | ||
| 2328 | int (*get_station)(struct wiphy *wiphy, struct net_device *dev, | 2374 | int (*get_station)(struct wiphy *wiphy, struct net_device *dev, |
| 2329 | u8 *mac, struct station_info *sinfo); | 2375 | const u8 *mac, struct station_info *sinfo); |
| 2330 | int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, | 2376 | int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, |
| 2331 | int idx, u8 *mac, struct station_info *sinfo); | 2377 | int idx, u8 *mac, struct station_info *sinfo); |
| 2332 | 2378 | ||
| 2333 | int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, | 2379 | int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, |
| 2334 | u8 *dst, u8 *next_hop); | 2380 | const u8 *dst, const u8 *next_hop); |
| 2335 | int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, | 2381 | int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, |
| 2336 | u8 *dst); | 2382 | const u8 *dst); |
| 2337 | int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, | 2383 | int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, |
| 2338 | u8 *dst, u8 *next_hop); | 2384 | const u8 *dst, const u8 *next_hop); |
| 2339 | int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, | 2385 | int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, |
| 2340 | u8 *dst, u8 *next_hop, | 2386 | u8 *dst, u8 *next_hop, struct mpath_info *pinfo); |
| 2341 | struct mpath_info *pinfo); | ||
| 2342 | int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, | 2387 | int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, |
| 2343 | int idx, u8 *dst, u8 *next_hop, | 2388 | int idx, u8 *dst, u8 *next_hop, |
| 2344 | struct mpath_info *pinfo); | 2389 | struct mpath_info *pinfo); |
| 2345 | int (*get_mesh_config)(struct wiphy *wiphy, | 2390 | int (*get_mesh_config)(struct wiphy *wiphy, |
| 2346 | struct net_device *dev, | 2391 | struct net_device *dev, |
| 2347 | struct mesh_config *conf); | 2392 | struct mesh_config *conf); |
| @@ -2471,11 +2516,11 @@ struct cfg80211_ops { | |||
| 2471 | struct cfg80211_gtk_rekey_data *data); | 2516 | struct cfg80211_gtk_rekey_data *data); |
| 2472 | 2517 | ||
| 2473 | int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, | 2518 | int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, |
| 2474 | u8 *peer, u8 action_code, u8 dialog_token, | 2519 | const u8 *peer, u8 action_code, u8 dialog_token, |
| 2475 | u16 status_code, u32 peer_capability, | 2520 | u16 status_code, u32 peer_capability, |
| 2476 | const u8 *buf, size_t len); | 2521 | const u8 *buf, size_t len); |
| 2477 | int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, | 2522 | int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, |
| 2478 | u8 *peer, enum nl80211_tdls_operation oper); | 2523 | const u8 *peer, enum nl80211_tdls_operation oper); |
| 2479 | 2524 | ||
| 2480 | int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, | 2525 | int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, |
| 2481 | const u8 *peer, u64 *cookie); | 2526 | const u8 *peer, u64 *cookie); |
| @@ -2521,9 +2566,13 @@ struct cfg80211_ops { | |||
| 2521 | int (*channel_switch)(struct wiphy *wiphy, | 2566 | int (*channel_switch)(struct wiphy *wiphy, |
| 2522 | struct net_device *dev, | 2567 | struct net_device *dev, |
| 2523 | struct cfg80211_csa_settings *params); | 2568 | struct cfg80211_csa_settings *params); |
| 2569 | |||
| 2524 | int (*set_qos_map)(struct wiphy *wiphy, | 2570 | int (*set_qos_map)(struct wiphy *wiphy, |
| 2525 | struct net_device *dev, | 2571 | struct net_device *dev, |
| 2526 | struct cfg80211_qos_map *qos_map); | 2572 | struct cfg80211_qos_map *qos_map); |
| 2573 | |||
| 2574 | int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev, | ||
| 2575 | struct cfg80211_chan_def *chandef); | ||
| 2527 | }; | 2576 | }; |
| 2528 | 2577 | ||
| 2529 | /* | 2578 | /* |
| @@ -2618,6 +2667,7 @@ struct ieee80211_iface_limit { | |||
| 2618 | * between infrastructure and AP types must match. This is required | 2667 | * between infrastructure and AP types must match. This is required |
| 2619 | * only in special cases. | 2668 | * only in special cases. |
| 2620 | * @radar_detect_widths: bitmap of channel widths supported for radar detection | 2669 | * @radar_detect_widths: bitmap of channel widths supported for radar detection |
| 2670 | * @radar_detect_regions: bitmap of regions supported for radar detection | ||
| 2621 | * | 2671 | * |
| 2622 | * With this structure the driver can describe which interface | 2672 | * With this structure the driver can describe which interface |
| 2623 | * combinations it supports concurrently. | 2673 | * combinations it supports concurrently. |
| @@ -2675,6 +2725,7 @@ struct ieee80211_iface_combination { | |||
| 2675 | u8 n_limits; | 2725 | u8 n_limits; |
| 2676 | bool beacon_int_infra_match; | 2726 | bool beacon_int_infra_match; |
| 2677 | u8 radar_detect_widths; | 2727 | u8 radar_detect_widths; |
| 2728 | u8 radar_detect_regions; | ||
| 2678 | }; | 2729 | }; |
| 2679 | 2730 | ||
| 2680 | struct ieee80211_txrx_stypes { | 2731 | struct ieee80211_txrx_stypes { |
| @@ -2905,6 +2956,17 @@ struct wiphy_vendor_command { | |||
| 2905 | * (including P2P GO) or 0 to indicate no such limit is advertised. The | 2956 | * (including P2P GO) or 0 to indicate no such limit is advertised. The |
| 2906 | * driver is allowed to advertise a theoretical limit that it can reach in | 2957 | * driver is allowed to advertise a theoretical limit that it can reach in |
| 2907 | * some cases, but may not always reach. | 2958 | * some cases, but may not always reach. |
| 2959 | * | ||
| 2960 | * @max_num_csa_counters: Number of supported csa_counters in beacons | ||
| 2961 | * and probe responses. This value should be set if the driver | ||
| 2962 | * wishes to limit the number of csa counters. Default (0) means | ||
| 2963 | * infinite. | ||
| 2964 | * @max_adj_channel_rssi_comp: max offset of between the channel on which the | ||
| 2965 | * frame was sent and the channel on which the frame was heard for which | ||
| 2966 | * the reported rssi is still valid. If a driver is able to compensate the | ||
| 2967 | * low rssi when a frame is heard on different channel, then it should set | ||
| 2968 | * this variable to the maximal offset for which it can compensate. | ||
| 2969 | * This value should be set in MHz. | ||
| 2908 | */ | 2970 | */ |
| 2909 | struct wiphy { | 2971 | struct wiphy { |
| 2910 | /* assign these fields before you register the wiphy */ | 2972 | /* assign these fields before you register the wiphy */ |
| @@ -3022,6 +3084,9 @@ struct wiphy { | |||
| 3022 | 3084 | ||
| 3023 | u16 max_ap_assoc_sta; | 3085 | u16 max_ap_assoc_sta; |
| 3024 | 3086 | ||
| 3087 | u8 max_num_csa_counters; | ||
| 3088 | u8 max_adj_channel_rssi_comp; | ||
| 3089 | |||
| 3025 | char priv[0] __aligned(NETDEV_ALIGN); | 3090 | char priv[0] __aligned(NETDEV_ALIGN); |
| 3026 | }; | 3091 | }; |
| 3027 | 3092 | ||
| @@ -3194,6 +3259,7 @@ struct cfg80211_cached_keys; | |||
| 3194 | * @ibss_dfs_possible: (private) IBSS may change to a DFS channel | 3259 | * @ibss_dfs_possible: (private) IBSS may change to a DFS channel |
| 3195 | * @event_list: (private) list for internal event processing | 3260 | * @event_list: (private) list for internal event processing |
| 3196 | * @event_lock: (private) lock for event list | 3261 | * @event_lock: (private) lock for event list |
| 3262 | * @owner_nlportid: (private) owner socket port ID | ||
| 3197 | */ | 3263 | */ |
| 3198 | struct wireless_dev { | 3264 | struct wireless_dev { |
| 3199 | struct wiphy *wiphy; | 3265 | struct wiphy *wiphy; |
| @@ -3241,13 +3307,15 @@ struct wireless_dev { | |||
| 3241 | unsigned long cac_start_time; | 3307 | unsigned long cac_start_time; |
| 3242 | unsigned int cac_time_ms; | 3308 | unsigned int cac_time_ms; |
| 3243 | 3309 | ||
| 3310 | u32 owner_nlportid; | ||
| 3311 | |||
| 3244 | #ifdef CONFIG_CFG80211_WEXT | 3312 | #ifdef CONFIG_CFG80211_WEXT |
| 3245 | /* wext data */ | 3313 | /* wext data */ |
| 3246 | struct { | 3314 | struct { |
| 3247 | struct cfg80211_ibss_params ibss; | 3315 | struct cfg80211_ibss_params ibss; |
| 3248 | struct cfg80211_connect_params connect; | 3316 | struct cfg80211_connect_params connect; |
| 3249 | struct cfg80211_cached_keys *keys; | 3317 | struct cfg80211_cached_keys *keys; |
| 3250 | u8 *ie; | 3318 | const u8 *ie; |
| 3251 | size_t ie_len; | 3319 | size_t ie_len; |
| 3252 | u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; | 3320 | u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; |
| 3253 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | 3321 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
| @@ -3488,7 +3556,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, | |||
| 3488 | * Return: 0 on success, or a negative error code. | 3556 | * Return: 0 on success, or a negative error code. |
| 3489 | */ | 3557 | */ |
| 3490 | int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, | 3558 | int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, |
| 3491 | enum nl80211_iftype iftype, u8 *bssid, bool qos); | 3559 | enum nl80211_iftype iftype, const u8 *bssid, |
| 3560 | bool qos); | ||
| 3492 | 3561 | ||
| 3493 | /** | 3562 | /** |
| 3494 | * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame | 3563 | * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame |
| @@ -3600,7 +3669,7 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2); | |||
| 3600 | * default channel settings will be disregarded. If no rule is found for a | 3669 | * default channel settings will be disregarded. If no rule is found for a |
| 3601 | * channel on the regulatory domain the channel will be disabled. | 3670 | * channel on the regulatory domain the channel will be disabled. |
| 3602 | * Drivers using this for a wiphy should also set the wiphy flag | 3671 | * Drivers using this for a wiphy should also set the wiphy flag |
| 3603 | * WIPHY_FLAG_CUSTOM_REGULATORY or cfg80211 will set it for the wiphy | 3672 | * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy |
| 3604 | * that called this helper. | 3673 | * that called this helper. |
| 3605 | */ | 3674 | */ |
| 3606 | void wiphy_apply_custom_regulatory(struct wiphy *wiphy, | 3675 | void wiphy_apply_custom_regulatory(struct wiphy *wiphy, |
| @@ -3669,6 +3738,18 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy); | |||
| 3669 | void cfg80211_sched_scan_stopped(struct wiphy *wiphy); | 3738 | void cfg80211_sched_scan_stopped(struct wiphy *wiphy); |
| 3670 | 3739 | ||
| 3671 | /** | 3740 | /** |
| 3741 | * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped | ||
| 3742 | * | ||
| 3743 | * @wiphy: the wiphy on which the scheduled scan stopped | ||
| 3744 | * | ||
| 3745 | * The driver can call this function to inform cfg80211 that the | ||
| 3746 | * scheduled scan had to be stopped, for whatever reason. The driver | ||
| 3747 | * is then called back via the sched_scan_stop operation when done. | ||
| 3748 | * This function should be called with rtnl locked. | ||
| 3749 | */ | ||
| 3750 | void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy); | ||
| 3751 | |||
| 3752 | /** | ||
| 3672 | * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame | 3753 | * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame |
| 3673 | * | 3754 | * |
| 3674 | * @wiphy: the wiphy reporting the BSS | 3755 | * @wiphy: the wiphy reporting the BSS |
| @@ -4277,7 +4358,7 @@ void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, | |||
| 4277 | * and not try to connect to any AP any more. | 4358 | * and not try to connect to any AP any more. |
| 4278 | */ | 4359 | */ |
| 4279 | void cfg80211_disconnected(struct net_device *dev, u16 reason, | 4360 | void cfg80211_disconnected(struct net_device *dev, u16 reason, |
| 4280 | u8 *ie, size_t ie_len, gfp_t gfp); | 4361 | const u8 *ie, size_t ie_len, gfp_t gfp); |
| 4281 | 4362 | ||
| 4282 | /** | 4363 | /** |
| 4283 | * cfg80211_ready_on_channel - notification of remain_on_channel start | 4364 | * cfg80211_ready_on_channel - notification of remain_on_channel start |
| @@ -4531,12 +4612,14 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy, | |||
| 4531 | * cfg80211_reg_can_beacon - check if beaconing is allowed | 4612 | * cfg80211_reg_can_beacon - check if beaconing is allowed |
| 4532 | * @wiphy: the wiphy | 4613 | * @wiphy: the wiphy |
| 4533 | * @chandef: the channel definition | 4614 | * @chandef: the channel definition |
| 4615 | * @iftype: interface type | ||
| 4534 | * | 4616 | * |
| 4535 | * Return: %true if there is no secondary channel or the secondary channel(s) | 4617 | * Return: %true if there is no secondary channel or the secondary channel(s) |
| 4536 | * can be used for beaconing (i.e. is not a radar channel etc.) | 4618 | * can be used for beaconing (i.e. is not a radar channel etc.) |
| 4537 | */ | 4619 | */ |
| 4538 | bool cfg80211_reg_can_beacon(struct wiphy *wiphy, | 4620 | bool cfg80211_reg_can_beacon(struct wiphy *wiphy, |
| 4539 | struct cfg80211_chan_def *chandef); | 4621 | struct cfg80211_chan_def *chandef, |
| 4622 | enum nl80211_iftype iftype); | ||
| 4540 | 4623 | ||
| 4541 | /* | 4624 | /* |
| 4542 | * cfg80211_ch_switch_notify - update wdev channel and notify userspace | 4625 | * cfg80211_ch_switch_notify - update wdev channel and notify userspace |
| @@ -4682,6 +4765,84 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); | |||
| 4682 | */ | 4765 | */ |
| 4683 | unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); | 4766 | unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); |
| 4684 | 4767 | ||
| 4768 | /** | ||
| 4769 | * cfg80211_check_combinations - check interface combinations | ||
| 4770 | * | ||
| 4771 | * @wiphy: the wiphy | ||
| 4772 | * @num_different_channels: the number of different channels we want | ||
| 4773 | * to use for verification | ||
| 4774 | * @radar_detect: a bitmap where each bit corresponds to a channel | ||
| 4775 | * width where radar detection is needed, as in the definition of | ||
| 4776 | * &struct ieee80211_iface_combination.@radar_detect_widths | ||
| 4777 | * @iftype_num: array with the numbers of interfaces of each interface | ||
| 4778 | * type. The index is the interface type as specified in &enum | ||
| 4779 | * nl80211_iftype. | ||
| 4780 | * | ||
| 4781 | * This function can be called by the driver to check whether a | ||
| 4782 | * combination of interfaces and their types are allowed according to | ||
| 4783 | * the interface combinations. | ||
| 4784 | */ | ||
| 4785 | int cfg80211_check_combinations(struct wiphy *wiphy, | ||
| 4786 | const int num_different_channels, | ||
| 4787 | const u8 radar_detect, | ||
| 4788 | const int iftype_num[NUM_NL80211_IFTYPES]); | ||
| 4789 | |||
| 4790 | /** | ||
| 4791 | * cfg80211_iter_combinations - iterate over matching combinations | ||
| 4792 | * | ||
| 4793 | * @wiphy: the wiphy | ||
| 4794 | * @num_different_channels: the number of different channels we want | ||
| 4795 | * to use for verification | ||
| 4796 | * @radar_detect: a bitmap where each bit corresponds to a channel | ||
| 4797 | * width where radar detection is needed, as in the definition of | ||
| 4798 | * &struct ieee80211_iface_combination.@radar_detect_widths | ||
| 4799 | * @iftype_num: array with the numbers of interfaces of each interface | ||
| 4800 | * type. The index is the interface type as specified in &enum | ||
| 4801 | * nl80211_iftype. | ||
| 4802 | * @iter: function to call for each matching combination | ||
| 4803 | * @data: pointer to pass to iter function | ||
| 4804 | * | ||
| 4805 | * This function can be called by the driver to check what possible | ||
| 4806 | * combinations it fits in at a given moment, e.g. for channel switching | ||
| 4807 | * purposes. | ||
| 4808 | */ | ||
| 4809 | int cfg80211_iter_combinations(struct wiphy *wiphy, | ||
| 4810 | const int num_different_channels, | ||
| 4811 | const u8 radar_detect, | ||
| 4812 | const int iftype_num[NUM_NL80211_IFTYPES], | ||
| 4813 | void (*iter)(const struct ieee80211_iface_combination *c, | ||
| 4814 | void *data), | ||
| 4815 | void *data); | ||
| 4816 | |||
| 4817 | /* | ||
| 4818 | * cfg80211_stop_iface - trigger interface disconnection | ||
| 4819 | * | ||
| 4820 | * @wiphy: the wiphy | ||
| 4821 | * @wdev: wireless device | ||
| 4822 | * @gfp: context flags | ||
| 4823 | * | ||
| 4824 | * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA | ||
| 4825 | * disconnected. | ||
| 4826 | * | ||
| 4827 | * Note: This doesn't need any locks and is asynchronous. | ||
| 4828 | */ | ||
| 4829 | void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, | ||
| 4830 | gfp_t gfp); | ||
| 4831 | |||
| 4832 | /** | ||
| 4833 | * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy | ||
| 4834 | * @wiphy: the wiphy to shut down | ||
| 4835 | * | ||
| 4836 | * This function shuts down all interfaces belonging to this wiphy by | ||
| 4837 | * calling dev_close() (and treating non-netdev interfaces as needed). | ||
| 4838 | * It shouldn't really be used unless there are some fatal device errors | ||
| 4839 | * that really can't be recovered in any other way. | ||
| 4840 | * | ||
| 4841 | * Callers must hold the RTNL and be able to deal with callbacks into | ||
| 4842 | * the driver while the function is running. | ||
| 4843 | */ | ||
| 4844 | void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy); | ||
| 4845 | |||
| 4685 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 4846 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
| 4686 | 4847 | ||
| 4687 | /* wiphy_printk helpers, similar to dev_printk */ | 4848 | /* wiphy_printk helpers, similar to dev_printk */ |
diff --git a/include/net/checksum.h b/include/net/checksum.h index a28f4e0f6251..87cb1903640d 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h | |||
| @@ -57,12 +57,14 @@ static __inline__ __wsum csum_and_copy_to_user | |||
| 57 | } | 57 | } |
| 58 | #endif | 58 | #endif |
| 59 | 59 | ||
| 60 | #ifndef HAVE_ARCH_CSUM_ADD | ||
| 60 | static inline __wsum csum_add(__wsum csum, __wsum addend) | 61 | static inline __wsum csum_add(__wsum csum, __wsum addend) |
| 61 | { | 62 | { |
| 62 | u32 res = (__force u32)csum; | 63 | u32 res = (__force u32)csum; |
| 63 | res += (__force u32)addend; | 64 | res += (__force u32)addend; |
| 64 | return (__force __wsum)(res + (res < (__force u32)addend)); | 65 | return (__force __wsum)(res + (res < (__force u32)addend)); |
| 65 | } | 66 | } |
| 67 | #endif | ||
| 66 | 68 | ||
| 67 | static inline __wsum csum_sub(__wsum csum, __wsum addend) | 69 | static inline __wsum csum_sub(__wsum csum, __wsum addend) |
| 68 | { | 70 | { |
diff --git a/include/net/dsa.h b/include/net/dsa.h index 7828ebf99ee1..6efce384451e 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h | |||
| @@ -181,6 +181,11 @@ struct dsa_switch_driver { | |||
| 181 | void register_switch_driver(struct dsa_switch_driver *type); | 181 | void register_switch_driver(struct dsa_switch_driver *type); |
| 182 | void unregister_switch_driver(struct dsa_switch_driver *type); | 182 | void unregister_switch_driver(struct dsa_switch_driver *type); |
| 183 | 183 | ||
| 184 | static inline void *ds_to_priv(struct dsa_switch *ds) | ||
| 185 | { | ||
| 186 | return (void *)(ds + 1); | ||
| 187 | } | ||
| 188 | |||
| 184 | /* | 189 | /* |
| 185 | * The original DSA tag format and some other tag formats have no | 190 | * The original DSA tag format and some other tag formats have no |
| 186 | * ethertype, which means that we need to add a little hack to the | 191 | * ethertype, which means that we need to add a little hack to the |
diff --git a/include/net/gre.h b/include/net/gre.h index 70046a0b0b89..b53182018743 100644 --- a/include/net/gre.h +++ b/include/net/gre.h | |||
| @@ -37,9 +37,10 @@ void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, | |||
| 37 | int hdr_len); | 37 | int hdr_len); |
| 38 | 38 | ||
| 39 | static inline struct sk_buff *gre_handle_offloads(struct sk_buff *skb, | 39 | static inline struct sk_buff *gre_handle_offloads(struct sk_buff *skb, |
| 40 | bool gre_csum) | 40 | bool csum) |
| 41 | { | 41 | { |
| 42 | return iptunnel_handle_offloads(skb, gre_csum, SKB_GSO_GRE); | 42 | return iptunnel_handle_offloads(skb, csum, |
| 43 | csum ? SKB_GSO_GRE_CSUM : SKB_GSO_GRE); | ||
| 43 | } | 44 | } |
| 44 | 45 | ||
| 45 | 46 | ||
diff --git a/include/net/ieee802154.h b/include/net/ieee802154.h index c7ae0ac528dc..0aa7122e8f15 100644 --- a/include/net/ieee802154.h +++ b/include/net/ieee802154.h | |||
| @@ -79,6 +79,15 @@ | |||
| 79 | #define IEEE802154_SCF_KEY_SHORT_INDEX 2 | 79 | #define IEEE802154_SCF_KEY_SHORT_INDEX 2 |
| 80 | #define IEEE802154_SCF_KEY_HW_INDEX 3 | 80 | #define IEEE802154_SCF_KEY_HW_INDEX 3 |
| 81 | 81 | ||
| 82 | #define IEEE802154_SCF_SECLEVEL_NONE 0 | ||
| 83 | #define IEEE802154_SCF_SECLEVEL_MIC32 1 | ||
| 84 | #define IEEE802154_SCF_SECLEVEL_MIC64 2 | ||
| 85 | #define IEEE802154_SCF_SECLEVEL_MIC128 3 | ||
| 86 | #define IEEE802154_SCF_SECLEVEL_ENC 4 | ||
| 87 | #define IEEE802154_SCF_SECLEVEL_ENC_MIC32 5 | ||
| 88 | #define IEEE802154_SCF_SECLEVEL_ENC_MIC64 6 | ||
| 89 | #define IEEE802154_SCF_SECLEVEL_ENC_MIC128 7 | ||
| 90 | |||
| 82 | /* MAC footer size */ | 91 | /* MAC footer size */ |
| 83 | #define IEEE802154_MFR_SIZE 2 /* 2 octets */ | 92 | #define IEEE802154_MFR_SIZE 2 /* 2 octets */ |
| 84 | 93 | ||
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h index 5a719ca892f4..3b53c8e405e4 100644 --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #ifndef IEEE802154_NETDEVICE_H | 27 | #ifndef IEEE802154_NETDEVICE_H |
| 28 | #define IEEE802154_NETDEVICE_H | 28 | #define IEEE802154_NETDEVICE_H |
| 29 | 29 | ||
| 30 | #include <net/ieee802154.h> | ||
| 30 | #include <net/af_ieee802154.h> | 31 | #include <net/af_ieee802154.h> |
| 31 | #include <linux/netdevice.h> | 32 | #include <linux/netdevice.h> |
| 32 | #include <linux/skbuff.h> | 33 | #include <linux/skbuff.h> |
| @@ -114,6 +115,34 @@ int ieee802154_hdr_pull(struct sk_buff *skb, struct ieee802154_hdr *hdr); | |||
| 114 | int ieee802154_hdr_peek_addrs(const struct sk_buff *skb, | 115 | int ieee802154_hdr_peek_addrs(const struct sk_buff *skb, |
| 115 | struct ieee802154_hdr *hdr); | 116 | struct ieee802154_hdr *hdr); |
| 116 | 117 | ||
| 118 | /* parses the full 802.15.4 header a given skb and stores them into hdr, | ||
| 119 | * performing pan id decompression and length checks to be suitable for use in | ||
| 120 | * header_ops.parse | ||
| 121 | */ | ||
| 122 | int ieee802154_hdr_peek(const struct sk_buff *skb, struct ieee802154_hdr *hdr); | ||
| 123 | |||
| 124 | int ieee802154_max_payload(const struct ieee802154_hdr *hdr); | ||
| 125 | |||
| 126 | static inline int | ||
| 127 | ieee802154_sechdr_authtag_len(const struct ieee802154_sechdr *sec) | ||
| 128 | { | ||
| 129 | switch (sec->level) { | ||
| 130 | case IEEE802154_SCF_SECLEVEL_MIC32: | ||
| 131 | case IEEE802154_SCF_SECLEVEL_ENC_MIC32: | ||
| 132 | return 4; | ||
| 133 | case IEEE802154_SCF_SECLEVEL_MIC64: | ||
| 134 | case IEEE802154_SCF_SECLEVEL_ENC_MIC64: | ||
| 135 | return 8; | ||
| 136 | case IEEE802154_SCF_SECLEVEL_MIC128: | ||
| 137 | case IEEE802154_SCF_SECLEVEL_ENC_MIC128: | ||
| 138 | return 16; | ||
| 139 | case IEEE802154_SCF_SECLEVEL_NONE: | ||
| 140 | case IEEE802154_SCF_SECLEVEL_ENC: | ||
| 141 | default: | ||
| 142 | return 0; | ||
| 143 | } | ||
| 144 | } | ||
| 145 | |||
| 117 | static inline int ieee802154_hdr_length(struct sk_buff *skb) | 146 | static inline int ieee802154_hdr_length(struct sk_buff *skb) |
| 118 | { | 147 | { |
| 119 | struct ieee802154_hdr hdr; | 148 | struct ieee802154_hdr hdr; |
| @@ -193,8 +222,12 @@ static inline void ieee802154_addr_to_sa(struct ieee802154_addr_sa *sa, | |||
| 193 | */ | 222 | */ |
| 194 | struct ieee802154_mac_cb { | 223 | struct ieee802154_mac_cb { |
| 195 | u8 lqi; | 224 | u8 lqi; |
| 196 | u8 flags; | 225 | u8 type; |
| 197 | u8 seq; | 226 | bool ackreq; |
| 227 | bool secen; | ||
| 228 | bool secen_override; | ||
| 229 | u8 seclevel; | ||
| 230 | bool seclevel_override; | ||
| 198 | struct ieee802154_addr source; | 231 | struct ieee802154_addr source; |
| 199 | struct ieee802154_addr dest; | 232 | struct ieee802154_addr dest; |
| 200 | }; | 233 | }; |
| @@ -204,25 +237,96 @@ static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb) | |||
| 204 | return (struct ieee802154_mac_cb *)skb->cb; | 237 | return (struct ieee802154_mac_cb *)skb->cb; |
| 205 | } | 238 | } |
| 206 | 239 | ||
| 207 | #define MAC_CB_FLAG_TYPEMASK ((1 << 3) - 1) | 240 | static inline struct ieee802154_mac_cb *mac_cb_init(struct sk_buff *skb) |
| 208 | |||
| 209 | #define MAC_CB_FLAG_ACKREQ (1 << 3) | ||
| 210 | #define MAC_CB_FLAG_SECEN (1 << 4) | ||
| 211 | |||
| 212 | static inline bool mac_cb_is_ackreq(struct sk_buff *skb) | ||
| 213 | { | 241 | { |
| 214 | return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ; | 242 | BUILD_BUG_ON(sizeof(struct ieee802154_mac_cb) > sizeof(skb->cb)); |
| 215 | } | ||
| 216 | 243 | ||
| 217 | static inline bool mac_cb_is_secen(struct sk_buff *skb) | 244 | memset(skb->cb, 0, sizeof(struct ieee802154_mac_cb)); |
| 218 | { | 245 | return mac_cb(skb); |
| 219 | return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN; | ||
| 220 | } | 246 | } |
| 221 | 247 | ||
| 222 | static inline int mac_cb_type(struct sk_buff *skb) | 248 | #define IEEE802154_LLSEC_KEY_SIZE 16 |
| 223 | { | 249 | |
| 224 | return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK; | 250 | struct ieee802154_llsec_key_id { |
| 225 | } | 251 | u8 mode; |
| 252 | u8 id; | ||
| 253 | union { | ||
| 254 | struct ieee802154_addr device_addr; | ||
| 255 | __le32 short_source; | ||
| 256 | __le64 extended_source; | ||
| 257 | }; | ||
| 258 | }; | ||
| 259 | |||
| 260 | struct ieee802154_llsec_key { | ||
| 261 | u8 frame_types; | ||
| 262 | u32 cmd_frame_ids; | ||
| 263 | u8 key[IEEE802154_LLSEC_KEY_SIZE]; | ||
| 264 | }; | ||
| 265 | |||
| 266 | struct ieee802154_llsec_key_entry { | ||
| 267 | struct list_head list; | ||
| 268 | |||
| 269 | struct ieee802154_llsec_key_id id; | ||
| 270 | struct ieee802154_llsec_key *key; | ||
| 271 | }; | ||
| 272 | |||
| 273 | struct ieee802154_llsec_device_key { | ||
| 274 | struct list_head list; | ||
| 275 | |||
| 276 | struct ieee802154_llsec_key_id key_id; | ||
| 277 | u32 frame_counter; | ||
| 278 | }; | ||
| 279 | |||
| 280 | enum { | ||
| 281 | IEEE802154_LLSEC_DEVKEY_IGNORE, | ||
| 282 | IEEE802154_LLSEC_DEVKEY_RESTRICT, | ||
| 283 | IEEE802154_LLSEC_DEVKEY_RECORD, | ||
| 284 | |||
| 285 | __IEEE802154_LLSEC_DEVKEY_MAX, | ||
| 286 | }; | ||
| 287 | |||
| 288 | struct ieee802154_llsec_device { | ||
| 289 | struct list_head list; | ||
| 290 | |||
| 291 | __le16 pan_id; | ||
| 292 | __le16 short_addr; | ||
| 293 | __le64 hwaddr; | ||
| 294 | u32 frame_counter; | ||
| 295 | bool seclevel_exempt; | ||
| 296 | |||
| 297 | u8 key_mode; | ||
| 298 | struct list_head keys; | ||
| 299 | }; | ||
| 300 | |||
| 301 | struct ieee802154_llsec_seclevel { | ||
| 302 | struct list_head list; | ||
| 303 | |||
| 304 | u8 frame_type; | ||
| 305 | u8 cmd_frame_id; | ||
| 306 | bool device_override; | ||
| 307 | u32 sec_levels; | ||
| 308 | }; | ||
| 309 | |||
| 310 | struct ieee802154_llsec_params { | ||
| 311 | bool enabled; | ||
| 312 | |||
| 313 | __be32 frame_counter; | ||
| 314 | u8 out_level; | ||
| 315 | struct ieee802154_llsec_key_id out_key; | ||
| 316 | |||
| 317 | __le64 default_key_source; | ||
| 318 | |||
| 319 | __le16 pan_id; | ||
| 320 | __le64 hwaddr; | ||
| 321 | __le64 coord_hwaddr; | ||
| 322 | __le16 coord_shortaddr; | ||
| 323 | }; | ||
| 324 | |||
| 325 | struct ieee802154_llsec_table { | ||
| 326 | struct list_head keys; | ||
| 327 | struct list_head devices; | ||
| 328 | struct list_head security_levels; | ||
| 329 | }; | ||
| 226 | 330 | ||
| 227 | #define IEEE802154_MAC_SCAN_ED 0 | 331 | #define IEEE802154_MAC_SCAN_ED 0 |
| 228 | #define IEEE802154_MAC_SCAN_ACTIVE 1 | 332 | #define IEEE802154_MAC_SCAN_ACTIVE 1 |
| @@ -242,6 +346,53 @@ struct ieee802154_mac_params { | |||
| 242 | }; | 346 | }; |
| 243 | 347 | ||
| 244 | struct wpan_phy; | 348 | struct wpan_phy; |
| 349 | |||
| 350 | enum { | ||
| 351 | IEEE802154_LLSEC_PARAM_ENABLED = 1 << 0, | ||
| 352 | IEEE802154_LLSEC_PARAM_FRAME_COUNTER = 1 << 1, | ||
| 353 | IEEE802154_LLSEC_PARAM_OUT_LEVEL = 1 << 2, | ||
| 354 | IEEE802154_LLSEC_PARAM_OUT_KEY = 1 << 3, | ||
| 355 | IEEE802154_LLSEC_PARAM_KEY_SOURCE = 1 << 4, | ||
| 356 | IEEE802154_LLSEC_PARAM_PAN_ID = 1 << 5, | ||
| 357 | IEEE802154_LLSEC_PARAM_HWADDR = 1 << 6, | ||
| 358 | IEEE802154_LLSEC_PARAM_COORD_HWADDR = 1 << 7, | ||
| 359 | IEEE802154_LLSEC_PARAM_COORD_SHORTADDR = 1 << 8, | ||
| 360 | }; | ||
| 361 | |||
| 362 | struct ieee802154_llsec_ops { | ||
| 363 | int (*get_params)(struct net_device *dev, | ||
| 364 | struct ieee802154_llsec_params *params); | ||
| 365 | int (*set_params)(struct net_device *dev, | ||
| 366 | const struct ieee802154_llsec_params *params, | ||
| 367 | int changed); | ||
| 368 | |||
| 369 | int (*add_key)(struct net_device *dev, | ||
| 370 | const struct ieee802154_llsec_key_id *id, | ||
| 371 | const struct ieee802154_llsec_key *key); | ||
| 372 | int (*del_key)(struct net_device *dev, | ||
| 373 | const struct ieee802154_llsec_key_id *id); | ||
| 374 | |||
| 375 | int (*add_dev)(struct net_device *dev, | ||
| 376 | const struct ieee802154_llsec_device *llsec_dev); | ||
| 377 | int (*del_dev)(struct net_device *dev, __le64 dev_addr); | ||
| 378 | |||
| 379 | int (*add_devkey)(struct net_device *dev, | ||
| 380 | __le64 device_addr, | ||
| 381 | const struct ieee802154_llsec_device_key *key); | ||
| 382 | int (*del_devkey)(struct net_device *dev, | ||
| 383 | __le64 device_addr, | ||
| 384 | const struct ieee802154_llsec_device_key *key); | ||
| 385 | |||
| 386 | int (*add_seclevel)(struct net_device *dev, | ||
| 387 | const struct ieee802154_llsec_seclevel *sl); | ||
| 388 | int (*del_seclevel)(struct net_device *dev, | ||
| 389 | const struct ieee802154_llsec_seclevel *sl); | ||
| 390 | |||
| 391 | void (*lock_table)(struct net_device *dev); | ||
| 392 | void (*get_table)(struct net_device *dev, | ||
| 393 | struct ieee802154_llsec_table **t); | ||
| 394 | void (*unlock_table)(struct net_device *dev); | ||
| 395 | }; | ||
| 245 | /* | 396 | /* |
| 246 | * This should be located at net_device->ml_priv | 397 | * This should be located at net_device->ml_priv |
| 247 | * | 398 | * |
| @@ -272,6 +423,8 @@ struct ieee802154_mlme_ops { | |||
| 272 | void (*get_mac_params)(struct net_device *dev, | 423 | void (*get_mac_params)(struct net_device *dev, |
| 273 | struct ieee802154_mac_params *params); | 424 | struct ieee802154_mac_params *params); |
| 274 | 425 | ||
| 426 | struct ieee802154_llsec_ops *llsec; | ||
| 427 | |||
| 275 | /* The fields below are required. */ | 428 | /* The fields below are required. */ |
| 276 | 429 | ||
| 277 | struct wpan_phy *(*get_phy)(const struct net_device *dev); | 430 | struct wpan_phy *(*get_phy)(const struct net_device *dev); |
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index 3bd22795c3e2..84b20835b736 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h | |||
| @@ -150,7 +150,7 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb) | |||
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | /* | 152 | /* |
| 153 | * RFC 6080 4.2 | 153 | * RFC 6040 4.2 |
| 154 | * To decapsulate the inner header at the tunnel egress, a compliant | 154 | * To decapsulate the inner header at the tunnel egress, a compliant |
| 155 | * tunnel egress MUST set the outgoing ECN field to the codepoint at the | 155 | * tunnel egress MUST set the outgoing ECN field to the codepoint at the |
| 156 | * intersection of the appropriate arriving inner header (row) and outer | 156 | * intersection of the appropriate arriving inner header (row) and outer |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 1bdb47715def..dd1950a7e273 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
| @@ -292,12 +292,12 @@ static inline struct sock *inet_lookup_listener(struct net *net, | |||
| 292 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ | 292 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ |
| 293 | const __addrpair __name = (__force __addrpair) ( \ | 293 | const __addrpair __name = (__force __addrpair) ( \ |
| 294 | (((__force __u64)(__be32)(__saddr)) << 32) | \ | 294 | (((__force __u64)(__be32)(__saddr)) << 32) | \ |
| 295 | ((__force __u64)(__be32)(__daddr))); | 295 | ((__force __u64)(__be32)(__daddr))) |
| 296 | #else /* __LITTLE_ENDIAN */ | 296 | #else /* __LITTLE_ENDIAN */ |
| 297 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ | 297 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ |
| 298 | const __addrpair __name = (__force __addrpair) ( \ | 298 | const __addrpair __name = (__force __addrpair) ( \ |
| 299 | (((__force __u64)(__be32)(__daddr)) << 32) | \ | 299 | (((__force __u64)(__be32)(__daddr)) << 32) | \ |
| 300 | ((__force __u64)(__be32)(__saddr))); | 300 | ((__force __u64)(__be32)(__saddr))) |
| 301 | #endif /* __BIG_ENDIAN */ | 301 | #endif /* __BIG_ENDIAN */ |
| 302 | #define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ | 302 | #define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ |
| 303 | (((__sk)->sk_portpair == (__ports)) && \ | 303 | (((__sk)->sk_portpair == (__ports)) && \ |
| @@ -306,7 +306,9 @@ static inline struct sock *inet_lookup_listener(struct net *net, | |||
| 306 | ((__sk)->sk_bound_dev_if == (__dif))) && \ | 306 | ((__sk)->sk_bound_dev_if == (__dif))) && \ |
| 307 | net_eq(sock_net(__sk), (__net))) | 307 | net_eq(sock_net(__sk), (__net))) |
| 308 | #else /* 32-bit arch */ | 308 | #else /* 32-bit arch */ |
| 309 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) | 309 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ |
| 310 | const int __name __deprecated __attribute__((unused)) | ||
| 311 | |||
| 310 | #define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ | 312 | #define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ |
| 311 | (((__sk)->sk_portpair == (__ports)) && \ | 313 | (((__sk)->sk_portpair == (__ports)) && \ |
| 312 | ((__sk)->sk_daddr == (__saddr)) && \ | 314 | ((__sk)->sk_daddr == (__saddr)) && \ |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 1833c3f389ee..b1edf17bec01 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
| @@ -90,6 +90,7 @@ struct inet_request_sock { | |||
| 90 | kmemcheck_bitfield_end(flags); | 90 | kmemcheck_bitfield_end(flags); |
| 91 | struct ip_options_rcu *opt; | 91 | struct ip_options_rcu *opt; |
| 92 | struct sk_buff *pktopts; | 92 | struct sk_buff *pktopts; |
| 93 | u32 ir_mark; | ||
| 93 | }; | 94 | }; |
| 94 | 95 | ||
| 95 | static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) | 96 | static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) |
| @@ -97,6 +98,15 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) | |||
| 97 | return (struct inet_request_sock *)sk; | 98 | return (struct inet_request_sock *)sk; |
| 98 | } | 99 | } |
| 99 | 100 | ||
| 101 | static inline u32 inet_request_mark(struct sock *sk, struct sk_buff *skb) | ||
| 102 | { | ||
| 103 | if (!sk->sk_mark && sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept) { | ||
| 104 | return skb->mark; | ||
| 105 | } else { | ||
| 106 | return sk->sk_mark; | ||
| 107 | } | ||
| 108 | } | ||
| 109 | |||
| 100 | struct inet_cork { | 110 | struct inet_cork { |
| 101 | unsigned int flags; | 111 | unsigned int flags; |
| 102 | __be32 addr; | 112 | __be32 addr; |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 6efe73c79c52..01d590ee5e7e 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
| @@ -41,14 +41,13 @@ struct inet_peer { | |||
| 41 | struct rcu_head gc_rcu; | 41 | struct rcu_head gc_rcu; |
| 42 | }; | 42 | }; |
| 43 | /* | 43 | /* |
| 44 | * Once inet_peer is queued for deletion (refcnt == -1), following fields | 44 | * Once inet_peer is queued for deletion (refcnt == -1), following field |
| 45 | * are not available: rid, ip_id_count | 45 | * is not available: rid |
| 46 | * We can share memory with rcu_head to help keep inet_peer small. | 46 | * We can share memory with rcu_head to help keep inet_peer small. |
| 47 | */ | 47 | */ |
| 48 | union { | 48 | union { |
| 49 | struct { | 49 | struct { |
| 50 | atomic_t rid; /* Frag reception counter */ | 50 | atomic_t rid; /* Frag reception counter */ |
| 51 | atomic_t ip_id_count; /* IP ID for the next packet */ | ||
| 52 | }; | 51 | }; |
| 53 | struct rcu_head rcu; | 52 | struct rcu_head rcu; |
| 54 | struct inet_peer *gc_next; | 53 | struct inet_peer *gc_next; |
| @@ -165,28 +164,11 @@ bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); | |||
| 165 | void inetpeer_invalidate_tree(struct inet_peer_base *); | 164 | void inetpeer_invalidate_tree(struct inet_peer_base *); |
| 166 | 165 | ||
| 167 | /* | 166 | /* |
| 168 | * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, | 167 | * temporary check to make sure we dont access rid, tcp_ts, |
| 169 | * tcp_ts_stamp if no refcount is taken on inet_peer | 168 | * tcp_ts_stamp if no refcount is taken on inet_peer |
| 170 | */ | 169 | */ |
| 171 | static inline void inet_peer_refcheck(const struct inet_peer *p) | 170 | static inline void inet_peer_refcheck(const struct inet_peer *p) |
| 172 | { | 171 | { |
| 173 | WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0); | 172 | WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0); |
| 174 | } | 173 | } |
| 175 | |||
| 176 | |||
| 177 | /* can be called with or without local BH being disabled */ | ||
| 178 | static inline int inet_getid(struct inet_peer *p, int more) | ||
| 179 | { | ||
| 180 | int old, new; | ||
| 181 | more++; | ||
| 182 | inet_peer_refcheck(p); | ||
| 183 | do { | ||
| 184 | old = atomic_read(&p->ip_id_count); | ||
| 185 | new = old + more; | ||
| 186 | if (!new) | ||
| 187 | new = 1; | ||
| 188 | } while (atomic_cmpxchg(&p->ip_id_count, old, new) != old); | ||
| 189 | return new; | ||
| 190 | } | ||
| 191 | |||
| 192 | #endif /* _NET_INETPEER_H */ | 174 | #endif /* _NET_INETPEER_H */ |
diff --git a/include/net/ip.h b/include/net/ip.h index 3ec2b0fb9d83..0e795df05ec9 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
| @@ -196,35 +196,31 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, | |||
| 196 | #define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) | 196 | #define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) |
| 197 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) | 197 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) |
| 198 | 198 | ||
| 199 | unsigned long snmp_fold_field(void __percpu *mib[], int offt); | 199 | unsigned long snmp_fold_field(void __percpu *mib, int offt); |
| 200 | #if BITS_PER_LONG==32 | 200 | #if BITS_PER_LONG==32 |
| 201 | u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off); | 201 | u64 snmp_fold_field64(void __percpu *mib, int offt, size_t sync_off); |
| 202 | #else | 202 | #else |
| 203 | static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off) | 203 | static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_off) |
| 204 | { | 204 | { |
| 205 | return snmp_fold_field(mib, offt); | 205 | return snmp_fold_field(mib, offt); |
| 206 | } | 206 | } |
| 207 | #endif | 207 | #endif |
| 208 | int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align); | ||
| 209 | |||
| 210 | static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ]) | ||
| 211 | { | ||
| 212 | int i; | ||
| 213 | |||
| 214 | BUG_ON(ptr == NULL); | ||
| 215 | for (i = 0; i < SNMP_ARRAY_SZ; i++) { | ||
| 216 | free_percpu(ptr[i]); | ||
| 217 | ptr[i] = NULL; | ||
| 218 | } | ||
| 219 | } | ||
| 220 | 208 | ||
| 221 | void inet_get_local_port_range(struct net *net, int *low, int *high); | 209 | void inet_get_local_port_range(struct net *net, int *low, int *high); |
| 222 | 210 | ||
| 223 | extern unsigned long *sysctl_local_reserved_ports; | 211 | #ifdef CONFIG_SYSCTL |
| 224 | static inline int inet_is_reserved_local_port(int port) | 212 | static inline int inet_is_local_reserved_port(struct net *net, int port) |
| 225 | { | 213 | { |
| 226 | return test_bit(port, sysctl_local_reserved_ports); | 214 | if (!net->ipv4.sysctl_local_reserved_ports) |
| 215 | return 0; | ||
| 216 | return test_bit(port, net->ipv4.sysctl_local_reserved_ports); | ||
| 227 | } | 217 | } |
| 218 | #else | ||
| 219 | static inline int inet_is_local_reserved_port(struct net *net, int port) | ||
| 220 | { | ||
| 221 | return 0; | ||
| 222 | } | ||
| 223 | #endif | ||
| 228 | 224 | ||
| 229 | extern int sysctl_ip_nonlocal_bind; | 225 | extern int sysctl_ip_nonlocal_bind; |
| 230 | 226 | ||
| @@ -243,6 +239,9 @@ void ipfrag_init(void); | |||
| 243 | 239 | ||
| 244 | void ip_static_sysctl_init(void); | 240 | void ip_static_sysctl_init(void); |
| 245 | 241 | ||
| 242 | #define IP4_REPLY_MARK(net, mark) \ | ||
| 243 | ((net)->ipv4.sysctl_fwmark_reflect ? (mark) : 0) | ||
| 244 | |||
| 246 | static inline bool ip_is_fragment(const struct iphdr *iph) | 245 | static inline bool ip_is_fragment(const struct iphdr *iph) |
| 247 | { | 246 | { |
| 248 | return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0; | 247 | return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0; |
| @@ -281,7 +280,7 @@ static inline bool ip_sk_use_pmtu(const struct sock *sk) | |||
| 281 | return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE; | 280 | return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE; |
| 282 | } | 281 | } |
| 283 | 282 | ||
| 284 | static inline bool ip_sk_local_df(const struct sock *sk) | 283 | static inline bool ip_sk_ignore_df(const struct sock *sk) |
| 285 | { | 284 | { |
| 286 | return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO || | 285 | return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO || |
| 287 | inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT; | 286 | inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT; |
| @@ -310,36 +309,48 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb) | |||
| 310 | } | 309 | } |
| 311 | } | 310 | } |
| 312 | 311 | ||
| 313 | void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); | 312 | #define IP_IDENTS_SZ 2048u |
| 313 | extern atomic_t *ip_idents; | ||
| 314 | |||
| 315 | static inline u32 ip_idents_reserve(u32 hash, int segs) | ||
| 316 | { | ||
| 317 | atomic_t *id_ptr = ip_idents + hash % IP_IDENTS_SZ; | ||
| 318 | |||
| 319 | return atomic_add_return(segs, id_ptr) - segs; | ||
| 320 | } | ||
| 321 | |||
| 322 | void __ip_select_ident(struct iphdr *iph, int segs); | ||
| 314 | 323 | ||
| 315 | static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk) | 324 | static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, int segs) |
| 316 | { | 325 | { |
| 317 | struct iphdr *iph = ip_hdr(skb); | 326 | struct iphdr *iph = ip_hdr(skb); |
| 318 | 327 | ||
| 319 | if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) { | 328 | if ((iph->frag_off & htons(IP_DF)) && !skb->ignore_df) { |
| 320 | /* This is only to work around buggy Windows95/2000 | 329 | /* This is only to work around buggy Windows95/2000 |
| 321 | * VJ compression implementations. If the ID field | 330 | * VJ compression implementations. If the ID field |
| 322 | * does not change, they drop every other packet in | 331 | * does not change, they drop every other packet in |
| 323 | * a TCP stream using header compression. | 332 | * a TCP stream using header compression. |
| 324 | */ | 333 | */ |
| 325 | iph->id = (sk && inet_sk(sk)->inet_daddr) ? | 334 | if (sk && inet_sk(sk)->inet_daddr) { |
| 326 | htons(inet_sk(sk)->inet_id++) : 0; | 335 | iph->id = htons(inet_sk(sk)->inet_id); |
| 327 | } else | 336 | inet_sk(sk)->inet_id += segs; |
| 328 | __ip_select_ident(iph, dst, 0); | 337 | } else { |
| 338 | iph->id = 0; | ||
| 339 | } | ||
| 340 | } else { | ||
| 341 | __ip_select_ident(iph, segs); | ||
| 342 | } | ||
| 329 | } | 343 | } |
| 330 | 344 | ||
| 331 | static inline void ip_select_ident_more(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk, int more) | 345 | static inline void ip_select_ident(struct sk_buff *skb, struct sock *sk) |
| 332 | { | 346 | { |
| 333 | struct iphdr *iph = ip_hdr(skb); | 347 | ip_select_ident_segs(skb, sk, 1); |
| 348 | } | ||
| 334 | 349 | ||
| 335 | if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) { | 350 | static inline __wsum inet_compute_pseudo(struct sk_buff *skb, int proto) |
| 336 | if (sk && inet_sk(sk)->inet_daddr) { | 351 | { |
| 337 | iph->id = htons(inet_sk(sk)->inet_id); | 352 | return csum_tcpudp_nofold(ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, |
| 338 | inet_sk(sk)->inet_id += 1 + more; | 353 | skb->len, proto, 0); |
| 339 | } else | ||
| 340 | iph->id = 0; | ||
| 341 | } else | ||
| 342 | __ip_select_ident(iph, dst, more); | ||
| 343 | } | 354 | } |
| 344 | 355 | ||
| 345 | /* | 356 | /* |
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h index 9e3c540c1b11..55236cb71174 100644 --- a/include/net/ip6_checksum.h +++ b/include/net/ip6_checksum.h | |||
| @@ -41,6 +41,13 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, | |||
| 41 | __wsum csum); | 41 | __wsum csum); |
| 42 | #endif | 42 | #endif |
| 43 | 43 | ||
| 44 | static inline __wsum ip6_compute_pseudo(struct sk_buff *skb, int proto) | ||
| 45 | { | ||
| 46 | return ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | ||
| 47 | &ipv6_hdr(skb)->daddr, | ||
| 48 | skb->len, proto, 0)); | ||
| 49 | } | ||
| 50 | |||
| 44 | static __inline__ __sum16 tcp_v6_check(int len, | 51 | static __inline__ __sum16 tcp_v6_check(int len, |
| 45 | const struct in6_addr *saddr, | 52 | const struct in6_addr *saddr, |
| 46 | const struct in6_addr *daddr, | 53 | const struct in6_addr *daddr, |
| @@ -75,5 +82,17 @@ static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) | |||
| 75 | } | 82 | } |
| 76 | #endif | 83 | #endif |
| 77 | 84 | ||
| 85 | static inline __sum16 udp_v6_check(int len, | ||
| 86 | const struct in6_addr *saddr, | ||
| 87 | const struct in6_addr *daddr, | ||
| 88 | __wsum base) | ||
| 89 | { | ||
| 90 | return csum_ipv6_magic(saddr, daddr, len, IPPROTO_UDP, base); | ||
| 91 | } | ||
| 92 | |||
| 93 | void udp6_set_csum(bool nocheck, struct sk_buff *skb, | ||
| 94 | const struct in6_addr *saddr, | ||
| 95 | const struct in6_addr *daddr, int len); | ||
| 96 | |||
| 78 | int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto); | 97 | int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto); |
| 79 | #endif | 98 | #endif |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 6c4f5eac98e7..1d09b46c1e48 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
| @@ -127,6 +127,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg); | |||
| 127 | void rt6_ifdown(struct net *net, struct net_device *dev); | 127 | void rt6_ifdown(struct net *net, struct net_device *dev); |
| 128 | void rt6_mtu_change(struct net_device *dev, unsigned int mtu); | 128 | void rt6_mtu_change(struct net_device *dev, unsigned int mtu); |
| 129 | void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); | 129 | void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); |
| 130 | void rt6_clean_tohost(struct net *net, struct in6_addr *gateway); | ||
| 130 | 131 | ||
| 131 | 132 | ||
| 132 | /* | 133 | /* |
| @@ -185,7 +186,7 @@ static inline bool ip6_sk_accept_pmtu(const struct sock *sk) | |||
| 185 | inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT; | 186 | inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT; |
| 186 | } | 187 | } |
| 187 | 188 | ||
| 188 | static inline bool ip6_sk_local_df(const struct sock *sk) | 189 | static inline bool ip6_sk_ignore_df(const struct sock *sk) |
| 189 | { | 190 | { |
| 190 | return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO || | 191 | return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO || |
| 191 | inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT; | 192 | inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT; |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 5679d927562b..624a8a54806d 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -1204,7 +1204,7 @@ static inline bool __ip_vs_conn_get(struct ip_vs_conn *cp) | |||
| 1204 | /* put back the conn without restarting its timer */ | 1204 | /* put back the conn without restarting its timer */ |
| 1205 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) | 1205 | static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) |
| 1206 | { | 1206 | { |
| 1207 | smp_mb__before_atomic_dec(); | 1207 | smp_mb__before_atomic(); |
| 1208 | atomic_dec(&cp->refcnt); | 1208 | atomic_dec(&cp->refcnt); |
| 1209 | } | 1209 | } |
| 1210 | void ip_vs_conn_put(struct ip_vs_conn *cp); | 1210 | void ip_vs_conn_put(struct ip_vs_conn *cp); |
| @@ -1408,7 +1408,7 @@ static inline void ip_vs_dest_hold(struct ip_vs_dest *dest) | |||
| 1408 | 1408 | ||
| 1409 | static inline void ip_vs_dest_put(struct ip_vs_dest *dest) | 1409 | static inline void ip_vs_dest_put(struct ip_vs_dest *dest) |
| 1410 | { | 1410 | { |
| 1411 | smp_mb__before_atomic_dec(); | 1411 | smp_mb__before_atomic(); |
| 1412 | atomic_dec(&dest->refcnt); | 1412 | atomic_dec(&dest->refcnt); |
| 1413 | } | 1413 | } |
| 1414 | 1414 | ||
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index d640925bc454..574337fe72dd 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -113,6 +113,9 @@ struct frag_hdr { | |||
| 113 | #define IP6_MF 0x0001 | 113 | #define IP6_MF 0x0001 |
| 114 | #define IP6_OFFSET 0xFFF8 | 114 | #define IP6_OFFSET 0xFFF8 |
| 115 | 115 | ||
| 116 | #define IP6_REPLY_MARK(net, mark) \ | ||
| 117 | ((net)->ipv6.sysctl.fwmark_reflect ? (mark) : 0) | ||
| 118 | |||
| 116 | #include <net/sock.h> | 119 | #include <net/sock.h> |
| 117 | 120 | ||
| 118 | /* sysctls */ | 121 | /* sysctls */ |
| @@ -583,6 +586,11 @@ static inline bool ipv6_addr_orchid(const struct in6_addr *a) | |||
| 583 | return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010); | 586 | return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010); |
| 584 | } | 587 | } |
| 585 | 588 | ||
| 589 | static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr) | ||
| 590 | { | ||
| 591 | return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000); | ||
| 592 | } | ||
| 593 | |||
| 586 | static inline void ipv6_addr_set_v4mapped(const __be32 addr, | 594 | static inline void ipv6_addr_set_v4mapped(const __be32 addr, |
| 587 | struct in6_addr *v4mapped) | 595 | struct in6_addr *v4mapped) |
| 588 | { | 596 | { |
| @@ -660,10 +668,22 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add | |||
| 660 | return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); | 668 | return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); |
| 661 | } | 669 | } |
| 662 | 670 | ||
| 663 | void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); | ||
| 664 | |||
| 665 | int ip6_dst_hoplimit(struct dst_entry *dst); | 671 | int ip6_dst_hoplimit(struct dst_entry *dst); |
| 666 | 672 | ||
| 673 | static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6, | ||
| 674 | struct dst_entry *dst) | ||
| 675 | { | ||
| 676 | int hlimit; | ||
| 677 | |||
| 678 | if (ipv6_addr_is_multicast(&fl6->daddr)) | ||
| 679 | hlimit = np->mcast_hops; | ||
| 680 | else | ||
| 681 | hlimit = np->hop_limit; | ||
| 682 | if (hlimit < 0) | ||
| 683 | hlimit = ip6_dst_hoplimit(dst); | ||
| 684 | return hlimit; | ||
| 685 | } | ||
| 686 | |||
| 667 | /* | 687 | /* |
| 668 | * Header manipulation | 688 | * Header manipulation |
| 669 | */ | 689 | */ |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 8248e3909fdf..421b6ecb4b2c 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -189,6 +189,43 @@ struct ieee80211_chanctx_conf { | |||
| 189 | }; | 189 | }; |
| 190 | 190 | ||
| 191 | /** | 191 | /** |
| 192 | * enum ieee80211_chanctx_switch_mode - channel context switch mode | ||
| 193 | * @CHANCTX_SWMODE_REASSIGN_VIF: Both old and new contexts already | ||
| 194 | * exist (and will continue to exist), but the virtual interface | ||
| 195 | * needs to be switched from one to the other. | ||
| 196 | * @CHANCTX_SWMODE_SWAP_CONTEXTS: The old context exists but will stop | ||
| 197 | * to exist with this call, the new context doesn't exist but | ||
| 198 | * will be active after this call, the virtual interface switches | ||
| 199 | * from the old to the new (note that the driver may of course | ||
| 200 | * implement this as an on-the-fly chandef switch of the existing | ||
| 201 | * hardware context, but the mac80211 pointer for the old context | ||
| 202 | * will cease to exist and only the new one will later be used | ||
| 203 | * for changes/removal.) | ||
| 204 | */ | ||
| 205 | enum ieee80211_chanctx_switch_mode { | ||
| 206 | CHANCTX_SWMODE_REASSIGN_VIF, | ||
| 207 | CHANCTX_SWMODE_SWAP_CONTEXTS, | ||
| 208 | }; | ||
| 209 | |||
| 210 | /** | ||
| 211 | * struct ieee80211_vif_chanctx_switch - vif chanctx switch information | ||
| 212 | * | ||
| 213 | * This is structure is used to pass information about a vif that | ||
| 214 | * needs to switch from one chanctx to another. The | ||
| 215 | * &ieee80211_chanctx_switch_mode defines how the switch should be | ||
| 216 | * done. | ||
| 217 | * | ||
| 218 | * @vif: the vif that should be switched from old_ctx to new_ctx | ||
| 219 | * @old_ctx: the old context to which the vif was assigned | ||
| 220 | * @new_ctx: the new context to which the vif must be assigned | ||
| 221 | */ | ||
| 222 | struct ieee80211_vif_chanctx_switch { | ||
| 223 | struct ieee80211_vif *vif; | ||
| 224 | struct ieee80211_chanctx_conf *old_ctx; | ||
| 225 | struct ieee80211_chanctx_conf *new_ctx; | ||
| 226 | }; | ||
| 227 | |||
| 228 | /** | ||
| 192 | * enum ieee80211_bss_change - BSS change notification flags | 229 | * enum ieee80211_bss_change - BSS change notification flags |
| 193 | * | 230 | * |
| 194 | * These flags are used with the bss_info_changed() callback | 231 | * These flags are used with the bss_info_changed() callback |
| @@ -1113,7 +1150,9 @@ enum ieee80211_vif_flags { | |||
| 1113 | * @addr: address of this interface | 1150 | * @addr: address of this interface |
| 1114 | * @p2p: indicates whether this AP or STA interface is a p2p | 1151 | * @p2p: indicates whether this AP or STA interface is a p2p |
| 1115 | * interface, i.e. a GO or p2p-sta respectively | 1152 | * interface, i.e. a GO or p2p-sta respectively |
| 1116 | * @csa_active: marks whether a channel switch is going on | 1153 | * @csa_active: marks whether a channel switch is going on. Internally it is |
| 1154 | * write-protected by sdata_lock and local->mtx so holding either is fine | ||
| 1155 | * for read access. | ||
| 1117 | * @driver_flags: flags/capabilities the driver has for this interface, | 1156 | * @driver_flags: flags/capabilities the driver has for this interface, |
| 1118 | * these need to be set (or cleared) when the interface is added | 1157 | * these need to be set (or cleared) when the interface is added |
| 1119 | * or, if supported by the driver, the interface type is changed | 1158 | * or, if supported by the driver, the interface type is changed |
| @@ -1202,14 +1241,18 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev); | |||
| 1202 | * fall back to software crypto. Note that this flag deals only with | 1241 | * fall back to software crypto. Note that this flag deals only with |
| 1203 | * RX, if your crypto engine can't deal with TX you can also set the | 1242 | * RX, if your crypto engine can't deal with TX you can also set the |
| 1204 | * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. | 1243 | * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. |
| 1244 | * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the | ||
| 1245 | * driver for a CCMP key to indicate that is requires IV generation | ||
| 1246 | * only for managment frames (MFP). | ||
| 1205 | */ | 1247 | */ |
| 1206 | enum ieee80211_key_flags { | 1248 | enum ieee80211_key_flags { |
| 1207 | IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, | 1249 | IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(0), |
| 1208 | IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, | 1250 | IEEE80211_KEY_FLAG_GENERATE_IV = BIT(1), |
| 1209 | IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, | 1251 | IEEE80211_KEY_FLAG_GENERATE_MMIC = BIT(2), |
| 1210 | IEEE80211_KEY_FLAG_SW_MGMT_TX = 1<<4, | 1252 | IEEE80211_KEY_FLAG_PAIRWISE = BIT(3), |
| 1211 | IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5, | 1253 | IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(4), |
| 1212 | IEEE80211_KEY_FLAG_RX_MGMT = 1<<6, | 1254 | IEEE80211_KEY_FLAG_PUT_IV_SPACE = BIT(5), |
| 1255 | IEEE80211_KEY_FLAG_RX_MGMT = BIT(6), | ||
| 1213 | }; | 1256 | }; |
| 1214 | 1257 | ||
| 1215 | /** | 1258 | /** |
| @@ -1370,6 +1413,7 @@ struct ieee80211_sta_rates { | |||
| 1370 | * the station moves to associated state. | 1413 | * the station moves to associated state. |
| 1371 | * @smps_mode: current SMPS mode (off, static or dynamic) | 1414 | * @smps_mode: current SMPS mode (off, static or dynamic) |
| 1372 | * @rates: rate control selection table | 1415 | * @rates: rate control selection table |
| 1416 | * @tdls: indicates whether the STA is a TDLS peer | ||
| 1373 | */ | 1417 | */ |
| 1374 | struct ieee80211_sta { | 1418 | struct ieee80211_sta { |
| 1375 | u32 supp_rates[IEEE80211_NUM_BANDS]; | 1419 | u32 supp_rates[IEEE80211_NUM_BANDS]; |
| @@ -1384,6 +1428,7 @@ struct ieee80211_sta { | |||
| 1384 | enum ieee80211_sta_rx_bandwidth bandwidth; | 1428 | enum ieee80211_sta_rx_bandwidth bandwidth; |
| 1385 | enum ieee80211_smps_mode smps_mode; | 1429 | enum ieee80211_smps_mode smps_mode; |
| 1386 | struct ieee80211_sta_rates __rcu *rates; | 1430 | struct ieee80211_sta_rates __rcu *rates; |
| 1431 | bool tdls; | ||
| 1387 | 1432 | ||
| 1388 | /* must be last */ | 1433 | /* must be last */ |
| 1389 | u8 drv_priv[0] __aligned(sizeof(void *)); | 1434 | u8 drv_priv[0] __aligned(sizeof(void *)); |
| @@ -1555,6 +1600,12 @@ struct ieee80211_tx_control { | |||
| 1555 | * for a single active channel while using channel contexts. When support | 1600 | * for a single active channel while using channel contexts. When support |
| 1556 | * is not enabled the default action is to disconnect when getting the | 1601 | * is not enabled the default action is to disconnect when getting the |
| 1557 | * CSA frame. | 1602 | * CSA frame. |
| 1603 | * | ||
| 1604 | * @IEEE80211_HW_CHANGE_RUNNING_CHANCTX: The hardware can change a | ||
| 1605 | * channel context on-the-fly. This is needed for channel switch | ||
| 1606 | * on single-channel hardware. It can also be used as an | ||
| 1607 | * optimization in certain channel switch cases with | ||
| 1608 | * multi-channel. | ||
| 1558 | */ | 1609 | */ |
| 1559 | enum ieee80211_hw_flags { | 1610 | enum ieee80211_hw_flags { |
| 1560 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, | 1611 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, |
| @@ -1586,6 +1637,7 @@ enum ieee80211_hw_flags { | |||
| 1586 | IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, | 1637 | IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, |
| 1587 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, | 1638 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, |
| 1588 | IEEE80211_HW_CHANCTX_STA_CSA = 1<<28, | 1639 | IEEE80211_HW_CHANCTX_STA_CSA = 1<<28, |
| 1640 | IEEE80211_HW_CHANGE_RUNNING_CHANCTX = 1<<29, | ||
| 1589 | }; | 1641 | }; |
| 1590 | 1642 | ||
| 1591 | /** | 1643 | /** |
| @@ -2609,6 +2661,7 @@ enum ieee80211_roc_type { | |||
| 2609 | * of queues to flush, which is useful if different virtual interfaces | 2661 | * of queues to flush, which is useful if different virtual interfaces |
| 2610 | * use different hardware queues; it may also indicate all queues. | 2662 | * use different hardware queues; it may also indicate all queues. |
| 2611 | * If the parameter @drop is set to %true, pending frames may be dropped. | 2663 | * If the parameter @drop is set to %true, pending frames may be dropped. |
| 2664 | * Note that vif can be NULL. | ||
| 2612 | * The callback can sleep. | 2665 | * The callback can sleep. |
| 2613 | * | 2666 | * |
| 2614 | * @channel_switch: Drivers that need (or want) to offload the channel | 2667 | * @channel_switch: Drivers that need (or want) to offload the channel |
| @@ -2720,6 +2773,11 @@ enum ieee80211_roc_type { | |||
| 2720 | * to vif. Possible use is for hw queue remapping. | 2773 | * to vif. Possible use is for hw queue remapping. |
| 2721 | * @unassign_vif_chanctx: Notifies device driver about channel context being | 2774 | * @unassign_vif_chanctx: Notifies device driver about channel context being |
| 2722 | * unbound from vif. | 2775 | * unbound from vif. |
| 2776 | * @switch_vif_chanctx: switch a number of vifs from one chanctx to | ||
| 2777 | * another, as specified in the list of | ||
| 2778 | * @ieee80211_vif_chanctx_switch passed to the driver, according | ||
| 2779 | * to the mode defined in &ieee80211_chanctx_switch_mode. | ||
| 2780 | * | ||
| 2723 | * @start_ap: Start operation on the AP interface, this is called after all the | 2781 | * @start_ap: Start operation on the AP interface, this is called after all the |
| 2724 | * information in bss_conf is set and beacon can be retrieved. A channel | 2782 | * information in bss_conf is set and beacon can be retrieved. A channel |
| 2725 | * context is bound before this is called. Note that if the driver uses | 2783 | * context is bound before this is called. Note that if the driver uses |
| @@ -2753,6 +2811,10 @@ enum ieee80211_roc_type { | |||
| 2753 | * information in bss_conf is set up and the beacon can be retrieved. A | 2811 | * information in bss_conf is set up and the beacon can be retrieved. A |
| 2754 | * channel context is bound before this is called. | 2812 | * channel context is bound before this is called. |
| 2755 | * @leave_ibss: Leave the IBSS again. | 2813 | * @leave_ibss: Leave the IBSS again. |
| 2814 | * | ||
| 2815 | * @get_expected_throughput: extract the expected throughput towards the | ||
| 2816 | * specified station. The returned value is expressed in Kbps. It returns 0 | ||
| 2817 | * if the RC algorithm does not have proper data to provide. | ||
| 2756 | */ | 2818 | */ |
| 2757 | struct ieee80211_ops { | 2819 | struct ieee80211_ops { |
| 2758 | void (*tx)(struct ieee80211_hw *hw, | 2820 | void (*tx)(struct ieee80211_hw *hw, |
| @@ -2871,7 +2933,8 @@ struct ieee80211_ops { | |||
| 2871 | struct netlink_callback *cb, | 2933 | struct netlink_callback *cb, |
| 2872 | void *data, int len); | 2934 | void *data, int len); |
| 2873 | #endif | 2935 | #endif |
| 2874 | void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop); | 2936 | void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
| 2937 | u32 queues, bool drop); | ||
| 2875 | void (*channel_switch)(struct ieee80211_hw *hw, | 2938 | void (*channel_switch)(struct ieee80211_hw *hw, |
| 2876 | struct ieee80211_channel_switch *ch_switch); | 2939 | struct ieee80211_channel_switch *ch_switch); |
| 2877 | int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); | 2940 | int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); |
| @@ -2931,6 +2994,10 @@ struct ieee80211_ops { | |||
| 2931 | void (*unassign_vif_chanctx)(struct ieee80211_hw *hw, | 2994 | void (*unassign_vif_chanctx)(struct ieee80211_hw *hw, |
| 2932 | struct ieee80211_vif *vif, | 2995 | struct ieee80211_vif *vif, |
| 2933 | struct ieee80211_chanctx_conf *ctx); | 2996 | struct ieee80211_chanctx_conf *ctx); |
| 2997 | int (*switch_vif_chanctx)(struct ieee80211_hw *hw, | ||
| 2998 | struct ieee80211_vif_chanctx_switch *vifs, | ||
| 2999 | int n_vifs, | ||
| 3000 | enum ieee80211_chanctx_switch_mode mode); | ||
| 2934 | 3001 | ||
| 2935 | void (*restart_complete)(struct ieee80211_hw *hw); | 3002 | void (*restart_complete)(struct ieee80211_hw *hw); |
| 2936 | 3003 | ||
| @@ -2945,6 +3012,7 @@ struct ieee80211_ops { | |||
| 2945 | 3012 | ||
| 2946 | int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); | 3013 | int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); |
| 2947 | void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); | 3014 | void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); |
| 3015 | u32 (*get_expected_throughput)(struct ieee80211_sta *sta); | ||
| 2948 | }; | 3016 | }; |
| 2949 | 3017 | ||
| 2950 | /** | 3018 | /** |
| @@ -3394,6 +3462,47 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, | |||
| 3394 | */ | 3462 | */ |
| 3395 | void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets); | 3463 | void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets); |
| 3396 | 3464 | ||
| 3465 | #define IEEE80211_MAX_CSA_COUNTERS_NUM 2 | ||
| 3466 | |||
| 3467 | /** | ||
| 3468 | * struct ieee80211_mutable_offsets - mutable beacon offsets | ||
| 3469 | * @tim_offset: position of TIM element | ||
| 3470 | * @tim_length: size of TIM element | ||
| 3471 | * @csa_counter_offs: array of IEEE80211_MAX_CSA_COUNTERS_NUM offsets | ||
| 3472 | * to CSA counters. This array can contain zero values which | ||
| 3473 | * should be ignored. | ||
| 3474 | */ | ||
| 3475 | struct ieee80211_mutable_offsets { | ||
| 3476 | u16 tim_offset; | ||
| 3477 | u16 tim_length; | ||
| 3478 | |||
| 3479 | u16 csa_counter_offs[IEEE80211_MAX_CSA_COUNTERS_NUM]; | ||
| 3480 | }; | ||
| 3481 | |||
| 3482 | /** | ||
| 3483 | * ieee80211_beacon_get_template - beacon template generation function | ||
| 3484 | * @hw: pointer obtained from ieee80211_alloc_hw(). | ||
| 3485 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
| 3486 | * @offs: &struct ieee80211_mutable_offsets pointer to struct that will | ||
| 3487 | * receive the offsets that may be updated by the driver. | ||
| 3488 | * | ||
| 3489 | * If the driver implements beaconing modes, it must use this function to | ||
| 3490 | * obtain the beacon template. | ||
| 3491 | * | ||
| 3492 | * This function should be used if the beacon frames are generated by the | ||
| 3493 | * device, and then the driver must use the returned beacon as the template | ||
| 3494 | * The driver or the device are responsible to update the DTIM and, when | ||
| 3495 | * applicable, the CSA count. | ||
| 3496 | * | ||
| 3497 | * The driver is responsible for freeing the returned skb. | ||
| 3498 | * | ||
| 3499 | * Return: The beacon template. %NULL on error. | ||
| 3500 | */ | ||
| 3501 | struct sk_buff * | ||
| 3502 | ieee80211_beacon_get_template(struct ieee80211_hw *hw, | ||
| 3503 | struct ieee80211_vif *vif, | ||
| 3504 | struct ieee80211_mutable_offsets *offs); | ||
| 3505 | |||
| 3397 | /** | 3506 | /** |
| 3398 | * ieee80211_beacon_get_tim - beacon generation function | 3507 | * ieee80211_beacon_get_tim - beacon generation function |
| 3399 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 3508 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
| @@ -3405,16 +3514,12 @@ void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets); | |||
| 3405 | * Set to 0 if invalid (in non-AP modes). | 3514 | * Set to 0 if invalid (in non-AP modes). |
| 3406 | * | 3515 | * |
| 3407 | * If the driver implements beaconing modes, it must use this function to | 3516 | * If the driver implements beaconing modes, it must use this function to |
| 3408 | * obtain the beacon frame/template. | 3517 | * obtain the beacon frame. |
| 3409 | * | 3518 | * |
| 3410 | * If the beacon frames are generated by the host system (i.e., not in | 3519 | * If the beacon frames are generated by the host system (i.e., not in |
| 3411 | * hardware/firmware), the driver uses this function to get each beacon | 3520 | * hardware/firmware), the driver uses this function to get each beacon |
| 3412 | * frame from mac80211 -- it is responsible for calling this function | 3521 | * frame from mac80211 -- it is responsible for calling this function exactly |
| 3413 | * before the beacon is needed (e.g. based on hardware interrupt). | 3522 | * once before the beacon is needed (e.g. based on hardware interrupt). |
| 3414 | * | ||
| 3415 | * If the beacon frames are generated by the device, then the driver | ||
| 3416 | * must use the returned beacon as the template and change the TIM IE | ||
| 3417 | * according to the current DTIM parameters/TIM bitmap. | ||
| 3418 | * | 3523 | * |
| 3419 | * The driver is responsible for freeing the returned skb. | 3524 | * The driver is responsible for freeing the returned skb. |
| 3420 | * | 3525 | * |
| @@ -3440,6 +3545,20 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
| 3440 | } | 3545 | } |
| 3441 | 3546 | ||
| 3442 | /** | 3547 | /** |
| 3548 | * ieee80211_csa_update_counter - request mac80211 to decrement the csa counter | ||
| 3549 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
| 3550 | * | ||
| 3551 | * The csa counter should be updated after each beacon transmission. | ||
| 3552 | * This function is called implicitly when | ||
| 3553 | * ieee80211_beacon_get/ieee80211_beacon_get_tim are called, however if the | ||
| 3554 | * beacon frames are generated by the device, the driver should call this | ||
| 3555 | * function after each beacon transmission to sync mac80211's csa counters. | ||
| 3556 | * | ||
| 3557 | * Return: new csa counter value | ||
| 3558 | */ | ||
| 3559 | u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif); | ||
| 3560 | |||
| 3561 | /** | ||
| 3443 | * ieee80211_csa_finish - notify mac80211 about channel switch | 3562 | * ieee80211_csa_finish - notify mac80211 about channel switch |
| 3444 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 3563 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 3445 | * | 3564 | * |
| @@ -4467,6 +4586,8 @@ struct rate_control_ops { | |||
| 4467 | void (*add_sta_debugfs)(void *priv, void *priv_sta, | 4586 | void (*add_sta_debugfs)(void *priv, void *priv_sta, |
| 4468 | struct dentry *dir); | 4587 | struct dentry *dir); |
| 4469 | void (*remove_sta_debugfs)(void *priv, void *priv_sta); | 4588 | void (*remove_sta_debugfs)(void *priv, void *priv_sta); |
| 4589 | |||
| 4590 | u32 (*get_expected_throughput)(void *priv_sta); | ||
| 4470 | }; | 4591 | }; |
| 4471 | 4592 | ||
| 4472 | static inline int rate_supported(struct ieee80211_sta *sta, | 4593 | static inline int rate_supported(struct ieee80211_sta *sta, |
| @@ -4576,7 +4697,9 @@ conf_is_ht40(struct ieee80211_conf *conf) | |||
| 4576 | static inline bool | 4697 | static inline bool |
| 4577 | conf_is_ht(struct ieee80211_conf *conf) | 4698 | conf_is_ht(struct ieee80211_conf *conf) |
| 4578 | { | 4699 | { |
| 4579 | return conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT; | 4700 | return (conf->chandef.width != NL80211_CHAN_WIDTH_5) && |
| 4701 | (conf->chandef.width != NL80211_CHAN_WIDTH_10) && | ||
| 4702 | (conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT); | ||
| 4580 | } | 4703 | } |
| 4581 | 4704 | ||
| 4582 | static inline enum nl80211_iftype | 4705 | static inline enum nl80211_iftype |
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/net_namespace.h b/include/net/net_namespace.h index 5f9eb260990f..361d26077196 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
| @@ -373,6 +373,14 @@ static inline void rt_genid_bump_ipv6(struct net *net) | |||
| 373 | } | 373 | } |
| 374 | #endif | 374 | #endif |
| 375 | 375 | ||
| 376 | #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN) | ||
| 377 | static inline struct netns_ieee802154_lowpan * | ||
| 378 | net_ieee802154_lowpan(struct net *net) | ||
| 379 | { | ||
| 380 | return &net->ieee802154_lowpan; | ||
| 381 | } | ||
| 382 | #endif | ||
| 383 | |||
| 376 | /* For callers who don't really care about whether it's IPv4 or IPv6 */ | 384 | /* For callers who don't really care about whether it's IPv4 or IPv6 */ |
| 377 | static inline void rt_genid_bump_all(struct net *net) | 385 | static inline void rt_genid_bump_all(struct net *net) |
| 378 | { | 386 | { |
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h index 07eaaf604092..a71dd333ac68 100644 --- a/include/net/netfilter/nf_nat.h +++ b/include/net/netfilter/nf_nat.h | |||
| @@ -48,6 +48,8 @@ unsigned int nf_nat_setup_info(struct nf_conn *ct, | |||
| 48 | extern unsigned int nf_nat_alloc_null_binding(struct nf_conn *ct, | 48 | extern unsigned int nf_nat_alloc_null_binding(struct nf_conn *ct, |
| 49 | unsigned int hooknum); | 49 | unsigned int hooknum); |
| 50 | 50 | ||
| 51 | struct nf_conn_nat *nf_ct_nat_ext_add(struct nf_conn *ct); | ||
| 52 | |||
| 51 | /* Is this tuple already taken? (not by us)*/ | 53 | /* Is this tuple already taken? (not by us)*/ |
| 52 | int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, | 54 | int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, |
| 53 | const struct nf_conn *ignored_conntrack); | 55 | const struct nf_conn *ignored_conntrack); |
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index e6bc14d8fa9a..713b0b88bd5a 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
| @@ -72,21 +72,23 @@ static inline void nft_data_debug(const struct nft_data *data) | |||
| 72 | * struct nft_ctx - nf_tables rule/set context | 72 | * struct nft_ctx - nf_tables rule/set context |
| 73 | * | 73 | * |
| 74 | * @net: net namespace | 74 | * @net: net namespace |
| 75 | * @skb: netlink skb | ||
| 76 | * @nlh: netlink message header | ||
| 77 | * @afi: address family info | 75 | * @afi: address family info |
| 78 | * @table: the table the chain is contained in | 76 | * @table: the table the chain is contained in |
| 79 | * @chain: the chain the rule is contained in | 77 | * @chain: the chain the rule is contained in |
| 80 | * @nla: netlink attributes | 78 | * @nla: netlink attributes |
| 79 | * @portid: netlink portID of the original message | ||
| 80 | * @seq: netlink sequence number | ||
| 81 | * @report: notify via unicast netlink message | ||
| 81 | */ | 82 | */ |
| 82 | struct nft_ctx { | 83 | struct nft_ctx { |
| 83 | struct net *net; | 84 | struct net *net; |
| 84 | const struct sk_buff *skb; | 85 | struct nft_af_info *afi; |
| 85 | const struct nlmsghdr *nlh; | 86 | struct nft_table *table; |
| 86 | const struct nft_af_info *afi; | 87 | struct nft_chain *chain; |
| 87 | const struct nft_table *table; | ||
| 88 | const struct nft_chain *chain; | ||
| 89 | const struct nlattr * const *nla; | 88 | const struct nlattr * const *nla; |
| 89 | u32 portid; | ||
| 90 | u32 seq; | ||
| 91 | bool report; | ||
| 90 | }; | 92 | }; |
| 91 | 93 | ||
| 92 | struct nft_data_desc { | 94 | struct nft_data_desc { |
| @@ -146,6 +148,44 @@ struct nft_set_iter { | |||
| 146 | }; | 148 | }; |
| 147 | 149 | ||
| 148 | /** | 150 | /** |
| 151 | * struct nft_set_desc - description of set elements | ||
| 152 | * | ||
| 153 | * @klen: key length | ||
| 154 | * @dlen: data length | ||
| 155 | * @size: number of set elements | ||
| 156 | */ | ||
| 157 | struct nft_set_desc { | ||
| 158 | unsigned int klen; | ||
| 159 | unsigned int dlen; | ||
| 160 | unsigned int size; | ||
| 161 | }; | ||
| 162 | |||
| 163 | /** | ||
| 164 | * enum nft_set_class - performance class | ||
| 165 | * | ||
| 166 | * @NFT_LOOKUP_O_1: constant, O(1) | ||
| 167 | * @NFT_LOOKUP_O_LOG_N: logarithmic, O(log N) | ||
| 168 | * @NFT_LOOKUP_O_N: linear, O(N) | ||
| 169 | */ | ||
| 170 | enum nft_set_class { | ||
| 171 | NFT_SET_CLASS_O_1, | ||
| 172 | NFT_SET_CLASS_O_LOG_N, | ||
| 173 | NFT_SET_CLASS_O_N, | ||
| 174 | }; | ||
| 175 | |||
| 176 | /** | ||
| 177 | * struct nft_set_estimate - estimation of memory and performance | ||
| 178 | * characteristics | ||
| 179 | * | ||
| 180 | * @size: required memory | ||
| 181 | * @class: lookup performance class | ||
| 182 | */ | ||
| 183 | struct nft_set_estimate { | ||
| 184 | unsigned int size; | ||
| 185 | enum nft_set_class class; | ||
| 186 | }; | ||
| 187 | |||
| 188 | /** | ||
| 149 | * struct nft_set_ops - nf_tables set operations | 189 | * struct nft_set_ops - nf_tables set operations |
| 150 | * | 190 | * |
| 151 | * @lookup: look up an element within the set | 191 | * @lookup: look up an element within the set |
| @@ -174,7 +214,11 @@ struct nft_set_ops { | |||
| 174 | struct nft_set_iter *iter); | 214 | struct nft_set_iter *iter); |
| 175 | 215 | ||
| 176 | unsigned int (*privsize)(const struct nlattr * const nla[]); | 216 | unsigned int (*privsize)(const struct nlattr * const nla[]); |
| 217 | bool (*estimate)(const struct nft_set_desc *desc, | ||
| 218 | u32 features, | ||
| 219 | struct nft_set_estimate *est); | ||
| 177 | int (*init)(const struct nft_set *set, | 220 | int (*init)(const struct nft_set *set, |
| 221 | const struct nft_set_desc *desc, | ||
| 178 | const struct nlattr * const nla[]); | 222 | const struct nlattr * const nla[]); |
| 179 | void (*destroy)(const struct nft_set *set); | 223 | void (*destroy)(const struct nft_set *set); |
| 180 | 224 | ||
| @@ -194,6 +238,8 @@ void nft_unregister_set(struct nft_set_ops *ops); | |||
| 194 | * @name: name of the set | 238 | * @name: name of the set |
| 195 | * @ktype: key type (numeric type defined by userspace, not used in the kernel) | 239 | * @ktype: key type (numeric type defined by userspace, not used in the kernel) |
| 196 | * @dtype: data type (verdict or numeric type defined by userspace) | 240 | * @dtype: data type (verdict or numeric type defined by userspace) |
| 241 | * @size: maximum set size | ||
| 242 | * @nelems: number of elements | ||
| 197 | * @ops: set ops | 243 | * @ops: set ops |
| 198 | * @flags: set flags | 244 | * @flags: set flags |
| 199 | * @klen: key length | 245 | * @klen: key length |
| @@ -206,6 +252,8 @@ struct nft_set { | |||
| 206 | char name[IFNAMSIZ]; | 252 | char name[IFNAMSIZ]; |
| 207 | u32 ktype; | 253 | u32 ktype; |
| 208 | u32 dtype; | 254 | u32 dtype; |
| 255 | u32 size; | ||
| 256 | u32 nelems; | ||
| 209 | /* runtime data below here */ | 257 | /* runtime data below here */ |
| 210 | const struct nft_set_ops *ops ____cacheline_aligned; | 258 | const struct nft_set_ops *ops ____cacheline_aligned; |
| 211 | u16 flags; | 259 | u16 flags; |
| @@ -222,6 +270,8 @@ static inline void *nft_set_priv(const struct nft_set *set) | |||
| 222 | 270 | ||
| 223 | struct nft_set *nf_tables_set_lookup(const struct nft_table *table, | 271 | struct nft_set *nf_tables_set_lookup(const struct nft_table *table, |
| 224 | const struct nlattr *nla); | 272 | const struct nlattr *nla); |
| 273 | struct nft_set *nf_tables_set_lookup_byid(const struct net *net, | ||
| 274 | const struct nlattr *nla); | ||
| 225 | 275 | ||
| 226 | /** | 276 | /** |
| 227 | * struct nft_set_binding - nf_tables set binding | 277 | * struct nft_set_binding - nf_tables set binding |
| @@ -341,18 +391,75 @@ struct nft_rule { | |||
| 341 | }; | 391 | }; |
| 342 | 392 | ||
| 343 | /** | 393 | /** |
| 344 | * struct nft_rule_trans - nf_tables rule update in transaction | 394 | * struct nft_trans - nf_tables object update in transaction |
| 345 | * | 395 | * |
| 396 | * @rcu_head: rcu head to defer release of transaction data | ||
| 346 | * @list: used internally | 397 | * @list: used internally |
| 347 | * @ctx: rule context | 398 | * @msg_type: message type |
| 348 | * @rule: rule that needs to be updated | 399 | * @ctx: transaction context |
| 400 | * @data: internal information related to the transaction | ||
| 349 | */ | 401 | */ |
| 350 | struct nft_rule_trans { | 402 | struct nft_trans { |
| 403 | struct rcu_head rcu_head; | ||
| 351 | struct list_head list; | 404 | struct list_head list; |
| 405 | int msg_type; | ||
| 352 | struct nft_ctx ctx; | 406 | struct nft_ctx ctx; |
| 407 | char data[0]; | ||
| 408 | }; | ||
| 409 | |||
| 410 | struct nft_trans_rule { | ||
| 353 | struct nft_rule *rule; | 411 | struct nft_rule *rule; |
| 354 | }; | 412 | }; |
| 355 | 413 | ||
| 414 | #define nft_trans_rule(trans) \ | ||
| 415 | (((struct nft_trans_rule *)trans->data)->rule) | ||
| 416 | |||
| 417 | struct nft_trans_set { | ||
| 418 | struct nft_set *set; | ||
| 419 | u32 set_id; | ||
| 420 | }; | ||
| 421 | |||
| 422 | #define nft_trans_set(trans) \ | ||
| 423 | (((struct nft_trans_set *)trans->data)->set) | ||
| 424 | #define nft_trans_set_id(trans) \ | ||
| 425 | (((struct nft_trans_set *)trans->data)->set_id) | ||
| 426 | |||
| 427 | struct nft_trans_chain { | ||
| 428 | bool update; | ||
| 429 | char name[NFT_CHAIN_MAXNAMELEN]; | ||
| 430 | struct nft_stats __percpu *stats; | ||
| 431 | u8 policy; | ||
| 432 | }; | ||
| 433 | |||
| 434 | #define nft_trans_chain_update(trans) \ | ||
| 435 | (((struct nft_trans_chain *)trans->data)->update) | ||
| 436 | #define nft_trans_chain_name(trans) \ | ||
| 437 | (((struct nft_trans_chain *)trans->data)->name) | ||
| 438 | #define nft_trans_chain_stats(trans) \ | ||
| 439 | (((struct nft_trans_chain *)trans->data)->stats) | ||
| 440 | #define nft_trans_chain_policy(trans) \ | ||
| 441 | (((struct nft_trans_chain *)trans->data)->policy) | ||
| 442 | |||
| 443 | struct nft_trans_table { | ||
| 444 | bool update; | ||
| 445 | bool enable; | ||
| 446 | }; | ||
| 447 | |||
| 448 | #define nft_trans_table_update(trans) \ | ||
| 449 | (((struct nft_trans_table *)trans->data)->update) | ||
| 450 | #define nft_trans_table_enable(trans) \ | ||
| 451 | (((struct nft_trans_table *)trans->data)->enable) | ||
| 452 | |||
| 453 | struct nft_trans_elem { | ||
| 454 | struct nft_set *set; | ||
| 455 | struct nft_set_elem elem; | ||
| 456 | }; | ||
| 457 | |||
| 458 | #define nft_trans_elem_set(trans) \ | ||
| 459 | (((struct nft_trans_elem *)trans->data)->set) | ||
| 460 | #define nft_trans_elem(trans) \ | ||
| 461 | (((struct nft_trans_elem *)trans->data)->elem) | ||
| 462 | |||
| 356 | static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule) | 463 | static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule) |
| 357 | { | 464 | { |
| 358 | return (struct nft_expr *)&rule->data[0]; | 465 | return (struct nft_expr *)&rule->data[0]; |
| @@ -385,6 +492,7 @@ static inline void *nft_userdata(const struct nft_rule *rule) | |||
| 385 | 492 | ||
| 386 | enum nft_chain_flags { | 493 | enum nft_chain_flags { |
| 387 | NFT_BASE_CHAIN = 0x1, | 494 | NFT_BASE_CHAIN = 0x1, |
| 495 | NFT_CHAIN_INACTIVE = 0x2, | ||
| 388 | }; | 496 | }; |
| 389 | 497 | ||
| 390 | /** | 498 | /** |
| @@ -395,9 +503,9 @@ enum nft_chain_flags { | |||
| 395 | * @net: net namespace that this chain belongs to | 503 | * @net: net namespace that this chain belongs to |
| 396 | * @table: table that this chain belongs to | 504 | * @table: table that this chain belongs to |
| 397 | * @handle: chain handle | 505 | * @handle: chain handle |
| 398 | * @flags: bitmask of enum nft_chain_flags | ||
| 399 | * @use: number of jump references to this chain | 506 | * @use: number of jump references to this chain |
| 400 | * @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 | ||
| 401 | * @name: name of the chain | 509 | * @name: name of the chain |
| 402 | */ | 510 | */ |
| 403 | struct nft_chain { | 511 | struct nft_chain { |
| @@ -406,9 +514,9 @@ struct nft_chain { | |||
| 406 | struct net *net; | 514 | struct net *net; |
| 407 | struct nft_table *table; | 515 | struct nft_table *table; |
| 408 | u64 handle; | 516 | u64 handle; |
| 409 | u8 flags; | 517 | u32 use; |
| 410 | u16 use; | ||
| 411 | u16 level; | 518 | u16 level; |
| 519 | u8 flags; | ||
| 412 | char name[NFT_CHAIN_MAXNAMELEN]; | 520 | char name[NFT_CHAIN_MAXNAMELEN]; |
| 413 | }; | 521 | }; |
| 414 | 522 | ||
diff --git a/include/net/netfilter/nft_meta.h b/include/net/netfilter/nft_meta.h new file mode 100644 index 000000000000..0ee47c3e2e31 --- /dev/null +++ b/include/net/netfilter/nft_meta.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | #ifndef _NFT_META_H_ | ||
| 2 | #define _NFT_META_H_ | ||
| 3 | |||
| 4 | struct nft_meta { | ||
| 5 | enum nft_meta_keys key:8; | ||
| 6 | union { | ||
| 7 | enum nft_registers dreg:8; | ||
| 8 | enum nft_registers sreg:8; | ||
| 9 | }; | ||
| 10 | }; | ||
| 11 | |||
| 12 | extern const struct nla_policy nft_meta_policy[]; | ||
| 13 | |||
| 14 | int nft_meta_get_init(const struct nft_ctx *ctx, | ||
| 15 | const struct nft_expr *expr, | ||
| 16 | const struct nlattr * const tb[]); | ||
| 17 | |||
| 18 | int nft_meta_set_init(const struct nft_ctx *ctx, | ||
| 19 | const struct nft_expr *expr, | ||
| 20 | const struct nlattr * const tb[]); | ||
| 21 | |||
| 22 | int nft_meta_get_dump(struct sk_buff *skb, | ||
| 23 | const struct nft_expr *expr); | ||
| 24 | |||
| 25 | int nft_meta_set_dump(struct sk_buff *skb, | ||
| 26 | const struct nft_expr *expr); | ||
| 27 | |||
| 28 | void nft_meta_get_eval(const struct nft_expr *expr, | ||
| 29 | struct nft_data data[NFT_REG_MAX + 1], | ||
| 30 | const struct nft_pktinfo *pkt); | ||
| 31 | |||
| 32 | void nft_meta_set_eval(const struct nft_expr *expr, | ||
| 33 | struct nft_data data[NFT_REG_MAX + 1], | ||
| 34 | const struct nft_pktinfo *pkt); | ||
| 35 | |||
| 36 | #endif | ||
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 { | |||
| 16 | struct netns_ieee802154_lowpan { | 16 | struct 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/ipv4.h b/include/net/netns/ipv4.h index 80f500a29498..aec5e12f9f19 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
| @@ -20,6 +20,11 @@ struct local_ports { | |||
| 20 | int range[2]; | 20 | int range[2]; |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | struct ping_group_range { | ||
| 24 | seqlock_t lock; | ||
| 25 | kgid_t range[2]; | ||
| 26 | }; | ||
| 27 | |||
| 23 | struct netns_ipv4 { | 28 | struct netns_ipv4 { |
| 24 | #ifdef CONFIG_SYSCTL | 29 | #ifdef CONFIG_SYSCTL |
| 25 | struct ctl_table_header *forw_hdr; | 30 | struct ctl_table_header *forw_hdr; |
| @@ -66,16 +71,23 @@ struct netns_ipv4 { | |||
| 66 | int sysctl_icmp_ratemask; | 71 | int sysctl_icmp_ratemask; |
| 67 | int sysctl_icmp_errors_use_inbound_ifaddr; | 72 | int sysctl_icmp_errors_use_inbound_ifaddr; |
| 68 | 73 | ||
| 69 | struct local_ports sysctl_local_ports; | 74 | struct local_ports ip_local_ports; |
| 70 | 75 | ||
| 71 | int sysctl_tcp_ecn; | 76 | int sysctl_tcp_ecn; |
| 72 | int sysctl_ip_no_pmtu_disc; | 77 | int sysctl_ip_no_pmtu_disc; |
| 73 | int sysctl_ip_fwd_use_pmtu; | 78 | int sysctl_ip_fwd_use_pmtu; |
| 74 | 79 | ||
| 75 | kgid_t sysctl_ping_group_range[2]; | 80 | int sysctl_fwmark_reflect; |
| 81 | int sysctl_tcp_fwmark_accept; | ||
| 82 | |||
| 83 | struct ping_group_range ping_group_range; | ||
| 76 | 84 | ||
| 77 | atomic_t dev_addr_genid; | 85 | atomic_t dev_addr_genid; |
| 78 | 86 | ||
| 87 | #ifdef CONFIG_SYSCTL | ||
| 88 | unsigned long *sysctl_local_reserved_ports; | ||
| 89 | #endif | ||
| 90 | |||
| 79 | #ifdef CONFIG_IP_MROUTE | 91 | #ifdef CONFIG_IP_MROUTE |
| 80 | #ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES | 92 | #ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES |
| 81 | struct mr_table *mrt; | 93 | struct mr_table *mrt; |
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 21edaf1f7916..19d3446e59d2 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h | |||
| @@ -30,6 +30,7 @@ struct netns_sysctl_ipv6 { | |||
| 30 | int flowlabel_consistency; | 30 | int flowlabel_consistency; |
| 31 | int icmpv6_time; | 31 | int icmpv6_time; |
| 32 | int anycast_src_echo_reply; | 32 | int anycast_src_echo_reply; |
| 33 | int fwmark_reflect; | ||
| 33 | }; | 34 | }; |
| 34 | 35 | ||
| 35 | struct netns_ipv6 { | 36 | struct netns_ipv6 { |
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h index 7655cfe27c34..bdf55c3b7a19 100644 --- a/include/net/nfc/digital.h +++ b/include/net/nfc/digital.h | |||
| @@ -36,6 +36,7 @@ enum { | |||
| 36 | NFC_DIGITAL_RF_TECH_212F, | 36 | NFC_DIGITAL_RF_TECH_212F, |
| 37 | NFC_DIGITAL_RF_TECH_424F, | 37 | NFC_DIGITAL_RF_TECH_424F, |
| 38 | NFC_DIGITAL_RF_TECH_ISO15693, | 38 | NFC_DIGITAL_RF_TECH_ISO15693, |
| 39 | NFC_DIGITAL_RF_TECH_106B, | ||
| 39 | 40 | ||
| 40 | NFC_DIGITAL_RF_TECH_LAST, | 41 | NFC_DIGITAL_RF_TECH_LAST, |
| 41 | }; | 42 | }; |
| @@ -62,6 +63,9 @@ enum { | |||
| 62 | NFC_DIGITAL_FRAMING_ISO15693_INVENTORY, | 63 | NFC_DIGITAL_FRAMING_ISO15693_INVENTORY, |
| 63 | NFC_DIGITAL_FRAMING_ISO15693_T5T, | 64 | NFC_DIGITAL_FRAMING_ISO15693_T5T, |
| 64 | 65 | ||
| 66 | NFC_DIGITAL_FRAMING_NFCB, | ||
| 67 | NFC_DIGITAL_FRAMING_NFCB_T4T, | ||
| 68 | |||
| 65 | NFC_DIGITAL_FRAMING_LAST, | 69 | NFC_DIGITAL_FRAMING_LAST, |
| 66 | }; | 70 | }; |
| 67 | 71 | ||
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h index 03c4650b548c..61286db54388 100644 --- a/include/net/nfc/hci.h +++ b/include/net/nfc/hci.h | |||
| @@ -27,6 +27,7 @@ struct nfc_hci_dev; | |||
| 27 | struct nfc_hci_ops { | 27 | struct nfc_hci_ops { |
| 28 | int (*open) (struct nfc_hci_dev *hdev); | 28 | int (*open) (struct nfc_hci_dev *hdev); |
| 29 | void (*close) (struct nfc_hci_dev *hdev); | 29 | void (*close) (struct nfc_hci_dev *hdev); |
| 30 | int (*load_session) (struct nfc_hci_dev *hdev); | ||
| 30 | int (*hci_ready) (struct nfc_hci_dev *hdev); | 31 | int (*hci_ready) (struct nfc_hci_dev *hdev); |
| 31 | /* | 32 | /* |
| 32 | * xmit must always send the complete buffer before | 33 | * xmit must always send the complete buffer before |
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 2e8b40c16274..6c583e244de2 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h | |||
| @@ -264,4 +264,7 @@ int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type); | |||
| 264 | int nfc_remove_se(struct nfc_dev *dev, u32 se_idx); | 264 | int nfc_remove_se(struct nfc_dev *dev, u32 se_idx); |
| 265 | struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx); | 265 | struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx); |
| 266 | 266 | ||
| 267 | void nfc_send_to_raw_sock(struct nfc_dev *dev, struct sk_buff *skb, | ||
| 268 | u8 payload_type, u8 direction); | ||
| 269 | |||
| 267 | #endif /* __NET_NFC_H */ | 270 | #endif /* __NET_NFC_H */ |
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index a2441fb1428f..6da46dcf1049 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
| @@ -136,7 +136,7 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts, | |||
| 136 | 136 | ||
| 137 | int tcf_exts_validate(struct net *net, struct tcf_proto *tp, | 137 | int tcf_exts_validate(struct net *net, struct tcf_proto *tp, |
| 138 | struct nlattr **tb, struct nlattr *rate_tlv, | 138 | struct nlattr **tb, struct nlattr *rate_tlv, |
| 139 | struct tcf_exts *exts); | 139 | struct tcf_exts *exts, bool ovr); |
| 140 | void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); | 140 | void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); |
| 141 | void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, | 141 | void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, |
| 142 | struct tcf_exts *src); | 142 | struct tcf_exts *src); |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 891d80d2c4d2..ec030cd76616 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
| @@ -96,7 +96,7 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, | |||
| 96 | struct nlattr *tab); | 96 | struct nlattr *tab); |
| 97 | void qdisc_put_rtab(struct qdisc_rate_table *tab); | 97 | void qdisc_put_rtab(struct qdisc_rate_table *tab); |
| 98 | void qdisc_put_stab(struct qdisc_size_table *tab); | 98 | void qdisc_put_stab(struct qdisc_size_table *tab); |
| 99 | void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc); | 99 | void qdisc_warn_nonwc(const char *txt, struct Qdisc *qdisc); |
| 100 | int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q, | 100 | int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q, |
| 101 | struct net_device *dev, struct netdev_queue *txq, | 101 | struct net_device *dev, struct netdev_queue *txq, |
| 102 | spinlock_t *root_lock); | 102 | spinlock_t *root_lock); |
diff --git a/include/net/protocol.h b/include/net/protocol.h index a7e986b08147..d6fcc1fcdb5b 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
| @@ -86,7 +86,6 @@ struct inet_protosw { | |||
| 86 | struct proto *prot; | 86 | struct proto *prot; |
| 87 | const struct proto_ops *ops; | 87 | const struct proto_ops *ops; |
| 88 | 88 | ||
| 89 | char no_check; /* checksum on rcv/xmit/none? */ | ||
| 90 | unsigned char flags; /* See INET_PROTOSW_* below. */ | 89 | unsigned char flags; /* See INET_PROTOSW_* below. */ |
| 91 | }; | 90 | }; |
| 92 | #define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ | 91 | #define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ |
diff --git a/include/net/regulatory.h b/include/net/regulatory.h index 75fc1f5a948d..259992444e80 100644 --- a/include/net/regulatory.h +++ b/include/net/regulatory.h | |||
| @@ -131,6 +131,11 @@ struct regulatory_request { | |||
| 131 | * all country IE information processed by the regulatory core. This will | 131 | * all country IE information processed by the regulatory core. This will |
| 132 | * override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will | 132 | * override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will |
| 133 | * be ignored. | 133 | * be ignored. |
| 134 | * @REGULATORY_ENABLE_RELAX_NO_IR: for devices that wish to allow the | ||
| 135 | * NO_IR relaxation, which enables transmissions on channels on which | ||
| 136 | * otherwise initiating radiation is not allowed. This will enable the | ||
| 137 | * relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration | ||
| 138 | * option | ||
| 134 | */ | 139 | */ |
| 135 | enum ieee80211_regulatory_flags { | 140 | enum ieee80211_regulatory_flags { |
| 136 | REGULATORY_CUSTOM_REG = BIT(0), | 141 | REGULATORY_CUSTOM_REG = BIT(0), |
| @@ -138,6 +143,7 @@ enum ieee80211_regulatory_flags { | |||
| 138 | REGULATORY_DISABLE_BEACON_HINTS = BIT(2), | 143 | REGULATORY_DISABLE_BEACON_HINTS = BIT(2), |
| 139 | REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3), | 144 | REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3), |
| 140 | REGULATORY_COUNTRY_IE_IGNORE = BIT(4), | 145 | REGULATORY_COUNTRY_IE_IGNORE = BIT(4), |
| 146 | REGULATORY_ENABLE_RELAX_NO_IR = BIT(5), | ||
| 141 | }; | 147 | }; |
| 142 | 148 | ||
| 143 | struct ieee80211_freq_range { | 149 | struct ieee80211_freq_range { |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index d062f81c692f..624f9857c83e 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
| @@ -199,7 +199,7 @@ struct tcf_proto_ops { | |||
| 199 | int (*change)(struct net *net, struct sk_buff *, | 199 | int (*change)(struct net *net, struct sk_buff *, |
| 200 | struct tcf_proto*, unsigned long, | 200 | struct tcf_proto*, unsigned long, |
| 201 | u32 handle, struct nlattr **, | 201 | u32 handle, struct nlattr **, |
| 202 | unsigned long *); | 202 | unsigned long *, bool); |
| 203 | int (*delete)(struct tcf_proto*, unsigned long); | 203 | int (*delete)(struct tcf_proto*, unsigned long); |
| 204 | void (*walk)(struct tcf_proto*, struct tcf_walker *arg); | 204 | void (*walk)(struct tcf_proto*, struct tcf_walker *arg); |
| 205 | 205 | ||
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 0dfcc92600e8..f38588bf3462 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
| @@ -838,10 +838,10 @@ struct sctp_transport { | |||
| 838 | unsigned long sackdelay; | 838 | unsigned long sackdelay; |
| 839 | __u32 sackfreq; | 839 | __u32 sackfreq; |
| 840 | 840 | ||
| 841 | /* When was the last time (in jiffies) that we heard from this | 841 | /* When was the last time that we heard from this transport? We use |
| 842 | * transport? We use this to pick new active and retran paths. | 842 | * this to pick new active and retran paths. |
| 843 | */ | 843 | */ |
| 844 | unsigned long last_time_heard; | 844 | ktime_t last_time_heard; |
| 845 | 845 | ||
| 846 | /* Last time(in jiffies) when cwnd is reduced due to the congestion | 846 | /* Last time(in jiffies) when cwnd is reduced due to the congestion |
| 847 | * indication based on ECNE chunk. | 847 | * indication based on ECNE chunk. |
diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h index f257486f17be..3f36d45b714a 100644 --- a/include/net/secure_seq.h +++ b/include/net/secure_seq.h | |||
| @@ -3,8 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | __u32 secure_ip_id(__be32 daddr); | ||
| 7 | __u32 secure_ipv6_id(const __be32 daddr[4]); | ||
| 8 | u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); | 6 | u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); |
| 9 | u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, | 7 | u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, |
| 10 | __be16 dport); | 8 | __be16 dport); |
diff --git a/include/net/snmp.h b/include/net/snmp.h index 71596261fa99..f1f27fdbb0d5 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
| @@ -116,51 +116,49 @@ struct linux_xfrm_mib { | |||
| 116 | unsigned long mibs[LINUX_MIB_XFRMMAX]; | 116 | unsigned long mibs[LINUX_MIB_XFRMMAX]; |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | #define SNMP_ARRAY_SZ 1 | ||
| 120 | |||
| 121 | #define DEFINE_SNMP_STAT(type, name) \ | 119 | #define DEFINE_SNMP_STAT(type, name) \ |
| 122 | __typeof__(type) __percpu *name[SNMP_ARRAY_SZ] | 120 | __typeof__(type) __percpu *name |
| 123 | #define DEFINE_SNMP_STAT_ATOMIC(type, name) \ | 121 | #define DEFINE_SNMP_STAT_ATOMIC(type, name) \ |
| 124 | __typeof__(type) *name | 122 | __typeof__(type) *name |
| 125 | #define DECLARE_SNMP_STAT(type, name) \ | 123 | #define DECLARE_SNMP_STAT(type, name) \ |
| 126 | extern __typeof__(type) __percpu *name[SNMP_ARRAY_SZ] | 124 | extern __typeof__(type) __percpu *name |
| 127 | 125 | ||
| 128 | #define SNMP_INC_STATS_BH(mib, field) \ | 126 | #define SNMP_INC_STATS_BH(mib, field) \ |
| 129 | __this_cpu_inc(mib[0]->mibs[field]) | 127 | __this_cpu_inc(mib->mibs[field]) |
| 130 | 128 | ||
| 131 | #define SNMP_INC_STATS_USER(mib, field) \ | 129 | #define SNMP_INC_STATS_USER(mib, field) \ |
| 132 | this_cpu_inc(mib[0]->mibs[field]) | 130 | this_cpu_inc(mib->mibs[field]) |
| 133 | 131 | ||
| 134 | #define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \ | 132 | #define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \ |
| 135 | atomic_long_inc(&mib->mibs[field]) | 133 | atomic_long_inc(&mib->mibs[field]) |
| 136 | 134 | ||
| 137 | #define SNMP_INC_STATS(mib, field) \ | 135 | #define SNMP_INC_STATS(mib, field) \ |
| 138 | this_cpu_inc(mib[0]->mibs[field]) | 136 | this_cpu_inc(mib->mibs[field]) |
| 139 | 137 | ||
| 140 | #define SNMP_DEC_STATS(mib, field) \ | 138 | #define SNMP_DEC_STATS(mib, field) \ |
| 141 | this_cpu_dec(mib[0]->mibs[field]) | 139 | this_cpu_dec(mib->mibs[field]) |
| 142 | 140 | ||
| 143 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ | 141 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
| 144 | __this_cpu_add(mib[0]->mibs[field], addend) | 142 | __this_cpu_add(mib->mibs[field], addend) |
| 145 | 143 | ||
| 146 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | 144 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
| 147 | this_cpu_add(mib[0]->mibs[field], addend) | 145 | this_cpu_add(mib->mibs[field], addend) |
| 148 | 146 | ||
| 149 | #define SNMP_ADD_STATS(mib, field, addend) \ | 147 | #define SNMP_ADD_STATS(mib, field, addend) \ |
| 150 | this_cpu_add(mib[0]->mibs[field], addend) | 148 | this_cpu_add(mib->mibs[field], addend) |
| 151 | /* | 149 | /* |
| 152 | * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" | 150 | * Use "__typeof__(*mib) *ptr" instead of "__typeof__(mib) ptr" |
| 153 | * to make @ptr a non-percpu pointer. | 151 | * to make @ptr a non-percpu pointer. |
| 154 | */ | 152 | */ |
| 155 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ | 153 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ |
| 156 | do { \ | 154 | do { \ |
| 157 | __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \ | 155 | __typeof__(*mib->mibs) *ptr = mib->mibs; \ |
| 158 | this_cpu_inc(ptr[basefield##PKTS]); \ | 156 | this_cpu_inc(ptr[basefield##PKTS]); \ |
| 159 | this_cpu_add(ptr[basefield##OCTETS], addend); \ | 157 | this_cpu_add(ptr[basefield##OCTETS], addend); \ |
| 160 | } while (0) | 158 | } while (0) |
| 161 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ | 159 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ |
| 162 | do { \ | 160 | do { \ |
| 163 | __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \ | 161 | __typeof__(*mib->mibs) *ptr = mib->mibs; \ |
| 164 | __this_cpu_inc(ptr[basefield##PKTS]); \ | 162 | __this_cpu_inc(ptr[basefield##PKTS]); \ |
| 165 | __this_cpu_add(ptr[basefield##OCTETS], addend); \ | 163 | __this_cpu_add(ptr[basefield##OCTETS], addend); \ |
| 166 | } while (0) | 164 | } while (0) |
| @@ -170,7 +168,7 @@ struct linux_xfrm_mib { | |||
| 170 | 168 | ||
| 171 | #define SNMP_ADD_STATS64_BH(mib, field, addend) \ | 169 | #define SNMP_ADD_STATS64_BH(mib, field, addend) \ |
| 172 | do { \ | 170 | do { \ |
| 173 | __typeof__(*mib[0]) *ptr = __this_cpu_ptr((mib)[0]); \ | 171 | __typeof__(*mib) *ptr = __this_cpu_ptr(mib); \ |
| 174 | u64_stats_update_begin(&ptr->syncp); \ | 172 | u64_stats_update_begin(&ptr->syncp); \ |
| 175 | ptr->mibs[field] += addend; \ | 173 | ptr->mibs[field] += addend; \ |
| 176 | u64_stats_update_end(&ptr->syncp); \ | 174 | u64_stats_update_end(&ptr->syncp); \ |
| @@ -191,8 +189,8 @@ struct linux_xfrm_mib { | |||
| 191 | #define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1) | 189 | #define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1) |
| 192 | #define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ | 190 | #define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ |
| 193 | do { \ | 191 | do { \ |
| 194 | __typeof__(*mib[0]) *ptr; \ | 192 | __typeof__(*mib) *ptr; \ |
| 195 | ptr = __this_cpu_ptr((mib)[0]); \ | 193 | ptr = __this_cpu_ptr(mib); \ |
| 196 | u64_stats_update_begin(&ptr->syncp); \ | 194 | u64_stats_update_begin(&ptr->syncp); \ |
| 197 | ptr->mibs[basefield##PKTS]++; \ | 195 | ptr->mibs[basefield##PKTS]++; \ |
| 198 | ptr->mibs[basefield##OCTETS] += addend; \ | 196 | ptr->mibs[basefield##OCTETS] += addend; \ |
diff --git a/include/net/sock.h b/include/net/sock.h index 21569cf456ed..156350745700 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -243,7 +243,8 @@ struct cg_proto; | |||
| 243 | * @sk_sndbuf: size of send buffer in bytes | 243 | * @sk_sndbuf: size of send buffer in bytes |
| 244 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, | 244 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, |
| 245 | * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings | 245 | * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings |
| 246 | * @sk_no_check: %SO_NO_CHECK setting, whether or not checkup packets | 246 | * @sk_no_check_tx: %SO_NO_CHECK setting, set checksum in TX packets |
| 247 | * @sk_no_check_rx: allow zero checksum in RX packets | ||
| 247 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) | 248 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) |
| 248 | * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK) | 249 | * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK) |
| 249 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) | 250 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) |
| @@ -371,7 +372,8 @@ struct sock { | |||
| 371 | struct sk_buff_head sk_write_queue; | 372 | struct sk_buff_head sk_write_queue; |
| 372 | kmemcheck_bitfield_begin(flags); | 373 | kmemcheck_bitfield_begin(flags); |
| 373 | unsigned int sk_shutdown : 2, | 374 | unsigned int sk_shutdown : 2, |
| 374 | sk_no_check : 2, | 375 | sk_no_check_tx : 1, |
| 376 | sk_no_check_rx : 1, | ||
| 375 | sk_userlocks : 4, | 377 | sk_userlocks : 4, |
| 376 | sk_protocol : 8, | 378 | sk_protocol : 8, |
| 377 | sk_type : 16; | 379 | sk_type : 16; |
| @@ -1728,8 +1730,8 @@ sk_dst_get(struct sock *sk) | |||
| 1728 | 1730 | ||
| 1729 | rcu_read_lock(); | 1731 | rcu_read_lock(); |
| 1730 | dst = rcu_dereference(sk->sk_dst_cache); | 1732 | dst = rcu_dereference(sk->sk_dst_cache); |
| 1731 | if (dst) | 1733 | if (dst && !atomic_inc_not_zero(&dst->__refcnt)) |
| 1732 | dst_hold(dst); | 1734 | dst = NULL; |
| 1733 | rcu_read_unlock(); | 1735 | rcu_read_unlock(); |
| 1734 | return dst; | 1736 | return dst; |
| 1735 | } | 1737 | } |
| @@ -1766,9 +1768,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst) | |||
| 1766 | static inline void | 1768 | static inline void |
| 1767 | sk_dst_set(struct sock *sk, struct dst_entry *dst) | 1769 | sk_dst_set(struct sock *sk, struct dst_entry *dst) |
| 1768 | { | 1770 | { |
| 1769 | spin_lock(&sk->sk_dst_lock); | 1771 | struct dst_entry *old_dst; |
| 1770 | __sk_dst_set(sk, dst); | 1772 | |
| 1771 | spin_unlock(&sk->sk_dst_lock); | 1773 | sk_tx_queue_clear(sk); |
| 1774 | old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst); | ||
| 1775 | dst_release(old_dst); | ||
| 1772 | } | 1776 | } |
| 1773 | 1777 | ||
| 1774 | static inline void | 1778 | static inline void |
| @@ -1780,9 +1784,7 @@ __sk_dst_reset(struct sock *sk) | |||
| 1780 | static inline void | 1784 | static inline void |
| 1781 | sk_dst_reset(struct sock *sk) | 1785 | sk_dst_reset(struct sock *sk) |
| 1782 | { | 1786 | { |
| 1783 | spin_lock(&sk->sk_dst_lock); | 1787 | sk_dst_set(sk, NULL); |
| 1784 | __sk_dst_reset(sk); | ||
| 1785 | spin_unlock(&sk->sk_dst_lock); | ||
| 1786 | } | 1788 | } |
| 1787 | 1789 | ||
| 1788 | struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); | 1790 | struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 87d877408188..7286db80e8b8 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -220,8 +220,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
| 220 | #define TFO_SERVER_ENABLE 2 | 220 | #define TFO_SERVER_ENABLE 2 |
| 221 | #define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */ | 221 | #define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */ |
| 222 | 222 | ||
| 223 | /* Process SYN data but skip cookie validation */ | ||
| 224 | #define TFO_SERVER_COOKIE_NOT_CHKED 0x100 | ||
| 225 | /* Accept SYN data w/o any cookie option */ | 223 | /* Accept SYN data w/o any cookie option */ |
| 226 | #define TFO_SERVER_COOKIE_NOT_REQD 0x200 | 224 | #define TFO_SERVER_COOKIE_NOT_REQD 0x200 |
| 227 | 225 | ||
| @@ -230,10 +228,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
| 230 | */ | 228 | */ |
| 231 | #define TFO_SERVER_WO_SOCKOPT1 0x400 | 229 | #define TFO_SERVER_WO_SOCKOPT1 0x400 |
| 232 | #define TFO_SERVER_WO_SOCKOPT2 0x800 | 230 | #define TFO_SERVER_WO_SOCKOPT2 0x800 |
| 233 | /* Always create TFO child sockets on a TFO listener even when | ||
| 234 | * cookie/data not present. (For testing purpose!) | ||
| 235 | */ | ||
| 236 | #define TFO_SERVER_ALWAYS 0x1000 | ||
| 237 | 231 | ||
| 238 | extern struct inet_timewait_death_row tcp_death_row; | 232 | extern struct inet_timewait_death_row tcp_death_row; |
| 239 | 233 | ||
| @@ -541,7 +535,7 @@ void tcp_retransmit_timer(struct sock *sk); | |||
| 541 | void tcp_xmit_retransmit_queue(struct sock *); | 535 | void tcp_xmit_retransmit_queue(struct sock *); |
| 542 | void tcp_simple_retransmit(struct sock *); | 536 | void tcp_simple_retransmit(struct sock *); |
| 543 | int tcp_trim_head(struct sock *, struct sk_buff *, u32); | 537 | int tcp_trim_head(struct sock *, struct sk_buff *, u32); |
| 544 | int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int); | 538 | int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int, gfp_t); |
| 545 | 539 | ||
| 546 | void tcp_send_probe0(struct sock *); | 540 | void tcp_send_probe0(struct sock *); |
| 547 | void tcp_send_partial(struct sock *); | 541 | void tcp_send_partial(struct sock *); |
| @@ -558,7 +552,6 @@ void tcp_send_loss_probe(struct sock *sk); | |||
| 558 | bool tcp_schedule_loss_probe(struct sock *sk); | 552 | bool tcp_schedule_loss_probe(struct sock *sk); |
| 559 | 553 | ||
| 560 | /* tcp_input.c */ | 554 | /* tcp_input.c */ |
| 561 | void tcp_cwnd_application_limited(struct sock *sk); | ||
| 562 | void tcp_resume_early_retransmit(struct sock *sk); | 555 | void tcp_resume_early_retransmit(struct sock *sk); |
| 563 | void tcp_rearm_rto(struct sock *sk); | 556 | void tcp_rearm_rto(struct sock *sk); |
| 564 | void tcp_reset(struct sock *sk); | 557 | void tcp_reset(struct sock *sk); |
| @@ -797,7 +790,7 @@ struct tcp_congestion_ops { | |||
| 797 | /* return slow start threshold (required) */ | 790 | /* return slow start threshold (required) */ |
| 798 | u32 (*ssthresh)(struct sock *sk); | 791 | u32 (*ssthresh)(struct sock *sk); |
| 799 | /* do new cwnd calculation (required) */ | 792 | /* do new cwnd calculation (required) */ |
| 800 | void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight); | 793 | void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked); |
| 801 | /* call before changing ca_state (optional) */ | 794 | /* call before changing ca_state (optional) */ |
| 802 | void (*set_state)(struct sock *sk, u8 new_state); | 795 | void (*set_state)(struct sock *sk, u8 new_state); |
| 803 | /* call when cwnd event occurs (optional) */ | 796 | /* call when cwnd event occurs (optional) */ |
| @@ -829,7 +822,7 @@ void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w); | |||
| 829 | 822 | ||
| 830 | extern struct tcp_congestion_ops tcp_init_congestion_ops; | 823 | extern struct tcp_congestion_ops tcp_init_congestion_ops; |
| 831 | u32 tcp_reno_ssthresh(struct sock *sk); | 824 | u32 tcp_reno_ssthresh(struct sock *sk); |
| 832 | void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight); | 825 | void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked); |
| 833 | extern struct tcp_congestion_ops tcp_reno; | 826 | extern struct tcp_congestion_ops tcp_reno; |
| 834 | 827 | ||
| 835 | static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) | 828 | static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) |
| @@ -975,7 +968,30 @@ static inline u32 tcp_wnd_end(const struct tcp_sock *tp) | |||
| 975 | { | 968 | { |
| 976 | return tp->snd_una + tp->snd_wnd; | 969 | return tp->snd_una + tp->snd_wnd; |
| 977 | } | 970 | } |
| 978 | bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); | 971 | |
| 972 | /* We follow the spirit of RFC2861 to validate cwnd but implement a more | ||
| 973 | * flexible approach. The RFC suggests cwnd should not be raised unless | ||
| 974 | * it was fully used previously. And that's exactly what we do in | ||
| 975 | * congestion avoidance mode. But in slow start we allow cwnd to grow | ||
| 976 | * as long as the application has used half the cwnd. | ||
| 977 | * Example : | ||
| 978 | * cwnd is 10 (IW10), but application sends 9 frames. | ||
| 979 | * We allow cwnd to reach 18 when all frames are ACKed. | ||
| 980 | * This check is safe because it's as aggressive as slow start which already | ||
| 981 | * risks 100% overshoot. The advantage is that we discourage application to | ||
| 982 | * either send more filler packets or data to artificially blow up the cwnd | ||
| 983 | * usage, and allow application-limited process to probe bw more aggressively. | ||
| 984 | */ | ||
| 985 | static inline bool tcp_is_cwnd_limited(const struct sock *sk) | ||
| 986 | { | ||
| 987 | const struct tcp_sock *tp = tcp_sk(sk); | ||
| 988 | |||
| 989 | /* If in slow start, ensure cwnd grows to twice what was ACKed. */ | ||
| 990 | if (tp->snd_cwnd <= tp->snd_ssthresh) | ||
| 991 | return tp->snd_cwnd < 2 * tp->max_packets_out; | ||
| 992 | |||
| 993 | return tp->is_cwnd_limited; | ||
| 994 | } | ||
| 979 | 995 | ||
| 980 | static inline void tcp_check_probe_timer(struct sock *sk) | 996 | static inline void tcp_check_probe_timer(struct sock *sk) |
| 981 | { | 997 | { |
| @@ -1103,6 +1119,9 @@ static inline void tcp_openreq_init(struct request_sock *req, | |||
| 1103 | ireq->ir_num = ntohs(tcp_hdr(skb)->dest); | 1119 | ireq->ir_num = ntohs(tcp_hdr(skb)->dest); |
| 1104 | } | 1120 | } |
| 1105 | 1121 | ||
| 1122 | extern void tcp_openreq_init_rwin(struct request_sock *req, | ||
| 1123 | struct sock *sk, struct dst_entry *dst); | ||
| 1124 | |||
| 1106 | void tcp_enter_memory_pressure(struct sock *sk); | 1125 | void tcp_enter_memory_pressure(struct sock *sk); |
| 1107 | 1126 | ||
| 1108 | static inline int keepalive_intvl_when(const struct tcp_sock *tp) | 1127 | static inline int keepalive_intvl_when(const struct tcp_sock *tp) |
| @@ -1312,8 +1331,10 @@ void tcp_free_fastopen_req(struct tcp_sock *tp); | |||
| 1312 | 1331 | ||
| 1313 | extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; | 1332 | extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; |
| 1314 | int tcp_fastopen_reset_cipher(void *key, unsigned int len); | 1333 | int tcp_fastopen_reset_cipher(void *key, unsigned int len); |
| 1315 | void tcp_fastopen_cookie_gen(__be32 src, __be32 dst, | 1334 | bool tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, |
| 1316 | struct tcp_fastopen_cookie *foc); | 1335 | struct request_sock *req, |
| 1336 | struct tcp_fastopen_cookie *foc, | ||
| 1337 | struct dst_entry *dst); | ||
| 1317 | void tcp_fastopen_init_key_once(bool publish); | 1338 | void tcp_fastopen_init_key_once(bool publish); |
| 1318 | #define TCP_FASTOPEN_KEY_LENGTH 16 | 1339 | #define TCP_FASTOPEN_KEY_LENGTH 16 |
| 1319 | 1340 | ||
diff --git a/include/net/tso.h b/include/net/tso.h new file mode 100644 index 000000000000..47e5444f7d15 --- /dev/null +++ b/include/net/tso.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #ifndef _TSO_H | ||
| 2 | #define _TSO_H | ||
| 3 | |||
| 4 | #include <net/ip.h> | ||
| 5 | |||
| 6 | struct tso_t { | ||
| 7 | int next_frag_idx; | ||
| 8 | void *data; | ||
| 9 | size_t size; | ||
| 10 | u16 ip_id; | ||
| 11 | u32 tcp_seq; | ||
| 12 | }; | ||
| 13 | |||
| 14 | int tso_count_descs(struct sk_buff *skb); | ||
| 15 | void tso_build_hdr(struct sk_buff *skb, char *hdr, struct tso_t *tso, | ||
| 16 | int size, bool is_last); | ||
| 17 | void tso_build_data(struct sk_buff *skb, struct tso_t *tso, int size); | ||
| 18 | void tso_start(struct sk_buff *skb, struct tso_t *tso); | ||
| 19 | |||
| 20 | #endif /* _TSO_H */ | ||
diff --git a/include/net/udp.h b/include/net/udp.h index a24f0f3e107f..68a1fefe3dfe 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
| @@ -95,15 +95,6 @@ static inline struct udp_hslot *udp_hashslot2(struct udp_table *table, | |||
| 95 | return &table->hash2[hash & table->mask]; | 95 | return &table->hash2[hash & table->mask]; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | /* Note: this must match 'valbool' in sock_setsockopt */ | ||
| 99 | #define UDP_CSUM_NOXMIT 1 | ||
| 100 | |||
| 101 | /* Used by SunRPC/xprt layer. */ | ||
| 102 | #define UDP_CSUM_NORCV 2 | ||
| 103 | |||
| 104 | /* Default, as per the RFC, is to always do csums. */ | ||
| 105 | #define UDP_CSUM_DEFAULT 0 | ||
| 106 | |||
| 107 | extern struct proto udp_prot; | 98 | extern struct proto udp_prot; |
| 108 | 99 | ||
| 109 | extern atomic_long_t udp_memory_allocated; | 100 | extern atomic_long_t udp_memory_allocated; |
| @@ -120,7 +111,9 @@ struct sk_buff; | |||
| 120 | */ | 111 | */ |
| 121 | static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) | 112 | static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) |
| 122 | { | 113 | { |
| 123 | return __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov); | 114 | return (UDP_SKB_CB(skb)->cscov == skb->len ? |
| 115 | __skb_checksum_complete(skb) : | ||
| 116 | __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov)); | ||
| 124 | } | 117 | } |
| 125 | 118 | ||
| 126 | static inline int udp_lib_checksum_complete(struct sk_buff *skb) | 119 | static inline int udp_lib_checksum_complete(struct sk_buff *skb) |
| @@ -156,6 +149,15 @@ static inline __wsum udp_csum(struct sk_buff *skb) | |||
| 156 | return csum; | 149 | return csum; |
| 157 | } | 150 | } |
| 158 | 151 | ||
| 152 | static inline __sum16 udp_v4_check(int len, __be32 saddr, | ||
| 153 | __be32 daddr, __wsum base) | ||
| 154 | { | ||
| 155 | return csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base); | ||
| 156 | } | ||
| 157 | |||
| 158 | void udp_set_csum(bool nocheck, struct sk_buff *skb, | ||
| 159 | __be32 saddr, __be32 daddr, int len); | ||
| 160 | |||
| 159 | /* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ | 161 | /* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ |
| 160 | static inline void udp_lib_hash(struct sock *sk) | 162 | static inline void udp_lib_hash(struct sock *sk) |
| 161 | { | 163 | { |
diff --git a/include/net/vxlan.h b/include/net/vxlan.h index 5deef1ae78c9..12196ce661d9 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h | |||
| @@ -24,16 +24,26 @@ struct vxlan_sock { | |||
| 24 | struct udp_offload udp_offloads; | 24 | struct udp_offload udp_offloads; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | #define VXLAN_F_LEARN 0x01 | ||
| 28 | #define VXLAN_F_PROXY 0x02 | ||
| 29 | #define VXLAN_F_RSC 0x04 | ||
| 30 | #define VXLAN_F_L2MISS 0x08 | ||
| 31 | #define VXLAN_F_L3MISS 0x10 | ||
| 32 | #define VXLAN_F_IPV6 0x20 | ||
| 33 | #define VXLAN_F_UDP_CSUM 0x40 | ||
| 34 | #define VXLAN_F_UDP_ZERO_CSUM6_TX 0x80 | ||
| 35 | #define VXLAN_F_UDP_ZERO_CSUM6_RX 0x100 | ||
| 36 | |||
| 27 | struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, | 37 | struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, |
| 28 | vxlan_rcv_t *rcv, void *data, | 38 | vxlan_rcv_t *rcv, void *data, |
| 29 | bool no_share, bool ipv6); | 39 | bool no_share, u32 flags); |
| 30 | 40 | ||
| 31 | void vxlan_sock_release(struct vxlan_sock *vs); | 41 | void vxlan_sock_release(struct vxlan_sock *vs); |
| 32 | 42 | ||
| 33 | int vxlan_xmit_skb(struct vxlan_sock *vs, | 43 | int vxlan_xmit_skb(struct vxlan_sock *vs, |
| 34 | struct rtable *rt, struct sk_buff *skb, | 44 | struct rtable *rt, struct sk_buff *skb, |
| 35 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, | 45 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, |
| 36 | __be16 src_port, __be16 dst_port, __be32 vni); | 46 | __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); |
| 37 | 47 | ||
| 38 | __be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb); | 48 | __be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb); |
| 39 | 49 | ||
diff --git a/include/net/wimax.h b/include/net/wimax.h index 98498e1daa06..e52ef5357e08 100644 --- a/include/net/wimax.h +++ b/include/net/wimax.h | |||
| @@ -483,8 +483,8 @@ void wimax_report_rfkill_sw(struct wimax_dev *, enum wimax_rf_state); | |||
| 483 | * Be sure not to modify skb->data in the middle (ie: don't use | 483 | * Be sure not to modify skb->data in the middle (ie: don't use |
| 484 | * skb_push()/skb_pull()/skb_reserve() on the skb). | 484 | * skb_push()/skb_pull()/skb_reserve() on the skb). |
| 485 | * | 485 | * |
| 486 | * "pipe_name" is any string, than can be interpreted as the name of | 486 | * "pipe_name" is any string, that can be interpreted as the name of |
| 487 | * the pipe or destinatary; the interpretation of it is driver | 487 | * the pipe or recipient; the interpretation of it is driver |
| 488 | * specific, so the recipient can multiplex it as wished. It can be | 488 | * specific, so the recipient can multiplex it as wished. It can be |
| 489 | * NULL, it won't be used - an example is using a "diagnostics" tag to | 489 | * NULL, it won't be used - an example is using a "diagnostics" tag to |
| 490 | * send diagnostics information that a device-specific diagnostics | 490 | * send diagnostics information that a device-specific diagnostics |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 116e9c7e19cb..721e9c3b11bd 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -691,13 +691,6 @@ struct xfrm_spi_skb_cb { | |||
| 691 | 691 | ||
| 692 | #define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0])) | 692 | #define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0])) |
| 693 | 693 | ||
| 694 | /* Audit Information */ | ||
| 695 | struct xfrm_audit { | ||
| 696 | u32 secid; | ||
| 697 | kuid_t loginuid; | ||
| 698 | unsigned int sessionid; | ||
| 699 | }; | ||
| 700 | |||
| 701 | #ifdef CONFIG_AUDITSYSCALL | 694 | #ifdef CONFIG_AUDITSYSCALL |
| 702 | static inline struct audit_buffer *xfrm_audit_start(const char *op) | 695 | static inline struct audit_buffer *xfrm_audit_start(const char *op) |
| 703 | { | 696 | { |
| @@ -713,30 +706,24 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op) | |||
| 713 | return audit_buf; | 706 | return audit_buf; |
| 714 | } | 707 | } |
| 715 | 708 | ||
| 716 | static inline void xfrm_audit_helper_usrinfo(kuid_t auid, unsigned int ses, u32 secid, | 709 | static inline void xfrm_audit_helper_usrinfo(bool task_valid, |
| 717 | struct audit_buffer *audit_buf) | 710 | struct audit_buffer *audit_buf) |
| 718 | { | 711 | { |
| 719 | char *secctx; | 712 | const unsigned int auid = from_kuid(&init_user_ns, task_valid ? |
| 720 | u32 secctx_len; | 713 | audit_get_loginuid(current) : |
| 721 | 714 | INVALID_UID); | |
| 722 | audit_log_format(audit_buf, " auid=%u ses=%u", | 715 | const unsigned int ses = task_valid ? audit_get_sessionid(current) : |
| 723 | from_kuid(&init_user_ns, auid), ses); | 716 | (unsigned int) -1; |
| 724 | if (secid != 0 && | 717 | |
| 725 | security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) { | 718 | audit_log_format(audit_buf, " auid=%u ses=%u", auid, ses); |
| 726 | audit_log_format(audit_buf, " subj=%s", secctx); | 719 | audit_log_task_context(audit_buf); |
| 727 | security_release_secctx(secctx, secctx_len); | 720 | } |
| 728 | } else | 721 | |
| 729 | audit_log_task_context(audit_buf); | 722 | void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, bool task_valid); |
| 730 | } | 723 | void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, |
| 731 | 724 | bool task_valid); | |
| 732 | void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, kuid_t auid, | 725 | void xfrm_audit_state_add(struct xfrm_state *x, int result, bool task_valid); |
| 733 | unsigned int ses, u32 secid); | 726 | void xfrm_audit_state_delete(struct xfrm_state *x, int result, bool task_valid); |
| 734 | void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, kuid_t auid, | ||
| 735 | unsigned int ses, u32 secid); | ||
| 736 | void xfrm_audit_state_add(struct xfrm_state *x, int result, kuid_t auid, | ||
| 737 | unsigned int ses, u32 secid); | ||
| 738 | void xfrm_audit_state_delete(struct xfrm_state *x, int result, kuid_t auid, | ||
| 739 | unsigned int ses, u32 secid); | ||
| 740 | void xfrm_audit_state_replay_overflow(struct xfrm_state *x, | 727 | void xfrm_audit_state_replay_overflow(struct xfrm_state *x, |
| 741 | struct sk_buff *skb); | 728 | struct sk_buff *skb); |
| 742 | void xfrm_audit_state_replay(struct xfrm_state *x, struct sk_buff *skb, | 729 | void xfrm_audit_state_replay(struct xfrm_state *x, struct sk_buff *skb, |
| @@ -749,22 +736,22 @@ void xfrm_audit_state_icvfail(struct xfrm_state *x, struct sk_buff *skb, | |||
| 749 | #else | 736 | #else |
| 750 | 737 | ||
| 751 | static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, | 738 | static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, |
| 752 | kuid_t auid, unsigned int ses, u32 secid) | 739 | bool task_valid) |
| 753 | { | 740 | { |
| 754 | } | 741 | } |
| 755 | 742 | ||
| 756 | static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, | 743 | static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, |
| 757 | kuid_t auid, unsigned int ses, u32 secid) | 744 | bool task_valid) |
| 758 | { | 745 | { |
| 759 | } | 746 | } |
| 760 | 747 | ||
| 761 | static inline void xfrm_audit_state_add(struct xfrm_state *x, int result, | 748 | static inline void xfrm_audit_state_add(struct xfrm_state *x, int result, |
| 762 | kuid_t auid, unsigned int ses, u32 secid) | 749 | bool task_valid) |
| 763 | { | 750 | { |
| 764 | } | 751 | } |
| 765 | 752 | ||
| 766 | static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result, | 753 | static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result, |
| 767 | kuid_t auid, unsigned int ses, u32 secid) | 754 | bool task_valid) |
| 768 | { | 755 | { |
| 769 | } | 756 | } |
| 770 | 757 | ||
| @@ -1508,7 +1495,7 @@ struct xfrmk_spdinfo { | |||
| 1508 | 1495 | ||
| 1509 | struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, u32 seq); | 1496 | struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, u32 seq); |
| 1510 | int xfrm_state_delete(struct xfrm_state *x); | 1497 | int xfrm_state_delete(struct xfrm_state *x); |
| 1511 | int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); | 1498 | int xfrm_state_flush(struct net *net, u8 proto, bool task_valid); |
| 1512 | void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); | 1499 | void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); |
| 1513 | void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); | 1500 | void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); |
| 1514 | u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); | 1501 | u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); |
| @@ -1603,7 +1590,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark, | |||
| 1603 | int *err); | 1590 | int *err); |
| 1604 | struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, | 1591 | struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, |
| 1605 | u32 id, int delete, int *err); | 1592 | u32 id, int delete, int *err); |
| 1606 | int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); | 1593 | int xfrm_policy_flush(struct net *net, u8 type, bool task_valid); |
| 1607 | u32 xfrm_get_acqseq(void); | 1594 | u32 xfrm_get_acqseq(void); |
| 1608 | int verify_spi_info(u8 proto, u32 min, u32 max); | 1595 | int verify_spi_info(u8 proto, u32 min, u32 max); |
| 1609 | int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); | 1596 | int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); |
