From 6c6375aa833de15a50492cb5ab1dcc00ebc44d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 12 Mar 2015 14:12:31 +0100 Subject: [PATCH] lwip: use netifapi The netifapi makes sure, that all operations are done in the context of the tcpip-thread. Issue #1327. --- repos/libports/src/lib/lwip/platform/sys_arch.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/repos/libports/src/lib/lwip/platform/sys_arch.cc b/repos/libports/src/lib/lwip/platform/sys_arch.cc index 4b5745198..c660f9ad1 100644 --- a/repos/libports/src/lib/lwip/platform/sys_arch.cc +++ b/repos/libports/src/lib/lwip/platform/sys_arch.cc @@ -163,13 +163,13 @@ extern "C" { * * See: http://lwip.wikia.com/wiki/Writing_a_device_driver */ - struct netif *ret = netif_add(&netif, &ip, &nm, &gw, &nbs, - genode_netif_init, tcpip_input); - if (!ret) + err_t ret = netifapi_netif_add(&netif, &ip, &nm, &gw, &nbs, + genode_netif_init, tcpip_input); + if (ret != ERR_OK) throw Nic_not_availble(); /* Set Genode's nic as the default nic */ - netif_set_default(&netif); + netifapi_netif_set_default(&netif); /* If no static ip was set, we do dhcp */ if (!ip_addr) { @@ -178,13 +178,14 @@ extern "C" { netif.status_callback = dhcp_callback; /* Start DHCP requests */ - dhcp_start(&netif); + netifapi_dhcp_start(&netif); /* Block until DHCP succeeded or a timeout was triggered */ try { dhcp_semaphore()->down(20000); } catch (Genode::Timeout_exception) { PWRN("DHCP timed out!"); + netifapi_dhcp_stop(&netif); return 1; } PINF("got IP address %d.%d.%d.%d", @@ -197,7 +198,7 @@ extern "C" { return 1; #endif /* LWIP_DHCP */ } else { - netif_set_up(&netif); + netifapi_netif_set_up(&netif); } } catch (Nic_not_availble) { PWRN("NIC not available, loopback is used as default");