diff options
author | Andreas Eversberg <andreas@eversberg.eu> | 2008-09-14 12:30:18 +0200 |
---|---|---|
committer | Karsten Keil <kkeil@suse.de> | 2009-01-09 22:44:27 +0100 |
commit | 1b4d33121f1d991f6ae226cc3333428ff87627bb (patch) | |
tree | 48fef7c8a422087a15a03c025b7709a100498a5a /drivers/isdn/mISDN/socket.c | |
parent | 02282eee56b75a35e6bbc42cc34c9005eb1653f4 (diff) |
mISDN: Fix deactivation, if peer IP is removed from l1oip instance.
Added GETPEER operation.
Socket now checks if device is already busy at a differen mode.
Signed-off-by: Andreas Eversberg <andreas@eversberg.eu>
Signed-off-by: Karsten Keil <kkeil@suse.de>
Diffstat (limited to 'drivers/isdn/mISDN/socket.c')
-rw-r--r-- | drivers/isdn/mISDN/socket.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c index 2f6d6e88ff2c..916569ca156d 100644 --- a/drivers/isdn/mISDN/socket.c +++ b/drivers/isdn/mISDN/socket.c @@ -460,6 +460,8 @@ data_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) { struct sockaddr_mISDN *maddr = (struct sockaddr_mISDN *) addr; struct sock *sk = sock->sk; + struct hlist_node *node; + struct sock *csk; int err = 0; if (*debug & DEBUG_SOCKET) @@ -480,6 +482,24 @@ data_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) err = -ENODEV; goto done; } + + read_lock_bh(&data_sockets.lock); + sk_for_each(csk, node, &data_sockets.head) { + if (sk == csk) + continue; + if (_pms(csk)->dev != _pms(sk)->dev) + continue; + if (csk->sk_protocol >= ISDN_P_B_START) + continue; + if (IS_ISDN_P_TE(csk->sk_protocol) + == IS_ISDN_P_TE(sk->sk_protocol)) + continue; + read_unlock_bh(&data_sockets.lock); + err = -EBUSY; + goto done; + } + read_unlock_bh(&data_sockets.lock); + _pms(sk)->ch.send = mISDN_send; _pms(sk)->ch.ctrl = mISDN_ctrl; |