#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; }