Changes in uspace/srv/net/tl/icmp/icmp.c [49bd793b:ffa2c8ef] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/icmp/icmp.c
r49bd793b rffa2c8ef 118 118 119 119 /** Global data */ 120 static async_sess_t *net_sess = NULL;121 static async_sess_t *ip_sess = NULL;120 static int phone_net = -1; 121 static int phone_ip = -1; 122 122 static bool error_reporting = true; 123 123 static bool echo_replying = true; … … 173 173 static void icmp_release(packet_t *packet) 174 174 { 175 pq_release_remote( net_sess, packet_get_id(packet));175 pq_release_remote(phone_net, packet_get_id(packet)); 176 176 } 177 177 … … 225 225 } 226 226 227 return ip_send_msg( ip_sess, -1, packet, SERVICE_ICMP, error);227 return ip_send_msg(phone_ip, -1, packet, SERVICE_ICMP, error); 228 228 } 229 229 … … 297 297 size_t length = (size_t) addrlen; 298 298 299 packet_t *packet = packet_get_4_remote( net_sess, size,299 packet_t *packet = packet_get_4_remote(phone_net, size, 300 300 icmp_dimension.addr_len, ICMP_HEADER_SIZE + icmp_dimension.prefix, 301 301 icmp_dimension.suffix); … … 595 595 case ICMP_SKIP: 596 596 case ICMP_PHOTURIS: 597 ip_received_error_msg( ip_sess, -1, packet,597 ip_received_error_msg(phone_ip, -1, packet, 598 598 SERVICE_IP, SERVICE_ICMP); 599 599 return EOK; … … 608 608 * @param[in] iid Message identifier. 609 609 * @param[in,out] icall Message parameters. 610 * @param[in] arg Local argument.611 * 612 */ 613 static void icmp_receiver(ipc_callid_t iid, ipc_call_t *icall, void *arg) 614 { 610 * 611 */ 612 static void icmp_receiver(ipc_callid_t iid, ipc_call_t *icall) 613 { 614 bool loop = true; 615 615 packet_t *packet; 616 616 int rc; 617 617 618 while (true) { 619 if (!IPC_GET_IMETHOD(*icall)) 620 break; 621 618 while (loop) { 622 619 switch (IPC_GET_IMETHOD(*icall)) { 623 620 case NET_TL_RECEIVED: 624 rc = packet_translate_remote( net_sess, &packet,621 rc = packet_translate_remote(phone_net, &packet, 625 622 IPC_GET_PACKET(*icall)); 626 623 if (rc == EOK) { … … 632 629 async_answer_0(iid, (sysarg_t) rc); 633 630 break; 631 case IPC_M_PHONE_HUNGUP: 632 loop = false; 633 continue; 634 634 default: 635 635 async_answer_0(iid, (sysarg_t) ENOTSUP); … … 642 642 /** Initialize the ICMP module. 643 643 * 644 * @param[in] sess Network module session.644 * @param[in] net_phone Network module phone. 645 645 * 646 646 * @return EOK on success. … … 648 648 * 649 649 */ 650 int tl_initialize( async_sess_t *sess)650 int tl_initialize(int net_phone) 651 651 { 652 652 measured_string_t names[] = { … … 670 670 atomic_set(&icmp_client, 0); 671 671 672 net_sess = sess;673 ip_sess= ip_bind_service(SERVICE_IP, IPPROTO_ICMP, SERVICE_ICMP,672 phone_net = net_phone; 673 phone_ip = ip_bind_service(SERVICE_IP, IPPROTO_ICMP, SERVICE_ICMP, 674 674 icmp_receiver); 675 if ( ip_sess == NULL)676 return ENOENT;677 678 int rc = ip_packet_size_req( ip_sess, -1, &icmp_dimension);675 if (phone_ip < 0) 676 return phone_ip; 677 678 int rc = ip_packet_size_req(phone_ip, -1, &icmp_dimension); 679 679 if (rc != EOK) 680 680 return rc; … … 685 685 /* Get configuration */ 686 686 configuration = &names[0]; 687 rc = net_get_conf_req( net_sess, &configuration, count, &data);687 rc = net_get_conf_req(phone_net, &configuration, count, &data); 688 688 if (rc != EOK) 689 689 return rc; … … 753 753 return rc; 754 754 755 rc = icmp_echo(icmp_id, icmp_seq, ICMP_GET_SIZE(*call), 755 rc = icmp_echo(icmp_id, icmp_seq, ICMP_GET_SIZE(*call), 756 756 ICMP_GET_TIMEOUT(*call), ICMP_GET_TTL(*call), 757 757 ICMP_GET_TOS(*call), ICMP_GET_DONT_FRAGMENT(*call), … … 763 763 764 764 case NET_ICMP_DEST_UNREACH: 765 rc = packet_translate_remote( net_sess, &packet,765 rc = packet_translate_remote(phone_net, &packet, 766 766 IPC_GET_PACKET(*call)); 767 767 if (rc != EOK) … … 772 772 773 773 case NET_ICMP_SOURCE_QUENCH: 774 rc = packet_translate_remote( net_sess, &packet,774 rc = packet_translate_remote(phone_net, &packet, 775 775 IPC_GET_PACKET(*call)); 776 776 if (rc != EOK) … … 780 780 781 781 case NET_ICMP_TIME_EXCEEDED: 782 rc = packet_translate_remote( net_sess, &packet,782 rc = packet_translate_remote(phone_net, &packet, 783 783 IPC_GET_PACKET(*call)); 784 784 if (rc != EOK) … … 788 788 789 789 case NET_ICMP_PARAMETERPROB: 790 rc = packet_translate_remote( net_sess, &packet,790 rc = packet_translate_remote(phone_net, &packet, 791 791 IPC_GET_PACKET(*call)); 792 792 if (rc != EOK)
Note:
See TracChangeset
for help on using the changeset viewer.