diff --git a/cpu/native/startup.c b/cpu/native/startup.c index 262f706b05..d760ebf747 100644 --- a/cpu/native/startup.c +++ b/cpu/native/startup.c @@ -115,6 +115,9 @@ static const char short_opts[] = ":hi:s:deEoc:" #endif #ifdef MODULE_PERIPH_SPIDEV_LINUX "p:" +#endif +#ifdef MODULE_NETDEV_TAP + "w:" #endif ""; @@ -367,6 +370,11 @@ void usage_exit(int status) " -M , --eeprom=\n" " Specify the file path where the EEPROM content is stored\n" " Example: --eeprom=/tmp/riot_native.eeprom\n"); +#endif +#ifdef MODULE_NETDEV_TAP + real_printf( +" -w \n" +" Add a tap interface as a wireless interface\n"); #endif real_exit(status); } @@ -468,6 +476,9 @@ __attribute__((constructor)) static void startup(int argc, char **argv, char **e _native_id = _native_pid; int c, opt_idx = 0, uart = 0; +#ifdef MODULE_NETDEV_TAP + unsigned taps = 0; +#endif #ifdef MODULE_SOCKET_ZEP unsigned zeps = 0; #endif @@ -575,6 +586,13 @@ __attribute__((constructor)) static void startup(int argc, char **argv, char **e strncpy(eeprom_file, optarg, EEPROM_FILEPATH_MAX_LEN); break; } +#endif +#ifdef MODULE_NETDEV_TAP + case 'w': + netdev_tap_params[taps].tap_name = &argv[optind - 1]; + netdev_tap_params[taps].wired = false; + ++taps; + break; #endif default: usage_exit(EXIT_FAILURE); @@ -582,7 +600,7 @@ __attribute__((constructor)) static void startup(int argc, char **argv, char **e } } #ifdef MODULE_NETDEV_TAP - for (int i = 0; i < NETDEV_TAP_MAX; i++) { + for (unsigned i = 0; i < NETDEV_TAP_MAX - taps; i++) { if (argv[optind + i] == NULL) { /* no tap parameter left */ usage_exit(EXIT_FAILURE); @@ -653,9 +671,9 @@ __attribute__((constructor)) static void startup(int argc, char **argv, char **e native_cpu_init(); native_interrupt_init(); #ifdef MODULE_NETDEV_TAP - for (int i = 0; i < NETDEV_TAP_MAX; i++) { - netdev_tap_params[i].tap_name = &argv[optind + i]; - netdev_tap_params[i].wired = true; + for (unsigned i = 0; taps < NETDEV_TAP_MAX; ++taps, ++i) { + netdev_tap_params[taps].tap_name = &argv[optind + i]; + netdev_tap_params[taps].wired = true; } #endif