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

51 Commits

Author SHA1 Message Date
Jon Shallow
ed64f06909 posix_sockets.c: Fix 16 bit integer compilation errors 2023-09-27 16:18:14 +00:00
Marian Buschsieweke
77afc5e637
sys/posix/sockets: set sin6_scope_id in _ep_to_sockaddr()
Fixes https://github.com/RIOT-OS/RIOT/issues/19486
2023-05-23 22:04:12 +02:00
Marian Buschsieweke
afa3b134f4
sys/posix/sockets: fix code style
Fix double indent of switch cases to single indent, as per coding
convention.
2023-05-23 22:03:51 +02:00
chrysn
2cb4b70458 vfs / treewide: Remove manual zeroing of vfs stat buffers 2022-02-12 12:31:38 +01:00
3aac469e61
Merge pull request #16852 from HendrikVE/pr/wolfmqtt_split_4
sys/posix/socket: use explicit bind
2022-01-05 14:31:52 +01:00
benpicco
bfe64fe66a
Merge pull request #16849 from HendrikVE/pr/wolfmqtt_split_1
sys/posix/socket: fix wrong member access
2021-09-14 17:50:08 +02:00
Hendrik van Essen
e4bd2c5ffe sys/posix/socket: use explicit bind
implicit bind would lead to StoreProhibitedCause on esp32
2021-09-14 13:30:37 +02:00
Hendrik van Essen
93604f3181 sys/posix/socket: fix ip member access 2021-09-07 15:39:06 +02:00
Hendrik van Essen
bf47e436d8 sys/posix/socket: fix tcp member access 2021-09-07 15:39:06 +02:00
Jan Romann
4384795cb9
treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
Marian Buschsieweke
3b6fa61829
sys: Cleanup access to internal variables
Replace direct accesses to sched_active_thread and sched_active_pid with
the helper functions thread_getpid() and thread_get_active(). This serves
two purposes:

1. It makes accidental writes to those variable from outside core less likely.
2. Casting off the volatile qualifier is now well contained to those two
   functions
2020-08-24 20:28:11 +02:00
Martine S. Lenders
6ba6740231
posix_select: initial import of select() function 2020-07-01 18:10:26 +02:00
Martine S. Lenders
af24c539d0
posix_sockets: count available received messages asynchronously
Utilizing `sock_async`
2020-07-01 13:36:36 +02:00
Martine S. Lenders
791069acf1
posix_sockets: provide function to check if file descriptor is a socket 2020-07-01 13:36:36 +02:00
Martine S. Lenders
c7dc0bb8de
posix_sockets: use vfs_file_get() to resolve file descriptor 2020-07-01 13:36:36 +02:00
Frank Engelhardt
356c8008dd posix_sockets: use sin6_scope_id field to specify netif 2020-06-15 11:23:46 +02:00
Daniele Lacamera
5cb76e521b posix_socket: set sock for returned socket on accept() 2019-08-30 21:18:25 +02:00
Martine Lenders
af5bf360a0
Merge pull request #11575 from miri64/posix_socket/fix/init-uninit-fields
posix_socket: initialize uninitialized fields
2019-08-08 15:56:48 +02:00
Martine Lenders
3bcb1ee2ef posix_socket: initialize uninitialized fields 2019-08-08 15:03:28 +02:00
Martine Lenders
a9ae2f4ac9 posix_sockets: set read/write permissions for socket fd 2019-05-24 15:58:50 +02:00
Olaf Bergmann
83e2932eb6 posix_sockets.c: fix send()/write() for connected UDP sockets
Calling send() or write() on a connected UDP socket raises a
kernel panic in posix_sockets.c, line 215, because _sockaddr_to_ep()
is called from socket_sendto() with address set to NULL.

This change modifies socket_sendto() to

* Check if the UDP socket is connected when the address argument
  is NULL.
* If connected, use the stored remote endpoint for sock_udp_send().
2019-04-10 11:19:13 +02:00
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