diff options
author | Rémi Denis-Courmont <remi.denis-courmont@nokia.com> | 2010-09-15 12:30:12 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-15 21:31:32 -0700 |
commit | 7417fa83c1a8b75a03bd9b9b358999f38e771eab (patch) | |
tree | 7abf2eb2df05e1ca8ed96cd94b6fe026c8a57972 /net/phonet/datagram.c | |
parent | 4e3d16ce5e82648d7f4dfd28b6cf8fe2e9a9efc3 (diff) |
Phonet: hook resource routing to userspace via ioctl()'s
I wish we could use something cleaner, such as bind(). But that would
not work since resource subscription is orthogonal/in addition to the
normal object ID allocated via bind(). This is similar to multicasting
which also uses ioctl()'s.
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/phonet/datagram.c')
-rw-r--r-- | net/phonet/datagram.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/phonet/datagram.c b/net/phonet/datagram.c index 1bd38db4fe1e..2f032381bd45 100644 --- a/net/phonet/datagram.c +++ b/net/phonet/datagram.c @@ -52,6 +52,19 @@ static int pn_ioctl(struct sock *sk, int cmd, unsigned long arg) answ = skb ? skb->len : 0; release_sock(sk); return put_user(answ, (int __user *)arg); + + case SIOCPNADDRESOURCE: + case SIOCPNDELRESOURCE: { + u32 res; + if (get_user(res, (u32 __user *)arg)) + return -EFAULT; + if (res >= 256) + return -EINVAL; + if (cmd == SIOCPNADDRESOURCE) + return pn_sock_bind_res(sk, res); + else + return pn_sock_unbind_res(sk, res); + } } return -ENOIOCTLCMD; |