diff options
Diffstat (limited to 'net/decnet/dn_nsp_in.c')
-rw-r--r-- | net/decnet/dn_nsp_in.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c index 39a6cf7fb566..0f244e81a377 100644 --- a/net/decnet/dn_nsp_in.c +++ b/net/decnet/dn_nsp_in.c | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | /****************************************************************************** | 34 | /****************************************************************************** |
35 | (c) 1995-1998 E.M. Serrat emserrat@geocities.com | 35 | (c) 1995-1998 E.M. Serrat emserrat@geocities.com |
36 | 36 | ||
37 | This program is free software; you can redistribute it and/or modify | 37 | This program is free software; you can redistribute it and/or modify |
38 | it under the terms of the GNU General Public License as published by | 38 | it under the terms of the GNU General Public License as published by |
39 | the Free Software Foundation; either version 2 of the License, or | 39 | the Free Software Foundation; either version 2 of the License, or |
@@ -63,7 +63,7 @@ | |||
63 | #include <asm/system.h> | 63 | #include <asm/system.h> |
64 | #include <linux/fcntl.h> | 64 | #include <linux/fcntl.h> |
65 | #include <linux/mm.h> | 65 | #include <linux/mm.h> |
66 | #include <linux/termios.h> | 66 | #include <linux/termios.h> |
67 | #include <linux/interrupt.h> | 67 | #include <linux/interrupt.h> |
68 | #include <linux/proc_fs.h> | 68 | #include <linux/proc_fs.h> |
69 | #include <linux/stat.h> | 69 | #include <linux/stat.h> |
@@ -139,7 +139,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth) | |||
139 | ptr++; | 139 | ptr++; |
140 | len += 2; | 140 | len += 2; |
141 | if ((ack & 0x4000) == 0) { | 141 | if ((ack & 0x4000) == 0) { |
142 | if (oth) | 142 | if (oth) |
143 | ack ^= 0x2000; | 143 | ack ^= 0x2000; |
144 | dn_ack(sk, skb, ack); | 144 | dn_ack(sk, skb, ack); |
145 | } | 145 | } |
@@ -152,7 +152,7 @@ static int dn_process_ack(struct sock *sk, struct sk_buff *skb, int oth) | |||
152 | skb_pull(skb, 2); | 152 | skb_pull(skb, 2); |
153 | len += 2; | 153 | len += 2; |
154 | if ((ack & 0x4000) == 0) { | 154 | if ((ack & 0x4000) == 0) { |
155 | if (oth) | 155 | if (oth) |
156 | ack ^= 0x2000; | 156 | ack ^= 0x2000; |
157 | dn_ack(sk, skb, ack); | 157 | dn_ack(sk, skb, ack); |
158 | } | 158 | } |
@@ -349,9 +349,9 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb) | |||
349 | 349 | ||
350 | if ((scp->state == DN_CI) || (scp->state == DN_CD)) { | 350 | if ((scp->state == DN_CI) || (scp->state == DN_CD)) { |
351 | scp->persist = 0; | 351 | scp->persist = 0; |
352 | scp->addrrem = cb->src_port; | 352 | scp->addrrem = cb->src_port; |
353 | sk->sk_state = TCP_ESTABLISHED; | 353 | sk->sk_state = TCP_ESTABLISHED; |
354 | scp->state = DN_RUN; | 354 | scp->state = DN_RUN; |
355 | scp->services_rem = cb->services; | 355 | scp->services_rem = cb->services; |
356 | scp->info_rem = cb->info; | 356 | scp->info_rem = cb->info; |
357 | scp->segsize_rem = cb->segsize; | 357 | scp->segsize_rem = cb->segsize; |
@@ -366,13 +366,13 @@ static void dn_nsp_conn_conf(struct sock *sk, struct sk_buff *skb) | |||
366 | memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen); | 366 | memcpy(scp->conndata_in.opt_data, skb->data + 1, dlen); |
367 | } | 367 | } |
368 | } | 368 | } |
369 | dn_nsp_send_link(sk, DN_NOCHANGE, 0); | 369 | dn_nsp_send_link(sk, DN_NOCHANGE, 0); |
370 | if (!sock_flag(sk, SOCK_DEAD)) | 370 | if (!sock_flag(sk, SOCK_DEAD)) |
371 | sk->sk_state_change(sk); | 371 | sk->sk_state_change(sk); |
372 | } | 372 | } |
373 | 373 | ||
374 | out: | 374 | out: |
375 | kfree_skb(skb); | 375 | kfree_skb(skb); |
376 | } | 376 | } |
377 | 377 | ||
378 | static void dn_nsp_conn_ack(struct sock *sk, struct sk_buff *skb) | 378 | static void dn_nsp_conn_ack(struct sock *sk, struct sk_buff *skb) |
@@ -435,7 +435,7 @@ static void dn_nsp_disc_init(struct sock *sk, struct sk_buff *skb) | |||
435 | sk->sk_state_change(sk); | 435 | sk->sk_state_change(sk); |
436 | } | 436 | } |
437 | 437 | ||
438 | /* | 438 | /* |
439 | * It appears that its possible for remote machines to send disc | 439 | * It appears that its possible for remote machines to send disc |
440 | * init messages with no port identifier if we are in the CI and | 440 | * init messages with no port identifier if we are in the CI and |
441 | * possibly also the CD state. Obviously we shouldn't reply with | 441 | * possibly also the CD state. Obviously we shouldn't reply with |
@@ -519,7 +519,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) | |||
519 | 519 | ||
520 | /* | 520 | /* |
521 | * Here we ignore erronous packets which should really | 521 | * Here we ignore erronous packets which should really |
522 | * should cause a connection abort. It is not critical | 522 | * should cause a connection abort. It is not critical |
523 | * for now though. | 523 | * for now though. |
524 | */ | 524 | */ |
525 | if (lsflags & 0xf8) | 525 | if (lsflags & 0xf8) |
@@ -530,7 +530,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) | |||
530 | switch(lsflags & 0x04) { /* FCVAL INT */ | 530 | switch(lsflags & 0x04) { /* FCVAL INT */ |
531 | case 0x00: /* Normal Request */ | 531 | case 0x00: /* Normal Request */ |
532 | switch(lsflags & 0x03) { /* FCVAL MOD */ | 532 | switch(lsflags & 0x03) { /* FCVAL MOD */ |
533 | case 0x00: /* Request count */ | 533 | case 0x00: /* Request count */ |
534 | if (fcval < 0) { | 534 | if (fcval < 0) { |
535 | unsigned char p_fcval = -fcval; | 535 | unsigned char p_fcval = -fcval; |
536 | if ((scp->flowrem_dat > p_fcval) && | 536 | if ((scp->flowrem_dat > p_fcval) && |
@@ -541,7 +541,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) | |||
541 | scp->flowrem_dat += fcval; | 541 | scp->flowrem_dat += fcval; |
542 | wake_up = 1; | 542 | wake_up = 1; |
543 | } | 543 | } |
544 | break; | 544 | break; |
545 | case 0x01: /* Stop outgoing data */ | 545 | case 0x01: /* Stop outgoing data */ |
546 | scp->flowrem_sw = DN_DONTSEND; | 546 | scp->flowrem_sw = DN_DONTSEND; |
547 | break; | 547 | break; |
@@ -557,10 +557,10 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) | |||
557 | wake_up = 1; | 557 | wake_up = 1; |
558 | } | 558 | } |
559 | break; | 559 | break; |
560 | } | 560 | } |
561 | if (wake_up && !sock_flag(sk, SOCK_DEAD)) | 561 | if (wake_up && !sock_flag(sk, SOCK_DEAD)) |
562 | sk->sk_state_change(sk); | 562 | sk->sk_state_change(sk); |
563 | } | 563 | } |
564 | 564 | ||
565 | dn_nsp_send_oth_ack(sk); | 565 | dn_nsp_send_oth_ack(sk); |
566 | 566 | ||
@@ -576,38 +576,38 @@ out: | |||
576 | static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue) | 576 | static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue) |
577 | { | 577 | { |
578 | int err; | 578 | int err; |
579 | 579 | ||
580 | /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces | 580 | /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces |
581 | number of warnings when compiling with -W --ANK | 581 | number of warnings when compiling with -W --ANK |
582 | */ | 582 | */ |
583 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | 583 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= |
584 | (unsigned)sk->sk_rcvbuf) { | 584 | (unsigned)sk->sk_rcvbuf) { |
585 | err = -ENOMEM; | 585 | err = -ENOMEM; |
586 | goto out; | 586 | goto out; |
587 | } | 587 | } |
588 | 588 | ||
589 | err = sk_filter(sk, skb); | 589 | err = sk_filter(sk, skb); |
590 | if (err) | 590 | if (err) |
591 | goto out; | 591 | goto out; |
592 | 592 | ||
593 | skb_set_owner_r(skb, sk); | 593 | skb_set_owner_r(skb, sk); |
594 | skb_queue_tail(queue, skb); | 594 | skb_queue_tail(queue, skb); |
595 | 595 | ||
596 | /* This code only runs from BH or BH protected context. | 596 | /* This code only runs from BH or BH protected context. |
597 | * Therefore the plain read_lock is ok here. -DaveM | 597 | * Therefore the plain read_lock is ok here. -DaveM |
598 | */ | 598 | */ |
599 | read_lock(&sk->sk_callback_lock); | 599 | read_lock(&sk->sk_callback_lock); |
600 | if (!sock_flag(sk, SOCK_DEAD)) { | 600 | if (!sock_flag(sk, SOCK_DEAD)) { |
601 | struct socket *sock = sk->sk_socket; | 601 | struct socket *sock = sk->sk_socket; |
602 | wake_up_interruptible(sk->sk_sleep); | 602 | wake_up_interruptible(sk->sk_sleep); |
603 | if (sock && sock->fasync_list && | 603 | if (sock && sock->fasync_list && |
604 | !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags)) | 604 | !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags)) |
605 | __kill_fasync(sock->fasync_list, sig, | 605 | __kill_fasync(sock->fasync_list, sig, |
606 | (sig == SIGURG) ? POLL_PRI : POLL_IN); | 606 | (sig == SIGURG) ? POLL_PRI : POLL_IN); |
607 | } | 607 | } |
608 | read_unlock(&sk->sk_callback_lock); | 608 | read_unlock(&sk->sk_callback_lock); |
609 | out: | 609 | out: |
610 | return err; | 610 | return err; |
611 | } | 611 | } |
612 | 612 | ||
613 | static void dn_nsp_otherdata(struct sock *sk, struct sk_buff *skb) | 613 | static void dn_nsp_otherdata(struct sock *sk, struct sk_buff *skb) |
@@ -652,16 +652,16 @@ static void dn_nsp_data(struct sock *sk, struct sk_buff *skb) | |||
652 | skb_pull(skb, 2); | 652 | skb_pull(skb, 2); |
653 | 653 | ||
654 | if (seq_next(scp->numdat_rcv, segnum)) { | 654 | if (seq_next(scp->numdat_rcv, segnum)) { |
655 | if (dn_queue_skb(sk, skb, SIGIO, &sk->sk_receive_queue) == 0) { | 655 | if (dn_queue_skb(sk, skb, SIGIO, &sk->sk_receive_queue) == 0) { |
656 | seq_add(&scp->numdat_rcv, 1); | 656 | seq_add(&scp->numdat_rcv, 1); |
657 | queued = 1; | 657 | queued = 1; |
658 | } | 658 | } |
659 | 659 | ||
660 | if ((scp->flowloc_sw == DN_SEND) && dn_congested(sk)) { | 660 | if ((scp->flowloc_sw == DN_SEND) && dn_congested(sk)) { |
661 | scp->flowloc_sw = DN_DONTSEND; | 661 | scp->flowloc_sw = DN_DONTSEND; |
662 | dn_nsp_send_link(sk, DN_DONTSEND, 0); | 662 | dn_nsp_send_link(sk, DN_DONTSEND, 0); |
663 | } | 663 | } |
664 | } | 664 | } |
665 | 665 | ||
666 | dn_nsp_send_data_ack(sk); | 666 | dn_nsp_send_data_ack(sk); |
667 | out: | 667 | out: |
@@ -732,7 +732,7 @@ static int dn_nsp_rx_packet(struct sk_buff *skb) | |||
732 | if (decnet_debug_level & 2) | 732 | if (decnet_debug_level & 2) |
733 | printk(KERN_DEBUG "dn_nsp_rx: Message type 0x%02x\n", (int)cb->nsp_flags); | 733 | printk(KERN_DEBUG "dn_nsp_rx: Message type 0x%02x\n", (int)cb->nsp_flags); |
734 | 734 | ||
735 | if (cb->nsp_flags & 0x83) | 735 | if (cb->nsp_flags & 0x83) |
736 | goto free_out; | 736 | goto free_out; |
737 | 737 | ||
738 | /* | 738 | /* |
@@ -852,7 +852,7 @@ int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb) | |||
852 | case 0x30: | 852 | case 0x30: |
853 | dn_nsp_disc_init(sk, skb); | 853 | dn_nsp_disc_init(sk, skb); |
854 | break; | 854 | break; |
855 | case 0x40: | 855 | case 0x40: |
856 | dn_nsp_disc_conf(sk, skb); | 856 | dn_nsp_disc_conf(sk, skb); |
857 | break; | 857 | break; |
858 | } | 858 | } |