mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #7404 from miri64/gnrc_netif2/feat/sc
shell_commands: port ifconfig command for gnrc_netif2
This commit is contained in:
commit
c8a025635a
@ -22,14 +22,24 @@
|
||||
#include "log.h"
|
||||
#include "debug.h"
|
||||
#include "netdev_tap_params.h"
|
||||
#ifdef MODULE_GNRC_NETIF2
|
||||
#include "net/gnrc/netif2/ethernet.h"
|
||||
#else
|
||||
#include "net/gnrc/netdev/eth.h"
|
||||
#endif
|
||||
|
||||
#define TAP_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)
|
||||
#ifdef MODULE_GNRC_NETIF2
|
||||
#define TAP_MAC_PRIO (GNRC_NETIF2_PRIO)
|
||||
#else
|
||||
#define TAP_MAC_PRIO (THREAD_PRIORITY_MAIN - 3)
|
||||
#endif
|
||||
|
||||
static netdev_tap_t netdev_tap[NETDEV_TAP_MAX];
|
||||
static char _netdev_eth_stack[NETDEV_TAP_MAX][TAP_MAC_STACKSIZE + DEBUG_EXTRA_STACKSIZE];
|
||||
#ifndef MODULE_GNRC_NETIF2
|
||||
static gnrc_netdev_t _gnrc_netdev_tap[NETDEV_TAP_MAX];
|
||||
#endif
|
||||
|
||||
void auto_init_netdev_tap(void)
|
||||
{
|
||||
@ -40,11 +50,21 @@ void auto_init_netdev_tap(void)
|
||||
i, *(p->tap_name));
|
||||
|
||||
netdev_tap_setup(&netdev_tap[i], p);
|
||||
#ifdef MODULE_GNRC_NETIF2
|
||||
if (!gnrc_netif2_ethernet_create(_netdev_eth_stack[i],
|
||||
TAP_MAC_STACKSIZE,
|
||||
TAP_MAC_PRIO, "gnrc_netdev_tap",
|
||||
&netdev_tap[i].netdev)) {
|
||||
LOG_ERROR("[auto_init_netif] error initializing TAP %s\n",
|
||||
*(p->tap_name));
|
||||
}
|
||||
#else
|
||||
gnrc_netdev_eth_init(&_gnrc_netdev_tap[i], (netdev_t*)&netdev_tap[i]);
|
||||
|
||||
gnrc_netdev_init(_netdev_eth_stack[i], TAP_MAC_STACKSIZE,
|
||||
TAP_MAC_PRIO, "gnrc_netdev_tap",
|
||||
&_gnrc_netdev_tap[i]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,9 @@ endif
|
||||
ifneq (,$(filter gnrc_netif,$(USEMODULE)))
|
||||
SRC += sc_netif.c
|
||||
endif
|
||||
ifneq (,$(filter gnrc_netif2,$(USEMODULE)))
|
||||
SRC += sc_gnrc_netif2.c
|
||||
endif
|
||||
ifneq (,$(filter fib,$(USEMODULE)))
|
||||
SRC += sc_fib.c
|
||||
endif
|
||||
|
1140
sys/shell/commands/sc_gnrc_netif2.c
Normal file
1140
sys/shell/commands/sc_gnrc_netif2.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -93,6 +93,13 @@ extern int _netif_config(int argc, char **argv);
|
||||
extern int _netif_send(int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_GNRC_NETIF2
|
||||
extern int _gnrc_netif2_config(int argc, char **argv);
|
||||
#ifdef MODULE_GNRC_TXTSND
|
||||
extern int _gnrc_netif2_send(int argc, char **argv);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_FIB
|
||||
extern int _fib_route_handler(int argc, char **argv);
|
||||
#endif
|
||||
@ -189,12 +196,18 @@ const shell_command_t _shell_command_list[] = {
|
||||
#ifdef MODULE_GNRC_IPV6_NIB
|
||||
{"nib", "Configure neighbor information base", _gnrc_ipv6_nib},
|
||||
#endif
|
||||
#ifdef MODULE_GNRC_NETIF
|
||||
#if defined(MODULE_GNRC_NETIF) && !defined(MODULE_GNRC_NETIF2)
|
||||
{"ifconfig", "Configure network interfaces", _netif_config},
|
||||
#ifdef MODULE_GNRC_TXTSND
|
||||
{"txtsnd", "Sends a custom string as is over the link layer", _netif_send },
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MODULE_GNRC_NETIF2
|
||||
{"ifconfig", "Configure network interfaces", _gnrc_netif2_config},
|
||||
#ifdef MODULE_GNRC_TXTSND
|
||||
{"txtsnd", "Sends a custom string as is over the link layer", _gnrc_netif2_send },
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MODULE_FIB
|
||||
{"fibroute", "Manipulate the FIB (info: 'fibroute [add|del]')", _fib_route_handler},
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user