aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandrew hendry <andrew.hendry@gmail.com>2010-05-16 19:00:27 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-17 20:39:27 -0400
commit37cda78741ecdbf45dd9b64e4c99dbdb11b47b46 (patch)
treeee213ce9347bc7434717092e600f970d919ceceb
parentb7792e34cba641c49cd436d42fbfd2a632ff39d3 (diff)
X25: Move accept approve flag to bitfield
Moves the x25 accept approve flag from char into bitfield. Signed-off-by: Andrew Hendry <andrew.hendry@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/x25.h5
-rw-r--r--net/x25/af_x25.c12
2 files changed, 8 insertions, 9 deletions
diff --git a/include/net/x25.h b/include/net/x25.h
index 1576e92c6cec..1479cb4a41fc 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -80,8 +80,6 @@ enum {
80#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */ 80#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */
81#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */ 81#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */
82#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */ 82#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */
83#define X25_DENY_ACCPT_APPRV 0x01 /* Default value */
84#define X25_ALLOW_ACCPT_APPRV 0x00 /* Control enabled */
85 83
86#define X25_SMODULUS 8 84#define X25_SMODULUS 8
87#define X25_EMODULUS 128 85#define X25_EMODULUS 128
@@ -116,6 +114,7 @@ enum {
116/* Bitset in x25_sock->flags for misc flags */ 114/* Bitset in x25_sock->flags for misc flags */
117#define X25_Q_BIT_FLAG 0 115#define X25_Q_BIT_FLAG 0
118#define X25_INTERRUPT_FLAG 1 116#define X25_INTERRUPT_FLAG 1
117#define X25_ACCPT_APPRV_FLAG 2
119 118
120/** 119/**
121 * struct x25_route - x25 routing entry 120 * struct x25_route - x25 routing entry
@@ -150,7 +149,7 @@ struct x25_sock {
150 struct x25_address source_addr, dest_addr; 149 struct x25_address source_addr, dest_addr;
151 struct x25_neigh *neighbour; 150 struct x25_neigh *neighbour;
152 unsigned int lci, cudmatchlength; 151 unsigned int lci, cudmatchlength;
153 unsigned char state, condition, accptapprv; 152 unsigned char state, condition;
154 unsigned short vs, vr, va, vl; 153 unsigned short vs, vr, va, vl;
155 unsigned long t2, t21, t22, t23; 154 unsigned long t2, t21, t22, t23;
156 unsigned short fraglen; 155 unsigned short fraglen;
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 3d97b8caf0b1..e5c1e3298f8a 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -586,7 +586,7 @@ static int x25_create(struct net *net, struct socket *sock, int protocol,
586 x25->t2 = sysctl_x25_ack_holdback_timeout; 586 x25->t2 = sysctl_x25_ack_holdback_timeout;
587 x25->state = X25_STATE_0; 587 x25->state = X25_STATE_0;
588 x25->cudmatchlength = 0; 588 x25->cudmatchlength = 0;
589 x25->accptapprv = X25_DENY_ACCPT_APPRV; /* normally no cud */ 589 set_bit(X25_ACCPT_APPRV_FLAG, &x25->flags); /* normally no cud */
590 /* on call accept */ 590 /* on call accept */
591 591
592 x25->facilities.winsize_in = X25_DEFAULT_WINDOW_SIZE; 592 x25->facilities.winsize_in = X25_DEFAULT_WINDOW_SIZE;
@@ -639,7 +639,6 @@ static struct sock *x25_make_new(struct sock *osk)
639 x25->facilities = ox25->facilities; 639 x25->facilities = ox25->facilities;
640 x25->dte_facilities = ox25->dte_facilities; 640 x25->dte_facilities = ox25->dte_facilities;
641 x25->cudmatchlength = ox25->cudmatchlength; 641 x25->cudmatchlength = ox25->cudmatchlength;
642 x25->accptapprv = ox25->accptapprv;
643 642
644 clear_bit(X25_INTERRUPT_FLAG, &x25->flags); 643 clear_bit(X25_INTERRUPT_FLAG, &x25->flags);
645 x25_init_timers(sk); 644 x25_init_timers(sk);
@@ -1057,8 +1056,8 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb,
1057 makex25->vc_facil_mask &= ~X25_MASK_CALLING_AE; 1056 makex25->vc_facil_mask &= ~X25_MASK_CALLING_AE;
1058 makex25->cudmatchlength = x25_sk(sk)->cudmatchlength; 1057 makex25->cudmatchlength = x25_sk(sk)->cudmatchlength;
1059 1058
1060 /* Normally all calls are accepted immediatly */ 1059 /* Normally all calls are accepted immediately */
1061 if(makex25->accptapprv & X25_DENY_ACCPT_APPRV) { 1060 if (test_bit(X25_ACCPT_APPRV_FLAG, &makex25->flags)) {
1062 x25_write_internal(make, X25_CALL_ACCEPTED); 1061 x25_write_internal(make, X25_CALL_ACCEPTED);
1063 makex25->state = X25_STATE_3; 1062 makex25->state = X25_STATE_3;
1064 } 1063 }
@@ -1580,7 +1579,7 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1580 rc = -EINVAL; 1579 rc = -EINVAL;
1581 if (sk->sk_state != TCP_CLOSE) 1580 if (sk->sk_state != TCP_CLOSE)
1582 break; 1581 break;
1583 x25->accptapprv = X25_ALLOW_ACCPT_APPRV; 1582 clear_bit(X25_ACCPT_APPRV_FLAG, &x25->flags);
1584 rc = 0; 1583 rc = 0;
1585 break; 1584 break;
1586 } 1585 }
@@ -1589,7 +1588,8 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1589 rc = -EINVAL; 1588 rc = -EINVAL;
1590 if (sk->sk_state != TCP_ESTABLISHED) 1589 if (sk->sk_state != TCP_ESTABLISHED)
1591 break; 1590 break;
1592 if (x25->accptapprv) /* must call accptapprv above */ 1591 /* must call accptapprv above */
1592 if (test_bit(X25_ACCPT_APPRV_FLAG, &x25->flags))
1593 break; 1593 break;
1594 x25_write_internal(sk, X25_CALL_ACCEPTED); 1594 x25_write_internal(sk, X25_CALL_ACCEPTED);
1595 x25->state = X25_STATE_3; 1595 x25->state = X25_STATE_3;