]> err.no Git - linux-2.6/blobdiff - net/x25/x25_subr.c
[AX25]: Make ax2asc thread-proof
[linux-2.6] / net / x25 / x25_subr.c
index c349bbd61684ec9272ed0a24c1724e84d041ee10..8be9b8fbc24d143e6d3df6c9dff14f005a6b4cfe 100644 (file)
  *     mar/20/00       Daniela Squassoni Disabling/enabling of facilities
  *                                       negotiation.
  *     jun/24/01       Arnaldo C. Melo   use skb_queue_purge, cleanups
+ *     apr/04/15       Shaun Pereira           Fast select with no
+ *                                             restriction on response.
  */
 
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
-#include <net/tcp.h>
+#include <net/tcp_states.h>
 #include <net/x25.h>
 
 /*
@@ -78,7 +80,7 @@ void x25_requeue_frames(struct sock *sk)
                if (!skb_prev)
                        skb_queue_head(&sk->sk_write_queue, skb);
                else
-                       skb_append(skb_prev, skb);
+                       skb_append(skb_prev, skb, &sk->sk_write_queue);
                skb_prev = skb;
        }
 }
@@ -127,8 +129,12 @@ void x25_write_internal(struct sock *sk, int frametype)
                        len += 1 + X25_ADDR_LEN + X25_MAX_FAC_LEN +
                               X25_MAX_CUD_LEN;
                        break;
-               case X25_CALL_ACCEPTED:
-                       len += 1 + X25_MAX_FAC_LEN + X25_MAX_CUD_LEN;
+               case X25_CALL_ACCEPTED: /* fast sel with no restr on resp */
+                       if(x25->facilities.reverse & 0x80) {
+                               len += 1 + X25_MAX_FAC_LEN + X25_MAX_CUD_LEN;
+                       } else {
+                               len += 1 + X25_MAX_FAC_LEN;
+                       }
                        break;
                case X25_CLEAR_REQUEST:
                case X25_RESET_REQUEST:
@@ -203,9 +209,16 @@ void x25_write_internal(struct sock *sk, int frametype)
                                                        x25->vc_facil_mask);
                        dptr    = skb_put(skb, len);
                        memcpy(dptr, facilities, len);
-                       dptr = skb_put(skb, x25->calluserdata.cudlength);
-                       memcpy(dptr, x25->calluserdata.cuddata,
-                              x25->calluserdata.cudlength);
+
+                       /* fast select with no restriction on response
+                               allows call user data. Userland must
+                               ensure it is ours and not theirs */
+                       if(x25->facilities.reverse & 0x80) {
+                               dptr = skb_put(skb,
+                                       x25->calluserdata.cudlength);
+                               memcpy(dptr, x25->calluserdata.cuddata,
+                                      x25->calluserdata.cudlength);
+                       }
                        x25->calluserdata.cudlength = 0;
                        break;