aboutsummaryrefslogtreecommitdiff
path: root/net/wanrouter
diff options
context:
space:
mode:
Diffstat (limited to 'net/wanrouter')
-rw-r--r--net/wanrouter/af_wanpipe.c514
-rw-r--r--net/wanrouter/wanmain.c18
-rw-r--r--net/wanrouter/wanproc.c4
3 files changed, 268 insertions, 268 deletions
diff --git a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c
index c2059733e15..41d7e32be70 100644
--- a/net/wanrouter/af_wanpipe.c
+++ b/net/wanrouter/af_wanpipe.c
@@ -11,11 +11,11 @@
* 2 of the License, or (at your option) any later version.
* ============================================================================
* Due Credit:
-* Wanpipe socket layer is based on Packet and
-* the X25 socket layers. The above sockets were
-* used for the specific use of Sangoma Technologies
-* API programs.
-* Packet socket Authors: Ross Biro, Fred N. van Kempen and
+* Wanpipe socket layer is based on Packet and
+* the X25 socket layers. The above sockets were
+* used for the specific use of Sangoma Technologies
+* API programs.
+* Packet socket Authors: Ross Biro, Fred N. van Kempen and
* Alan Cox.
* X25 socket Author: Jonathan Naylor.
* ============================================================================
@@ -28,7 +28,7 @@
* Feb 29, 2000 Nenad Corbic o Added support for PVC protocols, such as
* CHDLC, Frame Relay and HDLC API.
* Jan 17, 2000 Nenad Corbic o Initial version, based on AF_PACKET socket.
-* X25API support only.
+* X25API support only.
*
******************************************************************************/
@@ -71,33 +71,33 @@
#define DBG_PRINTK(format, a...) printk(format, ## a)
#else
#define DBG_PRINTK(format, a...)
-#endif
+#endif
-/* SECURE SOCKET IMPLEMENTATION
- *
+/* SECURE SOCKET IMPLEMENTATION
+ *
* TRANSMIT:
*
* When the user sends a packet via send() system call
- * the wanpipe_sendmsg() function is executed.
- *
+ * the wanpipe_sendmsg() function is executed.
+ *
* Each packet is enqueud into sk->sk_write_queue transmit
* queue. When the packet is enqueued, a delayed transmit
- * timer is triggerd which acts as a Bottom Half hander.
+ * timer is triggerd which acts as a Bottom Half hander.
*
* wanpipe_delay_transmit() function (BH), dequeues packets
- * from the sk->sk_write_queue transmit queue and sends it
- * to the deriver via dev->hard_start_xmit(skb, dev) function.
+ * from the sk->sk_write_queue transmit queue and sends it
+ * to the deriver via dev->hard_start_xmit(skb, dev) function.
* Note, this function is actual a function pointer of if_send()
* routine in the wanpipe driver.
*
* X25API GUARANTEED DELIVERY:
*
- * In order to provide 100% guaranteed packet delivery,
- * an atomic 'packet_sent' counter is implemented. Counter
- * is incremented for each packet enqueued
+ * In order to provide 100% guaranteed packet delivery,
+ * an atomic 'packet_sent' counter is implemented. Counter
+ * is incremented for each packet enqueued
* into sk->sk_write_queue. Counter is decremented each
- * time wanpipe_delayed_transmit() function successfuly
+ * time wanpipe_delayed_transmit() function successfuly
* passes the packet to the driver. Before each send(), a poll
* routine checks the sock resources The maximum value of
* packet sent counter is 1, thus if one packet is queued, the
@@ -110,11 +110,11 @@
* function, wanpipe_rcv() to queue the incoming packets
* into an AF_WANPIPE socket queue. Based on wanpipe_rcv()
* return code, the driver knows whether the packet was
- * successfully queued. If the socket queue is full,
- * protocol flow control is used by the driver, if any,
+ * successfully queued. If the socket queue is full,
+ * protocol flow control is used by the driver, if any,
* to slow down the traffic until the sock queue is free.
*
- * Every time a packet arrives into a socket queue the
+ * Every time a packet arrives into a socket queue the
* socket wakes up processes which are waiting to receive
* data.
*
@@ -122,12 +122,12 @@
* bit which signals the socket to kick the wanpipe driver
* bottom half hander when the socket queue is partialy
* empty. wanpipe_recvmsg() function performs this action.
- *
+ *
* In case of x25api, packets will never be dropped, since
- * flow control is available.
- *
- * In case of streaming protocols like CHDLC, packets will
- * be dropped but the statistics will be generated.
+ * flow control is available.
+ *
+ * In case of streaming protocols like CHDLC, packets will
+ * be dropped but the statistics will be generated.
*/
@@ -170,11 +170,11 @@ struct wanpipe_opt
struct net_device *dev; /* Bounded device */
unsigned short lcn; /* Binded LCN */
unsigned char svc; /* 0=pvc, 1=svc */
- unsigned char timer; /* flag for delayed transmit*/
+ unsigned char timer; /* flag for delayed transmit*/
struct timer_list tx_timer;
unsigned poll_cnt;
unsigned char force; /* Used to force sock release */
- atomic_t packet_sent;
+ atomic_t packet_sent;
};
#endif
@@ -215,8 +215,8 @@ static int check_driver_busy (struct sock *);
*
* Wanpipe socket bottom half handler. This function
* is called by the WANPIPE device drivers to queue a
- * incoming packet into the socket receive queue.
- * Once the packet is queued, all processes waiting to
+ * incoming packet into the socket receive queue.
+ * Once the packet is queued, all processes waiting to
* read are woken up.
*
* During socket bind, this function is bounded into
@@ -245,13 +245,13 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev,
if (dev->hard_header_parse)
sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr);
- /*
+ /*
* WAN_PACKET_DATA : Data which should be passed up the receive queue.
- * WAN_PACKET_ASYC : Asynchronous data like place call, which should
- * be passed up the listening sock.
- * WAN_PACKET_ERR : Asynchronous data like clear call or restart
- * which should go into an error queue.
- */
+ * WAN_PACKET_ASYC : Asynchronous data like place call, which should
+ * be passed up the listening sock.
+ * WAN_PACKET_ERR : Asynchronous data like clear call or restart
+ * which should go into an error queue.
+ */
switch (skb->pkt_type){
case WAN_PACKET_DATA:
@@ -261,10 +261,10 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev,
break;
case WAN_PACKET_CMD:
sk->sk_state = chan->state;
- /* Bug fix: update Mar6.
- * Do not set the sock lcn number here, since
- * cmd is not guaranteed to be executed on the
- * board, thus Lcn could be wrong */
+ /* Bug fix: update Mar6.
+ * Do not set the sock lcn number here, since
+ * cmd is not guaranteed to be executed on the
+ * board, thus Lcn could be wrong */
sk->sk_data_ready(sk, skb->len);
kfree_skb(skb);
break;
@@ -276,7 +276,7 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev,
break;
default:
printk(KERN_INFO "wansock: BH Illegal Packet Type Dropping\n");
- kfree_skb(skb);
+ kfree_skb(skb);
break;
}
@@ -297,20 +297,20 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev,
*
* Wanpipe LISTEN socket bottom half handler. This function
* is called by the WANPIPE device drivers to queue an
- * incoming call into the socket listening queue.
- * Once the packet is queued, the waiting accept() process
+ * incoming call into the socket listening queue.
+ * Once the packet is queued, the waiting accept() process
* is woken up.
*
* During socket bind, this function is bounded into
- * WANPIPE driver private.
- *
+ * WANPIPE driver private.
+ *
* IMPORTANT NOTE:
* The accept call() is waiting for an skb packet
* which contains a pointer to a device structure.
*
- * When we do a bind to a device structre, we
- * bind a newly created socket into "chan->sk". Thus,
- * when accept receives the skb packet, it will know
+ * When we do a bind to a device structre, we
+ * bind a newly created socket into "chan->sk". Thus,
+ * when accept receives the skb packet, it will know
* from which dev it came form, and in turn it will know
* the address of the new sock.
*
@@ -322,31 +322,31 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
wanpipe_opt *wp = wp_sk(sk), *newwp;
struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)skb->cb;
struct sock *newsk;
- struct net_device *dev;
+ struct net_device *dev;
sdla_t *card;
mbox_cmd_t *mbox_ptr;
wanpipe_common_t *chan;
- /* Find a free device, if none found, all svc's are busy
- */
+ /* Find a free device, if none found, all svc's are busy
+ */
card = (sdla_t*)wp->card;
if (!card){
printk(KERN_INFO "wansock: LISTEN ERROR, No Card\n");
return -ENODEV;
}
-
+
dev = wanpipe_find_free_dev(card);
if (!dev){
printk(KERN_INFO "wansock: LISTEN ERROR, No Free Device\n");
return -ENODEV;
}
- chan=dev->priv;
+ chan=dev->priv;
chan->state = WANSOCK_CONNECTING;
/* Allocate a new sock, which accept will bind
- * and pass up to the user
+ * and pass up to the user
*/
if ((newsk = wanpipe_make_new(sk)) == NULL){
release_device(dev);
@@ -354,33 +354,33 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
}
- /* Initialize the new sock structure
+ /* Initialize the new sock structure
*/
newsk->sk_bound_dev_if = dev->ifindex;
newwp = wp_sk(newsk);
newwp->card = wp->card;
/* Insert the sock into the main wanpipe
- * sock list.
- */
+ * sock list.
+ */
atomic_inc(&wanpipe_socks_nr);
/* Allocate and fill in the new Mail Box. Then
- * bind the mail box to the sock. It will be
- * used by the ioctl call to read call information
- * and to execute commands.
- */
+ * bind the mail box to the sock. It will be
+ * used by the ioctl call to read call information
+ * and to execute commands.
+ */
if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) {
wanpipe_kill_sock_irq (newsk);
- release_device(dev);
+ release_device(dev);
return -ENOMEM;
}
memcpy(mbox_ptr,skb->data,skb->len);
/* Register the lcn on which incoming call came
- * from. Thus, if we have to clear it, we know
- * which lcn to clear
- */
+ * from. Thus, if we have to clear it, we know
+ * which lcn to clear
+ */
newwp->lcn = mbox_ptr->cmd.lcn;
newwp->mbox = (void *)mbox_ptr;
@@ -416,20 +416,20 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
/* We must do this manually, since the sock_queue_rcv_skb()
* function sets the skb->dev to NULL. However, we use
- * the dev field in the accept function.*/
- if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
+ * the dev field in the accept function.*/
+ if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
(unsigned)sk->sk_rcvbuf) {
- wanpipe_unlink_driver(newsk);
+ wanpipe_unlink_driver(newsk);
wanpipe_kill_sock_irq (newsk);
--sk->sk_ack_backlog;
return -ENOMEM;
- }
+ }
skb_set_owner_r(skb, sk);
skb_queue_tail(&sk->sk_receive_queue, skb);
sk->sk_data_ready(sk, skb->len);
-
+
return 0;
}
@@ -474,7 +474,7 @@ static struct sock *wanpipe_make_new(struct sock *osk)
return sk;
}
-/*
+/*
* FIXME: wanpipe_opt has to include a sock in its definition and stop using
* sk_protinfo, but this code is not even compilable now, so lets leave it for
* later.
@@ -489,12 +489,12 @@ static struct proto wanpipe_proto = {
* wanpipe_make_new
*
* Allocate memory for the a new sock, and sock
- * private data.
- *
+ * private data.
+ *
* Increment the module use count.
- *
- * This function is used by wanpipe_create() and
- * wanpipe_make_new() functions.
+ *
+ * This function is used by wanpipe_create() and
+ * wanpipe_make_new() functions.
*
*===========================================================*/
@@ -514,7 +514,7 @@ static struct sock *wanpipe_alloc_socket(void)
wp_sk(sk) = wan_opt;
/* Use timer to send data to the driver. This will act
- * as a BH handler for sendmsg functions */
+ * as a BH handler for sendmsg functions */
init_timer(&wan_opt->tx_timer);
wan_opt->tx_timer.data = (unsigned long)sk;
wan_opt->tx_timer.function = wanpipe_delayed_transmit;
@@ -528,14 +528,14 @@ static struct sock *wanpipe_alloc_socket(void)
* wanpipe_sendmsg
*
* This function implements a sendto() system call,
- * for AF_WANPIPE socket family.
+ * for AF_WANPIPE socket family.
* During socket bind() sk->sk_bound_dev_if is initialized
* to a correct network device. This number is used
* to find a network device to which the packet should
* be passed to.
*
- * Each packet is queued into sk->sk_write_queue and
- * delayed transmit bottom half handler is marked for
+ * Each packet is queued into sk->sk_write_queue and
+ * delayed transmit bottom half handler is marked for
* execution.
*
* A socket must be in WANSOCK_CONNECTED state before
@@ -554,18 +554,18 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
unsigned char *addr;
int ifindex, err, reserve = 0;
-
+
if (!sock_flag(sk, SOCK_ZAPPED))
return -ENETDOWN;
if (sk->sk_state != WANSOCK_CONNECTED)
- return -ENOTCONN;
+ return -ENOTCONN;
- if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
+ if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
return(-EINVAL);
/* it was <=, now one can send
- * zero length packets */
+ * zero length packets */
if (len < sizeof(x25api_hdr_t))
return -EINVAL;
@@ -577,7 +577,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
addr = NULL;
}else{
- if (msg->msg_namelen < sizeof(struct wan_sockaddr_ll)){
+ if (msg->msg_namelen < sizeof(struct wan_sockaddr_ll)){
return -EINVAL;
}
@@ -592,12 +592,12 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
return -ENXIO;
}
dev_put(dev);
-
+
if (sock->type == SOCK_RAW)
reserve = dev->hard_header_len;
if (len > dev->mtu+reserve){
- return -EMSGSIZE;
+ return -EMSGSIZE;
}
skb = sock_alloc_send_skb(sk, len + LL_RESERVED_SPACE(dev),
@@ -606,7 +606,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
if (skb==NULL){
goto out_unlock;
}
-
+
skb_reserve(skb, LL_RESERVED_SPACE(dev));
skb->nh.raw = skb->data;
@@ -645,7 +645,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
if (!(test_and_set_bit(0, &wp->timer)))
mod_timer(&wp->tx_timer, jiffies + 1);
-
+
return(len);
out_free:
@@ -658,12 +658,12 @@ out_unlock:
* wanpipe_delayed_tarnsmit
*
* Transmit bottom half handler. It dequeues packets
- * from sk->sk_write_queue and passes them to the
- * driver. If the driver is busy, the packet is
- * re-enqueued.
+ * from sk->sk_write_queue and passes them to the
+ * driver. If the driver is busy, the packet is
+ * re-enqueued.
*
* Packet Sent counter is decremented on successful
- * transmission.
+ * transmission.
*===========================================================*/
@@ -680,17 +680,17 @@ static void wanpipe_delayed_transmit (unsigned long data)
DBG_PRINTK(KERN_INFO "wansock: Transmit delay, no dev or card\n");
return;
}
-
+
if (sk->sk_state != WANSOCK_CONNECTED || !sock_flag(sk, SOCK_ZAPPED)) {
clear_bit(0, &wp->timer);
DBG_PRINTK(KERN_INFO "wansock: Tx Timer, State not CONNECTED\n");
return;
}
-
+
/* If driver is executing command, we must offload
- * the board by not sending data. Otherwise a
- * pending command will never get a free buffer
- * to execute */
+ * the board by not sending data. Otherwise a
+ * pending command will never get a free buffer
+ * to execute */
if (atomic_read(&card->u.x.command_busy)){
wp->tx_timer.expires = jiffies + SLOW_BACKOFF;
add_timer(&wp->tx_timer);
@@ -698,30 +698,30 @@ static void wanpipe_delayed_transmit (unsigned long data)
return;
}
-
+
if (test_and_set_bit(0,&wanpipe_tx_critical)){
printk(KERN_INFO "WanSock: Tx timer critical %s\n",dev->name);
wp->tx_timer.expires = jiffies + SLOW_BACKOFF;
add_timer(&wp->tx_timer);
return;
- }
-
+ }
+
/* Check for a packet in the fifo and send */
if ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL){
- if (dev->hard_start_xmit(skb, dev) != 0){
+ if (dev->hard_start_xmit(skb, dev) != 0){
/* Driver failed to transmit, re-enqueue
- * the packet and retry again later */
+ * the packet and retry again later */
skb_queue_head(&sk->sk_write_queue,skb);
clear_bit(0,&wanpipe_tx_critical);
return;
}else{
/* Packet Sent successful. Check for more packets
- * if more packets, re-trigger the transmit routine
- * other wise exit
- */
+ * if more packets, re-trigger the transmit routine
+ * other wise exit
+ */
atomic_dec(&wp->packet_sent);
if (skb_peek(&sk->sk_write_queue) == NULL) {
@@ -741,18 +741,18 @@ static void wanpipe_delayed_transmit (unsigned long data)
}
/*============================================================
- * execute_command
+ * execute_command
*
* Execute x25api commands. The atomic variable
* chan->command is used to indicate to the driver that
* command is pending for execution. The acutal command
- * structure is placed into a sock mbox structure
+ * structure is placed into a sock mbox structure
* (wp_sk(sk)->mbox).
*
* The sock private structure, mbox is
* used as shared memory between sock and the driver.
* Driver uses the sock mbox to execute the command
- * and return the result.
+ * and return the result.
*
* For all command except PLACE CALL, the function
* waits for the result. PLACE CALL can be ether
@@ -768,7 +768,7 @@ static int execute_command(struct sock *sk, unsigned char cmd, unsigned int fla
wanpipe_common_t *chan=NULL;
int err=0;
DECLARE_WAITQUEUE(wait, current);
-
+
dev = dev_get_by_index(sk->sk_bound_dev_if);
if (dev == NULL){
printk(KERN_INFO "wansock: Exec failed no dev %i\n",
@@ -793,7 +793,7 @@ static int execute_command(struct sock *sk, unsigned char cmd, unsigned int fla
return -EINVAL;
}
- ((mbox_cmd_t*)wp->mbox)->cmd.command = cmd;
+ ((mbox_cmd_t*)wp->mbox)->cmd.command = cmd;
((mbox_cmd_t*)wp->mbox)->cmd.lcn = wp->lcn;
((mbox_cmd_t*)wp->mbox)->cmd.result = 0x7F;
@@ -820,12 +820,12 @@ static int execute_command(struct sock *sk, unsigned char cmd, unsigned int fla
}
current->state = TASK_RUNNING;
remove_wait_queue(sk->sk_sleep,&wait);
-
+
return err;
}
/*============================================================
- * wanpipe_destroy_timer
+ * wanpipe_destroy_timer
*
* Used by wanpipe_release, to delay release of
* the socket.
@@ -846,7 +846,7 @@ static void wanpipe_destroy_timer(unsigned long data)
kfree(wp);
wp_sk(sk) = NULL;
-
+
if (atomic_read(&sk->sk_refcnt) != 1) {
atomic_set(&sk->sk_refcnt, 1);
DBG_PRINTK(KERN_INFO "wansock: Error, wrong reference count: %i ! :delay.\n",
@@ -865,9 +865,9 @@ static void wanpipe_destroy_timer(unsigned long data)
/*============================================================
* wanpipe_unlink_driver
*
- * When the socket is released, this function is
+ * When the socket is released, this function is
* used to remove links that bind the sock and the
- * driver together.
+ * driver together.
*===========================================================*/
static void wanpipe_unlink_driver (struct sock *sk)
{
@@ -882,7 +882,7 @@ static void wanpipe_unlink_driver (struct sock *sk)
if (!dev){
printk(KERN_INFO "wansock: No dev on release\n");
return;
- }
+ }
dev_put(dev);
if ((chan = dev->priv) == NULL){
@@ -897,7 +897,7 @@ static void wanpipe_unlink_driver (struct sock *sk)
chan->tx_timer=NULL;
clear_bit(0,&chan->common_critical);
release_device(dev);
-
+
return;
}
@@ -931,7 +931,7 @@ static void wanpipe_link_driver(struct net_device *dev, struct sock *sk)
/*============================================================
* release_device
*
- * During sock release, clear a critical bit, which
+ * During sock release, clear a critical bit, which
* marks the device a being taken.
*===========================================================*/
@@ -945,8 +945,8 @@ static void release_device(struct net_device *dev)
/*============================================================
* wanpipe_release
*
- * Close a PACKET socket. This is fairly simple. We
- * immediately go to 'closed' state and remove our
+ * Close a PACKET socket. This is fairly simple. We
+ * immediately go to 'closed' state and remove our
* protocol entry in the device list.
*===========================================================*/
@@ -954,7 +954,7 @@ static int wanpipe_release(struct socket *sock)
{
wanpipe_opt *wp;
struct sock *sk = sock->sk;
-
+
if (!sk)
return 0;
@@ -962,9 +962,9 @@ static int wanpipe_release(struct socket *sock)
check_write_queue(sk);
/* Kill the tx timer, if we don't kill it now, the timer
- * will run after we kill the sock. Timer code will
- * try to access the sock which has been killed and cause
- * kernel panic */
+ * will run after we kill the sock. Timer code will
+ * try to access the sock which has been killed and cause
+ * kernel panic */
del_timer(&wp->tx_timer);
@@ -982,7 +982,7 @@ static int wanpipe_release(struct socket *sock)
DBG_PRINTK(KERN_INFO "wansock: Sending Clear Indication %i\n",
sk->sk_state);
dev_put(dev);
- }
+ }
}
set_bit(1,&wanpipe_tx_critical);
@@ -992,10 +992,10 @@ static int wanpipe_release(struct socket *sock)
clear_bit(1,&wanpipe_tx_critical);
-
+
release_driver(sk);
-
+
/*
* Now the socket is dead. No more input will appear.
*/
@@ -1040,9 +1040,9 @@ static int wanpipe_release(struct socket *sock)
/*============================================================
* check_write_queue
*
- * During sock shutdown, if the sock state is
- * WANSOCK_CONNECTED and there is transmit data
- * pending. Wait until data is released
+ * During sock shutdown, if the sock state is
+ * WANSOCK_CONNECTED and there is transmit data
+ * pending. Wait until data is released
* before proceeding.
*===========================================================*/
@@ -1062,7 +1062,7 @@ static void check_write_queue(struct sock *sk)
/*============================================================
* release_driver
*
- * This function is called during sock shutdown, to
+ * This function is called during sock shutdown, to
* release any resources and links that bind the sock
* to the driver. It also changes the state of the
* sock to WANSOCK_DISCONNECTED
@@ -1105,7 +1105,7 @@ static void release_driver(struct sock *sk)
* start_cleanup_timer
*
* If new incoming call's are pending but the socket
- * is being released, start the timer which will
+ * is being released, start the timer which will
* envoke the kill routines for pending socks.
*===========================================================*/
@@ -1125,7 +1125,7 @@ static void start_cleanup_timer (struct sock *sk)
*
* This is a function which performs actual killing
* of the sock. It releases socket resources,
- * and unlinks the sock from the driver.
+ * and unlinks the sock from the driver.
*===========================================================*/
static void wanpipe_kill_sock_timer (unsigned long data)
@@ -1139,13 +1139,13 @@ static void wanpipe_kill_sock_timer (unsigned long data)
/* This function can be called from interrupt. We must use
* appropriate locks */
-
+
if (test_bit(1,&wanpipe_tx_critical)){
sk->sk_timer.expires = jiffies + 10;
add_timer(&sk->sk_timer);
return;
}
-
+
write_lock(&wanpipe_sklist_lock);
sk_del_node_init(sk);
write_unlock(&wanpipe_sklist_lock);
@@ -1159,7 +1159,7 @@ static void wanpipe_kill_sock_timer (unsigned long data)
chan=dev->priv;
atomic_set(&chan->disconnect,1);
dev_put(dev);
- }
+ }
}
release_driver(sk);
@@ -1170,7 +1170,7 @@ static void wanpipe_kill_sock_timer (unsigned long data)
skb_queue_purge(&sk->sk_receive_queue);
skb_queue_purge(&sk->sk_write_queue);
skb_queue_purge(&sk->sk_error_queue);
-
+
if (atomic_read(&sk->sk_rmem_alloc) ||
atomic_read(&sk->sk_wmem_alloc)) {
del_timer(&sk->sk_timer);
@@ -1205,7 +1205,7 @@ static void wanpipe_kill_sock_accept (struct sock *sk)
/* This function can be called from interrupt. We must use
* appropriate locks */
-
+
write_lock(&wanpipe_sklist_lock);
sk_del_node_init(sk);
write_unlock(&wanpipe_sklist_lock);
@@ -1282,10 +1282,10 @@ static int wanpipe_do_bind(struct sock *sk, struct net_device *dev,
chan=dev->priv;
sk->sk_state = chan->state;
- if (wp->num == htons(X25_PROT) &&
- sk->sk_state != WANSOCK_DISCONNECTED &&
+ if (wp->num == htons(X25_PROT) &&
+ sk->sk_state != WANSOCK_DISCONNECTED &&
sk->sk_state != WANSOCK_CONNECTING) {
- DBG_PRINTK(KERN_INFO
+ DBG_PRINTK(KERN_INFO
"wansock: Binding to Device not DISCONNECTED %i\n",
sk->sk_state);
release_device(dev);
@@ -1338,7 +1338,7 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
/*
* Check legality
*/
-
+
if (addr_len < sizeof(struct wan_sockaddr_ll)){
printk(KERN_INFO "wansock: Address length error\n");
return -EINVAL;
@@ -1358,12 +1358,12 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
if (!strcmp(sll->sll_device,"svc_listen")){
- /* Bind a sock to a card structure for listening
- */
- int err=0;
+ /* Bind a sock to a card structure for listening
+ */
+ int err=0;
/* This is x25 specific area if protocol doesn't
- * match, return error */
+ * match, return error */
if (sll->sll_protocol != htons(X25_PROT))
return -EINVAL;
@@ -1376,14 +1376,14 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
sk->sk_state = WANSOCK_BIND_LISTEN;
return 0;
- }else if (!strcmp(sll->sll_device,"svc_connect")){
+ }else if (!strcmp(sll->sll_device,"svc_connect")){
/* This is x25 specific area if protocol doesn't
- * match, return error */
+ * match, return error */
if (sll->sll_protocol != htons(X25_PROT))
return -EINVAL;
- /* Find a free device
+ /* Find a free device
*/
dev = wanpipe_find_free_dev(card);
if (dev == NULL){
@@ -1392,9 +1392,9 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
return -EINVAL;
}
}else{
- /* Bind a socket to a interface name
- * This is used by PVC mostly
- */
+ /* Bind a socket to a interface name
+ * This is used by PVC mostly
+ */
strlcpy(name,sll->sll_device,sizeof(name));
dev = dev_get_by_name(name);
if (dev == NULL){
@@ -1419,8 +1419,8 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
/*============================================================
* get_atomic_device
- *
- * Sets a bit atomically which indicates that
+ *
+ * Sets a bit atomically which indicates that
* the interface is taken. This avoids race conditions.
*===========================================================*/
@@ -1436,7 +1436,7 @@ static inline int get_atomic_device(struct net_device *dev)
/*============================================================
* check_dev
- *
+ *
* Check that device name belongs to a particular card.
*===========================================================*/
@@ -1446,8 +1446,8 @@ static int check_dev(struct net_device *dev, sdla_t *card)
for (tmp_dev = card->wandev.dev; tmp_dev;
tmp_dev = *((struct net_device **)tmp_dev->priv)) {
- if (tmp_dev->ifindex == dev->ifindex){
- return 0;
+ if (tmp_dev->ifindex == dev->ifindex){
+ return 0;
}
}
return 1;
@@ -1455,7 +1455,7 @@ static int check_dev(struct net_device *dev, sdla_t *card)
/*============================================================
* wanpipe_find_free_dev
- *
+ *
* Find a free network interface. If found set atomic
* bit indicating that the interface is taken.
* X25API Specific.
@@ -1468,12 +1468,12 @@ struct net_device *wanpipe_find_free_dev(sdla_t *card)
if (test_and_set_bit(0,&find_free_critical)){
printk(KERN_INFO "CRITICAL in Find Free\n");
- }
+ }
for (dev = card->wandev.dev; dev;
dev = *((struct net_device **)dev->priv)) {
chan = dev->priv;
- if (!chan)
+ if (!chan)
continue;
if (chan->usedby == API && chan->svc){
if (!get_atomic_device (dev)){
@@ -1492,16 +1492,16 @@ struct net_device *wanpipe_find_free_dev(sdla_t *card)
/*============================================================
* wanpipe_create
- *
+ *
* SOCKET() System call. It allocates a sock structure
- * and adds the socket to the wanpipe_sk_list.
+ * and adds the socket to the wanpipe_sk_list.
* Crates AF_WANPIPE socket.
*===========================================================*/
static int wanpipe_create(struct socket *sock, int protocol)
{
struct sock *sk;
-
+
//FIXME: This checks for root user, SECURITY ?
//if (!capable(CAP_NET_RAW))
// return -EPERM;
@@ -1526,7 +1526,7 @@ static int wanpipe_create(struct socket *sock, int protocol)
sk->sk_bound_dev_if = 0;
atomic_inc(&wanpipe_socks_nr);
-
+
/* We must disable interrupts because the ISR
* can also change the list */
set_bit(1,&wanpipe_tx_critical);
@@ -1541,8 +1541,8 @@ static int wanpipe_create(struct socket *sock, int protocol)
/*============================================================
* wanpipe_recvmsg
- *
- * Pull a packet from our receive queue and hand it
+ *
+ * Pull a packet from our receive queue and hand it
* to the user. If necessary we block.
*===========================================================*/
@@ -1570,13 +1570,13 @@ static int wanpipe_recvmsg(struct kiocb *iocb, struct socket *sock,
* but then it will block.
*/
- if (flags & MSG_OOB){
+ if (flags & MSG_OOB){
skb = skb_dequeue(&sk->sk_error_queue);
}else{
skb=skb_recv_datagram(sk,flags,1,&err);
}
/*
- * An error occurred so return it. Because skb_recv_datagram()
+ * An error occurred so return it. Because skb_recv_datagram()
* handles the blocking we don't see and worry about blocking
* retries.
*/
@@ -1602,9 +1602,9 @@ static int wanpipe_recvmsg(struct kiocb *iocb, struct socket *sock,
err = memcpy_toiovec(msg->msg_iov, skb->data, copied);
if (err)
goto out_free;
-
+
sock_recv_timestamp(msg, sk, skb);
-
+
if (msg->msg_name)
memcpy(msg->msg_name, skb->cb, msg->msg_namelen);
@@ -1623,13 +1623,13 @@ out:
/*============================================================
* wanpipe_wakeup_driver
- *
+ *
* If socket receive buffer is full and driver cannot
* pass data up the sock, it sets a packet_block flag.
- * This function check that flag and if sock receive
- * queue has room it kicks the driver BH handler.
+ * This function check that flag and if sock receive
+ * queue has room it kicks the driver BH handler.
*
- * This way, driver doesn't have to poll the sock
+ * This way, driver doesn't have to poll the sock
* receive queue.
*===========================================================*/
@@ -1646,8 +1646,8 @@ static void wanpipe_wakeup_driver(struct sock *sk)
if ((chan = dev->priv) == NULL)
return;
-
- if (atomic_read(&chan->receive_block)){
+
+ if (atomic_read(&chan->receive_block)){
if (atomic_read(&sk->sk_rmem_alloc) <
((unsigned)sk->sk_rcvbuf * 0.9)) {
printk(KERN_INFO "wansock: Queuing task for wanpipe\n");
@@ -1655,13 +1655,13 @@ static void wanpipe_wakeup_driver(struct sock *sk)
wanpipe_queue_tq(&chan->wanpipe_task);
wanpipe_mark_bh();
}
- }
-}
+ }
+}
/*============================================================
* wanpipe_getname
- *
- * I don't know what to do with this yet.
+ *
+ * I don't know what to do with this yet.
* User can use this function to get sock address
* information. Not very useful for Sangoma's purposes.
*===========================================================*/
@@ -1687,17 +1687,17 @@ static int wanpipe_getname(struct socket *sock, struct sockaddr *uaddr,
sll->sll_halen = 0;
}
*uaddr_len = sizeof(*sll);
-
+
dev_put(dev);
-
+
return 0;
}
/*============================================================
* wanpipe_notifier
- *
+ *
* If driver turns off network interface, this function
- * will be envoked. Currently I treate it as a
+ * will be envoked. Currently I treate it as a
* call disconnect. More thought should go into this
* function.
*
@@ -1718,7 +1718,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void
continue;
if (dev == NULL)
continue;
-
+
switch (msg) {
case NETDEV_DOWN:
case NETDEV_UNREGISTER:
@@ -1732,7 +1732,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void
if (msg == NETDEV_UNREGISTER) {
printk(KERN_INFO "wansock: Unregistering Device: %s\n",
- dev->name);
+ dev->name);
wanpipe_unlink_driver(sk);
sk->sk_bound_dev_if = 0;
}
@@ -1753,7 +1753,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void
/*============================================================
* wanpipe_ioctl
- *
+ *
* Execute a user commands, and set socket options.
*
* FIXME: More thought should go into this function.
@@ -1765,7 +1765,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar
struct sock *sk = sock->sk;
int err;
- switch(cmd)
+ switch(cmd)
{
case SIOCGSTAMP:
return sock_get_timestamp(sk, (struct timeval __user *)arg);
@@ -1778,7 +1778,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar
if (sk->sk_state == WANSOCK_CONNECTED)
return 0;
-
+
return 1;
@@ -1804,7 +1804,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar
case SIOC_WANPIPE_DEBUG:
return wanpipe_debug(sk,(void*)arg);
-
+
case SIOC_WANPIPE_SET_NONBLOCK:
if (sk->sk_state != WANSOCK_DISCONNECTED)
@@ -1812,7 +1812,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar
sock->file->f_flags |= O_NONBLOCK;
return 0;
-
+
#ifdef CONFIG_INET
case SIOCADDRT:
case SIOCDELRT:
@@ -1842,7 +1842,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar
/*============================================================
* wanpipe_debug
- *
+ *
* This function will pass up information about all
* active sockets.
*
@@ -1893,49 +1893,49 @@ static int wanpipe_debug (struct sock *origsk, void *arg)
if (sk->sk_bound_dev_if) {
dev = dev_get_by_index(sk->sk_bound_dev_if);
- if (!dev)
+ if (!dev)
continue;
chan=dev->priv;
dev_put(dev);
-
+
if ((err=put_user(chan->state, &dbg_data->debug[cnt].d_state)))
return err;
if ((err=put_user(chan->svc, &dbg_data->debug[cnt].svc)))
return err;
- if ((err=put_user(atomic_read(&chan->command),
+ if ((err=put_user(atomic_read(&chan->command),
&dbg_data->debug[cnt].command)))
return err;
if (wp){
- sdla_t *card = (sdla_t*)wp->card;
-
+ sdla_t *card = (sdla_t*)wp->card;
+
if (card){
- if ((err=put_user(atomic_read(&card->u.x.command_busy),
+ if ((err=put_user(atomic_read(&card->u.x.command_busy),
&dbg_data->debug[cnt].cmd_busy)))
return err;
}
- if ((err=put_user(wp->lcn,
+ if ((err=put_user(wp->lcn,
&dbg_data->debug[cnt].lcn)))
return err;
-
+
if (wp->mbox) {
if ((err=put_user(1, &dbg_data->debug[cnt].mbox)))
return err;
}
}
- if ((err=put_user(atomic_read(&chan->receive_block),
+ if ((err=put_user(atomic_read(&chan->receive_block),
&dbg_data->debug[cnt].rblock)))
return err;
if (copy_to_user(dbg_data->debug[cnt].name, dev->name, strlen(dev->name)))
return -EFAULT;
}
-
+
if (++cnt == MAX_NUM_DEBUG)
break;
}
@@ -1944,7 +1944,7 @@ static int wanpipe_debug (struct sock *origsk, void *arg)
/*============================================================
* get_ioctl_cmd
- *
+ *
* Pass up the contents of socket MBOX to the user.
*===========================================================*/
@@ -1974,7 +1974,7 @@ static int get_ioctl_cmd (struct sock *sk, void *arg)
if ((err=put_user(mbox_ptr->cmd.result, &usr_data->hdr.result)))
return err;
if ((err=put_user(mbox_ptr->cmd.lcn, &usr_data->hdr.lcn)))
- return err;
+ return err;
if (mbox_ptr->cmd.length > 0){
if (mbox_ptr->cmd.length > X25_MAX_DATA)
@@ -1986,13 +1986,13 @@ static int get_ioctl_cmd (struct sock *sk, void *arg)
}
}
return 0;
-}
+}
/*============================================================
* set_ioctl_cmd
- *
+ *
* Before command can be execute, socket MBOX must
- * be created, and initialized with user data.
+ * be created, and initialized with user data.
*===========================================================*/
static int set_ioctl_cmd (struct sock *sk, void *arg)
@@ -2008,7 +2008,7 @@ static int set_ioctl_cmd (struct sock *sk, void *arg)
return -ENODEV;
dev_put(dev);
-
+
if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL)
return -ENOMEM;
@@ -2092,12 +2092,12 @@ unsigned int wanpipe_poll(struct file * file, struct socket *sock, poll_table *w
return mask;
}
- /* This check blocks the user process if there is
+ /* This check blocks the user process if there is
* a packet already queued in the socket write queue.
- * This option is only for X25API protocol, for other
- * protocol like chdlc enable streaming mode,
- * where multiple packets can be pending in the socket
- * transmit queue */
+ * This option is only for X25API protocol, for other
+ * protocol like chdlc enable streaming mode,
+ * where multiple packets can be pending in the socket
+ * transmit queue */
if (wp_sk(sk)->num == htons(X25_PROT)) {
if (atomic_read(&wp_sk(sk)->packet_sent))
@@ -2110,7 +2110,7 @@ unsigned int wanpipe_poll(struct file * file, struct socket *sock, poll_table *w
}else{
set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
}
-
+
return mask;
}
@@ -2125,8 +2125,8 @@ static int wanpipe_listen(struct socket *sock, int backlog)
{
struct sock *sk = sock->sk;
- /* This is x25 specific area if protocol doesn't
- * match, return error */
+ /* This is x25 specific area if protocol doesn't
+ * match, return error */
if (wp_sk(sk)->num != htons(X25_PROT))
return -EINVAL;
@@ -2163,7 +2163,7 @@ static int wanpipe_link_card (struct sock *sk)
card->sk=sk;
card->func=wanpipe_listen_rcv;
sock_set_flag(sk, SOCK_ZAPPED);
-
+
return 0;
}
@@ -2176,7 +2176,7 @@ static int wanpipe_link_card (struct sock *sk)
static void wanpipe_unlink_card (struct sock *sk)
{
- sdla_t *card = (sdla_t*)wp_sk(sk)->card;
+ sdla_t *card = (sdla_t*)wp_sk(sk)->card;
if (card){
card->sk=NULL;
@@ -2202,9 +2202,9 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
printk(KERN_INFO "NO MBOX PTR !!!!!\n");
return -EINVAL;
}
-
+
/* This is x25 specific area if protocol doesn't
- * match, return error */
+ * match, return error */
if (wp->num != htons(X25_PROT))
return -EINVAL;
@@ -2217,17 +2217,17 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
err = -EHOSTDOWN;
break;
}
-
+
err = execute_command(sk,X25_ACCEPT_CALL,0);
if (err < 0)
break;
- /* Update. Mar6 2000.
- * Do not set the sock lcn number here, since
- * it is done in wanpipe_listen_rcv().
- */
- if (sk->sk_state == WANSOCK_CONNECTED) {
- wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn;
+ /* Update. Mar6 2000.
+ * Do not set the sock lcn number here, since
+ * it is done in wanpipe_listen_rcv().
+ */
+ if (sk->sk_state == WANSOCK_CONNECTED) {
+ wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn;
DBG_PRINTK(KERN_INFO "\nwansock: Accept OK %i\n",
wp->lcn);
err = 0;
@@ -2249,15 +2249,15 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
/* Check if data buffers are pending for transmission,
- * if so, check whether user wants to wait until data
- * is transmitted, or clear a call and drop packets */
-
+ * if so, check whether user wants to wait until data
+ * is transmitted, or clear a call and drop packets */
+
if (atomic_read(&sk->sk_wmem_alloc) ||
check_driver_busy(sk)) {
- mbox_cmd_t *mbox = wp->mbox;
+ mbox_cmd_t *mbox = wp->mbox;
if (mbox->cmd.qdm & 0x80){
mbox->cmd.result = 0x35;
- err = -EAGAIN;
+ err = -EAGAIN;
break;
}
}
@@ -2286,15 +2286,15 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
/* Check if data buffers are pending for transmission,
- * if so, check whether user wants to wait until data
- * is transmitted, or reset a call and drop packets */
-
+ * if so, check whether user wants to wait until data
+ * is transmitted, or reset a call and drop packets */
+
if (atomic_read(&sk->sk_wmem_alloc) ||
check_driver_busy(sk)) {
- mbox_cmd_t *mbox = wp->mbox;
+ mbox_cmd_t *mbox = wp->mbox;
if (mbox->cmd.qdm & 0x80){
mbox->cmd.result = 0x35;
- err = -EAGAIN;
+ err = -EAGAIN;
break;
}
}
@@ -2316,7 +2316,7 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
if (sk->sk_state == WANSOCK_CONNECTED) {
- wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn;
+ wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn;
DBG_PRINTK(KERN_INFO "\nwansock: PLACE CALL OK %i\n",
wp->lcn);
@@ -2337,7 +2337,7 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags)
break;
- default:
+ default:
return -EINVAL;
}
@@ -2364,9 +2364,9 @@ static int check_driver_busy (struct sock *sk)
/*======================================================================
* wanpipe_accept
*
- * ACCEPT() System call. X25API Specific function.
- * For each incoming call, create a new socket and
- * return it to the user.
+ * ACCEPT() System call. X25API Specific function.
+ * For each incoming call, create a new socket and
+ * return it to the user.
*=====================================================================*/
static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags)
@@ -2378,10 +2378,10 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags
int err=0;
if (newsock->sk != NULL){
- wanpipe_kill_sock_accept(newsock->sk);
+ wanpipe_kill_sock_accept(newsock->sk);
newsock->sk=NULL;
}
-
+
if ((sk = sock->sk) == NULL)
return -EINVAL;
@@ -2410,10 +2410,10 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags
}
current->state = TASK_RUNNING;
remove_wait_queue(sk->sk_sleep,&wait);
-
+
if (err != 0)
return err;
-
+
newsk = get_newsk_from_skb(skb);
if (!newsk){
return -EINVAL;
@@ -2431,7 +2431,7 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags
/* Now attach up the new socket */
sk->sk_ack_backlog--;
newsock->sk = newsk;
-
+
kfree_skb(skb);
DBG_PRINTK(KERN_INFO "\nwansock: ACCEPT Got LCN %i\n",
@@ -2449,16 +2449,16 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags
struct sock * get_newsk_from_skb (struct sk_buff *skb)
{
struct net_device *dev = skb->dev;
- wanpipe_common_t *chan;
+ wanpipe_common_t *chan;
if (!dev){
return NULL;
}
-
+
if ((chan = dev->priv) == NULL){
return NULL;
}
-
+
if (!chan->sk){
return NULL;
}
@@ -2470,7 +2470,7 @@ struct sock * get_newsk_from_skb (struct sk_buff *skb)
*
* CONNECT() System Call. X25API specific function
* Check the state of the sock, and execute PLACE_CALL command.
- * Connect can ether block or return without waiting for connection,
+ * Connect can ether block or return without waiting for connection,
* if specified by user.
*=====================================================================*/
@@ -2492,7 +2492,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr
return -ECONNREFUSED;
}
- sk->sk_state = WANSOCK_DISCONNECTED;
+ sk->sk_state = WANSOCK_DISCONNECTED;
sock->state = SS_UNCONNECTED;
if (addr_len != sizeof(struct wan_sockaddr_ll))
@@ -2505,7 +2505,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr
return -ENETUNREACH;
dev_put(dev);
-
+
if (!sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */
return -EINVAL;
@@ -2534,7 +2534,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr
if (sk->sk_state != WANSOCK_CONNECTED) {
sock->state = SS_UNCONNECTED;
- return -ECONNREFUSED;
+ return -ECONNREFUSED;
}
sock->state = SS_CONNECTED;
@@ -2549,10 +2549,10 @@ const struct proto_ops wanpipe_ops = {
.connect = wanpipe_connect,
.socketpair = sock_no_socketpair,
.accept = wanpipe_accept,
- .getname = wanpipe_getname,
+ .getname = wanpipe_getname,
.poll = wanpipe_poll,
.ioctl = wanpipe_ioctl,
- .listen = wanpipe_listen,
+ .listen = wanpipe_listen,
.shutdown = sock_no_shutdown,
.setsockopt = sock_no_setsockopt,
.getsockopt = sock_no_getsockopt,
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 4d90a179aed..5d2d93dc083 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -314,10 +314,10 @@ __be16 wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev)
cnt += 1;
break;
- case NLPID_SNAP: /* SNAP encapsulation */
+ case NLPID_SNAP: /* SNAP encapsulation */
if (memcmp(&skb->data[cnt + 1], wanrouter_oui_ether,
sizeof(wanrouter_oui_ether))){
- printk(KERN_INFO
+ printk(KERN_INFO
"%s: unsupported SNAP OUI %02X-%02X-%02X "
"on interface %s!\n", wanrouter_modname,
skb->data[cnt+1], skb->data[cnt+2],
@@ -450,7 +450,7 @@ static int wanrouter_device_setup(struct wan_device *wandev,
kfree(conf);
printk(KERN_INFO "%s: ERROR, Invalid MAGIC Number\n",
wandev->name);
- return -EINVAL;
+ return -EINVAL;
}
if (conf->data_size && conf->data) {
@@ -459,13 +459,13 @@ static int wanrouter_device_setup(struct wan_device *wandev,
"%s: ERROR, Invalid firmware data size %i !\n",
wandev->name, conf->data_size);
kfree(conf);
- return -EINVAL;
+ return -EINVAL;
}
data = vmalloc(conf->data_size);
if (!data) {
printk(KERN_INFO
- "%s: ERROR, Faild allocate kernel memory !\n",
+ "%s: ERROR, Faild allocate kernel memory !\n",
wandev->name);
kfree(conf);
return -ENOBUFS;
@@ -686,7 +686,7 @@ out:
static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_name)
{
char name[WAN_IFNAME_SZ + 1];
- int err = 0;
+ int err = 0;
if (wandev->state == WAN_UNCONFIGURED)
return -ENODEV;
@@ -709,8 +709,8 @@ static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_nam
* interfaces are deleted and the link irrecoverably disconnected.
*/
- if (!wandev->ndev && wandev->shutdown)
- err = wandev->shutdown(wandev);
+ if (!wandev->ndev && wandev->shutdown)
+ err = wandev->shutdown(wandev);
return err;
}
@@ -804,7 +804,7 @@ static int wanrouter_delete_interface(struct wan_device *wandev, char *name)
static void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags)
{
- spin_lock_irqsave(lock, *smp_flags);
+ spin_lock_irqsave(lock, *smp_flags);
}
diff --git a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c
index 930ea59463a..abce8287360 100644
--- a/net/wanrouter/wanproc.c
+++ b/net/wanrouter/wanproc.c
@@ -37,10 +37,10 @@
#define PROT_DECODE(prot) ((prot == WANCONFIG_FR) ? " FR" :\
(prot == WANCONFIG_X25) ? " X25" : \
- (prot == WANCONFIG_PPP) ? " PPP" : \
+ (prot == WANCONFIG_PPP) ? " PPP" : \
(prot == WANCONFIG_CHDLC) ? " CHDLC": \
(prot == WANCONFIG_MPPP) ? " MPPP" : \
- " Unknown" )
+ " Unknown" )
/****** Function Prototypes *************************************************/