aboutgitcodelistschat:MatrixIRC
path: root/common/gluten.h
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2023-12-21 12:06:05 +0100
committerStefano Brivio <sbrivio@redhat.com>2023-12-21 12:45:36 +0100
commitbdbec30a849807fb5e6841a38cfe0d168e5962b9 (patch)
tree210949d96b4d764235c1c5b81ad2eebb61681f95 /common/gluten.h
parentc72c2493de8990c3a3b4780ec1429a3c359c121e (diff)
downloadseitan-bdbec30a849807fb5e6841a38cfe0d168e5962b9.tar
seitan-bdbec30a849807fb5e6841a38cfe0d168e5962b9.tar.gz
seitan-bdbec30a849807fb5e6841a38cfe0d168e5962b9.tar.bz2
seitan-bdbec30a849807fb5e6841a38cfe0d168e5962b9.tar.lz
seitan-bdbec30a849807fb5e6841a38cfe0d168e5962b9.tar.xz
seitan-bdbec30a849807fb5e6841a38cfe0d168e5962b9.tar.zst
seitan-bdbec30a849807fb5e6841a38cfe0d168e5962b9.zip
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 <sbrivio@redhat.com>
Diffstat (limited to 'common/gluten.h')
-rw-r--r--common/gluten.h18
1 files changed, 16 insertions, 2 deletions
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;
}
}