Commit Graph

7 Commits

Author SHA1 Message Date
Tim Schumacher
d7797c8bf8 Userland: Treat inet_pton returning 0 as an error
The POSIX man-page states that inet_pton returns 0 if the input is not a
valid IPv4 dotted-decimal string or a valid IPv6 address string. This is
also how it is implemented in SerenityOS.

This means that we should treat a return value of 0 as an error to avoid
using an invalid address (or 0.0.0.0).
2021-05-27 22:56:21 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Brian Gianforcaro
2ebb3f3c0d LibC: Add a definition for INET6_ADDRSTRLEN
Although serenity doesn't implement IPv6 yet, applications
will often declare buffers to be of size `INET6_ADDRSTRLEN`
so it's guaranteed to work in both IPv4 / IPv6 environments.

This is needed specifically for a port of Flexible IO Tester
https://fio.readthedocs.io

This is standardized here:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/netinet/in.h.html
2021-04-21 08:04:52 +02:00
Gunnar Beutner
287a93a2a4 LibC: Validate the len argument for inet_ntop() 2021-04-12 22:44:49 +02:00
Gunnar Beutner
fe8b1a732e LibC: Include additional headers in <arpa/inet.h>
According to the Single UNIX Specification, Version 2 the <arpa/inet.h>
header may optionally include <netinet/in.h> and <inttypes.h>. This
helps with porting software like c-ray that expects this to be the case.
2021-04-11 01:18:02 +02:00
jonno85uk
83d880180e
LibC: Use "static inline" for inline functions in arpa/inet.h (#5392)
This makes it work when compiling as C.
2021-02-18 00:02:47 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00