aboutgitcodelistschat:MatrixIRC
path: root/cooker/calls/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'cooker/calls/net.c')
-rw-r--r--cooker/calls/net.c259
1 files changed, 259 insertions, 0 deletions
diff --git a/cooker/calls/net.c b/cooker/calls/net.c
index a348037..94b13cd 100644
--- a/cooker/calls/net.c
+++ b/cooker/calls/net.c
@@ -79,6 +79,9 @@ static struct num protocols[] = {
{ "mpls", IPPROTO_MPLS },
{ "raw", IPPROTO_RAW },
{ "mptcp", IPPROTO_MPTCP },
+
+ { "nl_route", NETLINK_ROUTE },
+
{ 0 },
};
@@ -243,9 +246,265 @@ static struct arg connect_args[] = {
{ 0 }
};
+static struct num send_flags[] = {
+ { "confirm", MSG_CONFIRM },
+ { "dontroute", MSG_DONTROUTE },
+ { "dontwait", MSG_DONTWAIT },
+ { "eor", MSG_EOR },
+ { "more", MSG_MORE },
+ { "nosignal", MSG_NOSIGNAL },
+ { "oob", MSG_OOB },
+ { "fastopen", MSG_FASTOPEN },
+ { 0 },
+};
+
+static struct arg send_args[] = {
+ { 0,
+ {
+ "fd", INT, 0,
+ 0,
+ 0,
+ { 0 },
+ },
+ },
+ { 1,
+ {
+ "buf", STRING, WBUF,
+ 0,
+ BUFSIZ,
+ { 0 },
+ },
+ },
+ { 2,
+ {
+ "len", LONG, SIZE,
+ 0,
+ 0,
+ { .d_size = (intptr_t)&send_args[1] },
+ },
+ },
+ { 3,
+ {
+ "flags", INT, FLAGS,
+ 0,
+ 0,
+ { .d_num = send_flags }
+ }
+ },
+ { 0 }
+};
+
+static struct arg sendto_args[] = {
+ { 0,
+ {
+ "fd", INT, 0,
+ 0,
+ 0,
+ { 0 },
+ },
+ },
+ { 1,
+ {
+ "buf", STRING, WBUF,
+ 0,
+ BUFSIZ,
+ { 0 },
+ },
+ },
+ { 2,
+ {
+ "len", LONG, SIZE,
+ 0,
+ 0,
+ { .d_size = (intptr_t)&sendto_args[1] },
+ },
+ },
+ { 3,
+ {
+ "flags", INT, FLAGS,
+ 0,
+ 0,
+ { .d_num = send_flags }
+ }
+ },
+ { 4,
+ {
+ "addr", SELECT, 0,
+ 0,
+ sizeof(struct sockaddr_storage),
+ { .d_select = &connect_addr_select },
+ },
+ },
+ { 5,
+ {
+ "addrlen", LONG, SIZE,
+ 0,
+ 0,
+ { .d_size = (intptr_t)&connect_addr_select },
+ },
+ },
+ { 0 }
+};
+
+static struct select sendmsg_name_select = {
+ &connect_family, { .d_num = connect_addr_select_family }
+};
+
+static struct field sendmsg_msghdr[] = {
+ {
+ "name", SELECT, 0,
+ offsetof(struct msghdr, msg_name),
+ sizeof(struct sockaddr_storage),
+ { .d_select = &sendmsg_name_select },
+ },
+ {
+ "namelen", LONG, SIZE,
+ offsetof(struct msghdr, msg_namelen),
+ 0,
+ { .d_size = (intptr_t)&sendmsg_name_select },
+ },
+ {
+ "iov", STRING, WBUF | IOV,
+ offsetof(struct msghdr, msg_iov),
+ BUFSIZ,
+ { .d_iovlen = offsetof(struct msghdr, msg_iovlen) -
+ offsetof(struct msghdr, msg_iov) },
+ },
+ {
+ "iovlen", LONG, 0,
+ offsetof(struct msghdr, msg_iovlen),
+ 0,
+ { 0 },
+ },
+ {
+ "control", STRING, 0,
+ offsetof(struct msghdr, msg_control),
+ BUFSIZ,
+ { 0 },
+ },
+ {
+ "controllen", LONG, SIZE,
+ offsetof(struct msghdr, msg_controllen),
+ 0,
+ { 0 },
+ },
+ {
+ "flags", INT, 0,
+ offsetof(struct msghdr, msg_flags),
+ 0,
+ { 0 },
+ },
+ { 0 }
+};
+
+static struct arg sendmsg_args[] = {
+ { 0,
+ {
+ "fd", INT, 0,
+ 0,
+ 0,
+ { 0 },
+ },
+ },
+ { 1,
+ {
+ "msg", STRUCT, 0,
+ 0,
+ sizeof(struct msghdr),
+ { .d_struct = sendmsg_msghdr },
+ },
+ },
+ { 2,
+ {
+ "flags", INT, FLAGS,
+ 0,
+ 0,
+ { .d_num = send_flags }
+ }
+ },
+ { 0 }
+};
+
+static struct arg recvmsg_args[] = {
+ { 0,
+ {
+ "fd", INT, 0,
+ 0,
+ 0,
+ { 0 },
+ },
+ },
+ { 1,
+ {
+ "msg", STRUCT, 0,
+ 0,
+ sizeof(struct msghdr),
+ { .d_struct = sendmsg_msghdr },
+ },
+ },
+ { 2,
+ {
+ "flags", INT, FLAGS,
+ 0,
+ 0,
+ { .d_num = send_flags }
+ }
+ },
+ { 0 }
+};
+
+static struct arg setsockopt_args[] = {
+ { 0,
+ {
+ "fd", INT, 0,
+ 0,
+ 0,
+ { 0 },
+ },
+ },
+ { 1,
+ {
+ "level", INT, 0,
+ 0,
+ 0,
+ { 0 },
+ },
+ },
+ { 2,
+ {
+ "optname", INT, 0,
+ 0,
+ 0,
+ { 0 },
+ },
+ },
+ { 3,
+ {
+ "optval", INT, 0,
+ 0,
+ BUFSIZ,
+ { 0 },
+ },
+ },
+ { 4,
+ {
+ "optlen", INT, 0,
+ 0,
+ 0,
+ { 0 },
+ },
+ },
+ { 0 }
+};
+
struct call syscalls_net[] = {
{ __NR_connect, "connect", connect_args },
{ __NR_bind, "bind", connect_args },
{ __NR_socket, "socket", socket_args },
+ /* { __NR_send, "send", send_args }, */
+ { __NR_sendto, "sendto", sendto_args },
+ { __NR_sendmsg, "sendmsg", sendmsg_args },
+ { __NR_recvmsg, "recvmsg", recvmsg_args },
+ { __NR_setsockopt, "setsockopt", setsockopt_args },
{ 0 },
};