Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4270 → Rev 4271

/branches/network/uspace/srv/net/il/ip/ip.c
47,6 → 47,7
#include "../../include/sockaddr.h"
#include "../../include/socket.h"
#include "../../include/device.h"
#include "../../include/arp_messages.h"
#include "../../include/nil_messages.h"
#include "../../structures/measured_strings.h"
#include "../../structures/module_map.h"
185,18 → 186,12
return ip_netif->phone;
}
if( ip_netif->arp ){
message = async_send_3( ip_netif->arp->phone, NET_ARP_DEVICE, ip_netif->device_id, SERVICE_IP, service, & answer );
configuration[ 0 ].value = ( char * ) & ip_netif->address;
configuration[ 0 ].length = CONVERT_SIZE( in_addr_t, char, 1 );
if( ERROR_OCCURRED( measured_strings_send( ip_netif->arp->phone, & configuration[ 0 ], 1 ))){
if( ERROR_OCCURRED( arp_device_req( ip_netif->arp->phone, ip_netif->device_id, SERVICE_IP, service, & configuration[ 0 ] ))){
free( ip_netif );
return ERROR_CODE;
}
async_wait_for( message, & result );
if( ERROR_OCCURRED( result )){
free( ip_netif );
return ERROR_CODE;
}
}
index = ip_netifs_add( & ip_globals.netifs, ip_netif->device_id, ip_netif );
if( index < 0 ){
277,12 → 272,9
 
ip_netif_ref netif;
 
aid_t message;
ipc_call_t answer;
measured_string_t address;
measured_string_ref translation;
char * data;
ipcarg_t result;
 
netif = ip_netifs_find( & ip_globals.netifs, device_id );
if( ! netif ) return ENOENT;
289,21 → 281,12
// TODO state
printf( "\nip - device %d changed state to %d\n", device_id, state );
if( netif->arp ){
message = async_send_2( netif->arp->phone, NET_ARP_TRANSLATE, netif->device_id, SERVICE_IP, & answer );
address.value = ( char * ) & netif->gateway;
address.length = CONVERT_SIZE( in_addr_t, char, 1 );
if( ERROR_OCCURRED( measured_strings_send( netif->arp->phone, & address, 1 ))
|| ERROR_OCCURRED( measured_strings_return( netif->arp->phone, & translation, & data, 1 ))){
async_wait_for( message, & result );
return result;
}
async_wait_for( message, & result );
if( ! ERROR_OCCURRED( result )){
printf( "\n\tgateway translated to\t= %X:%X:%X:%X:%X:%X", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] );
}
ERROR_PROPAGATE( arp_translate_req( netif->arp->phone, netif->device_id, SERVICE_IP, & address, & translation, & data ));
printf( "\n\tgateway translated to\t= %X:%X:%X:%X:%X:%X", data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ] );
free( translation );
free( data );
return result;
}
return EOK;
}