diff options
author | 2013-04-02 10:25:16 +0200 | |
---|---|---|
committer | 2013-04-11 16:28:59 +0200 | |
commit | 064f370c5fd982e1264c03f5b704e00f5e41eb36 (patch) | |
tree | 636fc8d9c23ef114e7bf702f0d49ac53786c7b2e /net | |
parent | NFC: llcp: Reset RW, LTO, and MIU remote parameters when link goes down (diff) | |
download | linux-064f370c5fd982e1264c03f5b704e00f5e41eb36.tar.gz linux-064f370c5fd982e1264c03f5b704e00f5e41eb36.tar.bz2 linux-064f370c5fd982e1264c03f5b704e00f5e41eb36.zip |
NFC: llcp: Add support in getsockopt for RW, LTO, and MIU remote parameters
Useful for LLCP validation tests.
Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/nfc/llcp/sock.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c index 641c535be3d4..fd01ac6e0bf4 100644 --- a/net/nfc/llcp/sock.c +++ b/net/nfc/llcp/sock.c @@ -303,7 +303,7 @@ static int nfc_llcp_getsockopt(struct socket *sock, int level, int optname, struct sock *sk = sock->sk; struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk); int len, err = 0; - u16 miux; + u16 miux, remote_miu; u8 rw; pr_debug("%p optname %d\n", sk, optname); @@ -339,6 +339,27 @@ static int nfc_llcp_getsockopt(struct socket *sock, int level, int optname, break; + case NFC_LLCP_REMOTE_MIU: + remote_miu = llcp_sock->remote_miu > LLCP_MAX_MIU ? + local->remote_miu : llcp_sock->remote_miu; + + if (put_user(remote_miu, (u32 __user *) optval)) + err = -EFAULT; + + break; + + case NFC_LLCP_REMOTE_LTO: + if (put_user(local->remote_lto / 10, (u32 __user *) optval)) + err = -EFAULT; + + break; + + case NFC_LLCP_REMOTE_RW: + if (put_user(llcp_sock->remote_rw, (u32 __user *) optval)) + err = -EFAULT; + + break; + default: err = -ENOPROTOOPT; break; |