Пример #1
0
int nflog_set_flags(struct nflog_g_handle *gh, u_int16_t flags)
{
	char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(u_int16_t))];
	struct nlmsghdr *nmh = (struct nlmsghdr *) buf;

	nfnl_fill_hdr(gh->h->nfnlssh, nmh, 0, AF_UNSPEC, gh->id,
		      NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);

	nfnl_addattr16(nmh, sizeof(buf), NFULA_CFG_FLAGS, htons(flags));

	return nfnl_talk(gh->h->nfnlh, nmh, 0, 0, NULL, NULL, NULL);
}
/**
 * nflog_set_flags - set the nflog flags for this group
 * \param gh Netfilter log handle obtained by call to nflog_bind_group().
 * \param flags Flags that you want to set
 *
 * There are two existing flags:
 *
 *	- NFULNL_CFG_F_SEQ: This enables local nflog sequence numbering.
 *	- NFULNL_CFG_F_SEQ_GLOBAL: This enables global nflog sequence numbering.
 *
 * \return -1 in case of error and errno is explicity set.
 */
int nflog_set_flags(struct nflog_g_handle *gh, uint16_t flags)
{
	union {
		char buf[NFNL_HEADER_LEN+NFA_LENGTH(sizeof(uint16_t))];
		struct nlmsghdr nmh;
	} u;

	nfnl_fill_hdr(gh->h->nfnlssh, &u.nmh, 0, AF_UNSPEC, gh->id,
		      NFULNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);

	nfnl_addattr16(&u.nmh, sizeof(u), NFULA_CFG_FLAGS, htons(flags));

	return nfnl_query(gh->h->nfnlh, &u.nmh);
}
Пример #3
0
static void __build_zone(struct nfnlhdr *req, size_t size,
			 const struct nf_expect *exp)
{
	nfnl_addattr16(&req->nlh, size, CTA_EXPECT_ZONE, htons(exp->zone));
}
Пример #4
0
static void __build_zone(struct nfnlhdr *req,
			 size_t size,
			 const struct nf_conntrack *ct)
{
	nfnl_addattr16(&req->nlh, size, CTA_ZONE, htons(ct->zone));
}