Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4735 → Rev 4743

/branches/network/uspace/srv/net/il/arp/arp.c
328,7 → 328,7
}
device->service = service;
// bind the new one
device->phone = bind_service( device->service, ( ipcarg_t ) device->device_id, SERVICE_ARP, 0, arp_globals.client_connection );
device->phone = nil_bind_service( device->service, ( ipcarg_t ) device->device_id, SERVICE_ARP, arp_globals.client_connection );
if( device->phone < 0 ){
fibril_rwlock_write_unlock( & arp_globals.lock );
arp_protos_destroy( & device->protos );
343,7 → 343,7
return ERROR_CODE;
}
// get hardware address
if( ERROR_OCCURRED( nil_get_addr( device->phone, device_id, & device->addr, & device->addr_data ))){
if( ERROR_OCCURRED( nil_get_addr_req( device->phone, device_id, & device->addr, & device->addr_data ))){
fibril_rwlock_write_unlock( & arp_globals.lock );
arp_protos_destroy( & device->protos );
free( device );
350,7 → 350,7
return ERROR_CODE;
}
// get broadcast address
if( ERROR_OCCURRED( nil_get_broadcast_addr( device->phone, device_id, & device->broadcast_addr, & device->broadcast_data ))){
if( ERROR_OCCURRED( nil_get_broadcast_addr_req( device->phone, device_id, & device->broadcast_addr, & device->broadcast_data ))){
fibril_rwlock_write_unlock( & arp_globals.lock );
free( device->addr );
free( device->addr_data );
/branches/network/uspace/srv/net/il/ip/ip_client.c
117,7 → 117,7
struct sockaddr_in * address_in;
 
if( !( header && headerlen )) return EBADMEM;
if( !( src && dest && ( srclen >= sizeof( struct sockaddr )) && ( srclen == destlen ) && ( src->sa_family == dest->sa_family ))) return EINVAL;
if( !( src && dest && ( srclen > 0 ) && (( size_t ) srclen >= sizeof( struct sockaddr )) && ( srclen == destlen ) && ( src->sa_family == dest->sa_family ))) return EINVAL;
switch( src->sa_family ){
case AF_INET:
if( srclen != sizeof( struct sockaddr_in )) return EINVAL;
/branches/network/uspace/srv/net/il/ip/ip.c
53,7 → 53,7
 
#include "../../include/arp_interface.h"
#include "../../include/byteorder.h"
#include "../../include/crc.h"
#include "../../include/checksum.h"
#include "../../include/device.h"
#include "../../include/icmp_client.h"
#include "../../include/icmp_codes.h"
271,11 → 271,7
}
}
inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->broadcast.s_addr, data, INET_ADDRSTRLEN );
printf( "\tbroadcast\t= %s\n", data );
inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->dns1, data, INET_ADDRSTRLEN );
printf( "\tdns1\t= %s\n", data );
inet_ntop( AF_INET, ( uint8_t * ) & ip_netif->dns2, data, INET_ADDRSTRLEN );
printf( "\tdns2\t= %s\n", data );
printf( "\t\tbroadcast\t= %s\n", data );
free( data );
}
fibril_rwlock_write_unlock( & ip_globals.netifs_lock );
285,7 → 281,7
int ip_netif_initialize( ip_netif_ref ip_netif ){
ERROR_DECLARE;
 
measured_string_t names[] = {{ "IPV", 3 }, { "IP_CONFIG", 9 }, { "IP_ADDR", 7 }, { "NETMASK", 7 }, { "GATEWAY", 7 }, { "BROADCAST", 9 }, { "DNS1", 4 }, { "DNS2", 4 }, { "ARP", 3 }, { "IP_ROUTING", 10 }};
measured_string_t names[] = {{ "IPV", 3 }, { "IP_CONFIG", 9 }, { "IP_ADDR", 7 }, { "IP_NETMASK", 10 }, { "IP_GATEWAY", 10 }, { "IP_BROADCAST", 12 }, { "ARP", 3 }, { "IP_ROUTING", 10 }};
measured_string_ref configuration;
size_t count = sizeof( names ) / sizeof( measured_string_t );
char * data;
330,9 → 326,7
if( ERROR_OCCURRED( inet_pton( AF_INET, configuration[ 2 ].value, ( uint8_t * ) & route->address.s_addr ))
|| ERROR_OCCURRED( inet_pton( AF_INET, configuration[ 3 ].value, ( uint8_t * ) & route->netmask.s_addr ))
|| ( inet_pton( AF_INET, configuration[ 4 ].value, ( uint8_t * ) & gateway.s_addr ) == EINVAL )
|| ( inet_pton( AF_INET, configuration[ 5 ].value, ( uint8_t * ) & ip_netif->broadcast.s_addr ) == EINVAL )
|| ( inet_pton( AF_INET, configuration[ 6 ].value, ( uint8_t * ) & ip_netif->dns1 ) == EINVAL )
|| ( inet_pton( AF_INET, configuration[ 7 ].value, ( uint8_t * ) & ip_netif->dns2 ) == EINVAL )){
|| ( inet_pton( AF_INET, configuration[ 5 ].value, ( uint8_t * ) & ip_netif->broadcast.s_addr ) == EINVAL )){
net_free_settings( configuration, data );
return EINVAL;
}
341,21 → 335,21
net_free_settings( configuration, data );
return ENOTSUP;
}
if( configuration[ 8 ].value ){
ip_netif->arp = get_running_module( & ip_globals.modules, configuration[ 8 ].value );
if( configuration[ 6 ].value ){
ip_netif->arp = get_running_module( & ip_globals.modules, configuration[ 6 ].value );
if( ! ip_netif->arp ){
printf( "Failed to start the arp %s\n", configuration[ 8 ].value );
printf( "Failed to start the arp %s\n", configuration[ 6 ].value );
net_free_settings( configuration, data );
return EINVAL;
}
}
if( configuration[ 9 ].value ){
ip_netif->routing = ( configuration[ 9 ].value[ 0 ] == 'y' );
if( configuration[ 7 ].value ){
ip_netif->routing = ( configuration[ 7 ].value[ 0 ] == 'y' );
}
net_free_settings( configuration, data );
}
// binds the netif service which also initializes the device
ip_netif->phone = bind_service( ip_netif->service, ( ipcarg_t ) ip_netif->device_id, SERVICE_IP, 0, ip_globals.client_connection );
ip_netif->phone = nil_bind_service( ip_netif->service, ( ipcarg_t ) ip_netif->device_id, SERVICE_IP, ip_globals.client_connection );
if( ip_netif->phone < 0 ){
printf( "Failed to contact the nil service %d\n", ip_netif->service );
return ip_netif->phone;
469,7 → 463,7
if( addrlen < 0 ){
return ip_release_and_return( packet, addrlen );
}
if( addrlen < sizeof( struct sockaddr )){
if(( size_t ) addrlen < sizeof( struct sockaddr )){
return ip_release_and_return( packet, EINVAL );
}
switch( addr->sa_family ){
1290,7 → 1284,7
 
if( !( destination && ( addrlen > 0 ))) return EINVAL;
if( !( device_id && header && headerlen )) return EBADMEM;
if( addrlen < sizeof( struct sockaddr )){
if(( size_t ) addrlen < sizeof( struct sockaddr )){
return EINVAL;
}
switch( destination->sa_family ){
/branches/network/uspace/srv/net/il/ip/Makefile
39,7 → 39,7
$(NAME).c \
$(NAME)_client.c \
$(NAME)_module.c \
$(NET_BASE)crc.c \
$(NET_BASE)checksum.c \
$(NET_BASE)inet.c \
$(NET_BASE)module.c \
$(NET_BASE)modules.c \
/branches/network/uspace/srv/net/il/ip/ip.h
133,12 → 133,6
/** Broadcast address.
*/
in_addr_t broadcast;
/** First DNS address.
*/
in_addr_t dns1;
/** Second DNS address.
*/
in_addr_t dns2;
/** Routing table.
*/
ip_routes_t routes;