patch-2.2.18 linux/drivers/isdn/isdn_net.c

Next file: linux/drivers/isdn/isdn_net.h
Previous file: linux/drivers/isdn/isdn_concap.h
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/drivers/isdn/isdn_net.c linux/drivers/isdn/isdn_net.c
@@ -1,4 +1,4 @@
-/* $Id: isdn_net.c,v 1.114 2000/03/16 16:37:41 kai Exp $
+/* $Id: isdn_net.c,v 1.137 2000/09/12 19:43:47 kai Exp $
 
  * Linux ISDN subsystem, network interfaces and related functions (linklevel).
  *
@@ -20,443 +20,6 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Log: isdn_net.c,v $
- * Revision 1.114  2000/03/16 16:37:41  kai
- * Allow phone numbers starting with "*" as outgoing numbers for
- * networking interface. Some PBX's need this to allow dialing internal
- * numbers (mine, for example ;-)
- *
- * Revision 1.113  2000/03/16 15:46:37  kai
- * a little bugfix and cosmetic changes
- *
- * Revision 1.112  2000/03/04 16:20:42  detabc
- * copy frames before rewriting frame's saddr
- *
- * Revision 1.111  2000/02/28 22:28:24  he
- * moved tx_timeout warning messages in old (2.2.x) branch where it really only
- * indicates problems.
- *
- * Revision 1.110  2000/02/26 01:00:53  keil
- * changes from 2.3.47
- *
- * Revision 1.109  2000/02/25 11:29:17  paul
- * changed chargetime to ulong from int (after about 20 days the "chargetime of
- * ipppX is now 1234" message displays a negative number on alpha).
- *
- * Revision 1.108  2000/02/15 12:54:01  kai
- * set TX timeout back to 2 secs for 2.2.x, just to be safe
- *
- * Revision 1.107  2000/02/13 09:52:05  kai
- * increased TX_TIMEOUT to 20sec
- *
- * Revision 1.106  2000/02/12 19:26:55  kai
- * adopted to latest 2.3 softnet changes.
- *
- * tested with PPP and MPPP, it works here.
- * can somebody check raw-ip?
- *
- * also changed std2kern, stddiff for bash-1 compatibility,
- * hope this doesn't break anything.
- *
- * Revision 1.105  2000/02/12 11:43:26  he
- * SOFTNET related changes, first try. Compatible with linux 2.2.x, but
- * not tested for kernels with softnet (>= 2.3.43) yet.
- *
- * Revision 1.104  2000/02/06 21:49:59  detabc
- * add rewriting of socket's and frame's saddr for udp-ipv4 dynip-connections.
- * Include checksum-recompute of ip- and udp-header's.
- *
- * Revision 1.103  2000/01/23 18:45:37  keil
- * Change EAZ mapping to forbit the use of cards (insert a "-" for the MSN)
- *
- * Revision 1.102  2000/01/09 20:43:14  detabc
- * exand logical bind-group's for both call's (in and out).
- * add first part of kernel-config-help for abc-extension.
- *
- * Revision 1.101  1999/12/05 16:06:08  detabc
- * add resethandling for rawip-compression.
- * at now all B2-Protocols are usable with rawip-compression
- *
- * Revision 1.100  1999/12/04 15:05:25  detabc
- * bugfix abc-rawip-bsdcompress with channel-bundeling
- *
- * Revision 1.99  1999/11/30 11:29:06  detabc
- * add a on the fly frame-counter and limit
- *
- * Revision 1.98  1999/11/28 14:49:07  detabc
- * In case of rawip-compress adjust dev[x]->ibytes/obytes to reflect the
- * uncompressed size.
- *
- * Revision 1.97  1999/11/26 15:54:59  detabc
- * added compression (isdn_bsdcompress) for rawip interfaces with x75i B2-protocol.
- *
- * Revision 1.96  1999/11/20 22:14:13  detabc
- * added channel dial-skip in case of external use
- * (isdn phone or another isdn device) on the same NTBA.
- * usefull with two or more card's connected the different NTBA's.
- * global switchable in kernel-config and also per netinterface.
- *
- * add auto disable of netinterface's in case of:
- * 	to many connection's in short time.
- * 	config mistakes (wrong encapsulation, B2-protokoll or so on) on local
- * 	or remote side.
- * 	wrong password's or something else to a ISP (syncppp).
- *
- * possible encapsulations for this future are:
- * ISDN_NET_ENCAP_SYNCPPP, ISDN_NET_ENCAP_UIHDLC, ISDN_NET_ENCAP_RAWIP,
- * and ISDN_NET_ENCAP_CISCOHDLCK.
- *
- * Revision 1.95  1999/10/27 21:21:17  detabc
- * Added support for building logically-bind-group's per interface.
- * usefull for outgoing call's with more then one isdn-card.
- *
- * Switchable support to dont reset the hangup-timeout for
- * receive frames. Most part's of the timru-rules for receiving frames
- * are now obsolete. If the input- or forwarding-firewall deny
- * the frame, the line will be not hold open.
- *
- * Revision 1.94  1999/10/02 11:07:02  he
- * Changed tbusy logic in indn_net.c
- *
- * Revision 1.93  1999/09/23 22:22:41  detabc
- * added tcp-keepalive-detect with local response (ipv4 only)
- * added host-only-interface support
- * (source ipaddr == interface ipaddr) (ipv4 only)
- * ok with kernel 2.3.18 and 2.2.12
- *
- * Revision 1.92  1999/09/13 23:25:17  he
- * serialized xmitting frames from isdn_ppp and BSENT statcallb
- *
- * Revision 1.91  1999/09/12 16:19:39  detabc
- * added abc features
- * low cost routing for net-interfaces (only the HL side).
- * need more implementation in the isdnlog-utility
- * udp info support (first part).
- * different EAZ on outgoing call's.
- * more checks on D-Channel callbacks (double use of channels).
- * tested and running with kernel 2.3.17
- *
- * Revision 1.90  1999/09/04 22:21:39  detabc
- *
- * Revision 1.89  1999/08/22 20:26:03  calle
- * backported changes from kernel 2.3.14:
- * - several #include "config.h" gone, others come.
- * - "struct device" changed to "struct net_device" in 2.3.14, added a
- *   define in isdn_compat.h for older kernel versions.
- *
- * Revision 1.88  1999/07/07 10:13:31  detabc
- * remove unused messages
- *
- * Revision 1.87  1999/07/06 07:53:53  calle
- * calls to dev_alloc_skb waste 16 bytes of memory, if we calculate the
- * right header space for the lowlevel driver. using alloc_skb instead.
- *
- * Revision 1.86  1999/06/09 10:12:05  paul
- * thinko in previous patch
- *
- * Revision 1.85  1999/06/07 19:42:39  paul
- * isdn_net_getpeer() fixed to return correct `outgoing' flag
- *
- * Revision 1.84  1999/04/18 14:06:55  fritz
- * Removed TIMRU stuff.
- *
- * Revision 1.83  1999/04/12 12:33:23  fritz
- * Changes from 2.0 tree.
- *
- * Revision 1.82  1999/01/17 00:55:58  he
- * added mark_bh in BCONN statcallb and cleaned up some dead code
- *
- * Revision 1.81  1999/01/15 16:36:52  he
- * replaced icmp_send() by dst_link_failure()
- *
- * Revision 1.80  1998/12/01 13:06:22  paul
- * Also huptimeout with dialmode == manual
- *
- * Revision 1.79  1998/10/30 17:55:27  he
- * dialmode for x25iface and multulink ppp
- *
- * Revision 1.78  1998/10/26 18:20:46  he
- * re-inserted p=p->next in isdn_net_find_icall() (fixes kernel lock up
- * on incoming call not matching the first interface)
- *
- * Revision 1.77  1998/10/23 10:18:44  paul
- * Implementation of "dialmode" (successor of "status")
- * You also need current isdnctrl for this!
- *
- * Revision 1.76  1998/09/07 22:00:05  he
- * flush method for 2.1.118 and above
- * updated IIOCTLNETGPN
- *
- * Revision 1.75  1998/08/31 21:09:50  he
- * new ioctl IIOCNETGPN for /dev/isdninfo (get network interface'
- *     peer phone number)
- *
- * Revision 1.74  1998/07/30 11:28:32  paul
- * printk message only appeared when status is off and interface is rawIP,
- * which is confusing for people who don't know about "isdnctrl status <if> on".
- *
- * Revision 1.73  1998/06/26 22:01:37  keil
- * tx_queue_len = 5 was too small
- *
- * Revision 1.72  1998/06/26 15:12:31  fritz
- * Added handling of STAT_ICALL with incomplete CPN.
- * Added AT&L for ttyI emulator.
- * Added more locking stuff in tty_write.
- *
- * Revision 1.71  1998/06/18 22:43:08  fritz
- * Bugfix: Setting ndev->do_ioctl had beed accidetly removed at cleanup.
- *
- * Revision 1.70  1998/06/17 19:50:49  he
- * merged with 2.1.10[34] (cosmetics and udelay() -> mdelay())
- * brute force fix to avoid Ugh's in isdn_tty_write()
- * cleaned up some dead code
- *
- * Revision 1.69  1998/06/09 12:27:37  cal
- * Changed default of local netdev flags: ISDN_NET_STOPPED is default now,
- * so autodial is suppressed for that device until it is switched on using
- * 'isdnctrl status dev-name on'.
- *
- *
- *
- * Revision 1.66  1998/05/26 22:39:24  he
- * sync'ed with 2.1.102 where appropriate (CAPABILITY changes)
- * concap typo
- * cleared dev.tbusy in isdn_net BCONN status callback
- *
- * Revision 1.61  1998/04/16 19:19:42  keil
- * Fix from vger (tx max qlength)
- *
- * Revision 1.60  1998/04/14 16:28:49  he
- * Fixed user space access with interrupts off and remaining
- * copy_{to,from}_user() -> -EFAULT return codes
- *
- * Revision 1.59  1998/03/07 22:37:33  fritz
- * Bugfix: restore_flags missing.
- *
- * Revision 1.58  1998/03/07 18:21:05  cal
- * Dynamic Timeout-Rule-Handling vs. 971110 included
- *
- * Revision 1.57  1998/02/25 18:31:13  fritz
- * Added debugging output in adjust_header.
- *
- * Revision 1.56  1998/02/25 17:49:42  he
- * Changed return codes caused be failing copy_{to,from}_user to -EFAULT
- *
- * Revision 1.55  1998/02/23 19:38:22  fritz
- * Corrected check for modified feature-flags.
- *
- * Revision 1.54  1998/02/20 17:15:07  fritz
- * Changes for recent kernels.
- * Ugly workaround for adjusting Ethernet frames with recent kernels.
- * replaced direct calls to lowlevel-driver command by common hook.
- *
- * Revision 1.53  1998/01/31 22:05:54  keil
- * Lots of changes for X.25 support:
- * Added generic support for connection-controlling encapsulation protocols
- * Added support of BHUP status message
- * Added support for additional p_encap X25IFACE
- * Added support for kernels >= 2.1.72
- *
- * Revision 1.52  1998/01/31 19:29:51  calle
- * Merged changes from and for 2.1.82, not tested only compiled ...
- *
- * Revision 1.51  1997/10/09 21:28:50  fritz
- * New HL<->LL interface:
- *   New BSENT callback with nr. of bytes included.
- *   Sending without ACK.
- *   New L1 error status (not yet in use).
- *   Cleaned up obsolete structures.
- * Implemented Cisco-SLARP.
- * Changed local net-interface data to be dynamically allocated.
- * Removed old 2.0 compatibility stuff.
- *
- * Revision 1.50  1997/10/01 09:20:32  fritz
- * Removed old compatibility stuff for 2.0.X kernels.
- * From now on, this code is for 2.1.X ONLY!
- * Old stuff is still in the separate branch.
- *
- * Revision 1.49  1997/08/21 14:38:13  fritz
- * Bugfix: Did not compile without SyncPPP.
- *
- * Revision 1.48  1997/06/22 11:57:15  fritz
- * Added ability to adjust slave triggerlevel.
- *
- * Revision 1.47  1997/06/21 10:52:05  fritz
- * Removed wrong SET_SKB_FREE in isdn_net_send_skb()
- *
- * Revision 1.46  1997/06/17 13:05:24  hipp
- * Applied Eric's underflow-patches (slightly modified)
- *
- * Revision 1.45  1997/06/10 16:24:22  hipp
- * hard_header changes for syncPPP (now behaves like RAWIP)
- *
- * Revision 1.44  1997/05/27 15:17:26  fritz
- * Added changes for recent 2.1.x kernels:
- *   changed return type of isdn_close
- *   queue_task_* -> queue_task
- *   clear/set_bit -> test_and_... where apropriate.
- *   changed type of hard_header_cache parameter.
- *
- * Revision 1.43  1997/03/30 16:51:13  calle
- * changed calls to copy_from_user/copy_to_user and removed verify_area
- * were possible.
- *
- * Revision 1.42  1997/03/11 08:43:51  fritz
- * Perform a hangup if number is deleted while dialing.
- *
- * Revision 1.41  1997/03/08 08:16:31  fritz
- * Bugfix: Deleting a phone number during dial gave unpredictable results.
- *
- * Revision 1.40  1997/03/05 21:16:08  fritz
- * Fix: did not compile with 2.1.27
- *
- * Revision 1.39  1997/03/04 21:36:52  fritz
- * Added sending ICMP messages when no connetion is possible.
- *
- * Revision 1.38  1997/02/23 23:41:14  fritz
- * Bugfix: Slave interfaces have to be hung up before master.
- *
- * Revision 1.37  1997/02/11 18:32:51  fritz
- * Bugfix in isdn_ppp_free_mpqueue().
- *
- * Revision 1.36  1997/02/10 21:31:11  fritz
- * Changed setup-interface (incoming and outgoing).
- *
- * Revision 1.35  1997/02/10 20:12:45  fritz
- * Changed interface for reporting incoming calls.
- *
- * Revision 1.34  1997/02/03 23:15:07  fritz
- * Reformatted according CodingStyle.
- * replaced arp_find prototype by proper include.
- * made dev_purge_queues static.
- * Bugfix in bogocps calculation.
- * removed isdn_net_receive_callback - was never used ;-)
- * Misc. fixes for Kernel 2.1.X comaptibility.
- *
- * Revision 1.33  1997/01/17 01:19:25  fritz
- * Applied chargeint patch.
- *
- * Revision 1.32  1997/01/14 01:29:31  fritz
- * Bugfix: isdn_net_hangup() did not reset ISDN_NET_CONNECTED.
- *
- * Revision 1.31  1997/01/11 23:30:42  fritz
- * Speed up dial statemachine.
- *
- * Revision 1.30  1996/11/25 17:20:50  hipp
- * fixed pppbind bug in isdn_net_find_icall()
- *
- * Revision 1.29  1996/11/13 02:31:38  fritz
- * Minor cleanup.
- *
- * Revision 1.28  1996/10/27 20:49:06  keil
- * bugfix to compile without MPP
- *
- * Revision 1.27  1996/10/25 18:46:01  fritz
- * Another bugfix in isdn_net_autohup()
- *
- * Revision 1.26  1996/10/23 23:05:36  fritz
- * Bugfix: Divide by zero in isdn_net_autohup()
- *
- * Revision 1.25  1996/10/22 23:13:58  fritz
- * Changes for compatibility to 2.0.X and 2.1.X kernels.
- *
- * Revision 1.24  1996/10/11 13:57:40  fritz
- * Bugfix: Error in BogoCPS calculation.
- *
- * Revision 1.23  1996/09/23 01:58:08  fritz
- * Fix: With syncPPP encapsulation, discard LCP packets
- *      when calculating hangup timeout.
- *
- * Revision 1.22  1996/09/23 00:03:37  fritz
- * Fix: did not compile without CONFIG_ISDN_PPP
- *
- * Revision 1.21  1996/09/07 12:44:50  hipp
- * (hopefully) fixed callback problem with syncPPP
- * syncPPP network devices now show PPP link encap
- *
- * Revision 1.20  1996/08/29 20:06:03  fritz
- * Bugfix: Transmission timeout had been much to low.
- *
- * Revision 1.19  1996/08/12 16:24:32  hipp
- * removed some (now) obsolete functions for syncPPP in rebuild_header etc.
- *
- * Revision 1.18  1996/07/03 13:48:51  hipp
- * bugfix: Call dev_purge_queues() only for master device
- *
- * Revision 1.17  1996/06/25 18:37:37  fritz
- * Fixed return count for empty return string in isdn_net_getphones().
- *
- * Revision 1.16  1996/06/24 17:48:08  fritz
- * Bugfixes:
- *   - Did not free channel on unbinding.
- *   - ioctl returned wrong callback settings.
- *
- * Revision 1.15  1996/06/16 17:42:54  tsbogend
- * fixed problem with IP addresses on Linux/Alpha (long is 8 byte there)
- *
- * Revision 1.14  1996/06/11 14:54:08  hipp
- * minor bugfix in isdn_net_send_skb
- * changes in BSENT callback handler for syncPPP
- * added lp->sav_skb stuff
- *
- * Revision 1.13  1996/06/06 14:25:44  fritz
- * Changed loglevel of "incoming ... without OAD" message, since
- * with audio support this is quite normal.
- *
- * Revision 1.12  1996/06/05 02:36:45  fritz
- * Minor bugfixes by M. Hipp.
- *
- * Revision 1.11  1996/05/18 01:36:59  fritz
- * Added spelling corrections and some minor changes
- * to stay in sync with kernel.
- *
- * Revision 1.10  1996/05/17 03:49:01  fritz
- * Some cleanup.
- *
- * Revision 1.9  1996/05/06 11:34:57  hipp
- * fixed a few bugs
- *
- * Revision 1.8  1996/04/30 21:04:40  fritz
- * Test commit
- *
- * Revision 1.7  1996/04/30 11:10:42  fritz
- * Added Michael's ippp-bind patch.
- *
- * Revision 1.6  1996/04/30 09:34:35  fritz
- * Removed compatibility-macros.
- *
- * Revision 1.5  1996/04/20 16:28:38  fritz
- * Made more parameters of the dial statemachine user-configurable and
- * added hangup after dial for more reliability using callback.
- * Changed all io going through generic routines in isdn_common.c
- * Added missing call to dev_free_skb on failed dialing.
- * Added uihdlc encapsulation.
- * Fixed isdn_net_setcfg not to destroy interface-flags anymore.
- * Misc. typos.
- *
- * Revision 1.4  1996/02/19 15:23:38  fritz
- * Bugfix: Sync-PPP packets got compressed twice, when resent due to
- *         send-queue-full reject.
- *
- * Revision 1.3  1996/02/11 02:22:28  fritz
- * Changed status- receive-callbacks to use pointer-arrays for finding
- * a corresponding interface instead of looping over all interfaces.
- * Activate Auto-hangup-timer only when interface is online.
- * Some bugfixes in the dialing-statemachine.
- * Lot of bugfixes in sk_buff'ized encapsulation handling.
- * For speedup connection-setup after dialing, remember sk_buf that triggered
- * dialing.
- * Fixed isdn_net_log_packet according to different encapsulations.
- * Correct ARP-handling for ETHERNET-encapsulation.
- *
- * Revision 1.2  1996/01/22 05:05:12  fritz
- * Changed returncode-logic for isdn_net_start_xmit() and its
- * helper-functions.
- * Changed handling of buildheader for RAWIP and ETHERNET-encapsulation.
- *
- * Revision 1.1  1996/01/09 04:12:34  fritz
- * Initial revision
- *
  */
 
 #include <linux/config.h>
