[netfilter-cvslog] r6443 - in trunk/libnetfilter_log:
include/libnetfilter_log src
laforge at netfilter.org
laforge at netfilter.org
Thu Jan 26 17:14:57 CET 2006
Author: laforge at netfilter.org
Date: 2006-01-26 17:14:57 +0100 (Thu, 26 Jan 2006)
New Revision: 6443
Modified:
trunk/libnetfilter_log/include/libnetfilter_log/libnetfilter_log.h
trunk/libnetfilter_log/include/libnetfilter_log/linux_nfnetlink_log.h
trunk/libnetfilter_log/src/libnetfilter_log.c
Log:
add support for instance-local and global sequence counters
Modified: trunk/libnetfilter_log/include/libnetfilter_log/libnetfilter_log.h
===================================================================
--- trunk/libnetfilter_log/include/libnetfilter_log/libnetfilter_log.h 2006-01-26 14:43:52 UTC (rev 6442)
+++ trunk/libnetfilter_log/include/libnetfilter_log/libnetfilter_log.h 2006-01-26 16:14:57 UTC (rev 6443)
@@ -38,6 +38,7 @@
extern int nflog_set_mode(struct nflog_g_handle *gh,
u_int8_t mode, unsigned int len);
extern int nflog_set_timeout(struct nflog_g_handle *gh, u_int32_t timeout);
+extern int nflog_set_flags(struct nflog_g_handle *gh, u_int16_t flags);
extern int nflog_set_qthresh(struct nflog_g_handle *gh, u_int32_t qthresh);
extern int nflog_set_nlbufsiz(struct nflog_g_handle *gh, u_int32_t nlbufsiz);
@@ -57,5 +58,7 @@
extern int nflog_get_payload(struct nflog_data *nfad, char **data);
extern char *nflog_get_prefix(struct nflog_data *nfad);
extern int nflog_get_uid(struct nflog_data *nfad, u_int32_t *uid);
+extern int nflog_get_seq(struct nflog_data *nfad, u_int32_t *seq);
+extern int nflog_get_seq_global(struct nflog_data *nfad, u_int32_t *seq);
#endif /* __LIBNETFILTER_LOG_H */
Modified: trunk/libnetfilter_log/include/libnetfilter_log/linux_nfnetlink_log.h
===================================================================
--- trunk/libnetfilter_log/include/libnetfilter_log/linux_nfnetlink_log.h 2006-01-26 14:43:52 UTC (rev 6442)
+++ trunk/libnetfilter_log/include/libnetfilter_log/linux_nfnetlink_log.h 2006-01-26 16:14:57 UTC (rev 6443)
@@ -51,6 +51,8 @@
NFULA_PAYLOAD, /* opaque data payload */
NFULA_PREFIX, /* string prefix */
NFULA_UID, /* user id of socket */
+ NFULA_SEQ, /* instance-local sequence number */
+ NFULA_SEQ_GLOBAL, /* global sequence number */
__NFULA_MAX
};
@@ -81,6 +83,7 @@
NFULA_CFG_NLBUFSIZ, /* u_int32_t buffer size */
NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */
NFULA_CFG_QTHRESH, /* u_int32_t */
+ NFULA_CFG_FLAGS, /* u_int16_t */
__NFULA_CFG_MAX
};
#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
@@ -89,4 +92,7 @@
#define NFULNL_COPY_META 0x01
#define NFULNL_COPY_PACKET 0x02
+#define NFULNL_CFG_F_SEQ 0x0001
+#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002
+
#endif /* _NFNETLINK_LOG_H */
Modified: trunk/libnetfilter_log/src/libnetfilter_log.c
===================================================================
--- trunk/libnetfilter_log/src/libnetfilter_log.c 2006-01-26 14:43:52 UTC (rev 6442)
+++ trunk/libnetfilter_log/src/libnetfilter_log.c 2006-01-26 16:14:57 UTC (rev 6443)
@@ -353,7 +353,20 @@
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)
{
return nfnl_get_pointer_to_data(nfad->nfa, NFULA_PACKET_HDR,
@@ -429,3 +442,20 @@
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;
+}
More information about the netfilter-cvslog
mailing list