aboutsummaryrefslogtreecommitdiff
path: root/net/nfc/llcp/llcp.c
diff options
context:
space:
mode:
authorThierry Escande <thierry.escande@linux.intel.com>2013-04-02 10:25:15 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2013-04-11 16:28:59 +0200
commitabd18d43302ae0e214d020c842b34e706cc3778e (patch)
tree8f60cefae483e5ef1b006c79d2922dce7dcdda4b /net/nfc/llcp/llcp.c
parent66cbfa10f3bdbc86222598ac700c352da90e588f (diff)
NFC: llcp: Reset RW, LTO, and MIU remote parameters when link goes down
This resets remote parameters in both local and socket llcp structures when the link goes down. That way, nfc_llcp_getsockopt won't return values corresponding to the previous link parameters. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp/llcp.c')
-rw-r--r--net/nfc/llcp/llcp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index 79de8bafd42..83e788e840a 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -47,6 +47,12 @@ void nfc_llcp_sock_unlink(struct llcp_sock_list *l, struct sock *sk)
write_unlock(&l->lock);
}
+void nfc_llcp_socket_remote_param_init(struct nfc_llcp_sock *sock)
+{
+ sock->remote_rw = LLCP_DEFAULT_RW;
+ sock->remote_miu = LLCP_MAX_MIU + 1;
+}
+
static void nfc_llcp_socket_purge(struct nfc_llcp_sock *sock)
{
struct nfc_llcp_local *local = sock->local;
@@ -112,6 +118,7 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,
}
if (listen == true) {
+ nfc_llcp_socket_remote_param_init(llcp_sock);
bh_unlock_sock(sk);
continue;
}
@@ -123,6 +130,7 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,
*/
if (sk->sk_state == LLCP_BOUND && sk->sk_type == SOCK_DGRAM &&
listen == true) {
+ nfc_llcp_socket_remote_param_init(llcp_sock);
bh_unlock_sock(sk);
continue;
}
@@ -1522,6 +1530,9 @@ void nfc_llcp_mac_is_down(struct nfc_dev *dev)
if (local == NULL)
return;
+ local->remote_miu = LLCP_DEFAULT_MIU;
+ local->remote_lto = LLCP_DEFAULT_LTO;
+
/* Close and purge all existing sockets */
nfc_llcp_socket_release(local, true, 0);
}