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.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 03725c051752..7bf93df7248b 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -525,6 +525,13 @@ static int x25_create(struct socket *sock, int protocol)
525 x25->facilities.pacsize_out = X25_DEFAULT_PACKET_SIZE; 525 x25->facilities.pacsize_out = X25_DEFAULT_PACKET_SIZE;
526 x25->facilities.throughput = X25_DEFAULT_THROUGHPUT; 526 x25->facilities.throughput = X25_DEFAULT_THROUGHPUT;
527 x25->facilities.reverse = X25_DEFAULT_REVERSE; 527 x25->facilities.reverse = X25_DEFAULT_REVERSE;
528 x25->dte_facilities.calling_len = 0;
529 x25->dte_facilities.called_len = 0;
530 memset(x25->dte_facilities.called_ae, '\0',
531 sizeof(x25->dte_facilities.called_ae));
532 memset(x25->dte_facilities.calling_ae, '\0',
533 sizeof(x25->dte_facilities.calling_ae));
534
528 rc = 0; 535 rc = 0;
529out: 536out:
530 return rc; 537 return rc;
@@ -561,6 +568,7 @@ static struct sock *x25_make_new(struct sock *osk)
561 x25->t2 = ox25->t2; 568 x25->t2 = ox25->t2;
562 x25->facilities = ox25->facilities; 569 x25->facilities = ox25->facilities;
563 x25->qbitincl = ox25->qbitincl; 570 x25->qbitincl = ox25->qbitincl;
571 x25->dte_facilities = ox25->dte_facilities;
564 x25->cudmatchlength = ox25->cudmatchlength; 572 x25->cudmatchlength = ox25->cudmatchlength;
565 x25->accptapprv = ox25->accptapprv; 573 x25->accptapprv = ox25->accptapprv;
566 574
@@ -840,6 +848,7 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb,
840 struct x25_sock *makex25; 848 struct x25_sock *makex25;
841 struct x25_address source_addr, dest_addr; 849 struct x25_address source_addr, dest_addr;
842 struct x25_facilities facilities; 850 struct x25_facilities facilities;
851 struct x25_dte_facilities dte_facilities;
843 int len, rc; 852 int len, rc;
844 853
845 /* 854 /*
@@ -876,7 +885,8 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb,
876 /* 885 /*
877 * Try to reach a compromise on the requested facilities. 886 * Try to reach a compromise on the requested facilities.
878 */ 887 */
879 if ((len = x25_negotiate_facilities(skb, sk, &facilities)) == -1) 888 len = x25_negotiate_facilities(skb, sk, &facilities, &dte_facilities);
889 if (len == -1)
880 goto out_sock_put; 890 goto out_sock_put;
881 891
882 /* 892 /*
@@ -907,9 +917,12 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb,
907 makex25->source_addr = source_addr; 917 makex25->source_addr = source_addr;
908 makex25->neighbour = nb; 918 makex25->neighbour = nb;
909 makex25->facilities = facilities; 919 makex25->facilities = facilities;
920 makex25->dte_facilities= dte_facilities;
910 makex25->vc_facil_mask = x25_sk(sk)->vc_facil_mask; 921 makex25->vc_facil_mask = x25_sk(sk)->vc_facil_mask;
911 /* ensure no reverse facil on accept */ 922 /* ensure no reverse facil on accept */
912 makex25->vc_facil_mask &= ~X25_MASK_REVERSE; 923 makex25->vc_facil_mask &= ~X25_MASK_REVERSE;
924 /* ensure no calling address extension on accept */
925 makex25->vc_facil_mask &= ~X25_MASK_CALLING_AE;
913 makex25->cudmatchlength = x25_sk(sk)->cudmatchlength; 926 makex25->cudmatchlength = x25_sk(sk)->cudmatchlength;
914 927
915 /* Normally all calls are accepted immediatly */ 928 /* Normally all calls are accepted immediatly */
@@ -1316,6 +1329,36 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1316 break; 1329 break;
1317 } 1330 }
1318 1331
1332 case SIOCX25GDTEFACILITIES: {
1333 rc = copy_to_user(argp, &x25->dte_facilities,
1334 sizeof(x25->dte_facilities));
1335 if (rc)
1336 rc = -EFAULT;
1337 break;
1338 }
1339
1340 case SIOCX25SDTEFACILITIES: {
1341 struct x25_dte_facilities dtefacs;
1342 rc = -EFAULT;
1343 if (copy_from_user(&dtefacs, argp, sizeof(dtefacs)))
1344 break;
1345 rc = -EINVAL;
1346 if (sk->sk_state != TCP_LISTEN &&
1347 sk->sk_state != TCP_CLOSE)
1348 break;
1349 if (dtefacs.calling_len > X25_MAX_AE_LEN)
1350 break;
1351 if (dtefacs.calling_ae == NULL)
1352 break;
1353 if (dtefacs.called_len > X25_MAX_AE_LEN)
1354 break;
1355 if (dtefacs.called_ae == NULL)
1356 break;
1357 x25->dte_facilities = dtefacs;
1358 rc = 0;
1359 break;
1360 }
1361
1319 case SIOCX25GCALLUSERDATA: { 1362 case SIOCX25GCALLUSERDATA: {
1320 struct x25_calluserdata cud = x25->calluserdata; 1363 struct x25_calluserdata cud = x25->calluserdata;
1321 rc = copy_to_user(argp, &cud, 1364 rc = copy_to_user(argp, &cud,