65 #include <netlink-local.h>
66 #include <netlink/netlink.h>
67 #include <netlink/netfilter/nfnl.h>
109 int flags, uint8_t family, uint16_t res_id)
111 struct nfgenmsg hdr = {
112 .nfgen_family = family,
113 .version = NFNETLINK_V0,
114 .res_id = htons(res_id),
117 return nl_send_simple(handle, NFNLMSG_TYPE(subsys_id, type), flags,
154 return nfg->nfgen_family;
165 return ntohs(nfg->res_id);
175 static int nfnlmsg_append(
struct nl_msg *msg, uint8_t family, uint16_t res_id)
177 struct nfgenmsg *nfg;
181 return nl_errno(ENOMEM);
183 nfg->nfgen_family = family;
184 nfg->version = NFNETLINK_V0;
185 nfg->res_id = htons(res_id);
186 NL_DBG(2,
"msg %p: Added nfnetlink header family=%d res_id=%d\n",
187 msg, family, res_id);
202 uint8_t family, uint16_t res_id)
210 if (nfnlmsg_append(msg, family, res_id) < 0)
211 goto nla_put_failure;
232 uint8_t subsys_id, uint8_t type,
int flags, uint8_t family,
237 nlh =
nlmsg_put(msg, pid, seq, NFNLMSG_TYPE(subsys_id, type), 0, flags);
239 return nl_get_errno();
241 return nfnlmsg_append(msg, family, res_id);