diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-04-12 21:03:35 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-04-12 21:03:35 +0200 |
commit | 35bfd16af8f8316de5ee392fe06020a7d7ed7a33 (patch) | |
tree | a91818cbe150d002f995b0e2ffefd58a55931cf5 /qtctl.c | |
download | modquicktun-35bfd16af8f8316de5ee392fe06020a7d7ed7a33.tar modquicktun-35bfd16af8f8316de5ee392fe06020a7d7ed7a33.zip |
Sending through the quicktun interface is working now.
Diffstat (limited to 'qtctl.c')
-rw-r--r-- | qtctl.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -0,0 +1,36 @@ +#include <netlink/netlink.h> +#include <netlink/genl/genl.h> +#include <netlink/genl/ctrl.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +#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; +} |