Commit Graph

26 Commits (ac7671762d8385a3d136840f487ad009bc9130be)

Author SHA1 Message Date
Martine Lenders 8b5eda9020 posix_sockets: port to vfs for file descriptors 6 years ago
Francois Berder c787638696 posix: sockets: Implement SO_RCVTIMEO option in setsockopt
AwaLWM2M needs to be polled regularly to check for incoming data.
Since RIOT only supports timeout at the GNRC sock layer while
the network abstraction for RIOT in AwaLWM2M uses the posix layer,
this causes RIOT to be blocked waiting for data that never arrive.

This commit implements only the SO_RCVTIMEO option in setsockopt to
allow users to set a receive timeout for a socket at the posix layer.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
6 years ago
Martine Lenders 465f8e42a1 posix_sockets: fix assertion on close 6 years ago
Martine Lenders 4a51d1b433 Merge pull request #6697 from francois-berder-imgtec/awalwm2m
posix: sockets: Small fixes for listen and recvfrom functions
6 years ago
Francois Berder 27dec749e8 posix: sockets: Fix return value of recvfrom and sendto
_bind_connect already sets errno and returns -1 or 0.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
6 years ago
Francois Berder 8d2ec19be6 posix: sockets: Fix timeout regression of recvfrom
Commit de41971aab sets the default
timeout to 0. This change should not have been part of the commit.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
6 years ago
Francois Berder 8f839fbc31 posix: sockets: address was not set in recvfrom
The address is an optional parameter of recvfrom. If it is
not null, recvfrom must store the address of the sender.
However this was only allowed if res was equal to 0, which
is wrong since res contains the number of bytes received
or -1.
This commit ensures that the address is set only if no
previous errors happened before.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
6 years ago
Oleg Hahm 6022760fc6 posix: missing closing parenthesis 6 years ago
Francois Berder 2936a69a1b posix: sockets: Fix return value of listen function
If an error happens, listen was returning 1 instead of -1.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
6 years ago
Francois Berder de41971aab posix: sockets: Fix return value of sendto and recvfrom
The return value of these functions was not always correct
in case of errors: they were not returning -1 and setting
errno.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
6 years ago
Martine Lenders 4f5d046622 doc: net: replace doc references of conn with sock 6 years ago
Martine Lenders 1ccdc4643f posix_sockets: port to sock 6 years ago
Kaspar Schleiser ded39b461e sys: random: rename genrand_* to random_* 7 years ago
Oleg Hahm 94231241ec posix sockets: missing includes for conn 7 years ago
Oleg Hahm c811380440 Merge pull request #4468 from cgundogan/pr/posix_sockets/close_fd_fix
posix_sockets: fix overflowing fd in close()
7 years ago
Cenk Gündoğan 0ddfffc0c2 posix_sockets: fix overflowing fd in close() 7 years ago
Cenk Gündoğan 6f92b056f9 posix_sockets: do not use the address of best_match 7 years ago
Oleg Hahm 11add4d8fd sockets: implicit bind for connect()
According to
http://pubs.opengroup.org/onlinepubs/009695399/functions/connect.html
for a "socket [that] has not already been bound to a local address,
connect() shall bind it to an address which, unless the socket's address
family is AF_UNIX, is an unused local address."
7 years ago
Oleg Hahm b366e59c87 conn: add function to find the best source address
...and use it in POSIX sendto() function.
7 years ago
Oleg Hahm 860321c3e9 posix sockets: use network byteorder for port 7 years ago
Oleg Hahm 5f663826c7 posix sockets: remove pointless inline function 7 years ago
Oleg Hahm c366f2bbcd sockets: perform implicit bind during sendto()
A client should not require to explicitly call bind() to receive packets, but is expected to receive replies sent to the ephemeral port that was selected as a source port by the UDP implementation.
7 years ago
Oleg Hahm 0153933241 posix sockets: store src_port in socket struct 7 years ago
Oleg Hahm 7efc8fd265 posix sockets: initialize sockaddr properly to 0 7 years ago
Oleg Hahm a0dcbc6a3c posix: sockets: use correct datatypes for in6_addr
in6addr_any and in6addr_loopback are of type in6_addr
8 years ago
Martine Lenders 624530c7d0 posix: redo socket API to use conn 8 years ago