This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / net / netrom / nr_in.c
index bb24035..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);
 
@@ -76,7 +75,7 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb,
 {
        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);
@@ -99,6 +98,11 @@ 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;
        }
@@ -125,6 +129,11 @@ 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;
        }
@@ -138,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;
@@ -255,16 +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;
        }
        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)