From 35bfd16af8f8316de5ee392fe06020a7d7ed7a33 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 12 Apr 2011 21:03:35 +0200 Subject: Sending through the quicktun interface is working now. --- qtctl.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 qtctl.c (limited to 'qtctl.c') diff --git a/qtctl.c b/qtctl.c new file mode 100644 index 0000000..e601ad9 --- /dev/null +++ b/qtctl.c @@ -0,0 +1,36 @@ +#include +#include +#include +#include +#include + +#include "quicktun.h" + + +int main() +{ + struct nl_handle *sock; + struct nl_msg *msg; + struct nl_cb *cb; + int family; + + sock = nl_handle_alloc(); + genl_connect(sock); + family = genl_ctrl_resolve(sock, "quicktun"); + + msg = nlmsg_alloc(); + genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family, 0, NLM_F_ECHO, QUICKTUN_CMD_CREATE_DEVICE, 1); + nla_put_u16(msg, QUICKTUN_A_TYPE, QUICKTUN_TAP_DEV); + nla_put_u32(msg, QUICKTUN_A_REMOTE_ADDRESS, ntohl(inet_addr("192.168.0.2"))); + + nl_send_auto_complete(sock, msg); + + nlmsg_free(msg); + + cb = nl_cb_alloc(NL_CB_DEFAULT); + nl_cb_err(cb, NL_CB_DEBUG, NULL, NULL); + + nl_recvmsgs(sock, cb); + + return 0; +} -- cgit v1.2.3