diff options
author | Shaun Pereira <spereira@tusc.com.au> | 2005-06-23 01:16:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-23 01:16:17 -0400 |
commit | ebc3f64b864fc16a594c2e63bf55a55c7d42084b (patch) | |
tree | 95040f32ad5902051527b91966118e565d48865b /net/x25/af_x25.c | |
parent | cb65d506c34c86df5bcef939ce5a8666a451bd8b (diff) |
[X25]: Fast select with no restriction on response
This patch is a follow up to patch 1 regarding "Selective Sub Address
matching with call user data". It allows use of the Fast-Select-Acceptance
optional user facility for X.25.
This patch just implements fast select with no restriction on response
(NRR). What this means (according to ITU-T Recomendation 10/96 section
6.16) is that if in an incoming call packet, the relevant facility bits are
set for fast-select-NRR, then the called DTE can issue a direct response to
the incoming packet using a call-accepted packet that contains
call-user-data. This patch allows such a response.
The called DTE can also respond with a clear-request packet that contains
call-user-data. However, this feature is currently not implemented by the
patch.
How is Fast Select Acceptance used?
By default, the system does not allow fast select acceptance (as before).
To enable a response to fast select acceptance,
After a listen socket in created and bound as follows
socket(AF_X25, SOCK_SEQPACKET, 0);
bind(call_soc, (struct sockaddr *)&locl_addr, sizeof(locl_addr));
but before a listen system call is made, the following ioctl should be used.
ioctl(call_soc,SIOCX25CALLACCPTAPPRV);
Now the listen system call can be made
listen(call_soc, 4);
After this, an incoming-call packet will be accepted, but no call-accepted
packet will be sent back until the following system call is made on the socket
that accepts the call
ioctl(vc_soc,SIOCX25SENDCALLACCPT);
The network (or cisco xot router used for testing here) will allow the
application server's call-user-data in the call-accepted packet,
provided the call-request was made with Fast-select NRR.
Signed-off-by: Shaun Pereira <spereira@tusc.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/x25/af_x25.c')
-rw-r--r-- | net/x25/af_x25.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index e17d84a55d5e..04bec047fa9a 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -31,6 +31,8 @@ | |||
31 | * x25_proc.c, using seq_file | 31 | * x25_proc.c, using seq_file |
32 | * 2005-04-02 Shaun Pereira Selective sub address matching | 32 | * 2005-04-02 Shaun Pereira Selective sub address matching |
33 | * with call user data | 33 | * with call user data |
34 | * 2005-04-15 Shaun Pereira Fast select with no restriction on | ||
35 | * response | ||
34 | */ | 36 | */ |
35 | 37 | ||
36 | #include <linux/config.h> | 38 | #include <linux/config.h> |
@@ -502,6 +504,8 @@ static int x25_create(struct socket *sock, int protocol) | |||
502 | x25->t2 = sysctl_x25_ack_holdback_timeout; | 504 | x25->t2 = sysctl_x25_ack_holdback_timeout; |
503 | x25->state = X25_STATE_0; | 505 | x25->state = X25_STATE_0; |
504 | x25->cudmatchlength = 0; | 506 | x25->cudmatchlength = 0; |
507 | x25->accptapprv = X25_DENY_ACCPT_APPRV; /* normally no cud */ | ||
508 | /* on call accept */ | ||
505 | 509 | ||
506 | x25->facilities.winsize_in = X25_DEFAULT_WINDOW_SIZE; | 510 | x25->facilities.winsize_in = X25_DEFAULT_WINDOW_SIZE; |
507 | x25->facilities.winsize_out = X25_DEFAULT_WINDOW_SIZE; | 511 | x25->facilities.winsize_out = X25_DEFAULT_WINDOW_SIZE; |
@@ -551,6 +555,7 @@ static struct sock *x25_make_new(struct sock *osk) | |||
551 | x25->facilities = ox25->facilities; | 555 | x25->facilities = ox25->facilities; |
552 | x25->qbitincl = ox25->qbitincl; | 556 | x25->qbitincl = ox25->qbitincl; |
553 | x25->cudmatchlength = ox25->cudmatchlength; | 557 | x25->cudmatchlength = ox25->cudmatchlength; |
558 | x25->accptapprv = ox25->accptapprv; | ||
554 | 559 | ||
555 | x25_init_timers(sk); | 560 | x25_init_timers(sk); |
556 | out: | 561 | out: |
@@ -900,9 +905,11 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb, | |||
900 | makex25->vc_facil_mask &= ~X25_MASK_REVERSE; | 905 | makex25->vc_facil_mask &= ~X25_MASK_REVERSE; |
901 | makex25->cudmatchlength = x25_sk(sk)->cudmatchlength; | 906 | makex25->cudmatchlength = x25_sk(sk)->cudmatchlength; |
902 | 907 | ||
903 | x25_write_internal(make, X25_CALL_ACCEPTED); | 908 | /* Normally all calls are accepted immediatly */ |
904 | 909 | if(makex25->accptapprv & X25_DENY_ACCPT_APPRV) { | |
905 | makex25->state = X25_STATE_3; | 910 | x25_write_internal(make, X25_CALL_ACCEPTED); |
911 | makex25->state = X25_STATE_3; | ||
912 | } | ||
906 | 913 | ||
907 | /* | 914 | /* |
908 | * Incoming Call User Data. | 915 | * Incoming Call User Data. |
@@ -1294,7 +1301,8 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1294 | if (facilities.throughput < 0x03 || | 1301 | if (facilities.throughput < 0x03 || |
1295 | facilities.throughput > 0xDD) | 1302 | facilities.throughput > 0xDD) |
1296 | break; | 1303 | break; |
1297 | if (facilities.reverse && facilities.reverse != 1) | 1304 | if (facilities.reverse && |
1305 | (facilities.reverse | 0x81)!= 0x81) | ||
1298 | break; | 1306 | break; |
1299 | x25->facilities = facilities; | 1307 | x25->facilities = facilities; |
1300 | rc = 0; | 1308 | rc = 0; |
@@ -1348,6 +1356,27 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1348 | break; | 1356 | break; |
1349 | } | 1357 | } |
1350 | 1358 | ||
1359 | case SIOCX25CALLACCPTAPPRV: { | ||
1360 | rc = -EINVAL; | ||
1361 | if (sk->sk_state != TCP_CLOSE) | ||
1362 | break; | ||
1363 | x25->accptapprv = X25_ALLOW_ACCPT_APPRV; | ||
1364 | rc = 0; | ||
1365 | break; | ||
1366 | } | ||
1367 | |||
1368 | case SIOCX25SENDCALLACCPT: { | ||
1369 | rc = -EINVAL; | ||
1370 | if (sk->sk_state != TCP_ESTABLISHED) | ||
1371 | break; | ||
1372 | if (x25->accptapprv) /* must call accptapprv above */ | ||
1373 | break; | ||
1374 | x25_write_internal(sk, X25_CALL_ACCEPTED); | ||
1375 | x25->state = X25_STATE_3; | ||
1376 | rc = 0; | ||
1377 | break; | ||
1378 | } | ||
1379 | |||
1351 | default: | 1380 | default: |
1352 | rc = dev_ioctl(cmd, argp); | 1381 | rc = dev_ioctl(cmd, argp); |
1353 | break; | 1382 | break; |