mirage / mirage-tcpip

TCP/IP networking stack in pure OCaml, using the Mirage platform libraries. Includes IPv4/6, ICMP, and UDP/TCP support.
https://mirage.io
ISC License
339 stars 87 forks source link

unix stack may raise in `listen` #513

Open hannesm opened 8 months ago

hannesm commented 8 months ago

The Unix.bind in Tcpv4v6_socket is not guarded and may raise an exception. This leaks file descriptors, and the interface should be revised (or specified in a way that allows exceptions to occur).

Maybe a check in "connect" should be done if the IP address(es) are available at the moment (though obviously that may change during the operation of a unikernel.

Any ideas how to deal with that? Any networking unikernel were you specify dist/my-unikernel --ipv4=1.2.1.2/24 fails with an exeption (Unix.error EADDRNOTAVAIL) if 1.2.1.2 is not configured on the host.

hannesm commented 8 months ago

reported here from the issue comment https://github.com/robur-coop/tlstunnel/issues/13#issuecomment-1894295071