aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/mISDN/l1oip_core.c
diff options
context:
space:
mode:
authorAndreas Eversberg <andreas@eversberg.eu>2008-09-14 06:30:18 -0400
committerKarsten Keil <kkeil@suse.de>2009-01-09 16:44:27 -0500
commit1b4d33121f1d991f6ae226cc3333428ff87627bb (patch)
tree48fef7c8a422087a15a03c025b7709a100498a5a /drivers/isdn/mISDN/l1oip_core.c
parent02282eee56b75a35e6bbc42cc34c9005eb1653f4 (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/l1oip_core.c')
-rw-r--r--drivers/isdn/mISDN/l1oip_core.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c
index 0884dd6892f8..3ddcd2e09dc9 100644
--- a/drivers/isdn/mISDN/l1oip_core.c
+++ b/drivers/isdn/mISDN/l1oip_core.c
@@ -777,6 +777,8 @@ fail:
777static void 777static void
778l1oip_socket_close(struct l1oip *hc) 778l1oip_socket_close(struct l1oip *hc)
779{ 779{
780 struct dchannel *dch = hc->chan[hc->d_idx].dch;
781
780 /* kill thread */ 782 /* kill thread */
781 if (hc->socket_thread) { 783 if (hc->socket_thread) {
782 if (debug & DEBUG_L1OIP_SOCKET) 784 if (debug & DEBUG_L1OIP_SOCKET)
@@ -785,6 +787,16 @@ l1oip_socket_close(struct l1oip *hc)
785 send_sig(SIGTERM, hc->socket_thread, 0); 787 send_sig(SIGTERM, hc->socket_thread, 0);
786 wait_for_completion(&hc->socket_complete); 788 wait_for_completion(&hc->socket_complete);
787 } 789 }
790
791 /* if active, we send up a PH_DEACTIVATE and deactivate */
792 if (test_bit(FLG_ACTIVE, &dch->Flags)) {
793 if (debug & (DEBUG_L1OIP_MSG|DEBUG_L1OIP_SOCKET))
794 printk(KERN_DEBUG "%s: interface become deactivated "
795 "due to timeout\n", __func__);
796 test_and_clear_bit(FLG_ACTIVE, &dch->Flags);
797 _queue_data(&dch->dev.D, PH_DEACTIVATE_IND, MISDN_ID_ANY, 0,
798 NULL, GFP_ATOMIC);
799 }
788} 800}
789 801
790static int 802static int
@@ -944,7 +956,8 @@ channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq)
944 956
945 switch (cq->op) { 957 switch (cq->op) {
946 case MISDN_CTRL_GETOP: 958 case MISDN_CTRL_GETOP:
947 cq->op = MISDN_CTRL_SETPEER | MISDN_CTRL_UNSETPEER; 959 cq->op = MISDN_CTRL_SETPEER | MISDN_CTRL_UNSETPEER
960 | MISDN_CTRL_GETPEER;
948 break; 961 break;
949 case MISDN_CTRL_SETPEER: 962 case MISDN_CTRL_SETPEER:
950 hc->remoteip = (u32)cq->p1; 963 hc->remoteip = (u32)cq->p1;
@@ -964,6 +977,13 @@ channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq)
964 hc->remoteip = 0; 977 hc->remoteip = 0;
965 l1oip_socket_open(hc); 978 l1oip_socket_open(hc);
966 break; 979 break;
980 case MISDN_CTRL_GETPEER:
981 if (debug & DEBUG_L1OIP_SOCKET)
982 printk(KERN_DEBUG "%s: getting ip address.\n",
983 __func__);
984 (u32)cq->p1 = hc->remoteip;
985 cq->p2 = hc->remoteport | (hc->localport << 16);
986 break;
967 default: 987 default:
968 printk(KERN_WARNING "%s: unknown Op %x\n", 988 printk(KERN_WARNING "%s: unknown Op %x\n",
969 __func__, cq->op); 989 __func__, cq->op);