#include #include #include "common.h" #include "lwip.h" #include "lwip/netif.h" #include "net/ipv4/addr.h" #include "shell.h" #define ENABLE_DEBUG 1 #include "debug.h" static int ifconfig(int argc, char **argv) { /* Silent compiler Wunused */ (void)argc; (void)argv; for (struct netif *iface = netif_list; iface != NULL; iface = iface->next) { printf("%s_%02u: ", iface->name, iface->num); #ifdef MODULE_LWIP_IPV4 char addrstr[IPV4_ADDR_MAX_STR_LEN]; printf(" inet %s\n", ipv4_addr_to_str(addrstr, (ipv4_addr_t *)&iface->ip_addr, sizeof(addrstr))); #endif } return 0; } static const shell_command_t shell_commands[] = { { "ifconfig", "Shows assigned IPv4 addresses", ifconfig }, { NULL, NULL, NULL } }; static char line_buf[SHELL_DEFAULT_BUFSIZE]; int main(void) { DEBUG("[DEBUG]: ON\n"); puts("[*] System started"); shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE); /* should be never reached */ return 0; }