Mihai Pogonaru [Sat, 15 Jun 2019 13:18:19 +0000 (16:18 +0300)]
Provide gethostbyname and gethostbyname_r
Define gethostbyname and gethostbyname_r as their LWIP counterparts.
The defines are in place in origin/netdb.h, but they are protected by
LWIP_COMPAT_SOCKETS, which for us is defined as 0 since we provide
wrappers for most of socket.h functions.
Signed-off-by: Mihai Pogonaru <pogonarumihai@gmail.com> Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
Florian Schmidt [Mon, 20 May 2019 11:29:51 +0000 (13:29 +0200)]
Provide poll() and select() wrappers around lwip versions
This takes the vfscore-provided file descriptors, translates them into
lwip file descriptors, and will run the lwip versions on those sockets.
If any of the file descriptors provided isn't an LWIP socket, the call
will fail with a return of -1, errno EBADF.
Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu> Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
Florian Schmidt [Mon, 20 May 2019 11:29:50 +0000 (13:29 +0200)]
sockets.c: Refuse to deal with non-sockets
Otherwise, socket_net_file_get() will try to look up lwip's file
descriptors for file objects not created by lwip, reading garbage from
where it expects sock_fd in sock_net_file.
Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu> Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
Florian Schmidt [Mon, 20 May 2019 11:29:48 +0000 (13:29 +0200)]
Don't provide file status flags when we have a libc
Instead, trust that they will show up during compilation, just maybe a
bit later. Otherwise, we might very well end up with conflicting
definitions for the values of these flags.
Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu> Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
Florian Schmidt [Mon, 20 May 2019 11:29:44 +0000 (13:29 +0200)]
Move export.syms to exportsyms.uk
This file was ignored up to now because it followed a superseded naming
standard. This patch also adds lwip_htonl, lwip_htons, and lwip_select
to exportsyms.uk, because those are known to be used by applications,
and provided via #defines of their non-prefixed versions.
Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu> Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
Sharan Santhanam [Mon, 27 May 2019 13:00:33 +0000 (15:00 +0200)]
liblwip: Remove vfscore_put_fd from socket_close
This patch fixes a bug in the function sock_net_close. The close
function frees up a descriptor that was removed by fdrop. The fdrop
function invokes the close callback after it had removed the fd
from its list.
Simon Kuenzer [Wed, 8 May 2019 09:54:53 +0000 (11:54 +0200)]
Adopt to latest libuklock, libukmpi changes
lwip's semaphores are implemented based on semphores provided by
libuklock and lwip's mailboxes are implemented based on mailboxes
provided by libukmpi. The API of both have changed recently;
originally with commit a48d634 ("lib/uklock: Use timeout equal to 0
for trying down a semaphore"): A passed timeout of `0` is now
immediately returning instead of blocking the current thread until the
according event happened.
This patch also depends on the Unikraft patch 734930 ("lib/ukmpi:
Provide blocking uk_mbox_recv()"):
https://patchwork.unikraft.org/patch/734930/
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
Florian Schmidt [Mon, 18 Feb 2019 09:30:26 +0000 (10:30 +0100)]
uknetdev_output: Fix loop iterator
Setting q to p->next leads to an infinite loop if p has at least two
segments. The correct way is to iterate over q so we actually progress
through the list.
Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Simon Kuenzer [Thu, 7 Feb 2019 23:00:35 +0000 (00:00 +0100)]
Netif status print callback
Introduce a status print hook to all netifs operated by the lwIP
stack. State changes (e.g., assigning of an IP, bringing device up or
down) are printed to the standard console. Because the stack is not
printing any message to the console with the default configuration, we
enable this print hook as default.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Simon Kuenzer [Thu, 7 Feb 2019 23:00:34 +0000 (00:00 +0100)]
Attach uknetdev netifs during boot
Scan for uknetdev devices and attach them automatically to the lwIP
stack during initialization. If DHCP support is enabled, the stack
will query for an address on the interfaces.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Simon Kuenzer [Thu, 7 Feb 2019 23:00:33 +0000 (00:00 +0100)]
Netif driver for libuknetdev devices
Introduces a netif driver for libuknetdev devices. Packet buffers are
allocated on the heap for now. Receive interrupts are supported and
enabled when lwIP is operated in "threaded" mode. Zero-copy receive is
implemented with packet buffers having two personalities: pbuf and netbuf.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Simon Kuenzer [Thu, 7 Feb 2019 23:00:32 +0000 (00:00 +0100)]
Update to lwIP 2.1.2
Update lwIP from 2.0.3 to the latest relase 2.1.2 from Dec 2018. We
transform the rather beta state of our glue library to a more stable
implementation based on the latest staging branch of Unikraft towards
release 0.3.
This commit provides the following features as selectable options from
lwIP:
- Two operation modes: "threaded" or as (part of a) "mainloop"
- IPv4 support
- Experimental IPv6 support (incomplete)
- Protocols: UDP, TCP, ICMP, IGMP, SNMP
- DNS resolver
- DHCPv4 client
- Socket API
Sharan Santhanam [Fri, 15 Jun 2018 20:53:48 +0000 (22:53 +0200)]
Expose socket header & disable socket polling
In this patch, we expose the socket API through lwIP. In its current
implementation, we do disable support for select()/poll() on a file
descriptor since an implementation is missing in vfscore.
We are going to add this feature again in the near future.
Simon Kuenzer [Thu, 14 Jun 2018 23:13:10 +0000 (01:13 +0200)]
Adopt to new configuration variable name scheme of Unikraft
Adopts to the new configuration variable name scheme introduced
with latest Unikraft build system (see patch de27b01: "build:
add prefix CONFIG_ to every kconfig symbol")
Sharan Santhanam [Wed, 13 Jun 2018 13:41:46 +0000 (15:41 +0200)]
Adhering to uksched API for thread creation
sys_thread_new was unnecessarily using a static allocated variable for
creating a thread. On failure, uk_printd() was called without specifying
a level which fails. Additonally the code style of this function is updated.