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 <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2020-05-29 13:33:12 -07:00 committed by Carles Cufí
parent 299ec8f1b5
commit fed960b94a
6 changed files with 9 additions and 5 deletions

View file

@ -594,6 +594,8 @@ add_custom_command(
${PYTHON_EXECUTABLE} ${PYTHON_EXECUTABLE}
${ZEPHYR_BASE}/scripts/parse_syscalls.py ${ZEPHYR_BASE}/scripts/parse_syscalls.py
--include ${ZEPHYR_BASE}/include # Read files from this dir --include ${ZEPHYR_BASE}/include # Read files from this dir
--include ${ZEPHYR_BASE}/drivers # For net sockets
--include ${ZEPHYR_BASE}/subsys/net # More net sockets
${parse_syscalls_include_args} # Read files from these dirs also ${parse_syscalls_include_args} # Read files from these dirs also
--json-file ${syscalls_json} # Write this file --json-file ${syscalls_json} # Write this file
--tag-struct-file ${struct_tags_json} # Write subsystem list to this file --tag-struct-file ${struct_tags_json} # Write subsystem list to this file

View file

@ -23,7 +23,7 @@
extern "C" { extern "C" {
#endif #endif
struct modem_socket { __net_socket struct modem_socket {
sa_family_t family; sa_family_t family;
enum net_sock_type type; enum net_sock_type type;
enum net_ip_protocol ip_proto; enum net_ip_protocol ip_proto;

View file

@ -196,7 +196,7 @@ struct tls_context;
* If there is no such source address there, the packet cannot be sent * If there is no such source address there, the packet cannot be sent
* anyway. This saves 12 bytes / context in IPv6. * anyway. This saves 12 bytes / context in IPv6.
*/ */
struct net_context { __net_socket struct net_context {
/** User data. /** User data.
* *
* First member of the structure to let users either have user data * First member of the structure to let users either have user data

View file

@ -48,7 +48,7 @@ enum {
* - write operations may block if the remote @a recv_q is full * - write operations may block if the remote @a recv_q is full
* - each endpoint may be blocking or non-blocking * - each endpoint may be blocking or non-blocking
*/ */
struct spair { __net_socket struct spair {
int remote; /**< the remote endpoint file descriptor */ int remote; /**< the remote endpoint file descriptor */
u32_t flags; /**< status and option bits */ u32_t flags; /**< status and option bits */
struct k_sem sem; /**< semaphore for exclusive structure access */ struct k_sem sem; /**< semaphore for exclusive structure access */

View file

@ -23,7 +23,7 @@ LOG_MODULE_REGISTER(net_sock_mgmt, CONFIG_NET_SOCKETS_LOG_LEVEL);
#define MSG_ALLOC_TIMEOUT K_MSEC(100) #define MSG_ALLOC_TIMEOUT K_MSEC(100)
struct net_mgmt_socket { __net_socket struct net_mgmt_socket {
/* Network interface related to this socket */ /* Network interface related to this socket */
struct net_if *iface; struct net_if *iface;

View file

@ -10,6 +10,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include <toolchain/common.h>
#define WS_SHA1_OUTPUT_LEN 20 #define WS_SHA1_OUTPUT_LEN 20
/* Min Websocket header length */ /* Min Websocket header length */
@ -24,7 +26,7 @@
/** /**
* Websocket connection information * Websocket connection information
*/ */
struct websocket_context { __net_socket struct websocket_context {
union { union {
/** User data. /** User data.
*/ */