summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libnfnetlink/libnfnetlink.h1
-rw-r--r--src/libnfnetlink.c17
2 files changed, 18 insertions, 0 deletions
diff --git a/include/libnfnetlink/libnfnetlink.h b/include/libnfnetlink/libnfnetlink.h
index b7f56e1..1d8c49d 100644
--- a/include/libnfnetlink/libnfnetlink.h
+++ b/include/libnfnetlink/libnfnetlink.h
@@ -180,6 +180,7 @@ extern int nfnl_query(struct nfnl_handle *h, struct nlmsghdr *nlh);
/* nfnl attribute handling functions */
extern int nfnl_addattr_l(struct nlmsghdr *, int, int, const void *, int);
+extern int nfnl_addattr8(struct nlmsghdr *, int, int, u_int8_t);
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, const void *, int);
diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c
index c1c4477..b048d2b 100644
--- a/src/libnfnetlink.c
+++ b/src/libnfnetlink.c
@@ -853,6 +853,23 @@ int nfnl_nfa_addattr_l(struct nfattr *nfa, int maxlen, int type,
}
/**
+ * nfnl_addattr8 - Add u_int8_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_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data)
+{
+ assert(n);
+ assert(maxlen > 0);
+ assert(type >= 0);
+
+ return nfnl_addattr_l(n, maxlen, type, &data, sizeof(data));
+}
+
+/**
* nfnl_nfa_addattr16 - Add u_int16_t attribute to struct nfattr
*
* @nfa: struct nfattr