Changeset 24ab58b3 in mainline for uspace/srv/net/il/ip/ip.c
- Timestamp:
- 2010-04-06T11:41:48Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 14f1db0
- Parents:
- 4dd8529
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/il/ip/ip.c
r4dd8529 r24ab58b3 79 79 /** IP module name. 80 80 */ 81 #define NAME "IP protocol"81 #define NAME "ip" 82 82 83 83 /** IP version 4. … … 430 430 ip_route_ref route; 431 431 int index; 432 char * data;433 432 434 433 ip_netif = (ip_netif_ref) malloc(sizeof(ip_netif_t)); … … 454 453 } 455 454 // print the settings 456 printf("New device registered:\n\tid\t= %d\n\tphone\t= %d\n\tIPV\t= %d\n", ip_netif->device_id, ip_netif->phone, ip_netif->ipv); 457 printf("\tconfiguration\t= %s\n", ip_netif->dhcp ? "dhcp" : "static"); 455 printf("%s: Device registered (id: %d, phone: %d, ipv: %d, conf: %s)\n", 456 NAME, ip_netif->device_id, ip_netif->phone, ip_netif->ipv, 457 ip_netif->dhcp ? "dhcp" : "static"); 458 458 459 // TODO ipv6 addresses 459 data = (char *) malloc(INET_ADDRSTRLEN); 460 if(data){ 461 for(index = 0; index < ip_routes_count(&ip_netif->routes); ++ index){ 462 route = ip_routes_get_index(&ip_netif->routes, index); 463 if(route){ 464 printf("\tRouting %d:\n", index); 465 inet_ntop(AF_INET, (uint8_t *) &route->address.s_addr, data, INET_ADDRSTRLEN); 466 printf("\t\taddress\t= %s\n", data); 467 inet_ntop(AF_INET, (uint8_t *) &route->netmask.s_addr, data, INET_ADDRSTRLEN); 468 printf("\t\tnetmask\t= %s\n", data); 469 inet_ntop(AF_INET, (uint8_t *) &route->gateway.s_addr, data, INET_ADDRSTRLEN); 470 printf("\t\tgateway\t= %s\n", data); 471 } 472 } 473 inet_ntop(AF_INET, (uint8_t *) &ip_netif->broadcast.s_addr, data, INET_ADDRSTRLEN); 474 printf("\t\tbroadcast\t= %s\n", data); 475 free(data); 476 } 460 461 char address[INET_ADDRSTRLEN]; 462 char netmask[INET_ADDRSTRLEN]; 463 char gateway[INET_ADDRSTRLEN]; 464 465 for (index = 0; index < ip_routes_count(&ip_netif->routes); ++ index){ 466 route = ip_routes_get_index(&ip_netif->routes, index); 467 if (route) { 468 inet_ntop(AF_INET, (uint8_t *) &route->address.s_addr, address, INET_ADDRSTRLEN); 469 inet_ntop(AF_INET, (uint8_t *) &route->netmask.s_addr, netmask, INET_ADDRSTRLEN); 470 inet_ntop(AF_INET, (uint8_t *) &route->gateway.s_addr, gateway, INET_ADDRSTRLEN); 471 printf("%s: Route %d (address: %s, netmask: %s, gateway: %s)\n", 472 NAME, index, address, netmask, gateway); 473 } 474 } 475 476 inet_ntop(AF_INET, (uint8_t *) &ip_netif->broadcast.s_addr, address, INET_ADDRSTRLEN); 477 printf("%s: Broadcast (%s)\n", NAME, address); 478 477 479 fibril_rwlock_write_unlock(&ip_globals.netifs_lock); 478 480 return EOK; … … 595 597 } 596 598 netif->packet_dimension.content = mtu; 597 printf(" ip - device %d changed mtu to %d\n\n", device_id, mtu);599 printf("%s: Device %d changed MTU to %d\n", NAME, device_id, mtu); 598 600 fibril_rwlock_write_unlock(&ip_globals.netifs_lock); 599 601 return EOK; … … 611 613 } 612 614 netif->state = state; 613 printf(" ip - device %d changed state to %d\n\n", device_id, state);615 printf("%s: Device %d changed state to %d\n", NAME, device_id, state); 614 616 fibril_rwlock_write_unlock(&ip_globals.netifs_lock); 615 617 return EOK; … … 646 648 return index; 647 649 } 648 printf("New protocol registered:\n\tprotocol\t= %d\n\tphone\t= %d\n", proto->protocol, proto->phone); 650 651 printf("%s: Protocol registered (protocol: %d, phone: %d)\n", 652 NAME, proto->protocol, proto->phone); 653 649 654 fibril_rwlock_write_unlock(&ip_globals.protos_lock); 650 655 return EOK; … … 1677 1682 ERROR_DECLARE; 1678 1683 1679 /* Print the module label */1680 printf("Task %d - %s\n", task_get_id(), NAME);1681 1682 1684 /* Start the module */ 1683 if (ERROR_OCCURRED(il_module_start(il_client_connection))) { 1684 printf(" - ERROR %i\n", ERROR_CODE); 1685 if (ERROR_OCCURRED(il_module_start(il_client_connection))) 1685 1686 return ERROR_CODE; 1686 }1687 1687 1688 1688 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.