Bug 27

Summary: Fail gracefully if sockets (or other file descriptors) can't be opened
Product: passt Reporter: Stefano Brivio <sbrivio>
Component: generalAssignee: nobody
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   

Description Stefano Brivio 2022-10-27 19:31:38 UTC
If passt forwards many or all ports, it needs to open a relatively significant
amount of file descriptors. We're already setting the RLIMIT_NOFILE soft quota
to match the hard quota via setrlimit() in main(), but that's not necessarily
enough on some distributions.

If we can't open enough file descriptors, we'll just go ahead, bind as many
ports as we can, and warn about the rest. In pasta mode, we might fail from time
to time to establish spliced connections.

This is not necessarily desirable, because we're doing something wildly
different compared to what we were configured for. Fail gracefully instead: if
we can't bind for that reason (and not getting, say, EACCES), explain and quit,
so that the user realises right away.