diff options
author | /C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org> | 2006-01-26 10:44:06 +0000 |
---|---|---|
committer | /C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org> | 2006-01-26 10:44:06 +0000 |
commit | d809e93036d15654f120d1f1ad0172942be12f53 (patch) | |
tree | 898e291c7283625833a4b2badf41ef1bbb56f8d4 /src/libnfnetlink.c | |
parent | 8f076cfcad17e3590302c8831f83b216fb255ec6 (diff) |
add 16bit attribute functions
Diffstat (limited to 'src/libnfnetlink.c')
-rw-r--r-- | src/libnfnetlink.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c index 5765072..47a95cd 100644 --- a/src/libnfnetlink.c +++ b/src/libnfnetlink.c @@ -20,6 +20,10 @@ * 2006-01-15 Pablo Neira Ayuso <pablo@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@netfilter.org>: + * remove bogus nfnlh->local.nl_pid from nfnl_open ;) + * add 16bit attribute functions */ #include <stdlib.h> @@ -680,6 +684,36 @@ int nfnl_nfa_addattr_l(struct nfattr *nfa, int maxlen, int type, void *data, 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 |