Skip to content

Commit fed960b

Browse files
Andrew Boiecarlescufi
authored andcommitted
net: tag net socket objects
Used for permission validation when accessing the associated file descriptors from user mode. There often get defined in implementation code, expand the search to look in drivers/ and subsys/net/. Signed-off-by: Andrew Boie <[email protected]>
1 parent 299ec8f commit fed960b

File tree

6 files changed

+9
-5
lines changed

6 files changed

+9
-5
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,8 @@ add_custom_command(
594594
${PYTHON_EXECUTABLE}
595595
${ZEPHYR_BASE}/scripts/parse_syscalls.py
596596
--include ${ZEPHYR_BASE}/include # Read files from this dir
597+
--include ${ZEPHYR_BASE}/drivers # For net sockets
598+
--include ${ZEPHYR_BASE}/subsys/net # More net sockets
597599
${parse_syscalls_include_args} # Read files from these dirs also
598600
--json-file ${syscalls_json} # Write this file
599601
--tag-struct-file ${struct_tags_json} # Write subsystem list to this file

drivers/modem/modem_socket.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
extern "C" {
2424
#endif
2525

26-
struct modem_socket {
26+
__net_socket struct modem_socket {
2727
sa_family_t family;
2828
enum net_sock_type type;
2929
enum net_ip_protocol ip_proto;

include/net/net_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ struct tls_context;
196196
* If there is no such source address there, the packet cannot be sent
197197
* anyway. This saves 12 bytes / context in IPv6.
198198
*/
199-
struct net_context {
199+
__net_socket struct net_context {
200200
/** User data.
201201
*
202202
* First member of the structure to let users either have user data

subsys/net/lib/sockets/socketpair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ enum {
4848
* - write operations may block if the remote @a recv_q is full
4949
* - each endpoint may be blocking or non-blocking
5050
*/
51-
struct spair {
51+
__net_socket struct spair {
5252
int remote; /**< the remote endpoint file descriptor */
5353
u32_t flags; /**< status and option bits */
5454
struct k_sem sem; /**< semaphore for exclusive structure access */

subsys/net/lib/sockets/sockets_net_mgmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ LOG_MODULE_REGISTER(net_sock_mgmt, CONFIG_NET_SOCKETS_LOG_LEVEL);
2323

2424
#define MSG_ALLOC_TIMEOUT K_MSEC(100)
2525

26-
struct net_mgmt_socket {
26+
__net_socket struct net_mgmt_socket {
2727
/* Network interface related to this socket */
2828
struct net_if *iface;
2929

subsys/net/lib/websocket/websocket_internal.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* SPDX-License-Identifier: Apache-2.0
1111
*/
1212

13+
#include <toolchain/common.h>
14+
1315
#define WS_SHA1_OUTPUT_LEN 20
1416

1517
/* Min Websocket header length */
@@ -24,7 +26,7 @@
2426
/**
2527
* Websocket connection information
2628
*/
27-
struct websocket_context {
29+
__net_socket struct websocket_context {
2830
union {
2931
/** User data.
3032
*/

0 commit comments

Comments
 (0)