diff options
Diffstat (limited to 'src/user/app/netstack/netstack.c')
-rw-r--r-- | src/user/app/netstack/netstack.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/user/app/netstack/netstack.c b/src/user/app/netstack/netstack.c index 0451511..137d9d9 100644 --- a/src/user/app/netstack/netstack.c +++ b/src/user/app/netstack/netstack.c @@ -10,7 +10,6 @@ struct net_state state = { // TODO dynamically get mac .mac = {0x52, 0x54, 0x00, 0xCA, 0x77, 0x1A}, - .ip = (192 << 24) + (168 << 16) + 11, }; void network_thread(void *arg) { (void)arg; @@ -27,10 +26,14 @@ void network_thread(void *arg) { (void)arg; void fs_thread(void *arg); int main(int argc, char **argv) { - if (argc < 2) { - eprintf("no argument"); + if (argc < 3) { + eprintf("usage: netstack iface ip"); return 1; } + if (ip_parse(argv[2], &state.ip) < 0) { + eprintf("invalid ip"); + return -1; + } state.raw_h = _syscall_open(argv[1], strlen(argv[1]), 0); if (state.raw_h < 0) { eprintf("couldn't open %s", argv[1]); |