Subversion Repositories HelenOS

Rev

Rev 4730 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4730 Rev 4743
Line 61... Line 61...
61
#include "../include/nil_interface.h"
61
#include "../include/nil_interface.h"
62
#include "../include/net_interface.h"
62
#include "../include/net_interface.h"
63
#include "../include/ip_interface.h"
63
#include "../include/ip_interface.h"
64
 
64
 
65
#include "net.h"
65
#include "net.h"
-
 
66
#include "net_messages.h"
66
 
67
 
67
/** Networking module name.
68
/** Networking module name.
68
 */
69
 */
69
#define NAME    "Networking"
70
#define NAME    "Networking"
70
 
71
 
Line 248... Line 249...
248
 
249
 
249
    * answer_count = 0;
250
    * answer_count = 0;
250
    switch( IPC_GET_METHOD( * call )){
251
    switch( IPC_GET_METHOD( * call )){
251
        case IPC_M_PHONE_HUNGUP:
252
        case IPC_M_PHONE_HUNGUP:
252
            return EOK;
253
            return EOK;
253
        case NET_NET_DEVICE:
-
 
254
            // TODO configure, register
-
 
255
            printf( "Networking: new netif %d\n", IPC_GET_DEVICE( call ));
-
 
256
            return EOK;
-
 
257
        case NET_NET_GET_DEVICE_CONF:
254
        case NET_NET_GET_DEVICE_CONF:
258
            ERROR_PROPAGATE( measured_strings_receive( & strings, & data, IPC_GET_COUNT( call )));
255
            ERROR_PROPAGATE( measured_strings_receive( & strings, & data, IPC_GET_COUNT( call )));
259
            net_get_device_conf_req( 0, IPC_GET_DEVICE( call ), & strings, IPC_GET_COUNT( call ), NULL );
256
            net_get_device_conf_req( 0, IPC_GET_DEVICE( call ), & strings, IPC_GET_COUNT( call ), NULL );
260
            // strings should not contain received data anymore
257
            // strings should not contain received data anymore
261
            free( data );
258
            free( data );
Line 345... Line 342...
345
int read_configuration( void ){
342
int read_configuration( void ){
346
    ERROR_DECLARE;
343
    ERROR_DECLARE;
347
 
344
 
348
    // read general configuration
345
    // read general configuration
349
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "IPV", "4" ));
346
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "IPV", "4" ));
-
 
347
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "IP_ROUTING", "no" ));
350
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "MTU", "1500" ));
348
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "MTU", "1500" ));
351
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "ICMP_ERROR_REPORTING", "yes" ));  //anything else not starting with 'y'
349
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "ICMP_ERROR_REPORTING", "yes" ));  //anything else not starting with 'y'
352
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "ICMP_ECHO_REPLYING", "yes" ));  //anything else not starting with 'y'
350
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "ICMP_ECHO_REPLYING", "yes" ));  //anything else not starting with 'y'
353
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "UDP_CHECKSUM_COMPUTING", "yes" ));  //anything else not starting with 'y'
351
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "UDP_CHECKSUM_COMPUTING", "yes" ));  //anything else not starting with 'y'
354
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "UDP_AUTOBINDING", "yes" ));  //anything else not starting with 'y'
352
    ERROR_PROPAGATE( add_configuration( & net_globals.configuration, "UDP_AUTOBINDING", "yes" ));  //anything else not starting with 'y'
Line 362... Line 360...
362
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", LO_NAME ));
360
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", LO_NAME ));
363
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", LO_NAME ));
361
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", LO_NAME ));
364
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME ));
362
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IL", IP_NAME ));
365
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
363
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
366
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" ));
364
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "127.0.0.1" ));
367
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" ));
-
 
368
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.0.0.0" ));
365
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_NETMASK", "255.0.0.0" ));
369
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "15535" ));
366
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "15535" ));
370
    }else if( str_lcmp( name, "ne2k", 4 ) == 0 ){
367
    }else if( str_lcmp( name, "ne2k", 4 ) == 0 ){
371
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", "eth0" ));
368
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NAME", "eth0" ));
372
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", DP8390_NAME ));
369
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETIF", DP8390_NAME ));
373
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "ETH_MODE", "DIX" )); //8023_2_LSAP( not supported ), 8023_2_SNAP
370
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "ETH_MODE", "DIX" )); //8023_2_LSAP( not supported ), 8023_2_SNAP
Line 377... Line 374...
377
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IO", "300" ));
374
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IO", "300" ));
378
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "576" ));
375
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "MTU", "576" ));
379
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
376
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_CONFIG", "static" ));
380
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "10.0.2.15" ));
377
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ADDR", "10.0.2.15" ));
381
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" ));
378
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_ROUTING", "yes" ));
382
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "NETMASK", "255.255.255.240" ));
379
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_NETMASK", "255.255.255.240" ));
383
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "BROADCAST", "10.0.2.255" ));
380
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_BROADCAST", "10.0.2.255" ));
384
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "GATEWAY", "10.0.2.2" ));
381
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "IP_GATEWAY", "10.0.2.2" ));
385
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS1", "10.0.2.2" ));
-
 
386
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "DNS2", "10.0.2.2" ));
-
 
387
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "ARP", "arp" ));
382
        ERROR_PROPAGATE( add_configuration( & netif->configuration, "ARP", "arp" ));
388
    }
383
    }
389
    return read_netif_configuration_build( name, netif );
384
    return read_netif_configuration_build( name, netif );
390
}
385
}
391
 
386