From bdbec30a849807fb5e6841a38cfe0d168e5962b9 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 21 Dec 2023 12:06:05 +0100 Subject: seitan: Add netlink, sendto()/sendmsg(), iovec handling, demo with routes A bit rough at the moment, but it does the trick. Bonus: setsockopt() (with magic values only, not used in any demo yet). Signed-off-by: Stefano Brivio --- common/gluten.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'common/gluten.h') diff --git a/common/gluten.h b/common/gluten.h index e80916a..1414d9e 100644 --- a/common/gluten.h +++ b/common/gluten.h @@ -70,6 +70,7 @@ enum op_type { OP_RETURN, OP_LOAD, OP_STORE, + OP_IOVLOAD, OP_BITWISE, OP_CMP, OP_RESOLVEDFD, @@ -210,6 +211,13 @@ struct op_store { struct gluten_offset count; }; +struct op_iovload { + struct gluten_offset iov; + struct gluten_offset iovlen; + struct gluten_offset dst; + size_t size; +}; + enum op_cmp_type { CMP_EQ, CMP_NE, @@ -278,6 +286,7 @@ struct op { struct op_fd fd; struct op_load load; struct op_store store; + struct op_iovload iovload; struct op_bitwise bitwise; struct op_cmp cmp; struct op_resolvefd resfd; @@ -291,8 +300,12 @@ struct op { # define GLUTEN_CONST const #endif +struct gluten_header { + struct gluten_offset relocation[256]; +}; + struct gluten { - GLUTEN_CONST char header[HEADER_SIZE]; + GLUTEN_CONST struct gluten_header header; GLUTEN_CONST char inst[INST_SIZE]; @@ -309,7 +322,7 @@ static inline bool is_offset_valid(const struct gluten_offset x) { switch (x.type) { case OFFSET_NULL: - return false; + return true; case OFFSET_DATA: return x.offset < DATA_SIZE; case OFFSET_RO_DATA: @@ -319,6 +332,7 @@ static inline bool is_offset_valid(const struct gluten_offset x) case OFFSET_SECCOMP_DATA: return x.offset < 6; default: + debug("unknown offset in range check"); return false; } } -- cgit v1.2.3