1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

30 Commits

Author SHA1 Message Date
Lucas Jenss
6998ffbb14 cppcheck: Provide consistent reason formatting for all cppcheck-suppresses 2017-10-10 10:25:20 -07:00
Sam Kumar
331c60409e posix_sockets: fix use of fd_new 2017-05-17 08:01:54 -07:00
185c7ac11b some (ptr == 0) -> (ptr == NULL) fixes (found by coccinelle) 2017-04-20 23:31:32 +02:00
smlng
3a6cb0dc71 sys, posix: fix cppcheck warnings and errors in posix_socket 2017-04-19 17:20:48 +02:00
Martine Lenders
8b5eda9020 posix_sockets: port to vfs for file descriptors 2017-04-03 20:23:14 +02:00
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>
2017-03-23 09:59:46 +00:00
Martine Lenders
465f8e42a1 posix_sockets: fix assertion on close 2017-03-20 09:37:26 +01:00
Martine Lenders
4a51d1b433 Merge pull request #6697 from francois-berder-imgtec/awalwm2m
posix: sockets: Small fixes for listen and recvfrom functions
2017-03-11 19:22:35 +01:00
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>
2017-03-07 16:42:21 +00:00
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>
2017-03-07 11:07:16 +00:00
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>
2017-03-07 11:06:01 +00:00
Oleg Hahm
6022760fc6 posix: missing closing parenthesis 2017-03-06 22:37:28 +01:00
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>
2017-03-06 13:26:51 +00:00
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>
2017-03-03 15:52:22 +00:00
Martine Lenders
4f5d046622 doc: net: replace doc references of conn with sock 2017-02-07 13:32:20 +01:00
Martine Lenders
1ccdc4643f posix_sockets: port to sock 2017-01-24 15:17:15 +01:00
ded39b461e sys: random: rename genrand_* to random_* 2016-02-29 21:33:17 +01:00
Oleg Hahm
94231241ec posix sockets: missing includes for conn 2016-02-25 10:42:50 +01:00
Oleg Hahm
c811380440 Merge pull request #4468 from cgundogan/pr/posix_sockets/close_fd_fix
posix_sockets: fix overflowing fd in close()
2015-12-12 12:13:51 +01:00
Cenk Gündoğan
0ddfffc0c2 posix_sockets: fix overflowing fd in close() 2015-12-12 04:24:23 +01:00
Cenk Gündoğan
6f92b056f9 posix_sockets: do not use the address of best_match 2015-12-12 02:51:00 +01:00
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."
2015-12-08 11:57:20 +01:00
Oleg Hahm
b366e59c87 conn: add function to find the best source address
...and use it in POSIX sendto() function.
2015-12-02 18:11:55 +01:00
Oleg Hahm
860321c3e9 posix sockets: use network byteorder for port 2015-12-02 14:45:43 +01:00
Oleg Hahm
5f663826c7 posix sockets: remove pointless inline function 2015-12-02 14:45:43 +01:00
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.
2015-12-02 14:45:43 +01:00
Oleg Hahm
0153933241 posix sockets: store src_port in socket struct 2015-12-02 14:38:52 +01:00
Oleg Hahm
7efc8fd265 posix sockets: initialize sockaddr properly to 0 2015-11-26 11:25:40 +01:00
Oleg Hahm
a0dcbc6a3c posix: sockets: use correct datatypes for in6_addr
in6addr_any and in6addr_loopback are of type in6_addr
2015-10-27 11:39:11 +01:00
Martine Lenders
624530c7d0 posix: redo socket API to use conn 2015-09-22 22:24:52 +02:00