[netfilter-cvslog] r6440 - in trunk/libnfnetlink:
include/libnfnetlink src
laforge at netfilter.org
laforge at netfilter.org
Thu Jan 26 11:44:09 CET 2006
Author: laforge at netfilter.org
Date: 2006-01-26 11:44:06 +0100 (Thu, 26 Jan 2006)
New Revision: 6440
Modified:
trunk/libnfnetlink/include/libnfnetlink/libnfnetlink.h
trunk/libnfnetlink/src/libnfnetlink.c
Log:
add 16bit attribute functions
Modified: trunk/libnfnetlink/include/libnfnetlink/libnfnetlink.h
===================================================================
--- trunk/libnfnetlink/include/libnfnetlink/libnfnetlink.h 2006-01-26 09:28:47 UTC (rev 6439)
+++ trunk/libnfnetlink/include/libnfnetlink/libnfnetlink.h 2006-01-26 10:44:06 UTC (rev 6440)
@@ -117,8 +117,10 @@
/* nfnl attribute handling functions */
extern int nfnl_addattr_l(struct nlmsghdr *, int, int, void *, int);
+extern int nfnl_addattr16(struct nlmsghdr *, int, int, u_int16_t);
extern int nfnl_addattr32(struct nlmsghdr *, int, int, u_int32_t);
extern int nfnl_nfa_addattr_l(struct nfattr *, int, int, void *, int);
+extern int nfnl_nfa_addattr16(struct nfattr *, int, int, u_int16_t);
extern int nfnl_nfa_addattr32(struct nfattr *, int, int, u_int32_t);
extern int nfnl_parse_attr(struct nfattr **, int, struct nfattr *, int);
#define nfnl_parse_nested(tb, max, nfa) \
Modified: trunk/libnfnetlink/src/libnfnetlink.c
===================================================================
--- trunk/libnfnetlink/src/libnfnetlink.c 2006-01-26 09:28:47 UTC (rev 6439)
+++ trunk/libnfnetlink/src/libnfnetlink.c 2006-01-26 10:44:06 UTC (rev 6440)
@@ -20,6 +20,10 @@
* 2006-01-15 Pablo Neira Ayuso <pablo at netfilter.org>:
* set missing subsys_id in nfnl_subsys_open
* set missing nfnlh->local.nl_pid in nfnl_open
+ *
+ * 2006-01-26 Harald Welte <laforge at netfilter.org>:
+ * remove bogus nfnlh->local.nl_pid from nfnl_open ;)
+ * add 16bit attribute functions
*/
#include <stdlib.h>
@@ -680,8 +684,38 @@
return 0;
}
+/**
+ * nfnl_nfa_addattr16 - Add u_int16_t attribute to struct nfattr
+ *
+ * nfa: struct nfattr
+ * maxlen: maximal length of nfattr buffer
+ * type: type for new attribute
+ * data: content of new attribute
+ *
+ */
+int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type,
+ u_int16_t data)
+{
+ return nfnl_nfa_addattr_l(nfa, maxlen, type, &data, sizeof(data));
+}
+
/**
+ * nfnl_addattr16 - Add u_int16_t attribute to nlmsghdr
+ *
+ * n: netlink message header to which attribute is to be added
+ * maxlen: maximum length of netlink message header
+ * type: type of new attribute
+ * data: content of new attribute
+ *
+ */
+int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type,
+ u_int16_t data)
+{
+ return nfnl_addattr_l(n, maxlen, type, &data, sizeof(data));
+}
+
+/**
* nfnl_nfa_addattr32 - Add u_int32_t attribute to struct nfattr
*
* nfa: struct nfattr
More information about the netfilter-cvslog
mailing list