aboutsummaryrefslogtreecommitdiff
path: root/include/net
AgeCommit message (Collapse)AuthorFilesLines
2022-07-18tcp: Fix data-races around keepalive sysctl knobs.Kuniyuki Iwashima1-3/+6
While reading sysctl_tcp_keepalive_(time|probes|intvl), they can be changed concurrently. Thus, we need to add READ_ONCE() to their readers. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-18tls: rx: async: hold onto the input skbJakub Kicinski1-0/+1
Async crypto currently benefits from the fact that we decrypt in place. When we allow input and output to be different skbs we will have to hang onto the input while we move to the next record. Clone the inputs and keep them on a list. Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-18tls: rx: remove the message decrypted trackingJakub Kicinski1-1/+0
We no longer allow a decrypted skb to remain linked to ctx->recv_pkt. Anything on the list is decrypted, anything on ctx->recv_pkt needs to be decrypted. Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-18tls: rx: allow only one reader at a timeJakub Kicinski1-0/+3
recvmsg() in TLS gets data from the skb list (rx_list) or fresh skbs we read from TCP via strparser. The former holds skbs which were already decrypted for peek or decrypted and partially consumed. tls_wait_data() only notices appearance of fresh skbs coming out of TCP (or psock). It is possible, if there is a concurrent call to peek() and recv() that the peek() will move the data from input to rx_list without recv() noticing. recv() will then read data out of order or never wake up. This is not a practical use case/concern, but it makes the self tests less reliable. This patch solves the problem by allowing only one reader in. Because having multiple processes calling read()/peek() is not normal avoid adding a lock and try to fast-path the single reader case. Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-18net/smc: Introduce a sysctl for setting SMC-R buffer typeWen Gu1-0/+1
This patch introduces the sysctl smcr_buf_type for setting the type of SMC-R sndbufs and RMBs. Valid values includes: - SMCR_PHYS_CONT_BUFS, which means use physically contiguous buffers for better performance and is the default value. - SMCR_VIRT_CONT_BUFS, which means use virtually contiguous buffers in case of physically contiguous memory is scarce. - SMCR_MIXED_BUFS, which means first try to use physically contiguous buffers. If not available, then use virtually contiguous buffers. Signed-off-by: Wen Gu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-15tcp/udp: Make early_demux back namespacified.Kuniyuki Iwashima3-6/+2
Commit e21145a9871a ("ipv4: namespacify ip_early_demux sysctl knob") made it possible to enable/disable early_demux on a per-netns basis. Then, we introduced two knobs, tcp_early_demux and udp_early_demux, to switch it for TCP/UDP in commit dddb64bcb346 ("net: Add sysctl to toggle early demux for tcp and udp"). However, the .proc_handler() was wrong and actually disabled us from changing the behaviour in each netns. We can execute early_demux if net.ipv4.ip_early_demux is on and each proto .early_demux() handler is not NULL. When we toggle (tcp|udp)_early_demux, the change itself is saved in each netns variable, but the .early_demux() handler is a global variable, so the handler is switched based on the init_net's sysctl variable. Thus, netns (tcp|udp)_early_demux knobs have nothing to do with the logic. Whether we CAN execute proto .early_demux() is always decided by init_net's sysctl knob, and whether we DO it or not is by each netns ip_early_demux knob. This patch namespacifies (tcp|udp)_early_demux again. For now, the users of the .early_demux() handler are TCP and UDP only, and they are called directly to avoid retpoline. So, we can remove the .early_demux() handler from inet6?_protos and need not dereference them in ip6?_rcv_finish_core(). If another proto needs .early_demux(), we can restore it at that time. Fixes: dddb64bcb346 ("net: Add sysctl to toggle early demux for tcp and udp") Signed-off-by: Kuniyuki Iwashima <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-07-15tcp: Fix data-races around sysctl_tcp_l3mdev_accept.Kuniyuki Iwashima2-3/+3
While reading sysctl_tcp_l3mdev_accept, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: 6dd9a14e92e5 ("net: Allow accepted sockets to be bound to l3mdev domain") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-15tcp/dccp: Fix a data-race around sysctl_tcp_fwmark_accept.Kuniyuki Iwashima1-1/+2
While reading sysctl_tcp_fwmark_accept, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 84f39b08d786 ("net: support marking accepting TCP sockets") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-15ip: Fix a data-race around sysctl_fwmark_reflect.Kuniyuki Iwashima1-1/+1
While reading sysctl_fwmark_reflect, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: e110861f8609 ("net: add a sysctl to reflect the fwmark on replies") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-15ip: Fix data-races around sysctl_ip_nonlocal_bind.Kuniyuki Iwashima1-1/+1
While reading sysctl_ip_nonlocal_bind, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-15ip: Fix data-races around sysctl_ip_fwd_use_pmtu.Kuniyuki Iwashima1-1/+1
While reading sysctl_ip_fwd_use_pmtu, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: f87c10a8aa1e ("ipv4: introduce ip_dst_mtu_maybe_forward and protect forwarding path against pmtu spoofing") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-15ip: Fix data-races around sysctl_ip_default_ttl.Kuniyuki Iwashima1-1/+1
While reading sysctl_ip_default_ttl, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-15wifi: mac80211: select link when transmitting to non-MLO stationsAndrei Otcheretianski1-0/+2
When an MLO AP is transmitting to a non-MLO station, addr2 should be set to a link address. This should be done before the frame is encrypted as otherwise aad verification would fail. In case of software encryption this can't be left for the device to handle, and should be done by mac80211 when building the frame hdr. Signed-off-by: Andrei Otcheretianski <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: cfg80211: add cfg80211_get_iftype_ext_capa()Johannes Berg1-0/+8
Add a helper function cfg80211_get_iftype_ext_capa() to look up interface type-specific (extended) capabilities. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: mac80211: remove link_id parameter from link_info_changed()Gregory Greenman1-1/+0
Since struct ieee80211_bss_conf already contains link_id, passing link_id is not necessary. Signed-off-by: Gregory Greenman <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: mac80211: replace link_id with link_conf in ↵Gregory Greenman1-4/+4
switch/(un)assign_vif_chanctx() Since mac80211 already has a protected pointer to link_conf, pass it to the driver to avoid additional RCU locking. Signed-off-by: Gregory Greenman <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: cfg80211/mac80211: Support control port TX from specific linkAndrei Otcheretianski1-1/+1
In case of authentication with a legacy station, link addressed EAPOL frames should be sent. Support it. Signed-off-by: Andrei Otcheretianski <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: nl80211: add EML/MLD capabilities to per-iftype capabilitiesJohannes Berg1-0/+4
We have the per-interface type capabilities, currently for extended capabilities, add the EML/MLD capabilities there to have this advertised by the driver. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: cfg80211: add ieee80211_chanwidth_rate_flags()Johannes Berg1-6/+19
To simplify things when we don't have a full chandef, add ieee80211_chanwidth_rate_flags(). Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: mac80211: replace link_id with link_conf in start/stop_ap()Gregory Greenman1-2/+2
When calling start/stop_ap(), mac80211 already has a protected link_conf pointer. Pass it to the driver, so it shouldn't handle RCU protection. Signed-off-by: Gregory Greenman <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: cfg80211: extend cfg80211_rx_assoc_resp() for MLOJohannes Berg1-1/+8
Extend the cfg80211_rx_assoc_resp() to cover multiple BSSes, the AP MLD address and local link addresses for MLO. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: cfg80211: put cfg80211_rx_assoc_resp() arguments into a structJohannes Berg1-7/+17
For MLO we'll need a lot more arguments, including all the BSS pointers and link addresses, so move the data to a struct to be able to extend it more easily later. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: cfg80211: adjust assoc comeback for MLOJohannes Berg1-2/+2
We only report the BSSID to userspace, so change the argument from BSS struct pointer to AP address, which we'll use to carry either the BSSID or AP MLD address. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: cfg80211: prepare association failure APIs for MLOJohannes Berg1-12/+17
For MLO, we need the ability to report back multiple BSS structures to release, as well as the AP MLD address (if attempting to make an MLO connection). Unify cfg80211_assoc_timeout() and cfg80211_abandon_assoc() into a new cfg80211_assoc_failure() that gets a structure parameter with the necessary data. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: cfg80211: remove BSS pointer from cfg80211_disassoc_requestJohannes Berg1-3/+3
The race described by the comment in mac80211 hasn't existed since the locking rework to use the same lock and for MLO we need to pass the AP MLD address, so just pass the BSSID or AP MLD address instead of the BSS struct pointer, and adjust all the code accordingly. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: mac80211: mlme: track AP (MLD) address separatelyJohannes Berg1-0/+3
To prepare a bit more for MLO in the client code, track the AP's address (for now only the BSSID, but will track the AP MLD's address later) separately from the per-link BSSID. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: mac80211: change QoS settings API to take link into accountJohannes Berg1-1/+2
Take the link into account in the QoS settings (EDCA parameters) APIs. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: mac80211: move ps setting to vif configJohannes Berg1-3/+3
This really shouldn't be in a per-link config, we don't want to let anyone control it that way (if anything, link powersave could be forced through APIs to activate/deactivate a link), and we don't support powersave in software with devices that can do MLO. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: mac80211: provide link ID in link_confJohannes Berg1-0/+2
It might be useful to drivers to be able to pass only the link_conf pointer, rather than both the pointer and the link_id; add the link_id to the link_conf to facility that. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: cfg80211: make cfg80211_auth_request::key_idx signedJohannes Berg1-1/+2
We might assign -1 to it in some cases when key is NULL, which means the key_idx isn't used but can lead to a warning from static checkers such as smatch. Make the struct member signed simply to avoid that, we only need a range of -1..3 anyway. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: mac80211: RCU-ify link/link_conf pointersJohannes Berg1-2/+4
Since links can be added and removed dynamically, we need to somehow protect the sdata->link[] and vif->link_conf[] array pointers from disappearing when accessing them without locks. RCU-ify the pointers to achieve this, which requires quite a bit of rework. Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: cfg80211/mac80211: separate link params from station paramsShaul Triebitz1-26/+2
Put the link_station_parameters structure in the station_parameters structure (and remove the station_parameters fields already existing in link_station_parameters). Now, for an MLD station, the default link is added together with the station. Signed-off-by: Shaul Triebitz <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2022-07-15wifi: cfg80211: add API to add/modify/remove a link stationShaul Triebitz1-0/+64
Add an API for adding/modifying/removing a link of a station. Signed-off-by: Shaul Triebitz <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
2022-07-14net: devlink: make devlink_dpipe_headers_register() return voidJiri Pirko1-1/+1
The return value is not used, so change the return value type to void. Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Jakub Kicinski <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
2022-07-14Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski5-10/+16
include/net/sock.h 310731e2f161 ("net: Fix data-races around sysctl_mem.") e70f3c701276 ("Revert "net: set SK_MEM_QUANTUM to 4096"") https://lore.kernel.org/all/[email protected]/ net/ipv4/fib_semantics.c 747c14307214 ("ip: fix dflt addr selection for connected nexthop") d62607c3fe45 ("net: rename reference+tracking helpers") net/tls/tls.h include/net/tls.h 3d8c51b25a23 ("net/tls: Check for errors in tls_device_init") 587903142308 ("tls: create an internal header") Signed-off-by: Jakub Kicinski <[email protected]>
2022-07-14xsk: Mark napi_id on sendmsg()Maciej Fijalkowski1-0/+14
When application runs in busy poll mode and does not receive a single packet but only sends them, it is currently impossible to get into napi_busy_loop() as napi_id is only marked on Rx side in xsk_rcv_check(). In there, napi_id is being taken from xdp_rxq_info carried by xdp_buff. From Tx perspective, we do not have access to it. What we have handy is the xsk pool. Xsk pool works on a pool of internal xdp_buff wrappers called xdp_buff_xsk. AF_XDP ZC enabled drivers call xp_set_rxq_info() so each of xdp_buff_xsk has a valid pointer to xdp_rxq_info of underlying queue. Therefore, on Tx side, napi_id can be pulled from xs->pool->heads[0].xdp.rxq->napi_id. Hide this pointer chase under helper function, xsk_pool_get_napi_id(). Do this only for sockets working in ZC mode as otherwise rxq pointers would not be initialized. Signed-off-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Magnus Karlsson <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
2022-07-14net/tls: Check for errors in tls_device_initTariq Toukan1-2/+2
Add missing error checks in tls_device_init. Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure") Reported-by: Jakub Kicinski <[email protected]> Reviewed-by: Maxim Mikityanskiy <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-07-14netfilter: nf_nat: in nf_nat_initialized(), use const struct nf_conn *James Yonan1-1/+1
nf_nat_initialized() doesn't modify passed struct nf_conn, so declare as const. This is helpful for code readability and makes it possible to call nf_nat_initialized() with a const struct nf_conn *. Signed-off-by: James Yonan <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
2022-07-13net/sched: remove return value of unregister_tcf_proto_opsZhengchao Shao1-1/+1
Return value of unregister_tcf_proto_ops is unused, remove it. Signed-off-by: Zhengchao Shao <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-13Merge tag 'wireless-next-2022-07-13' of ↵David S. Miller2-113/+381
git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next Johannes Berg says: ==================== A fairly large set of updates for next, highlights: ath10k * ethernet frame format support rtw89 * TDLS support cfg80211/mac80211 * airtime fairness fixes * EHT support continued, especially in AP mode * initial (and still major) rework for multi-link operation (MLO) from 802.11be/wifi 7 As usual, also many small updates/cleanups/fixes/etc. ==================== Signed-off-by: David S. Miller <[email protected]>
2022-07-13Merge tag 'wireless-2022-07-13' of ↵David S. Miller2-3/+5
git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless Johannes Berg says: ==================== A small set of fixes for * queue selection in mesh/ocb * queue handling on interface stop * hwsim virtio device vs. some other virtio changes * dt-bindings email addresses * color collision memory allocation * a const variable in rtw88 * shared SKB transmit in the ethernet format path * P2P client port authorization ==================== Signed-off-by: David S. Miller <[email protected]>
2022-07-13net: devlink: move unlocked function prototypes alongside the locked onesJiri Pirko1-9/+7
Maintain the same order as it is in devlink.c for function prototypes. The most of the locked variants would very likely soon be removed and the unlocked version would be the only one. Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-13raw: Fix a data-race around sysctl_raw_l3mdev_accept.Kuniyuki Iwashima1-1/+1
While reading sysctl_raw_l3mdev_accept, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 6897445fb194 ("net: provide a sysctl raw_l3mdev_accept for raw socket lookup with VRFs") Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-13net: extract port range fields from fl_flow_keyMaksym Glubokiy2-0/+22
So it can be used for port range filter offloading. Co-developed-by: Volodymyr Mytnyk <[email protected]> Signed-off-by: Volodymyr Mytnyk <[email protected]> Signed-off-by: Maksym Glubokiy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-07-12net: change the type of ip_route_input_rcu to staticZhengchao Shao1-4/+0
The type of ip_route_input_rcu should be static. Signed-off-by: Zhengchao Shao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2022-07-12devlink: Remove unused functions devlink_rate_leaf_create/destroyMoshe Shemesh1-2/+0
The previous patch removed the last usage of the functions devlink_rate_leaf_create() and devlink_rate_nodes_destroy(). Thus, remove these function from devlink API. Signed-off-by: Moshe Shemesh <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
2022-07-12devlink: Remove unused function devlink_rate_nodes_destroyMoshe Shemesh1-1/+0
The previous patch removed the last usage of the function devlink_rate_nodes_destroy(). Thus, remove this function from devlink API. Signed-off-by: Moshe Shemesh <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
2022-07-11net/fq_impl: Use the bitmap API to allocate bitmapsChristophe JAILLET1-3/+2
Use bitmap_zalloc()/bitmap_free() instead of hand-writing them. It is less verbose and it improves the semantic. Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/c7bf099af07eb497b02d195906ee8c11fea3b3bd.1657377335.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <[email protected]>
2022-07-11netfilter: nf_tables: move nft_cmp_fast_mask to where its usedFlorian Westphal1-10/+0
... and cast result to u32 so sparse won't complain anymore. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
2022-07-11netfilter: nf_tables: add and use BE register load-store helpersFlorian Westphal1-0/+15
Same as the existing ones, no conversions. This is just for sparse sake only so that we no longer mix be16/u16 and be32/u32 types. Alternative is to add __force __beX in various places, but this seems nicer. objdiff shows no changes. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>