1 /*****************************************************************************
2 * wanmain.c WAN Multiprotocol Router Module. Main code.
4 * This module is completely hardware-independent and provides
5 * the following common services for the WAN Link Drivers:
6 * o WAN device managenment (registering, unregistering)
7 * o Network interface management
8 * o Physical connection management (dial-up, incoming calls)
9 * o Logical connection management (switched virtual circuits)
10 * o Protocol encapsulation/decapsulation
14 * Copyright: (c) 1995-1999 Sangoma Technologies Inc.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version.
20 * ============================================================================
21 * Nov 24, 2000 Nenad Corbic Updated for 2.4.X kernels
22 * Nov 07, 2000 Nenad Corbic Fixed the Mulit-Port PPP for kernels 2.2.16 and
24 * Aug 2, 2000 Nenad Corbic Block the Multi-Port PPP from running on
25 * kernels 2.2.16 or greater. The SyncPPP
27 * Jul 13, 2000 Nenad Corbic Added SyncPPP support
28 * Added extra debugging in device_setup().
29 * Oct 01, 1999 Gideon Hack Update for s514 PCI card
30 * Dec 27, 1996 Gene Kozin Initial version (based on Sangoma's WANPIPE)
31 * Jan 16, 1997 Gene Kozin router_devlist made public
32 * Jan 31, 1997 Alan Cox Hacked it about a bit for 2.1
33 * Jun 27, 1997 Alan Cox realigned with vendor code
34 * Oct 15, 1997 Farhan Thawar changed wan_encapsulate to add a pad byte of 0
35 * Apr 20, 1998 Alan Cox Fixed 2.1 symbols
36 * May 17, 1998 K. Baranowski Fixed SNAP encapsulation in wan_encapsulate
37 * Dec 15, 1998 Arnaldo Melo support for firmwares of up to 128000 bytes
38 * check wandev->setup return value
39 * Dec 22, 1998 Arnaldo Melo vmalloc/vfree used in device_setup to allocate
40 * kernel memory and copy configuration data to
41 * kernel space (for big firmwares)
42 * Jun 02, 1999 Gideon Hack Updates for Linux 2.0.X and 2.2.X kernels.
43 *****************************************************************************/
45 #include <linux/version.h>
46 #include <linux/config.h>
47 #include <linux/stddef.h> /* offsetof(), etc. */
48 #include <linux/errno.h> /* return codes */
49 #include <linux/kernel.h>
50 #include <linux/module.h> /* support for loadable modules */
51 #include <linux/slab.h> /* kmalloc(), kfree() */
52 #include <linux/mm.h> /* verify_area(), etc. */
53 #include <linux/string.h> /* inline mem*, str* functions */
55 #include <asm/byteorder.h> /* htons(), etc. */
56 #include <linux/wanrouter.h> /* WAN router API definitions */
59 #if defined(LINUX_2_4)
60 #include <linux/vmalloc.h> /* vmalloc, vfree */
61 #include <asm/uaccess.h> /* copy_to/from_user */
62 #include <linux/init.h> /* __initfunc et al. */
64 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,3)
65 #include <net/syncppp.h>
67 #include <../drivers/net/wan/syncppp.h>
70 #elif defined(LINUX_2_1)
72 #include <linux/vmalloc.h> /* vmalloc, vfree */
73 #include <asm/uaccess.h> /* copy_to/from_user */
74 #include <linux/init.h> /* __initfunc et al. */
75 #include <../drivers/net/syncppp.h>
78 #include <asm/segment.h> /* kernel <-> user copy */
81 #define KMEM_SAFETYZONE 8
83 /***********FOR DEBUGGING PURPOSES*********************************************
84 static void * dbg_kmalloc(unsigned int size, int prio, int line) {
86 void * v = kmalloc(size+sizeof(unsigned int)+2*KMEM_SAFETYZONE*8,prio);
88 c1 += sizeof(unsigned int);
89 *((unsigned int *)v) = size;
91 for (i = 0; i < KMEM_SAFETYZONE; i++) {
92 c1[0] = 'D'; c1[1] = 'E'; c1[2] = 'A'; c1[3] = 'D';
93 c1[4] = 'B'; c1[5] = 'E'; c1[6] = 'E'; c1[7] = 'F';
97 for (i = 0; i < KMEM_SAFETYZONE; i++) {
98 c1[0] = 'M'; c1[1] = 'U'; c1[2] = 'N'; c1[3] = 'G';
99 c1[4] = 'W'; c1[5] = 'A'; c1[6] = 'L'; c1[7] = 'L';
102 v = ((char *)v) + sizeof(unsigned int) + KMEM_SAFETYZONE*8;
103 printk(KERN_INFO "line %d kmalloc(%d,%d) = %p\n",line,size,prio,v);
106 static void dbg_kfree(void * v, int line) {
107 unsigned int * sp = (unsigned int *)(((char *)v) - (sizeof(unsigned int) + KMEM_SAFETYZONE*8));
108 unsigned int size = *sp;
109 char * c1 = ((char *)v) - KMEM_SAFETYZONE*8;
111 for (i = 0; i < KMEM_SAFETYZONE; i++) {
112 if ( c1[0] != 'D' || c1[1] != 'E' || c1[2] != 'A' || c1[3] != 'D'
113 || c1[4] != 'B' || c1[5] != 'E' || c1[6] != 'E' || c1[7] != 'F') {
114 printk(KERN_INFO "kmalloced block at %p has been corrupted (underrun)!\n",v);
115 printk(KERN_INFO " %4x: %2x %2x %2x %2x %2x %2x %2x %2x\n", i*8,
116 c1[0],c1[1],c1[2],c1[3],c1[4],c1[5],c1[6],c1[7] );
121 for (i = 0; i < KMEM_SAFETYZONE; i++) {
122 if ( c1[0] != 'M' || c1[1] != 'U' || c1[2] != 'N' || c1[3] != 'G'
123 || c1[4] != 'W' || c1[5] != 'A' || c1[6] != 'L' || c1[7] != 'L'
125 printk(KERN_INFO "kmalloced block at %p has been corrupted (overrun):\n",v);
126 printk(KERN_INFO " %4x: %2x %2x %2x %2x %2x %2x %2x %2x\n", i*8,
127 c1[0],c1[1],c1[2],c1[3],c1[4],c1[5],c1[6],c1[7] );
131 printk(KERN_INFO "line %d kfree(%p)\n",line,v);
132 v = ((char *)v) - (sizeof(unsigned int) + KMEM_SAFETYZONE*8);
136 #define kmalloc(x,y) dbg_kmalloc(x,y,__LINE__)
137 #define kfree(x) dbg_kfree(x,__LINE__)
138 *****************************************************************************/
142 * Function Prototypes
146 * Kernel loadable module interface.
149 int init_module (void);
150 void cleanup_module (void);
154 * WAN device IOCTL handlers
157 static int device_setup(wan_device_t *wandev, wandev_conf_t *u_conf);
158 static int device_stat(wan_device_t *wandev, wandev_stat_t *u_stat);
159 static int device_shutdown(wan_device_t *wandev);
160 static int device_new_if(wan_device_t *wandev, wanif_conf_t *u_conf);
161 static int device_del_if(wan_device_t *wandev, char *u_name);
167 static wan_device_t *find_device (char *name);
168 static int delete_interface (wan_device_t *wandev, char *name);
169 void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags);
170 void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags);
178 static char fullname[] = "Sangoma WANPIPE Router";
179 static char copyright[] = "(c) 1995-2000 Sangoma Technologies Inc.";
180 static char modname[] = ROUTER_NAME; /* short module name */
181 wan_device_t* router_devlist = NULL; /* list of registered devices */
182 static int devcnt = 0;
185 * Organize Unique Identifiers for encapsulation/decapsulation
188 static unsigned char oui_ether[] = { 0x00, 0x00, 0x00 };
190 static unsigned char oui_802_2[] = { 0x00, 0x80, 0xC2 };
195 int wanrouter_init(void)
198 extern int wanpipe_init(void);
199 extern int sdladrv_init(void);
201 printk(KERN_INFO "%s v%u.%u %s\n",
202 fullname, ROUTER_VERSION, ROUTER_RELEASE, copyright);
204 err = wanrouter_proc_init();
206 printk(KERN_INFO "%s: can't create entry in proc filesystem!\n", modname);
210 * Initialise compiled in boards
213 #ifdef CONFIG_VENDOR_SANGOMA
223 static void __exit wanrouter_cleanup (void)
225 wanrouter_proc_cleanup();
232 * Kernel Loadable Module Entry Points
236 * Module 'insert' entry point.
237 * o print announcement
238 * o initialize static data
239 * o create /proc/net/router directory and static entries
246 int init_module (void)
250 printk(KERN_INFO "%s v%u.%u %s\n",
251 fullname, ROUTER_VERSION, ROUTER_RELEASE, copyright);
253 err = wanrouter_proc_init();
257 "%s: can't create entry in proc filesystem!\n", modname);
263 * Module 'remove' entry point.
264 * o delete /proc/net/router directory and static entries.
267 void cleanup_module (void)
269 wanrouter_proc_cleanup();
279 * Register WAN device.
280 * o verify device credentials
281 * o create an entry for the device in the /proc/net/router directory
282 * o initialize internally maintained fields of the wan_device structure
283 * o link device data space to a singly-linked list
284 * o if it's the first device, then start kernel 'thread'
285 * o increment module use count
295 int register_wan_device(wan_device_t *wandev)
299 if ((wandev == NULL) || (wandev->magic != ROUTER_MAGIC) ||
300 (wandev->name == NULL))
303 namelen = strlen(wandev->name);
304 if (!namelen || (namelen > WAN_DRVNAME_SZ))
307 if (find_device(wandev->name) != NULL)
311 printk(KERN_INFO "%s: registering WAN device %s\n",
312 modname, wandev->name);
316 * Register /proc directory entry
318 err = wanrouter_proc_add(wandev);
321 "%s: can't create /proc/net/router/%s entry!\n",
322 modname, wandev->name);
327 * Initialize fields of the wan_device structure maintained by the
328 * router and update local data.
333 wandev->next = router_devlist;
334 router_devlist = wandev;
336 MOD_INC_USE_COUNT; /* prevent module from unloading */
341 * Unregister WAN device.
343 * o unlink device data space from the linked list
344 * o delete device entry in the /proc/net/router directory
345 * o decrement module use count
353 int unregister_wan_device(char *name)
355 wan_device_t *wandev, *prev;
360 for (wandev = router_devlist, prev = NULL;
361 wandev && strcmp(wandev->name, name);
362 prev = wandev, wandev = wandev->next)
368 printk(KERN_INFO "%s: unregistering WAN device %s\n", modname, name);
371 if (wandev->state != WAN_UNCONFIGURED) {
372 device_shutdown(wandev);
376 prev->next = wandev->next;
378 router_devlist = wandev->next;
382 wanrouter_proc_delete(wandev);
388 * Encapsulate packet.
390 * Return: encapsulation header size
391 * < 0 - unsupported Ethertype
394 * 1. This function may be called on interrupt context.
398 int wanrouter_encapsulate (struct sk_buff *skb, netdevice_t *dev,
404 case ETH_P_IP: /* IP datagram encapsulation */
407 skb->data[0] = NLPID_IP;
410 case ETH_P_IPX: /* SNAP encapsulation */
415 skb->data[1] = NLPID_SNAP;
416 memcpy(&skb->data[2], oui_ether, sizeof(oui_ether));
417 *((unsigned short*)&skb->data[5]) = htons(type);
420 default: /* Unknown packet type */
422 "%s: unsupported Ethertype 0x%04X on interface %s!\n",
423 modname, type, dev->name);
431 * Decapsulate packet.
433 * Return: Ethertype (in network order)
434 * 0 unknown encapsulation
437 * 1. This function may be called on interrupt context.
441 unsigned short wanrouter_type_trans (struct sk_buff *skb, netdevice_t *dev)
443 int cnt = skb->data[0] ? 0 : 1; /* there may be a pad present */
444 unsigned short ethertype;
446 switch (skb->data[cnt]) {
447 case NLPID_IP: /* IP datagramm */
448 ethertype = htons(ETH_P_IP);
452 case NLPID_SNAP: /* SNAP encapsulation */
453 if (memcmp(&skb->data[cnt + 1], oui_ether, sizeof(oui_ether))){
455 "%s: unsupported SNAP OUI %02X-%02X-%02X "
456 "on interface %s!\n", modname,
457 skb->data[cnt+1], skb->data[cnt+2],
458 skb->data[cnt+3], dev->name);
461 ethertype = *((unsigned short*)&skb->data[cnt+4]);
465 /* add other protocols, e.g. CLNP, ESIS, ISIS, if needed */
469 "%s: unsupported NLPID 0x%02X on interface %s!\n",
470 modname, skb->data[cnt], dev->name);
473 skb->protocol = ethertype;
474 skb->pkt_type = PACKET_HOST; /* Physically point to point */
476 skb->mac.raw = skb->data;
483 * o find WAN device associated with this node
484 * o execute requested action or pass command to the device driver
487 int wanrouter_ioctl(struct inode *inode, struct file *file,
488 unsigned int cmd, unsigned long arg)
491 struct proc_dir_entry *dent;
492 wan_device_t *wandev;
494 #if defined (LINUX_2_1) || defined (LINUX_2_4)
495 if (!capable(CAP_NET_ADMIN)){
500 if ((cmd >> 8) != ROUTER_IOCTL)
503 dent = inode->u.generic_ip;
504 if ((dent == NULL) || (dent->data == NULL))
508 if (wandev->magic != ROUTER_MAGIC)
513 err = device_setup(wandev, (void*)arg);
517 err = device_shutdown(wandev);
521 err = device_stat(wandev, (void*)arg);
525 err = device_new_if(wandev, (void*)arg);
529 err = device_del_if(wandev, (void*)arg);
536 if ((cmd >= ROUTER_USER) &&
537 (cmd <= ROUTER_USER_MAX) &&
539 err = wandev->ioctl(wandev, cmd, arg);
546 * WAN Driver IOCTL Handlers
550 * Setup WAN link device.
551 * o verify user address space
552 * o allocate kernel memory and copy configuration data to kernel space
553 * o if configuration data includes extension, copy it to kernel space too
554 * o call driver's setup() entry point
557 static int device_setup (wan_device_t *wandev, wandev_conf_t *u_conf)
563 if (wandev->setup == NULL){ /* Nothing to do ? */
564 printk(KERN_INFO "%s: ERROR, No setup script: wandev->setup()\n",
570 err = verify_area (VERIFY_READ, u_conf, sizeof(wandev_conf_t));
576 conf = kmalloc(sizeof(wandev_conf_t), GFP_KERNEL);
578 printk(KERN_INFO "%s: ERROR, Failed to allocate kernel memory !\n",
583 #if defined (LINUX_2_1) || defined (LINUX_2_4)
584 if(copy_from_user(conf, u_conf, sizeof(wandev_conf_t))) {
585 printk(KERN_INFO "%s: Failed to copy user config data to kernel space!\n",
591 memcpy_fromfs ((void *)conf, (void *)u_conf, sizeof(wandev_conf_t));
594 if (conf->magic != ROUTER_MAGIC){
596 printk(KERN_INFO "%s: ERROR, Invalid MAGIC Number\n",
601 if (conf->data_size && conf->data){
602 if(conf->data_size > 128000 || conf->data_size < 0) {
604 "%s: ERROR, Invalid firmware data size %i !\n",
605 wandev->name, conf->data_size);
610 #if defined (LINUX_2_1) || defined (LINUX_2_4)
611 data = vmalloc(conf->data_size);
613 if(!copy_from_user(data, conf->data, conf->data_size)){
615 err = wandev->setup(wandev,conf);
618 "%s: ERROR, Faild to copy from user data !\n",
624 "%s: ERROR, Faild allocate kernel memory !\n",
633 err = verify_area(VERIFY_READ, conf->data, conf->data_size);
635 data = kmalloc(conf->data_size, GFP_KERNEL);
637 memcpy_fromfs(data, (void*)conf->data,
642 "%s: ERROR, Faild allocate kernel memory !\n",wandev->name);
647 "%s: ERROR, Faild to copy from user data !\n",wandev->name);
651 err = wandev->setup(wandev, conf);
660 "%s: ERROR, No firmware found ! Firmware size = %i !\n",
661 wandev->name, conf->data_size);
669 * Shutdown WAN device.
670 * o delete all not opened logical channels for this device
671 * o call driver's shutdown() entry point
674 static int device_shutdown (wan_device_t *wandev)
679 if (wandev->state == WAN_UNCONFIGURED){
683 printk(KERN_INFO "\n%s: Shutting Down!\n",wandev->name);
685 for (dev = wandev->dev; dev;) {
686 if ((err=delete_interface(wandev, dev->name)) != 0){
690 /* The above function deallocates the current dev
691 * structure. Therefore, we cannot use dev->priv
692 * as the next element: wandev->dev points to the
698 return -EBUSY; /* there are opened interfaces */
701 if (wandev->shutdown)
702 err=wandev->shutdown(wandev);
708 * Get WAN device status & statistics.
711 static int device_stat (wan_device_t *wandev, wandev_stat_t *u_stat)
717 err = verify_area(VERIFY_WRITE, u_stat, sizeof(wandev_stat_t));
722 memset(&stat, 0, sizeof(stat));
724 /* Ask device driver to update device statistics */
725 if ((wandev->state != WAN_UNCONFIGURED) && wandev->update)
726 wandev->update(wandev);
728 /* Fill out structure */
729 stat.ndev = wandev->ndev;
730 stat.state = wandev->state;
732 #if defined (LINUX_2_1) || defined (LINUX_2_4)
733 if(copy_to_user(u_stat, &stat, sizeof(stat)))
736 memcpy_tofs((void*)u_stat, (void*)&stat, sizeof(stat));
743 * Create new WAN interface.
744 * o verify user address space
745 * o copy configuration data to kernel address space
746 * o allocate network interface data space
747 * o call driver's new_if() entry point
748 * o make sure there is no interface name conflict
749 * o register network interface
752 static int device_new_if (wan_device_t *wandev, wanif_conf_t *u_conf)
755 netdevice_t *dev=NULL;
756 #ifdef CONFIG_WANPIPE_MULTPPP
757 struct ppp_device *pppdev=NULL;
761 if ((wandev->state == WAN_UNCONFIGURED) || (wandev->new_if == NULL))
764 #if defined (LINUX_2_1) || defined (LINUX_2_4)
765 if(copy_from_user(&conf, u_conf, sizeof(wanif_conf_t)))
768 err = verify_area(VERIFY_READ, u_conf, sizeof(wanif_conf_t));
771 memcpy_fromfs((void*)&conf, (void*)u_conf, sizeof(wanif_conf_t));
774 if (conf.magic != ROUTER_MAGIC)
777 err = -EPROTONOSUPPORT;
780 #ifdef CONFIG_WANPIPE_MULTPPP
781 if (conf.config_id == WANCONFIG_MPPP){
783 pppdev = kmalloc(sizeof(struct ppp_device), GFP_KERNEL);
787 memset(pppdev, 0, sizeof(struct ppp_device));
789 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,16)
790 pppdev->dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL);
791 if (pppdev->dev == NULL){
795 memset(pppdev->dev, 0, sizeof(netdevice_t));
798 err = wandev->new_if(wandev, (netdevice_t *)pppdev, &conf);
800 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,16)
808 dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL);
812 memset(dev, 0, sizeof(netdevice_t));
813 err = wandev->new_if(wandev, dev, &conf);
817 /* Sync PPP is disabled */
818 if (conf.config_id != WANCONFIG_MPPP){
820 dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL);
824 memset(dev, 0, sizeof(netdevice_t));
825 err = wandev->new_if(wandev, dev, &conf);
827 printk(KERN_INFO "%s: Wanpipe Mulit-Port PPP support has not been compiled in!\n",
834 /* Register network interface. This will invoke init()
835 * function supplied by the driver. If device registered
836 * successfully, add it to the interface list.
839 if (dev->name == NULL){
841 }else if (dev_get(dev->name)){
842 err = -EEXIST; /* name already exists */
846 printk(KERN_INFO "%s: registering interface %s...\n",
850 err = register_netdev(dev);
852 netdevice_t *slave=NULL;
853 unsigned long smp_flags=0;
855 lock_adapter_irq(&wandev->lock, &smp_flags);
857 if (wandev->dev == NULL){
860 for (slave=wandev->dev;
861 *((netdevice_t**)slave->priv);
862 slave=*((netdevice_t**)slave->priv));
864 *((netdevice_t**)slave->priv) = dev;
868 unlock_adapter_irq(&wandev->lock, &smp_flags);
869 return 0; /* done !!! */
873 wandev->del_if(wandev, dev);
876 /* This code has moved from del_if() function */
883 #ifdef CONFIG_WANPIPE_MULTPPP
884 if (conf.config_id == WANCONFIG_MPPP){
890 /* Sync PPP is disabled */
891 if (conf.config_id != WANCONFIG_MPPP){
901 * Delete WAN logical channel.
902 * o verify user address space
903 * o copy configuration data to kernel address space
906 static int device_del_if (wan_device_t *wandev, char *u_name)
908 char name[WAN_IFNAME_SZ + 1];
911 if (wandev->state == WAN_UNCONFIGURED)
915 err = verify_area(VERIFY_READ, u_name, WAN_IFNAME_SZ);
920 memset(name, 0, sizeof(name));
922 #if defined (LINUX_2_1) || defined (LINUX_2_4)
923 if(copy_from_user(name, u_name, WAN_IFNAME_SZ))
926 memcpy_fromfs((void*)name, (void*)u_name, WAN_IFNAME_SZ);
929 err = delete_interface(wandev, name);
933 /* If last interface being deleted, shutdown card
934 * This helps with administration at leaf nodes
935 * (You can tell if the person at the other end of the phone
936 * has an interface configured) and avoids DoS vulnerabilities
937 * in binary driver files - this fixes a problem with the current
938 * Sangoma driver going into strange states when all the network
939 * interfaces are deleted and the link irrecoverably disconnected.
942 if (!wandev->ndev && wandev->shutdown){
943 err = wandev->shutdown(wandev);
950 * Miscellaneous Functions
954 * Find WAN device by name.
955 * Return pointer to the WAN device data space or NULL if device not found.
958 static wan_device_t *find_device(char *name)
960 wan_device_t *wandev;
962 for (wandev = router_devlist;wandev && strcmp(wandev->name, name);
963 wandev = wandev->next);
968 * Delete WAN logical channel identified by its name.
969 * o find logical channel by its name
970 * o call driver's del_if() entry point
971 * o unregister network interface
972 * o unlink channel data space from linked list of channels
973 * o release channel data space
976 * -ENODEV channel not found.
977 * -EBUSY interface is open
979 * Note: If (force != 0), then device will be destroyed even if interface
980 * associated with it is open. It's caller's responsibility to make
981 * sure that opened interfaces are not removed!
984 static int delete_interface (wan_device_t *wandev, char *name)
986 netdevice_t *dev=NULL, *prev=NULL;
987 unsigned long smp_flags=0;
989 lock_adapter_irq(&wandev->lock, &smp_flags);
992 while (dev && strcmp(name, dev->name)) {
993 netdevice_t **slave = dev->priv;
997 unlock_adapter_irq(&wandev->lock, &smp_flags);
1000 return -ENODEV; /* interface not found */
1004 if (netif_running(dev)){
1008 return -EBUSY; /* interface in use */
1012 wandev->del_if(wandev, dev);
1014 lock_adapter_irq(&wandev->lock, &smp_flags);
1016 netdevice_t **prev_slave = prev->priv;
1017 netdevice_t **slave = dev->priv;
1019 *prev_slave = *slave;
1021 netdevice_t **slave = dev->priv;
1022 wandev->dev = *slave;
1025 unlock_adapter_irq(&wandev->lock, &smp_flags);
1027 printk(KERN_INFO "%s: unregistering '%s'\n", wandev->name, dev->name);
1029 /* Due to new interface linking method using dev->priv,
1030 * this code has moved from del_if() function.*/
1036 unregister_netdev(dev);
1050 void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags)
1053 save_flags(*smp_flags);
1056 spin_lock_irqsave(lock, *smp_flags);
1061 void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags)
1064 restore_flags(*smp_flags);
1066 spin_unlock_irqrestore(lock, *smp_flags);
1072 #if defined (LINUX_2_1) || defined (LINUX_2_4)
1073 EXPORT_SYMBOL(register_wan_device);
1074 EXPORT_SYMBOL(unregister_wan_device);
1075 EXPORT_SYMBOL(wanrouter_encapsulate);
1076 EXPORT_SYMBOL(wanrouter_type_trans);
1077 EXPORT_SYMBOL(lock_adapter_irq);
1078 EXPORT_SYMBOL(unlock_adapter_irq);