@@ -2220,7 +1783,7 @@
  *                   would eventually match if CID was longer.
  */
 int
-isdn_net_find_icall(int di, int ch, int idx, setup_parm setup)
+isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
 {
 	char *eaz;
 	int si1;
@@ -2236,19 +1799,19 @@
 	/* Search name in netdev-chain */
 	save_flags(flags);
 	cli();
-	if (!setup.phone[0]) {
+	if (!setup->phone[0]) {
 		nr[0] = '0';
 		nr[1] = '\0';
 		printk(KERN_INFO "isdn_net: Incoming call without OAD, assuming '0'\n");
 	} else
-		strcpy(nr, setup.phone);
-	si1 = (int) setup.si1;
-	si2 = (int) setup.si2;
-	if (!setup.eazmsn[0]) {
+		strcpy(nr, setup->phone);
+	si1 = (int) setup->si1;
+	si2 = (int) setup->si2;
+	if (!setup->eazmsn[0]) {
 		printk(KERN_WARNING "isdn_net: Incoming call without CPN, assuming '0'\n");
 		eaz = "0";
 	} else
-		eaz = setup.eazmsn;
+		eaz = setup->eazmsn;
 	if (dev->net_verbose > 1)
 		printk(KERN_INFO "isdn_net: call from %s,%d,%d -> %s\n", nr, si1, si2, eaz);
 	/* Accept only calls with Si1 = 7 (Data-Transmission) */
@@ -2279,7 +1842,7 @@
 				break;
 		}
 		swapped = 0;
-		if (!(matchret = isdn_wildmat(eaz, isdn_map_eaz2msn(lp->msn, di))))
+		if (!(matchret = isdn_msncmp(eaz, isdn_map_eaz2msn(lp->msn, di))))
 			ematch = 1;
 		/* Remember if more numbers eventually can match */
 		if (matchret > wret)
@@ -2371,7 +1934,7 @@
 			n = lp->phone[0];
 			if (lp->flags & ISDN_NET_SECURE) {
 				while (n) {
-					if (!isdn_wildmat(nr, n->num))
+					if (!isdn_msncmp(nr, n->num))
 						break;
 					n = (isdn_net_phone *) n->next;
 				}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)