we now build smp by default when doing buildup; will just get rid of buildup/buildsmp...
[linux-2.6.git] / net / netrom / nr_in.c
index e272aff..a7d88b5 100644 (file)
@@ -22,8 +22,7 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <net/tcp.h>
-#include <net/ip.h>                    /* For ip_rcv */
+#include <net/tcp_states.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
 #include <linux/fcntl.h>
@@ -34,7 +33,7 @@
 static int nr_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more)
 {
        struct sk_buff *skbo, *skbn = skb;
-       nr_cb *nr = nr_sk(sk);
+       struct nr_sock *nr = nr_sk(sk);
 
        skb_pull(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN);
 
@@ -74,10 +73,9 @@ static int nr_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more)
 static int nr_state1_machine(struct sock *sk, struct sk_buff *skb,
        int frametype)
 {
-       bh_lock_sock(sk);
        switch (frametype) {
        case NR_CONNACK: {
-               nr_cb *nr = nr_sk(sk);
+               struct nr_sock *nr = nr_sk(sk);
 
                nr_stop_t1timer(sk);
                nr_start_idletimer(sk);
@@ -100,11 +98,14 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb,
                nr_disconnect(sk, ECONNREFUSED);
                break;
 
+       case NR_RESET:
+               if (sysctl_netrom_reset_circuit)
+                       nr_disconnect(sk, ECONNRESET);
+               break;
+
        default:
                break;
        }
-       bh_unlock_sock(sk);
-
        return 0;
 }
 
@@ -116,7 +117,6 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb,
 static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,
        int frametype)
 {
-       bh_lock_sock(sk);
        switch (frametype) {
        case NR_CONNACK | NR_CHOKE_FLAG:
                nr_disconnect(sk, ECONNRESET);
@@ -129,11 +129,14 @@ static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,
                nr_disconnect(sk, 0);
                break;
 
+       case NR_RESET:
+               if (sysctl_netrom_reset_circuit)
+                       nr_disconnect(sk, ECONNRESET);
+               break;
+
        default:
                break;
        }
-       bh_unlock_sock(sk);
-
        return 0;
 }
 
@@ -144,7 +147,7 @@ static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,
  */
 static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype)
 {
-       nr_cb *nrom = nr_sk(sk);
+       struct nr_sock *nrom = nr_sk(sk);
        struct sk_buff_head temp_queue;
        struct sk_buff *skbn;
        unsigned short save_vr;
@@ -154,7 +157,6 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype
        nr = skb->data[18];
        ns = skb->data[17];
 
-       bh_lock_sock(sk);
        switch (frametype) {
        case NR_CONNREQ:
                nr_write_internal(sk, NR_CONNACK);
@@ -262,18 +264,21 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype
                }
                break;
 
+       case NR_RESET:
+               if (sysctl_netrom_reset_circuit)
+                       nr_disconnect(sk, ECONNRESET);
+               break;
+
        default:
                break;
        }
-       bh_unlock_sock(sk);
-
        return queued;
 }
 
-/* Higher level upcall for a LAPB frame */
+/* Higher level upcall for a LAPB frame - called with sk locked */
 int nr_process_rx_frame(struct sock *sk, struct sk_buff *skb)
 {
-       nr_cb *nr = nr_sk(sk);
+       struct nr_sock *nr = nr_sk(sk);
        int queued = 0, frametype;
 
        if (nr->state == NR_STATE_0)