aboutsummaryrefslogtreecommitdiffstats
path: root/net/x25/af_x25.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/x25/af_x25.c')
-rw-r--r--net/x25/af_x25.c17
1 files changed, 10 insertions, 7 deletions
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 }