Lines Matching +full:0 +full:x25
33 #define pr_fmt(fmt) "X25: " fmt
57 #include <net/x25.h>
65 int sysctl_x25_forward = 0;
93 rc = 0; in x25_parse_address_block()
98 needed = 1 + ((len >> 4) + (len & 0x0f) + 1) / 2; in x25_parse_address_block()
110 *called_addr->x25_addr = 0; in x25_parse_address_block()
111 *calling_addr->x25_addr = 0; in x25_parse_address_block()
124 called_len = (*p >> 0) & 0x0F; in x25_addr_ntoa()
125 calling_len = (*p >> 4) & 0x0F; in x25_addr_ntoa()
131 for (i = 0; i < (called_len + calling_len); i++) { in x25_addr_ntoa()
133 if (i % 2 != 0) { in x25_addr_ntoa()
134 *called++ = ((*p >> 0) & 0x0F) + '0'; in x25_addr_ntoa()
137 *called++ = ((*p >> 4) & 0x0F) + '0'; in x25_addr_ntoa()
140 if (i % 2 != 0) { in x25_addr_ntoa()
141 *calling++ = ((*p >> 0) & 0x0F) + '0'; in x25_addr_ntoa()
144 *calling++ = ((*p >> 4) & 0x0F) + '0'; in x25_addr_ntoa()
149 *called = *calling = '\0'; in x25_addr_ntoa()
167 *p++ = (calling_len << 4) | (called_len << 0); in x25_addr_aton()
169 for (i = 0; i < (called_len + calling_len); i++) { in x25_addr_aton()
171 if (i % 2 != 0) { in x25_addr_aton()
172 *p |= (*called++ - '0') << 0; in x25_addr_aton()
175 *p = 0x00; in x25_addr_aton()
176 *p |= (*called++ - '0') << 4; in x25_addr_aton()
179 if (i % 2 != 0) { in x25_addr_aton()
180 *p |= (*calling++ - '0') << 0; in x25_addr_aton()
183 *p = 0x00; in x25_addr_aton()
184 *p |= (*calling++ - '0') << 4; in x25_addr_aton()
213 x25_disconnect(s, ENETUNREACH, 0, 0); in x25_kill_by_device()
293 if (x25_sk(s)->cudmatchlength > 0 && in x25_find_listener()
297 x25_sk(s)->cudmatchlength)) == 0) { in x25_find_listener()
353 lci = 0; in x25_new_lci()
455 rc = 0; in x25_setsockopt()
476 if (len < 0) in x25_getsockopt()
484 rc = copy_to_user(optval, &val, len) ? -EFAULT : 0; in x25_getsockopt()
502 memset(&x25_sk(sk)->dest_addr, 0, X25_ADDR_LEN); in x25_listen()
505 rc = 0; in x25_listen()
513 .name = "X25",
520 struct x25_sock *x25; in x25_alloc_socket() local
528 x25 = x25_sk(sk); in x25_alloc_socket()
529 skb_queue_head_init(&x25->ack_queue); in x25_alloc_socket()
530 skb_queue_head_init(&x25->fragment_queue); in x25_alloc_socket()
531 skb_queue_head_init(&x25->interrupt_in_queue); in x25_alloc_socket()
532 skb_queue_head_init(&x25->interrupt_out_queue); in x25_alloc_socket()
541 struct x25_sock *x25; in x25_create() local
559 x25 = x25_sk(sk); in x25_create()
569 x25->t21 = sysctl_x25_call_request_timeout; in x25_create()
570 x25->t22 = sysctl_x25_reset_request_timeout; in x25_create()
571 x25->t23 = sysctl_x25_clear_request_timeout; in x25_create()
572 x25->t2 = sysctl_x25_ack_holdback_timeout; in x25_create()
573 x25->state = X25_STATE_0; in x25_create()
574 x25->cudmatchlength = 0; in x25_create()
575 set_bit(X25_ACCPT_APPRV_FLAG, &x25->flags); /* normally no cud */ in x25_create()
578 x25->facilities.winsize_in = X25_DEFAULT_WINDOW_SIZE; in x25_create()
579 x25->facilities.winsize_out = X25_DEFAULT_WINDOW_SIZE; in x25_create()
580 x25->facilities.pacsize_in = X25_DEFAULT_PACKET_SIZE; in x25_create()
581 x25->facilities.pacsize_out = X25_DEFAULT_PACKET_SIZE; in x25_create()
582 x25->facilities.throughput = 0; /* by default don't negotiate in x25_create()
584 x25->facilities.reverse = X25_DEFAULT_REVERSE; in x25_create()
585 x25->dte_facilities.calling_len = 0; in x25_create()
586 x25->dte_facilities.called_len = 0; in x25_create()
587 memset(x25->dte_facilities.called_ae, '\0', in x25_create()
588 sizeof(x25->dte_facilities.called_ae)); in x25_create()
589 memset(x25->dte_facilities.calling_ae, '\0', in x25_create()
590 sizeof(x25->dte_facilities.calling_ae)); in x25_create()
592 rc = 0; in x25_create()
600 struct x25_sock *x25, *ox25; in x25_make_new() local
605 if ((sk = x25_alloc_socket(sock_net(osk), 0)) == NULL) in x25_make_new()
608 x25 = x25_sk(sk); in x25_make_new()
620 x25->t21 = ox25->t21; in x25_make_new()
621 x25->t22 = ox25->t22; in x25_make_new()
622 x25->t23 = ox25->t23; in x25_make_new()
623 x25->t2 = ox25->t2; in x25_make_new()
624 x25->flags = ox25->flags; in x25_make_new()
625 x25->facilities = ox25->facilities; in x25_make_new()
626 x25->dte_facilities = ox25->dte_facilities; in x25_make_new()
627 x25->cudmatchlength = ox25->cudmatchlength; in x25_make_new()
629 clear_bit(X25_INTERRUPT_FLAG, &x25->flags); in x25_make_new()
638 struct x25_sock *x25; in x25_release() local
641 return 0; in x25_release()
643 x25 = x25_sk(sk); in x25_release()
647 switch (x25->state) { in x25_release()
651 x25_disconnect(sk, 0, 0, 0); in x25_release()
661 x25->state = X25_STATE_2; in x25_release()
671 x25_disconnect(sk, 0, 0, 0); in x25_release()
680 return 0; in x25_release()
687 int len, i, rc = 0; in x25_bind()
700 for (i = 0; i < len; i++) { in x25_bind()
738 rc = 0; in x25_wait_for_connection_establishment()
755 struct x25_sock *x25 = x25_sk(sk); in x25_connect() local
758 int rc = 0; in x25_connect()
794 x25->neighbour = x25_get_neigh(rt->dev); in x25_connect()
795 if (!x25->neighbour) in x25_connect()
798 x25_limit_facilities(&x25->facilities, x25->neighbour); in x25_connect()
800 x25->lci = x25_new_lci(x25->neighbour); in x25_connect()
801 if (!x25->lci) in x25_connect()
808 if (!strcmp(x25->source_addr.x25_addr, null_x25_address.x25_addr)) in x25_connect()
809 memset(&x25->source_addr, '\0', X25_ADDR_LEN); in x25_connect()
811 x25->dest_addr = addr->sx25_addr; in x25_connect()
817 x25->state = X25_STATE_1; in x25_connect()
834 rc = 0; in x25_connect()
836 if (rc && x25->neighbour) { in x25_connect()
838 x25_neigh_put(x25->neighbour); in x25_connect()
839 x25->neighbour = NULL; in x25_connect()
841 x25->state = X25_STATE_0; in x25_connect()
853 int rc = 0; in x25_wait_for_data()
866 rc = 0; in x25_wait_for_data()
914 rc = 0; in x25_accept()
926 struct x25_sock *x25 = x25_sk(sk); in x25_getname() local
927 int rc = 0; in x25_getname()
934 sx25->sx25_addr = x25->dest_addr; in x25_getname()
936 sx25->sx25_addr = x25->source_addr; in x25_getname()
968 if (addr_len <= 0) in x25_rx_call_request()
981 len = skb->data[0] + 1; in x25_rx_call_request()
1016 x25_forward_call(&dest_addr, nb, skb, lci) > 0) in x25_rx_call_request()
1103 rc = 0; in x25_rx_call_request()
1104 x25_transmit_clear_request(nb, lci, 0x01); in x25_rx_call_request()
1111 struct x25_sock *x25 = x25_sk(sk); in x25_sendmsg() local
1118 int qbit = 0, rc = -EINVAL; in x25_sendmsg()
1134 send_sig(SIGPIPE, current, 0); in x25_sendmsg()
1139 if (!x25->neighbour) in x25_sendmsg()
1148 if (strcmp(x25->dest_addr.x25_addr, sx25.sx25_addr.x25_addr)) in x25_sendmsg()
1164 sx25.sx25_addr = x25->dest_addr; in x25_sendmsg()
1208 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) { in x25_sendmsg()
1212 qbit = skb->data[0]; in x25_sendmsg()
1222 if (x25->neighbour->extended) { in x25_sendmsg()
1224 *asmptr++ = ((x25->lci >> 8) & 0x0F) | X25_GFI_EXTSEQ; in x25_sendmsg()
1225 *asmptr++ = (x25->lci >> 0) & 0xFF; in x25_sendmsg()
1229 *asmptr++ = ((x25->lci >> 8) & 0x0F) | X25_GFI_STDSEQ; in x25_sendmsg()
1230 *asmptr++ = (x25->lci >> 0) & 0xFF; in x25_sendmsg()
1234 if (x25->neighbour->extended) { in x25_sendmsg()
1237 *asmptr++ = ((x25->lci >> 8) & 0x0F) | X25_GFI_EXTSEQ; in x25_sendmsg()
1238 *asmptr++ = (x25->lci >> 0) & 0xFF; in x25_sendmsg()
1244 *asmptr++ = ((x25->lci >> 8) & 0x0F) | X25_GFI_STDSEQ; in x25_sendmsg()
1245 *asmptr++ = (x25->lci >> 0) & 0xFF; in x25_sendmsg()
1250 skb->data[0] |= X25_Q_BIT; in x25_sendmsg()
1261 skb_queue_tail(&x25->interrupt_out_queue, skb); in x25_sendmsg()
1265 if (rc < 0) in x25_sendmsg()
1267 else if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) in x25_sendmsg()
1286 struct x25_sock *x25 = x25_sk(sk); in x25_recvmsg() local
1296 if (x25->neighbour == NULL) in x25_recvmsg()
1299 header_len = x25->neighbour->extended ? in x25_recvmsg()
1312 !skb_peek(&x25->interrupt_in_queue)) in x25_recvmsg()
1315 skb = skb_dequeue(&x25->interrupt_in_queue); in x25_recvmsg()
1325 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) { in x25_recvmsg()
1327 *asmptr = 0x00; in x25_recvmsg()
1343 qbit = (skb->data[0] & X25_Q_BIT) == X25_Q_BIT; in x25_recvmsg()
1347 if (test_bit(X25_Q_BIT_FLAG, &x25->flags)) { in x25_recvmsg()
1364 rc = skb_copy_datagram_msg(skb, 0, msg, copied); in x25_recvmsg()
1370 sx25->sx25_addr = x25->dest_addr; in x25_recvmsg()
1387 struct x25_sock *x25 = x25_sk(sk); in x25_ioctl() local
1396 if (amount < 0) in x25_ioctl()
1397 amount = 0; in x25_ioctl()
1404 int amount = 0; in x25_ioctl()
1447 rc = copy_to_user(argp, &x25->facilities, in x25_ioctl()
1448 sizeof(x25->facilities)) in x25_ioctl()
1449 ? -EFAULT : 0; in x25_ioctl()
1474 int out = facilities.throughput & 0xf0; in x25_ioctl()
1475 int in = facilities.throughput & 0x0f; in x25_ioctl()
1479 else if (out < 0x30 || out > 0xD0) in x25_ioctl()
1484 else if (in < 0x03 || in > 0x0D) in x25_ioctl()
1488 (facilities.reverse & 0x81) != 0x81) in x25_ioctl()
1490 x25->facilities = facilities; in x25_ioctl()
1491 rc = 0; in x25_ioctl()
1499 rc = copy_to_user(argp, &x25->dte_facilities, in x25_ioctl()
1500 sizeof(x25->dte_facilities)); in x25_ioctl()
1521 x25->dte_facilities = dtefacs; in x25_ioctl()
1522 rc = 0; in x25_ioctl()
1530 rc = copy_to_user(argp, &x25->calluserdata, in x25_ioctl()
1531 sizeof(x25->calluserdata)) in x25_ioctl()
1532 ? -EFAULT : 0; in x25_ioctl()
1547 x25->calluserdata = calluserdata; in x25_ioctl()
1549 rc = 0; in x25_ioctl()
1555 rc = copy_to_user(argp, &x25->causediag, sizeof(x25->causediag)) in x25_ioctl()
1556 ? -EFAULT : 0; in x25_ioctl()
1567 x25->causediag = causediag; in x25_ioctl()
1569 rc = 0; in x25_ioctl()
1587 x25->cudmatchlength = sub_addr.cudmatchlength; in x25_ioctl()
1588 rc = 0; in x25_ioctl()
1598 clear_bit(X25_ACCPT_APPRV_FLAG, &x25->flags); in x25_ioctl()
1599 rc = 0; in x25_ioctl()
1611 if (test_bit(X25_ACCPT_APPRV_FLAG, &x25->flags)) in x25_ioctl()
1614 x25->state = X25_STATE_3; in x25_ioctl()
1615 rc = 0; in x25_ioctl()
1665 sizeof(*x25_subscr32)) ? -EFAULT : 0; in compat_x25_subscr_ioctl()
1668 if (x25_subscr.extended == 0 || x25_subscr.extended == 1) { in compat_x25_subscr_ioctl()
1669 rc = 0; in compat_x25_subscr_ioctl()
1788 x25_disconnect(s, ENETUNREACH, 0, 0); in x25_kill_by_neigh()
1803 rc = proto_register(&x25_proto, 0); in x25_init()