Lines Matching refs:nlh
78 static inline void add_attr(struct nlmsghdr *nlh, uint16_t type, size_t len, const void *data)
80 struct my_nlattr *attr = (void *)nlh + NL_ALIGN(nlh->nlmsg_len);
85 nlh->nlmsg_len += NL_ALIGN(payload_len);
119 struct nlmsghdr *nlh;
138 nlh = (struct nlmsghdr *)buffer;
139 nlh->nlmsg_len = NL_ALIGN(sizeof(struct nlmsghdr));
140 nlh->nlmsg_type = (remove ? IPSET_CMD_DEL : IPSET_CMD_ADD) | (NFNL_SUBSYS_IPSET << 8);
141 nlh->nlmsg_flags = NLM_F_REQUEST;
143 nfg = (struct my_nfgenmsg *)(buffer + nlh->nlmsg_len);
144 nlh->nlmsg_len += NL_ALIGN(sizeof(struct my_nfgenmsg));
150 add_attr(nlh, IPSET_ATTR_PROTOCOL, sizeof(proto), &proto);
151 add_attr(nlh, IPSET_ATTR_SETNAME, strlen(setname) + 1, setname);
152 nested[0] = (struct my_nlattr *)(buffer + NL_ALIGN(nlh->nlmsg_len));
153 nlh->nlmsg_len += NL_ALIGN(sizeof(struct my_nlattr));
155 nested[1] = (struct my_nlattr *)(buffer + NL_ALIGN(nlh->nlmsg_len));
156 nlh->nlmsg_len += NL_ALIGN(sizeof(struct my_nlattr));
158 add_attr(nlh,
161 nested[1]->nla_len = (void *)buffer + NL_ALIGN(nlh->nlmsg_len) - (void *)nested[1];
162 nested[0]->nla_len = (void *)buffer + NL_ALIGN(nlh->nlmsg_len) - (void *)nested[0];
164 while (retry_send(sendto(ipset_sock, buffer, nlh->nlmsg_len, 0,