From bff350fad76eb03fc395be33a7208b7b179406fb Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org" Date: Thu, 26 Jan 2006 16:14:57 +0000 Subject: add support for instance-local and global sequence counters --- src/libnetfilter_log.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/libnetfilter_log.c') diff --git a/src/libnetfilter_log.c b/src/libnetfilter_log.c index 4685738..95537d8 100644 --- a/src/libnetfilter_log.c +++ b/src/libnetfilter_log.c @@ -353,6 +353,19 @@ int nflog_set_nlbufsiz(struct nflog_g_handle *gh, u_int32_t nlbufsiz) return status; } +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); +} + struct nfulnl_msg_packet_hdr *nflog_get_msg_packet_hdr(struct nflog_data *nfad) { @@ -429,3 +442,20 @@ int nflog_get_uid(struct nflog_data *nfad, u_int32_t *uid) return 0; } +int nflog_get_seq(struct nflog_data *nfad, u_int32_t *seq) +{ + if (!nfnl_attr_present(nfad->nfa, NFULA_SEQ)) + return -1; + + *seq = ntohl(nfnl_get_data(nfad->nfa, NFULA_SEQ, u_int32_t)); + return 0; +} + +int nflog_get_seq_global(struct nflog_data *nfad, u_int32_t *seq) +{ + if (!nfnl_attr_present(nfad->nfa, NFULA_SEQ_GLOBAL)) + return -1; + + *seq = ntohl(nfnl_get_data(nfad->nfa, NFULA_SEQ_GLOBAL, u_int32_t)); + return 0; +} -- cgit v1.2.3