libnfnetlink.h | libnfnetlink.h | |||
---|---|---|---|---|
/* libnfnetlink.h: Header file for generic netfilter netlink interface | /* libnfnetlink.h: Header file for generic netfilter netlink interface | |||
* | * | |||
* (C) 2002 Harald Welte <laforge@gnumonks.org> | * (C) 2002 Harald Welte <laforge@gnumonks.org> | |||
* | * | |||
* 2005-10-29 Pablo Neira Ayuso <pablo@netfilter.org>: | * 2005-10-29 Pablo Neira Ayuso <pablo@netfilter.org>: | |||
* Fix NFNL_HEADER_LEN | * Fix NFNL_HEADER_LEN | |||
* 2005-11-13 Pablo Neira Ayuso <pablo@netfilter.org>: | ||||
* Define NETLINK_NETFILTER if it's undefined | ||||
*/ | */ | |||
#ifndef __LIBNFNETLINK_H | #ifndef __LIBNFNETLINK_H | |||
#define __LIBNFNETLINK_H | #define __LIBNFNETLINK_H | |||
#ifndef aligned_u64 | #ifndef aligned_u64 | |||
#define aligned_u64 unsigned long long __attribute__((aligned(8))) | #define aligned_u64 unsigned long long __attribute__((aligned(8))) | |||
#endif | #endif | |||
#include <linux/types.h> | #include <linux/types.h> | |||
#include <sys/socket.h> /* for sa_family_t */ | #include <sys/socket.h> /* for sa_family_t */ | |||
#include <linux/netlink.h> | #include <linux/netlink.h> | |||
#include <libnfnetlink/linux_nfnetlink.h> | #include <libnfnetlink/linux_nfnetlink.h> | |||
#ifndef NETLINK_NETFILTER | ||||
#define NETLINK_NETFILTER 12 | ||||
#endif | ||||
#define NLMSG_TAIL(nlh) \ | #define NLMSG_TAIL(nlh) \ | |||
(((void *) (nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)) | (((void *) (nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)) | |||
#define NFNL_HEADER_LEN (NLMSG_ALIGN(sizeof(struct nlmsghdr)) \ | #define NFNL_HEADER_LEN (NLMSG_ALIGN(sizeof(struct nlmsghdr)) \ | |||
+NLMSG_ALIGN(sizeof(struct nfgenmsg))) | +NLMSG_ALIGN(sizeof(struct nfgenmsg))) | |||
#define NFNL_BUFFSIZE 8192 | #define NFNL_BUFFSIZE 8192 | |||
struct nfnlhdr { | struct nfnlhdr { | |||
struct nlmsghdr nlh; | struct nlmsghdr nlh; | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 6 lines changed or added | |||
linux_nfnetlink.h | linux_nfnetlink.h | |||
---|---|---|---|---|
skipping to change at line 115 | skipping to change at line 115 | |||
#ifdef __KERNEL__ | #ifdef __KERNEL__ | |||
#include <linux/netlink.h> | #include <linux/netlink.h> | |||
#include <linux/capability.h> | #include <linux/capability.h> | |||
struct nfnl_callback | struct nfnl_callback | |||
{ | { | |||
int (*call)(struct sock *nl, struct sk_buff *skb, | int (*call)(struct sock *nl, struct sk_buff *skb, | |||
struct nlmsghdr *nlh, struct nfattr *cda[], int *errp); | struct nlmsghdr *nlh, struct nfattr *cda[], int *errp); | |||
kernel_cap_t cap_required; /* capabilities required for this msg */ | ||||
u_int16_t attr_count; /* number of nfattr's */ | u_int16_t attr_count; /* number of nfattr's */ | |||
}; | }; | |||
struct nfnetlink_subsystem | struct nfnetlink_subsystem | |||
{ | { | |||
const char *name; | const char *name; | |||
__u8 subsys_id; /* nfnetlink subsystem ID */ | __u8 subsys_id; /* nfnetlink subsystem ID */ | |||
__u8 cb_count; /* number of callbacks */ | __u8 cb_count; /* number of callbacks */ | |||
struct nfnl_callback *cb; /* callback for individual types */ | struct nfnl_callback *cb; /* callback for individual types */ | |||
}; | }; | |||
skipping to change at line 149 | skipping to change at line 148 | |||
if(nfnl && nfnl->sk_receive_queue.qlen) \ | if(nfnl && nfnl->sk_receive_queue.qlen) \ | |||
nfnl->sk_data_ready(nfnl, 0); \ | nfnl->sk_data_ready(nfnl, 0); \ | |||
} while(0) | } while(0) | |||
extern void nfnl_lock(void); | extern void nfnl_lock(void); | |||
extern void nfnl_unlock(void); | extern void nfnl_unlock(void); | |||
extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); | extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); | |||
extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); | extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); | |||
extern int nfattr_parse(struct nfattr *tb[], int maxattr, | extern void nfattr_parse(struct nfattr *tb[], int maxattr, | |||
struct nfattr *nfa, int len); | struct nfattr *nfa, int len); | |||
#define nfattr_parse_nested(tb, max, nfa) \ | #define nfattr_parse_nested(tb, max, nfa) \ | |||
nfattr_parse((tb), (max), NFA_DATA((nfa)), NFA_PAYLOAD((nfa))) | nfattr_parse((tb), (max), NFA_DATA((nfa)), NFA_PAYLOAD((nfa))) | |||
#define nfattr_bad_size(tb, max, cta_min) \ | #define nfattr_bad_size(tb, max, cta_min) \ | |||
({ int __i, __res = 0; \ | ({ int __i, __res = 0; \ | |||
for (__i=0; __i<max; __i++) \ | for (__i=0; __i<max; __i++) { \ | |||
if (!cta_min[__i]) \ | ||||
continue; \ | ||||
if (tb[__i] && NFA_PAYLOAD(tb[__i]) < cta_min[__i]){ \ | if (tb[__i] && NFA_PAYLOAD(tb[__i]) < cta_min[__i]){ \ | |||
__res = 1; \ | __res = 1; \ | |||
break; \ | break; \ | |||
} \ | } \ | |||
} \ | ||||
__res; \ | __res; \ | |||
}) | }) | |||
extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, | extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, | |||
int echo); | int echo); | |||
extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags) ; | extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags) ; | |||
#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ | #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ | |||
MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) | MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 5 lines changed or added | |||