aboutsummaryrefslogtreecommitdiff
path: root/net
AgeCommit message (Collapse)AuthorFilesLines
2010-07-21mac80211: proper IBSS lockingJohannes Berg2-50/+54
IBSS has never had locking, instead relying on some memory barriers etc. That's hard to get right, and I think we had it wrong too until the previous patch. Since this is not performance sensitive, it doesn't make sense to have the maintenance overhead of that, so add proper locking. Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: John W. Linville <[email protected]>
2010-07-21mac80211: fix IBSS lockdep complaintJohannes Berg1-5/+14
Bob reported a lockdep complaint originating in the mac80211 IBSS code due to the common work struct patch. The reason is that the IBSS and station mode code have different locking orders for the cfg80211 wdev lock and the work struct (where "locking" implies running/canceling). Fix this by simply not canceling the work in the IBSS code, it is not necessary since when the REQ_RUN bit is cleared, the work will run without effect if it runs. When the interface is set down, it is flushed anyway, so there's no concern about it running after memory has been invalidated either. This fixes https://bugzilla.kernel.org/show_bug.cgi?id=16419 Additionally, looking into this I noticed that there's a small window while the IBSS is torn down in which the work may be rescheduled and the REQ_RUN bit be set again after leave() has cleared it when a scan finishes at exactly the same time. Avoid that by setting the ssid_len to zero before clearing REQ_RUN which signals to the scan finish code that this interface is not active. Reported-by: Bob Copeland <[email protected]> Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: John W. Linville <[email protected]>
2010-07-21mac80211: refuse shared key auth when WEP is unavailableJohannes Berg1-0/+2
When WEP is not available, we should reject shared key authentication because it could never succeed. Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: John W. Linville <[email protected]>
2010-07-21cfg80211: fix race between sysfs and cfg80211Maxime Bizon1-6/+8
device_add() is called before adding the phy to the cfg80211 device list. So if a userspace program uses sysfs uevents to detect new phy devices, and queries nl80211 to get phy info, it can get ENODEV even though the phy exists in sysfs. An easy workaround is to hold the cfg80211 mutex until the phy is present in sysfs/cfg80211/debugfs. Signed-off-by: Maxime Bizon <[email protected]> Signed-off-by: John W. Linville <[email protected]>
2010-07-21Bluetooth: Enable L2CAP Extended features by defaultGustavo F. Padovan1-9/+9
Change the enable_ertm param to disable_ertm and default value to 0. That means that L2CAP Extended features are enabled by default now. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix typo in hci_event.cGustavo F. Padovan1-2/+2
memmory -> memory Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Add Google's copyright to L2CAPGustavo F. Padovan1-0/+1
Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Implemented HCI frame reassembly for RX from streamSuraj Sumangala1-0/+35
Implemented frame reassembly implementation for reassembling fragments received from stream. Signed-off-by: Suraj Sumangala <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Modified hci_recv_fragment() to use hci_reassembly helperSuraj Sumangala1-74/+11
Modified packet based reassembly function hci_recv_fragment() to use hci_reassembly() Signed-off-by: Suraj Sumangala <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Implement hci_reassembly helper to reassemble RX packetsSuraj Sumangala1-0/+109
Implements feature to reassemble received HCI frames from any input stream Signed-off-by: Suraj Sumangala <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Add one more buffer for HCI stream reassemblySuraj Sumangala1-3/+3
Additional reassembly buffer to keep track of stream reasembly Signed-off-by: Suraj Sumangala <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Update L2CAP version informationGustavo F. Padovan1-1/+1
We did some changes on the L2CAP configuration process and its behaviour is bit different now. That justifies a updated on the L2CAP version. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Add Copyright notice to L2CAPGustavo F. Padovan1-0/+1
Copyright for the time I worked on L2CAP during the Google Summer of Code program. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Keep code under column 80Gustavo F. Padovan1-21/+25
Purely a cosmetic change, it doesn't change the code flow. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix bug in kzalloc allocation sizeGustavo F. Padovan1-1/+1
Probably a typo error. We were using the wrong struct to get size. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Send ConfigReq after send a ConnectionRspGustavo F. Padovan1-3/+41
The extended L2CAP features requires that one should initiate a ConfigReq after send the ConnectionRsp. This patch changes the behaviour of the configuration process of our stack. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix error return on L2CAP-HCI interface.João Paulo Rechi Vita1-3/+3
L2CAP only deals with ACL links. EINVAL should be returned otherwise. Signed-off-by: João Paulo Rechi Vita <[email protected]> Acked-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix error value for wrong FCS.João Paulo Rechi Vita1-1/+1
Signed-off-by: João Paulo Rechi Vita <[email protected]> Acked-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix error return for l2cap_connect_rsp().João Paulo Rechi Vita1-2/+2
Signed-off-by: João Paulo Rechi Vita <[email protected]> Acked-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix error return value on sendmsg.João Paulo Rechi Vita1-1/+1
When the socket is in a bad state EBADFD is more appropriate then EINVAL. Signed-off-by: João Paulo Rechi Vita <[email protected]> Acked-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix error return value on sendmsg.João Paulo Rechi Vita1-1/+1
When we try to send a message bigger than the outgoing MTU value EMSGSIZE (message too long) should be returned. Signed-off-by: João Paulo Rechi Vita <[email protected]> Acked-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Make l2cap_streaming_send() void.João Paulo Rechi Vita1-3/+2
It doesn't make sense to have a return value since we always set it to 0. Signed-off-by: João Paulo Rechi Vita <[email protected]> Acked-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix l2cap_sock_connect error return.João Paulo Rechi Vita1-0/+1
Return a proper error value if socket is already connected. Signed-off-by: João Paulo Rechi Vita <[email protected]> Acked-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Improve ERTM local busy handlingGustavo F. Padovan1-36/+47
Now we also check if can push skb userspace just after receive a new skb instead of only wait the l2cap_busy_work wake up from time to time to check the local busy condition. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Add backlog queue to ERTM codeGustavo F. Padovan1-53/+79
backlog queue is the canonical mechanism to avoid race conditions due interrupts in bottom half context. After the socket lock is released the net core take care of push all skb in its backlog queue. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Remove the send_lock spinlock from ERTMGustavo F. Padovan1-27/+1
Using a lock to deal with the ERTM race condition - interruption with new data from the hci layer - is wrong. We should use the native skb backlog queue. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Don't accept ConfigReq if we aren't in the BT_CONFIG stateGustavo F. Padovan1-1/+7
If such event happens we shall reply with a Command Reject, because we are not expecting any configure request. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Disconnect early if mode is not supportedGustavo F. Padovan1-16/+40
When mode is mandatory we shall not send connect request and report this to the userspace as well. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Remove check for supported modeGustavo F. Padovan1-7/+2
Since now we have checks for the supported mode before on l2cap_info_rsp we can remove the check for it here. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Refuse ConfigRsp with different modeGustavo F. Padovan1-1/+5
If our mode is Basic Mode we have to refuse any ConfigRsp that proposes a different mode. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Actively send request for Basic ModeGustavo F. Padovan1-6/+11
The Profile Tuning Suite requires that we send a RFC containing the Basic Mode configuration when requesting Basic Mode. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Prefer Basic Mode on receipt of ConfigReqGustavo F. Padovan1-3/+0
If we choose to use Basic Mode then we have to refuse the received mode and propose Basic Mode again. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Disconnect the channel if we don't want the proposed modeGustavo F. Padovan1-1/+2
If the device is a STATE 2 then it should disconnect the channel if the remote device propose a mode different from its mandatory mode. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Change the way we set ERTM mode as mandatoryGustavo F. Padovan1-4/+18
If the socket type is SOCK_STREAM we set Enhanced Retransmisson Mode or Streaming Mode as mandatory. That means that we will close the channel if the other side doesn't support or request the the mandatory mode. Basic mode can't be set as mandatory. Signed-off-by: Gustavo F. Padovan <[email protected]> Reviewed-by: João Paulo Rechi Vita <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Tweaks to l2cap_send_i_or_rr_or_rnr() flowGustavo F. Padovan1-2/+1
l2cap_send_sframe() already set the F-bit if we set L2CAP_CONN_SEND_FBIT and unset L2CAP_CONN_SEND_FBIT after send the F-bit. Signed-off-by: Gustavo F. Padovan <[email protected]> Reviewed-by: João Paulo Rechi Vita <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Add debug output to ERTM codeGustavo F. Padovan1-1/+22
Use the dynamic debug to output info about ERTM protocol stuff. The following script can be used to enable debug for ERTM: DEBUGFS="/sys/kernel/debug/dynamic_debug/control" echo -n 'func l2cap_send_disconn_req +p' > $DEBUGFS echo -n 'func l2cap_monitor_timeout +p' > $DEBUGFS echo -n 'func l2cap_retrans_timeout +p' > $DEBUGFS echo -n 'func l2cap_busy_work +p' > $DEBUGFS echo -n 'func l2cap_push_rx_skb +p' > $DEBUGFS echo -n 'func l2cap_data_channel_iframe +p' > $DEBUGFS echo -n 'func l2cap_data_channel_rrframe +p' > $DEBUGFS echo -n 'func l2cap_data_channel_rejframe +p' > $DEBUGFS echo -n 'func l2cap_data_channel_srejframe +p' > $DEBUGFS echo -n 'func l2cap_data_channel_rnrframe +p' > $DEBUGFS Signed-off-by: Gustavo F. Padovan <[email protected]> Reviewed-by: João Paulo Rechi Vita <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix ERTM error reporting to the userspaceGustavo F. Padovan1-17/+22
If any error occurs during transfers we have to tell userspace that something wrong happened. Signed-off-by: Gustavo F. Padovan <[email protected]> Reviewed-by: João Paulo Rechi Vita <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix missing retransmission action with RR(P=1)Gustavo F. Padovan1-2/+2
The Bluetooth SIG Profile Tuning Suite Software uses the CSA1 spec to run the L2CAP tests. The new 3.0 spec has a missing Retransmit-I-Frames action when the Remote side is Busy. We still start the retransmission timer if Remote is Busy and unacked frames > 0. We do everything we did before this change plus the Retransmission of I-frames. Signed-off-by: Gustavo F. Padovan <[email protected]> Reviewed-by: João Paulo Rechi Vita <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Check packet FCS earlierGustavo F. Padovan1-11/+11
This way, if FCS is enabled and the packet is corrupted, we just drop it without read it len, which could be corrupted. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Check the tx_window size on setsockoptGustavo F. Padovan1-0/+5
We have to check if the proposed tx_window value is not greater that maximum value supported. Signed-off-by: Gustavo F. Padovan <[email protected]> Reviewed-by: João Paulo Rechi Vita <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix handle of received P-bitGustavo F. Padovan1-2/+12
ERTM spec mandates that after receive a P-bit we shall send an F-bit in response. This patch fixes this for retransmitted packets, on retransmitting we were missing to check for a pending F-bit to be sent. Also we were missing some annotation to send a F-bit. Signed-off-by: Gustavo F. Padovan <[email protected]> Reviewed-by: João Paulo Rechi Vita <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Update buffer_seq before retransmit framesGustavo F. Padovan1-4/+4
Updating buffer_seq first make us able to ack the last I-frame received. This is also a requirement of the Profile Tuning Suite software. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Stop ack_timer if ERTM enters in Local Busy or SREJ_SENTGustavo F. Padovan1-0/+4
The ack_timer is implemation specific, disabling it in such situation avoids some potencial errors in the ERTM protocol. Signed-off-by: Gustavo F. Padovan <[email protected]> Reviewed-by: João Paulo Rechi Vita <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Reassigned copyright to Code Aurora ForumRon Shaffer2-2/+2
Qualcomm, Inc. has reassigned rights to Code Aurora Forum. Accordingly, as files are modified by Code Aurora Forum members, the copyright statement will be updated. Signed-off-by: Ron Shaffer <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Add debugfs support for showing the blacklistJohan Hedberg1-0/+38
This patch adds a debugfs blacklist entry for each HCI device which can be used to list the current content of the blacklist. Signed-off-by: Johan Hedberg <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Add blacklist support for incoming connectionsJohan Hedberg3-1/+94
In some circumstances it could be desirable to reject incoming connections on the baseband level. This patch adds this feature through two new ioctl's: HCIBLOCKADDR and HCIUNBLOCKADDR. Both take a simple Bluetooth address as a parameter. BDADDR_ANY can be used with HCIUNBLOCKADDR to remove all devices from the blacklist. Signed-off-by: Johan Hedberg <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix L2CAP control bit field corruptionGustavo F. Padovan1-0/+4
When resending an I-frame, ERTM was reusing the control bits from the last time it was sent, that was causing a corruption in the new control field due to it dirty fields. This patches extracts only the SAR bits from the old field and reuse it to resend the packet, the others bits should be reset and receive the updated value. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Proper shutdown ERTM when closing the channelGustavo F. Padovan1-22/+37
Fix a crash regarding the Monitor Timeout, it was running even after the shutdown of the ACL connection, which doesn't make sense. The same code also fixes another issue, before this patch L2CAP was sending many Disconnections Requests while we have to send only one. The issues are related to each other, a expired Monitor Timeout can trigger a Disconnection Request and then we may have a crash if the link was already deleted. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix bug with ERTM minimum packet lengthNathan Holstein1-4/+4
ERTM and streaming mode L2CAP sockets have no minimum packet length. Only basic mode connections have minimum length. Instead, validate the packet containing all necessary control, FCS, and SAR fields. The patch fixes the drop of valid packets with length lower than 4. Signed-off-by: Nathan Holstein <[email protected]> Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2010-07-21Bluetooth: Fix SREJ_QUEUE corruption in L2CAPJoão Paulo Rechi Vita1-1/+12
Since all TxSeq values are modulo, we shall not compare them directly. We have to compare their offset inside the TxWindow instead. Signed-off-by: João Paulo Rechi Vita <[email protected]> Acked-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>