void system_get_apcli0_ip(void){ _show_all_interfaces(); //ifconfig apcli0 show_network_interface(&printf, argv[0]); // show route show_network_tables(&printf); }
static void do_test( cyg_serial_baud_rate_t baud ) { cyg_ppp_options_t options; cyg_ppp_handle_t ppp_handle; int i = 0; ppp_test_announce( "PPP_UP" ); cyg_ppp_options_init( &options ); // options.debug = 1; // options.kdebugflag = 1; options.baud = baud; show_network_tables( diag_printf ); ppp_handle = cyg_ppp_up( CYGPKG_PPP_TEST_DEVICE, &options ); CYG_TEST_INFO( "Waiting for PPP to come up"); cyg_ppp_wait_up( ppp_handle ); CYG_TEST_INFO( "Waiting until remote end goes down"); while( cyg_ppp_wait_up( ppp_handle ) == 0 ) { i++; if( (i % 60) == 0 ) show_network_tables( diag_printf ); cyg_thread_delay(100); } cyg_ppp_wait_down( ppp_handle ); }
int main(void) { //firewall char * ipfw_command2[] = {"add","set", "3", "allow", "all", "from", "192.168.2.100", "to", "192.168.1.100"}; char * ipfw_command1[] = {"add","set", "2", "allow", "all", "from", "192.168.1.100", "to", "192.168.2.100"}; //char * ipfw_nat_config1[] = {"nat-config", "1", "ip", "192.168.1.1", "redirect_addr", "192.168.2.100", "192.168.5.1"}; //char * ipfw_nat_config2[] = {"nat-config", "2", "if", "eth1", "redirect_addr", "192.168.1.100", "192.168.2.1"}; //char * ipfw_nat1[] = {"add", "nat", "1", "ip", "from", "192.168.2.100", "to","192.168.1.100"}; //char * ipfw_nat2[] = {"add", "nat", "2", "ip", "from", "192.168.2.100", "to","192.168.2.1"}; //vnet_ipfw_init(); //ipfw_nat_init(); //struct cfg_nat cfg; //(*ipfw_nat_cfg_ptr)(&cfg); //ipfw_config_nat(sizeof(ipfw_nat_config2)/sizeof(char*), ipfw_nat_config2); //ipfw_config_nat(sizeof(ipfw_nat_config1)/sizeof(char*), ipfw_nat_config1); //ipfw_add(&ipfw_nat2); //ipfw_add(&ipfw_nat1); //ipfw_add(&ipfw_command1); //ipfw_add(&ipfw_command2); init_all_network_interfaces(); //routing cyg_route_init(); cyg_route_reinit(); //example - transfers packets from 192.168.5.0/24 to 192.168.2.100 via eth0 //add_route("eth0", "192.168.5.1", "255.255.255.0", "192.168.2.100"); //mandatory for proper routing, do not remove add_route("eth0", "192.168.2.100", "255.255.255.0", "192.168.2.100"); add_route("eth1", "192.168.1.100", "255.255.255.0", "192.168.1.100"); show_network_tables(printf); printf("Hello, eCos world!\n"); while (1) { printf("Sleeping\n"); cyg_thread_delay(1000); } return 0; }