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 ){ |