Changes in uspace/srv/net/net/net.c [ffa2c8ef:ee2fa30a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/net/net.c
rffa2c8ef ree2fa30a 36 36 */ 37 37 38 #include "net.h"39 40 38 #include <async.h> 41 39 #include <ctype.h> … … 46 44 #include <str.h> 47 45 #include <str_error.h> 48 46 #include <ns.h> 49 47 #include <ipc/services.h> 50 48 #include <ipc/net.h> … … 52 50 #include <ipc/il.h> 53 51 #include <ipc/nil.h> 54 55 52 #include <net/modules.h> 56 53 #include <net/packet.h> 57 54 #include <net/device.h> 58 59 55 #include <adt/char_map.h> 60 56 #include <adt/generic_char_map.h> 61 57 #include <adt/measured_strings.h> 62 58 #include <adt/module_map.h> 63 64 59 #include <netif_remote.h> 65 60 #include <nil_remote.h> 66 61 #include <net_interface.h> 67 62 #include <ip_interface.h> 63 #include "net.h" 68 64 69 65 /** Networking module name. */ … … 289 285 if (rc != EOK) 290 286 return rc; 287 291 288 rc = add_module(NULL, &net_globals.modules, (uint8_t *) NE2000_NAME, 292 289 (uint8_t *) NE2000_FILENAME, SERVICE_NE2000, 0, connect_to_service); 293 290 if (rc != EOK) 294 291 return rc; 292 295 293 rc = add_module(NULL, &net_globals.modules, (uint8_t *) ETHERNET_NAME, 296 294 (uint8_t *) ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service); 297 295 if (rc != EOK) 298 296 return rc; 297 299 298 rc = add_module(NULL, &net_globals.modules, (uint8_t *) NILDUMMY_NAME, 300 299 (uint8_t *) NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service); … … 336 335 goto out; 337 336 338 rc = async_connect_to_me(PHONE_NS, SERVICE_NETWORKING, 0, 0, NULL);337 rc = service_register(SERVICE_NETWORKING); 339 338 if (rc != EOK) 340 339 goto out; … … 390 389 } 391 390 392 int net_get_conf_req(int net_phone,measured_string_t **configuration,391 static int net_get_conf_req_local(measured_string_t **configuration, 393 392 size_t count, uint8_t **data) 394 393 { … … 399 398 } 400 399 401 int net_get_device_conf_req(int net_phone,device_id_t device_id,400 static int net_get_device_conf_req_local(device_id_t device_id, 402 401 measured_string_t **configuration, size_t count, uint8_t **data) 403 402 { … … 475 474 uintptr_t io = setting ? strtol((char *) setting->value, NULL, 16) : 0; 476 475 477 rc = netif_probe_req(netif->driver-> phone, netif->id, irq, (void *) io);476 rc = netif_probe_req(netif->driver->sess, netif->id, irq, (void *) io); 478 477 if (rc != EOK) 479 478 return rc; … … 488 487 489 488 int mtu = setting ? strtol((char *) setting->value, NULL, 10) : 0; 490 491 rc = nil_device_req(netif->nil->phone, netif->id, mtu, 489 rc = nil_device_req(netif->nil->sess, netif->id, mtu, 492 490 netif->driver->service); 493 491 if (rc != EOK) … … 499 497 500 498 /* Inter-network layer startup */ 501 switch (netif->il->service) { 502 case SERVICE_IP: 503 rc = ip_device_req(netif->il->phone, netif->id, 504 internet_service); 505 if (rc != EOK) 506 return rc; 507 break; 508 default: 509 return ENOENT; 510 } 511 512 return netif_start_req(netif->driver->phone, netif->id); 499 rc = ip_device_req(netif->il->sess, netif->id, internet_service); 500 if (rc != EOK) 501 return rc; 502 503 return netif_start_req(netif->driver->sess, netif->id); 513 504 } 514 505 … … 552 543 rc = read_netif_configuration(conf_files[i], netif); 553 544 if (rc != EOK) { 554 measured_strings_destroy(&netif->configuration );545 measured_strings_destroy(&netif->configuration, free); 555 546 free(netif); 556 547 return rc; … … 562 553 if (!setting) { 563 554 fprintf(stderr, "%s: Network interface name is missing\n", NAME); 564 measured_strings_destroy(&netif->configuration );555 measured_strings_destroy(&netif->configuration, free); 565 556 free(netif); 566 557 return EINVAL; … … 571 562 int index = netifs_add(&net_globals.netifs, netif->id, netif); 572 563 if (index < 0) { 573 measured_strings_destroy(&netif->configuration );564 measured_strings_destroy(&netif->configuration, free); 574 565 free(netif); 575 566 return index; … … 583 574 index); 584 575 if (rc != EOK) { 585 measured_strings_destroy(&netif->configuration );586 netifs_exclude_index(&net_globals.netifs, index );576 measured_strings_destroy(&netif->configuration, free); 577 netifs_exclude_index(&net_globals.netifs, index, free); 587 578 return rc; 588 579 } … … 590 581 rc = start_device(netif); 591 582 if (rc != EOK) { 592 printf("%s: Error startinginterface %s (%s)\n", NAME,583 printf("%s: Ignoring failed interface %s (%s)\n", NAME, 593 584 netif->name, str_error(rc)); 594 measured_strings_destroy(&netif->configuration); 595 netifs_exclude_index(&net_globals.netifs, index); 596 597 return rc; 585 measured_strings_destroy(&netif->configuration, free); 586 netifs_exclude_index(&net_globals.netifs, index, free); 587 continue; 598 588 } 599 589 … … 636 626 637 627 *answer_count = 0; 628 629 if (!IPC_GET_IMETHOD(*call)) 630 return EOK; 631 638 632 switch (IPC_GET_IMETHOD(*call)) { 639 case IPC_M_PHONE_HUNGUP:640 return EOK;641 633 case NET_NET_GET_DEVICE_CONF: 642 634 rc = measured_strings_receive(&strings, &data, … … 644 636 if (rc != EOK) 645 637 return rc; 646 net_get_device_conf_req (0,IPC_GET_DEVICE(*call), &strings,638 net_get_device_conf_req_local(IPC_GET_DEVICE(*call), &strings, 647 639 IPC_GET_COUNT(*call), NULL); 648 640 … … 658 650 if (rc != EOK) 659 651 return rc; 660 net_get_conf_req (0,&strings, IPC_GET_COUNT(*call), NULL);652 net_get_conf_req_local(&strings, IPC_GET_COUNT(*call), NULL); 661 653 662 654 /* Strings should not contain received data anymore */ … … 675 667 /** Default thread for new connections. 676 668 * 677 * @param[in] iid The initial message identifier.669 * @param[in] iid The initial message identifier. 678 670 * @param[in] icall The initial message call structure. 679 * 680 */ 681 static void net_client_connection(ipc_callid_t iid, ipc_call_t *icall) 671 * @param[in] arg Local argument. 672 * 673 */ 674 static void net_client_connection(ipc_callid_t iid, ipc_call_t *icall, 675 void *arg) 682 676 { 683 677 /* … … 701 695 702 696 /* End if told to either by the message or the processing result */ 703 if (( IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))697 if ((!IPC_GET_IMETHOD(call)) || (res == EHANGUP)) 704 698 return; 705 699
Note:
See TracChangeset
for help on using the changeset viewer.