lwip: use netifapi
The netifapi makes sure, that all operations are done in the context of the tcpip-thread. Issue #1327.
This commit is contained in:
parent
5518a21692
commit
6c6375aa83
|
@ -163,13 +163,13 @@ extern "C" {
|
||||||
*
|
*
|
||||||
* See: http://lwip.wikia.com/wiki/Writing_a_device_driver
|
* See: http://lwip.wikia.com/wiki/Writing_a_device_driver
|
||||||
*/
|
*/
|
||||||
struct netif *ret = netif_add(&netif, &ip, &nm, &gw, &nbs,
|
err_t ret = netifapi_netif_add(&netif, &ip, &nm, &gw, &nbs,
|
||||||
genode_netif_init, tcpip_input);
|
genode_netif_init, tcpip_input);
|
||||||
if (!ret)
|
if (ret != ERR_OK)
|
||||||
throw Nic_not_availble();
|
throw Nic_not_availble();
|
||||||
|
|
||||||
/* Set Genode's nic as the default nic */
|
/* 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 no static ip was set, we do dhcp */
|
||||||
if (!ip_addr) {
|
if (!ip_addr) {
|
||||||
|
@ -178,13 +178,14 @@ extern "C" {
|
||||||
netif.status_callback = dhcp_callback;
|
netif.status_callback = dhcp_callback;
|
||||||
|
|
||||||
/* Start DHCP requests */
|
/* Start DHCP requests */
|
||||||
dhcp_start(&netif);
|
netifapi_dhcp_start(&netif);
|
||||||
|
|
||||||
/* Block until DHCP succeeded or a timeout was triggered */
|
/* Block until DHCP succeeded or a timeout was triggered */
|
||||||
try {
|
try {
|
||||||
dhcp_semaphore()->down(20000);
|
dhcp_semaphore()->down(20000);
|
||||||
} catch (Genode::Timeout_exception) {
|
} catch (Genode::Timeout_exception) {
|
||||||
PWRN("DHCP timed out!");
|
PWRN("DHCP timed out!");
|
||||||
|
netifapi_dhcp_stop(&netif);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
PINF("got IP address %d.%d.%d.%d",
|
PINF("got IP address %d.%d.%d.%d",
|
||||||
|
@ -197,7 +198,7 @@ extern "C" {
|
||||||
return 1;
|
return 1;
|
||||||
#endif /* LWIP_DHCP */
|
#endif /* LWIP_DHCP */
|
||||||
} else {
|
} else {
|
||||||
netif_set_up(&netif);
|
netifapi_netif_set_up(&netif);
|
||||||
}
|
}
|
||||||
} catch (Nic_not_availble) {
|
} catch (Nic_not_availble) {
|
||||||
PWRN("NIC not available, loopback is used as default");
|
PWRN("NIC not available, loopback is used as default");
|
||||||
|
|
Loading…
Reference in New Issue