aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/x25.h6
-rw-r--r--net/x25/af_x25.c17
2 files changed, 15 insertions, 8 deletions
diff --git a/include/net/x25.h b/include/net/x25.h
index 468551ea4f1d..7b5795e1ceb2 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -113,6 +113,9 @@ enum {
113#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */ 113#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */
114#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */ 114#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */
115 115
116/* Bitset in x25_sock->flags for misc flags */
117#define X25_Q_BIT_FLAG 0
118
116/** 119/**
117 * struct x25_route - x25 routing entry 120 * struct x25_route - x25 routing entry
118 * @node - entry in x25_list_lock 121 * @node - entry in x25_list_lock
@@ -146,10 +149,11 @@ struct x25_sock {
146 struct x25_address source_addr, dest_addr; 149 struct x25_address source_addr, dest_addr;
147 struct x25_neigh *neighbour; 150 struct x25_neigh *neighbour;
148 unsigned int lci, cudmatchlength; 151 unsigned int lci, cudmatchlength;
149 unsigned char state, condition, qbitincl, intflag, accptapprv; 152 unsigned char state, condition, intflag, accptapprv;
150 unsigned short vs, vr, va, vl; 153 unsigned short vs, vr, va, vl;
151 unsigned long t2, t21, t22, t23; 154 unsigned long t2, t21, t22, t23;
152 unsigned short fraglen; 155 unsigned short fraglen;
156 unsigned long flags;
153 struct sk_buff_head ack_queue; 157 struct sk_buff_head ack_queue;
154 struct sk_buff_head fragment_queue; 158 struct sk_buff_head fragment_queue;
155 struct sk_buff_head interrupt_in_queue; 159 struct sk_buff_head interrupt_in_queue;
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 296e65e01064..720534ce1fd9 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -465,7 +465,10 @@ static int x25_setsockopt(struct socket *sock, int level, int optname,
465 if (get_user(opt, (int __user *)optval)) 465 if (get_user(opt, (int __user *)optval))
466 goto out; 466 goto out;
467 467
468 x25_sk(sk)->qbitincl = !!opt; 468 if (opt)
469 set_bit(X25_Q_BIT_FLAG, &x25_sk(sk)->flags);
470 else
471 clear_bit(X25_Q_BIT_FLAG, &x25_sk(sk)->flags);
469 rc = 0; 472 rc = 0;
470out: 473out:
471 unlock_kernel(); 474 unlock_kernel();
@@ -496,7 +499,7 @@ static int x25_getsockopt(struct socket *sock, int level, int optname,
496 if (put_user(len, optlen)) 499 if (put_user(len, optlen))
497 goto out; 500 goto out;
498 501
499 val = x25_sk(sk)->qbitincl; 502 val = test_bit(X25_Q_BIT_FLAG, &x25_sk(sk)->flags);
500 rc = copy_to_user(optval, &val, len) ? -EFAULT : 0; 503 rc = copy_to_user(optval, &val, len) ? -EFAULT : 0;
501out: 504out:
502 unlock_kernel(); 505 unlock_kernel();
@@ -632,8 +635,8 @@ static struct sock *x25_make_new(struct sock *osk)
632 x25->t22 = ox25->t22; 635 x25->t22 = ox25->t22;
633 x25->t23 = ox25->t23; 636 x25->t23 = ox25->t23;
634 x25->t2 = ox25->t2; 637 x25->t2 = ox25->t2;
638 x25->flags = ox25->flags;
635 x25->facilities = ox25->facilities; 639 x25->facilities = ox25->facilities;
636 x25->qbitincl = ox25->qbitincl;
637 x25->dte_facilities = ox25->dte_facilities; 640 x25->dte_facilities = ox25->dte_facilities;
638 x25->cudmatchlength = ox25->cudmatchlength; 641 x25->cudmatchlength = ox25->cudmatchlength;
639 x25->accptapprv = ox25->accptapprv; 642 x25->accptapprv = ox25->accptapprv;
@@ -1186,7 +1189,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
1186 * If the Q BIT Include socket option is in force, the first 1189 * If the Q BIT Include socket option is in force, the first
1187 * byte of the user data is the logical value of the Q Bit. 1190 * byte of the user data is the logical value of the Q Bit.
1188 */ 1191 */
1189 if (x25->qbitincl) { 1192 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) {
1190 qbit = skb->data[0]; 1193 qbit = skb->data[0];
1191 skb_pull(skb, 1); 1194 skb_pull(skb, 1);
1192 } 1195 }
@@ -1242,7 +1245,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
1242 len = rc; 1245 len = rc;
1243 if (rc < 0) 1246 if (rc < 0)
1244 kfree_skb(skb); 1247 kfree_skb(skb);
1245 else if (x25->qbitincl) 1248 else if (test_bit(X25_Q_BIT_FLAG, &x25->flags))
1246 len++; 1249 len++;
1247 } 1250 }
1248 1251
@@ -1307,7 +1310,7 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
1307 /* 1310 /*
1308 * No Q bit information on Interrupt data. 1311 * No Q bit information on Interrupt data.
1309 */ 1312 */
1310 if (x25->qbitincl) { 1313 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) {
1311 asmptr = skb_push(skb, 1); 1314 asmptr = skb_push(skb, 1);
1312 *asmptr = 0x00; 1315 *asmptr = 0x00;
1313 } 1316 }
@@ -1325,7 +1328,7 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
1325 skb_pull(skb, x25->neighbour->extended ? 1328 skb_pull(skb, x25->neighbour->extended ?
1326 X25_EXT_MIN_LEN : X25_STD_MIN_LEN); 1329 X25_EXT_MIN_LEN : X25_STD_MIN_LEN);
1327 1330
1328 if (x25->qbitincl) { 1331 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) {
1329 asmptr = skb_push(skb, 1); 1332 asmptr = skb_push(skb, 1);
1330 *asmptr = qbit; 1333 *asmptr = qbit;
1331 } 1334 }