: Use generic netlink functions for nfnetlink
Subsystems (2)
cover : Use generic netlink functions for nfnetlink
I've queued these patches which convert nfnetlink to use the generic netlink functions. Will push upstream after a bit more testing. Comments, review and patches on top to use the typeful attribute parsing/dumping functions (NLA_PUT_BE32, nla_get_u32, ...) welcome :)
include/linux/netfilter/Kbuild | 1 + include/linux/netfilter/nfnetlink.h | 98 +----- include/linux/netfilter/nfnetlink_compat.h | 61 +++ include/net/netfilter/nf_conntrack_helper.h | 2 +- include/net/netfilter/nf_conntrack_l3proto.h | 9 +- include/net/netfilter/nf_conntrack_l4proto.h | 17 +- include/net/netfilter/nf_nat_protocol.h | 8 +- net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 30 +- net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 40 +- net/ipv4/netfilter/nf_nat_core.c | 22 +- net/ipv4/netfilter/nf_nat_proto_gre.c | 4 +- net/ipv4/netfilter/nf_nat_proto_icmp.c | 4 +- net/ipv4/netfilter/nf_nat_proto_tcp.c | 4 +- net/ipv4/netfilter/nf_nat_proto_udp.c | 4 +- net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 30 +- net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 40 +- net/netfilter/nf_conntrack_core.c | 31 +- net/netfilter/nf_conntrack_netlink.c | 498 ++++++++++++----------- net/netfilter/nf_conntrack_proto_gre.c | 5 +- net/netfilter/nf_conntrack_proto_tcp.c | 87 +++-- net/netfilter/nf_conntrack_proto_udp.c | 10 +- net/netfilter/nf_conntrack_proto_udplite.c | 10 +- net/netfilter/nfnetlink.c | 107 ++---- net/netfilter/nfnetlink_log.c | 155 ++++----- net/netfilter/nfnetlink_queue.c | 133 +++---- 25 files changed, 665 insertions(+), 745 deletions(-) create mode 100644 include/linux/netfilter/nfnetlink_compat.h
Patrick McHardy (9):
[NETFILTER]: nfnetlink: make subsystem and callbacks const [NETFILTER]: nfnetlink: convert to generic netlink attribute functions [NETFILTER]: nfnetlink: rename functions containing 'nfattr' [NETFILTER]: nfnetlink: use nlmsg_notify()
[NETFILTER]: nfnetlink: support attribute policies [NETFILTER]: nfnetlink_log: use netlink policy [NETFILTER]: nfnetlink_queue: use netlink policy [NETFILTER]: ctnetlink: use netlink policy
[NETFILTER]: nfnetlink: kill nlattr_bad_size
PATCH 1/9 : nfnetlink: make subsystem and callbacks const
[NETFILTER]: nfnetlink: make subsystem and callbacks const
---
commit 51a4f2a104898dd615d91bae8283dc61de0544e4
tree de6f515c5e2705f85fb86777db0fb8f1b6b5dbbf
parent 5f81f1c0a4e68593feb6b95dbacab87f1718ea6e
author Patrick McHardy <[email protected]> Thu, 27 Sep 2007 13:03:05 +0200 committer Patrick McHardy <[email protected]> Thu, 27 Sep 2007 13:03:05 +0200
include/linux/netfilter/nfnetlink.h | 10 +++++----- net/netfilter/nf_conntrack_netlink.c | 8 ++++---- net/netfilter/nfnetlink.c | 18 +++++++++--------- net/netfilter/nfnetlink_log.c | 4 ++-- net/netfilter/nfnetlink_queue.c | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-)
include/linux/netfilter/nfnetlink.h +5 -5
@@ -118,9 +118,9 @@ struct nfnl_callbackstruct nfnetlink_subsystem {const char *name; -__u8 subsys_id;/* nfnetlink subsystem ID */ -__u8 cb_count;/* number of callbacks */ -struct nfnl_callback *cb;/* callback for individual types */ +__u8 subsys_id;/* nfnetlink subsystem ID */ +__u8 cb_count;/* number of callbacks */ +const struct nfnl_callback *cb;/* callback for individual types */ }; extern void __nfa_fill(struct sk_buff *skb, int attrtype,
@@ -129,8 +129,8 @@ extern void __nfa_fill(struct sk_buff *skb, int attrtype, ({if (skb_tailroom (skb) < (int )NFA_SPACE (attrlen)) goto nfattr_failure; \ __nfa_fill(skb, attrtype, attrlen, data); }) -extern int nfnetlink_subsys_register (struct nfnetlink_subsystem *n); -extern int nfnetlink_subsys_unregister (struct nfnetlink_subsystem *n); +extern int nfnetlink_subsys_register (const struct nfnetlink_subsystem *n); +extern int nfnetlink_subsys_unregister (const struct nfnetlink_subsystem *n);extern void nfattr_parse (struct nfattr *tb[],int maxattr,struct nfattr *nfa,int len);
net/netfilter/nf_conntrack_netlink.c +4 -4
@@ -1548,7 +1548,7 @@ static struct notifier_block ctnl_notifier_exp = { };#endif -static struct nfnl_callback ctnl_cb[IPCTNL_MSG_MAX ] = { +static const struct nfnl_callback ctnl_cb[IPCTNL_MSG_MAX ] = { [IPCTNL_MSG_CT_NEW ] = { .call = ctnetlink_new_conntrack, .attr_count =CTA_MAX , }, [IPCTNL_MSG_CT_GET ] = { .call = ctnetlink_get_conntrack,
@@ -1559,7 +1559,7 @@ static struct nfnl_callback ctnl_cb[IPCTNL_MSG_MAX] = { .attr_count = CTA_MAX, }, }; -static struct nfnl_callback ctnl_exp_cb[IPCTNL_MSG_EXP_MAX ] = { +static const struct nfnl_callback ctnl_exp_cb[IPCTNL_MSG_EXP_MAX ] = { [IPCTNL_MSG_EXP_GET ] = { .call = ctnetlink_get_expect, .attr_count =CTA_EXPECT_MAX , }, [IPCTNL_MSG_EXP_NEW ] = { .call = ctnetlink_new_expect,
@@ -1568,14 +1568,14 @@ static struct nfnl_callback ctnl_exp_cb[IPCTNL_MSG_EXP_MAX] = { .attr_count = CTA_EXPECT_MAX, }, }; -static struct nfnetlink_subsystem ctnl_subsys = { +static const struct nfnetlink_subsystem ctnl_subsys = { .name ="conntrack" , .subsys_id =NFNL_SUBSYS_CTNETLINK , .cb_count =IPCTNL_MSG_MAX , .cb = ctnl_cb, }; -static struct nfnetlink_subsystem ctnl_exp_subsys = { +static const struct nfnetlink_subsystem ctnl_exp_subsys = { .name ="conntrack_expect" , .subsys_id =NFNL_SUBSYS_CTNETLINK_EXP , .cb_count = IPCTNL_MSG_EXP_MAX,
net/netfilter/nfnetlink.c +9 -9
@@ -41,7 +41,7 @@ MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_NETFILTER);static char __initdata nfversion[] ="0.30" ;static struct sock *nfnl =NULL ; -static struct nfnetlink_subsystem *subsys_table[NFNL_SUBSYS_COUNT ]; +static const struct nfnetlink_subsystem *subsys_table[NFNL_SUBSYS_COUNT ];static DEFINE_MUTEX (nfnl_mutex);static void nfnl_lock (void )
@@ -66,7 +66,7 @@ static void nfnl_unlock(void) nfnl->sk_data_ready (nfnl,0 ); } -int nfnetlink_subsys_register (struct nfnetlink_subsystem *n) +int nfnetlink_subsys_register (const struct nfnetlink_subsystem *n) {nfnl_lock ();if (subsys_table[n->subsys_id]) {
@@ -80,7 +80,7 @@ int nfnetlink_subsys_register(struct nfnetlink_subsystem *n) }EXPORT_SYMBOL_GPL (nfnetlink_subsys_register); -int nfnetlink_subsys_unregister (struct nfnetlink_subsystem *n) +int nfnetlink_subsys_unregister (const struct nfnetlink_subsystem *n) {nfnl_lock (); subsys_table[n->subsys_id] =NULL ;
@@ -90,7 +90,7 @@ int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n) }EXPORT_SYMBOL_GPL (nfnetlink_subsys_unregister); -static inline struct nfnetlink_subsystem *nfnetlink_get_subsys (u_int16_t type) +static inline const struct nfnetlink_subsystem *nfnetlink_get_subsys (u_int16_t type) {u_int8_t subsys_id =NFNL_SUBSYS_ID (type);
@@ -100,8 +100,8 @@ static inline struct nfnetlink_subsystem *nfnetlink_get_subsys(u_int16_t type)return subsys_table[subsys_id]; } -static inline struct nfnl_callback * -nfnetlink_find_client (u_int16_t type,struct nfnetlink_subsystem *ss) +static inline const struct nfnl_callback * +nfnetlink_find_client (u_int16_t type,const struct nfnetlink_subsystem *ss) {u_int8_t cb_id =NFNL_MSG_TYPE (type);
@@ -147,7 +147,7 @@ EXPORT_SYMBOL_GPL(nfattr_parse);* */ static int -nfnetlink_check_attributes (struct nfnetlink_subsystem *subsys, +nfnetlink_check_attributes (const struct nfnetlink_subsystem *subsys,struct nlmsghdr *nlh,struct nfattr *cda[]) {int min_len =NLMSG_SPACE (sizeof (struct nfgenmsg ));
@@ -197,8 +197,8 @@ EXPORT_SYMBOL_GPL(nfnetlink_unicast);/* Process one complete nfnetlink message. */ static int nfnetlink_rcv_msg (struct sk_buff *skb,struct nlmsghdr *nlh) { -struct nfnl_callback *nc; -struct nfnetlink_subsystem *ss; +const struct nfnl_callback *nc; +const struct nfnetlink_subsystem *ss;int type, err;if (security_netlink_recv (skb,CAP_NET_ADMIN ))
net/netfilter/nfnetlink_log.c +2 -2
@@ -882,14 +882,14 @@ out:return ret; } -static struct nfnl_callback nfulnl_cb[NFULNL_MSG_MAX ] = { +static const struct nfnl_callback nfulnl_cb[NFULNL_MSG_MAX ] = { [NFULNL_MSG_PACKET ] = { .call = nfulnl_recv_unsupp, .attr_count =NFULA_MAX , }, [NFULNL_MSG_CONFIG ] = { .call = nfulnl_recv_config, .attr_count =NFULA_CFG_MAX , }, }; -static struct nfnetlink_subsystem nfulnl_subsys = { +static const struct nfnetlink_subsystem nfulnl_subsys = { .name ="log" , .subsys_id =NFNL_SUBSYS_ULOG , .cb_count =NFULNL_MSG_MAX ,
net/netfilter/nfnetlink_queue.c +2 -2
@@ -962,7 +962,7 @@ out_put:return ret; } -static struct nfnl_callback nfqnl_cb[NFQNL_MSG_MAX ] = { +static const struct nfnl_callback nfqnl_cb[NFQNL_MSG_MAX ] = { [NFQNL_MSG_PACKET ] = { .call = nfqnl_recv_unsupp, .attr_count =NFQA_MAX , }, [NFQNL_MSG_VERDICT ] = { .call = nfqnl_recv_verdict,
@@ -971,7 +971,7 @@ static struct nfnl_callback nfqnl_cb[NFQNL_MSG_MAX] = { .attr_count = NFQA_CFG_MAX, }, }; -static struct nfnetlink_subsystem nfqnl_subsys = { +static const struct nfnetlink_subsystem nfqnl_subsys = { .name ="nf_queue" , .subsys_id =NFNL_SUBSYS_QUEUE , .cb_count = NFQNL_MSG_MAX,
PATCH 2/9 : nfnetlink: convert to generic netlink attribute functions
In reply to Patrick McHardy[NETFILTER]: nfnetlink: convert to generic netlink attribute functions
Get rid of the duplicated rtnetlink macros and use the generic netlink attribute functions. The old duplicated stuff is moved to a new header file that exists just for userspace.
---
commit 849e8039365ef524d5b1f64f820122e2c6e0f7d0
tree 74d67928848ef96554cfb8a61edf30f2cda45d74
parent 51a4f2a104898dd615d91bae8283dc61de0544e4
author Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:05:31 +0200 committer Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:05:31 +0200
include/linux/netfilter/Kbuild | 1 include/linux/netfilter/nfnetlink.h | 78 ----- include/linux/netfilter/nfnetlink_compat.h | 61 ++++ include/net/netfilter/nf_conntrack_l3proto.h | 5 include/net/netfilter/nf_conntrack_l4proto.h | 10 - include/net/netfilter/nf_nat_protocol.h | 4 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 20 + net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 30 +- net/ipv4/netfilter/nf_nat_core.c | 16 - net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 20 + net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 30 +- net/netfilter/nf_conntrack_core.c | 21 + net/netfilter/nf_conntrack_netlink.c | 393 +++++++++++++----------- net/netfilter/nf_conntrack_proto_tcp.c | 63 ++-- net/netfilter/nfnetlink.c | 39 -- net/netfilter/nfnetlink_log.c | 155 +++++---- net/netfilter/nfnetlink_queue.c | 113 +++---- 17 files changed, 527 insertions(+), 532 deletions(-)
include/linux/netfilter/Kbuild +1 -0
@@ -40,5 +40,6 @@ unifdef-y += nf_conntrack_common.h unifdef-y += nf_conntrack_ftp.h unifdef-y += nf_conntrack_tcp.h unifdef-y += nfnetlink.h +unifdef-y += nfnetlink_compat.h unifdef-y += x_tables.h unifdef-y += xt_physdev.h
include/linux/netfilter/nfnetlink.h +6 -72
119 lines not on this page · raw message
include/linux/netfilter/nfnetlink_compat.h new file +61 -0
61 lines not on this page · raw message
include/net/netfilter/nf_conntrack_l3proto.h +2 -3
@@ -11,11 +11,10 @@#ifndef _NF_CONNTRACK_L3PROTO_H#define _NF_CONNTRACK_L3PROTO_H +#include <linux/netlink.h> #include <linux/seq_file.h> #include <net/netfilter/nf_conntrack.h> -struct nfattr ; -struct nf_conntrack_l3proto {/* L3 Protocol Family number. ex) PF_INET */
@@ -67,7 +66,7 @@ struct nf_conntrack_l3protoint (*tuple_to_nfattr)(struct sk_buff *skb,const struct nf_conntrack_tuple *t); -int (*nfattr_to_tuple)(struct nfattr *tb[], +int (*nfattr_to_tuple)(struct nlattr *tb[],struct nf_conntrack_tuple *t);#ifdef CONFIG_SYSCTL
include/net/netfilter/nf_conntrack_l4proto.h +5 -5
@@ -9,10 +9,10 @@#ifndef _NF_CONNTRACK_L4PROTO_H#define _NF_CONNTRACK_L4PROTO_H +#include <linux/netlink.h> #include <net/netfilter/nf_conntrack.h> struct seq_file ; -struct nfattr ;struct nf_conntrack_l4proto {
@@ -65,15 +65,15 @@ struct nf_conntrack_l4proto int pf, unsigned int hooknum);/* convert protoinfo to nfnetink attributes */ -int (*to_nfattr)(struct sk_buff *skb,struct nfattr *nfa, +int (*to_nfattr)(struct sk_buff *skb,struct nlattr *nla,const struct nf_conn *ct);/* convert nfnetlink attributes to protoinfo */ -int (*from_nfattr)(struct nfattr *tb[],struct nf_conn *ct); +int (*from_nfattr)(struct nlattr *tb[],struct nf_conn *ct);int (*tuple_to_nfattr)(struct sk_buff *skb,const struct nf_conntrack_tuple *t); -int (*nfattr_to_tuple)(struct nfattr *tb[], +int (*nfattr_to_tuple)(struct nlattr *tb[],struct nf_conntrack_tuple *t);#ifdef CONFIG_SYSCTL
@@ -113,7 +113,7 @@ extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);/* Generic netlink helpers */ extern int nf_ct_port_tuple_to_nfattr (struct sk_buff *skb,const struct nf_conntrack_tuple *tuple); -extern int nf_ct_port_nfattr_to_tuple (struct nfattr *tb[], +extern int nf_ct_port_nfattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *t);/* Log invalid packets */
include/net/netfilter/nf_nat_protocol.h +2 -2
@@ -41,7 +41,7 @@ struct nf_nat_protocolint (*range_to_nfattr)(struct sk_buff *skb,const struct nf_nat_range *range); -int (*nfattr_to_range)(struct nfattr *tb[], +int (*nfattr_to_range)(struct nlattr *tb[],struct nf_nat_range *range); };
@@ -64,7 +64,7 @@ extern struct nf_nat_protocol *find_nat_proto(u_int16_t protonum);extern int nf_nat_port_range_to_nfattr (struct sk_buff *skb,const struct nf_nat_range *range); -extern int nf_nat_port_nfattr_to_range (struct nfattr *tb[], +extern int nf_nat_port_nfattr_to_range (struct nlattr *tb[],struct nf_nat_range *range);#endif /*_NF_NAT_PROTO_H*/
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +10 -10
@@ -363,32 +363,32 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)static int ipv4_tuple_to_nfattr (struct sk_buff *skb,const struct nf_conntrack_tuple *tuple) { -NFA_PUT (skb,CTA_IP_V4_SRC ,sizeof (u_int32_t), +NLA_PUT (skb,CTA_IP_V4_SRC ,sizeof (u_int32_t), &tuple->src.u3.ip); -NFA_PUT (skb,CTA_IP_V4_DST ,sizeof (u_int32_t), +NLA_PUT (skb,CTA_IP_V4_DST ,sizeof (u_int32_t), &tuple->dst.u3.ip);return 0 ; -nfattr_failure: +nla_put_failure:return -1 ; } -static const size_t cta_min_ip[CTA_IP_MAX ] = { - [CTA_IP_V4_SRC -1 ] =sizeof (u_int32_t), - [CTA_IP_V4_DST -1 ] =sizeof (u_int32_t), +static const size_t cta_min_ip[CTA_IP_MAX +1 ] = { + [CTA_IP_V4_SRC ] =sizeof (u_int32_t), + [CTA_IP_V4_DST ] =sizeof (u_int32_t), }; -static int ipv4_nfattr_to_tuple (struct nfattr *tb[], +static int ipv4_nfattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *t) { -if (!tb[CTA_IP_V4_SRC -1 ] || !tb[CTA_IP_V4_DST -1 ]) +if (!tb[CTA_IP_V4_SRC ] || !tb[CTA_IP_V4_DST ])return -EINVAL ;if (nfattr_bad_size (tb,CTA_IP_MAX , cta_min_ip))return -EINVAL ; - t->src.u3.ip = *(__be32 *)NFA_DATA (tb[CTA_IP_V4_SRC -1 ]); - t->dst.u3.ip = *(__be32 *)NFA_DATA (tb[CTA_IP_V4_DST -1 ]); + t->src.u3.ip = *(__be32 *)nla_data (tb[CTA_IP_V4_SRC ]); + t->dst.u3.ip = *(__be32 *)nla_data (tb[CTA_IP_V4_DST ]);return 0 ; }
net/ipv4/netfilter/nf_conntrack_proto_icmp.c +15 -15
@@ -235,42 +235,42 @@ icmp_error(struct sk_buff *skb, unsigned int dataoff,static int icmp_tuple_to_nfattr (struct sk_buff *skb,const struct nf_conntrack_tuple *t) { -NFA_PUT (skb,CTA_PROTO_ICMP_ID ,sizeof (u_int16_t), +NLA_PUT (skb,CTA_PROTO_ICMP_ID ,sizeof (u_int16_t), &t->src.u.icmp.id); -NFA_PUT (skb,CTA_PROTO_ICMP_TYPE ,sizeof (u_int8_t), +NLA_PUT (skb,CTA_PROTO_ICMP_TYPE ,sizeof (u_int8_t), &t->dst.u.icmp.type); -NFA_PUT (skb,CTA_PROTO_ICMP_CODE ,sizeof (u_int8_t), +NLA_PUT (skb,CTA_PROTO_ICMP_CODE ,sizeof (u_int8_t), &t->dst.u.icmp.code);return 0 ; -nfattr_failure: +nla_put_failure:return -1 ; } -static const size_t cta_min_proto[CTA_PROTO_MAX ] = { - [CTA_PROTO_ICMP_TYPE -1 ] =sizeof (u_int8_t), - [CTA_PROTO_ICMP_CODE -1 ] =sizeof (u_int8_t), - [CTA_PROTO_ICMP_ID -1 ] =sizeof (u_int16_t) +static const size_t cta_min_proto[CTA_PROTO_MAX +1 ] = { + [CTA_PROTO_ICMP_TYPE ] =sizeof (u_int8_t), + [CTA_PROTO_ICMP_CODE ] =sizeof (u_int8_t), + [CTA_PROTO_ICMP_ID ] =sizeof (u_int16_t) }; -static int icmp_nfattr_to_tuple (struct nfattr *tb[], +static int icmp_nfattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *tuple) { -if (!tb[CTA_PROTO_ICMP_TYPE -1 ] - || !tb[CTA_PROTO_ICMP_CODE -1 ] - || !tb[CTA_PROTO_ICMP_ID -1 ]) +if (!tb[CTA_PROTO_ICMP_TYPE ] + || !tb[CTA_PROTO_ICMP_CODE ] + || !tb[CTA_PROTO_ICMP_ID ])return -EINVAL ;if (nfattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto))return -EINVAL ; tuple->dst.u.icmp.type = - *(u_int8_t *)NFA_DATA (tb[CTA_PROTO_ICMP_TYPE -1 ]); + *(u_int8_t *)nla_data (tb[CTA_PROTO_ICMP_TYPE ]); tuple->dst.u.icmp.code = - *(u_int8_t *)NFA_DATA (tb[CTA_PROTO_ICMP_CODE -1 ]); + *(u_int8_t *)nla_data (tb[CTA_PROTO_ICMP_CODE ]); tuple->src.u.icmp.id = - *(__be16 *)NFA_DATA (tb[CTA_PROTO_ICMP_ID -1 ]); + *(__be16 *)nla_data (tb[CTA_PROTO_ICMP_ID ]);if (tuple->dst.u.icmp.type >=sizeof (invmap) || !invmap[tuple->dst.u.icmp.type])
net/ipv4/netfilter/nf_nat_core.c +8 -8
@@ -547,38 +547,38 @@ int nf_nat_port_range_to_nfattr(struct sk_buff *skb, const struct nf_nat_range *range) { -NFA_PUT (skb, CTA_PROTONAT_PORT_MIN, sizeof(__be16 ), +NLA_PUT (skb, CTA_PROTONAT_PORT_MIN, sizeof(__be16 ), &range->min.tcp.port); -NFA_PUT (skb,CTA_PROTONAT_PORT_MAX ,sizeof (__be16), +NLA_PUT (skb,CTA_PROTONAT_PORT_MAX ,sizeof (__be16), &range->max.tcp.port);return 0 ; -nfattr_failure: +nla_put_failure:return -1 ; }EXPORT_SYMBOL_GPL (nf_nat_port_nfattr_to_range);int -nf_nat_port_nfattr_to_range (struct nfattr *tb[],struct nf_nat_range *range) +nf_nat_port_nfattr_to_range (struct nlattr *tb[],struct nf_nat_range *range) {int ret =0 ;/* we have to return whether we actually parsed something or not */ -if (tb[CTA_PROTONAT_PORT_MIN -1 ]) { +if (tb[CTA_PROTONAT_PORT_MIN ]) { ret =1 ; range->min.tcp.port = - *(__be16 *)NFA_DATA (tb[CTA_PROTONAT_PORT_MIN -1 ]); + *(__be16 *)nla_data (tb[CTA_PROTONAT_PORT_MIN ]); } -if (!tb[CTA_PROTONAT_PORT_MAX -1 ]) { +if (!tb[CTA_PROTONAT_PORT_MAX ]) {if (ret) range->max.tcp.port = range->min.tcp.port; }else { ret =1 ; range->max.tcp.port = - *(__be16 *)NFA_DATA (tb[CTA_PROTONAT_PORT_MAX -1 ]); + *(__be16 *)nla_data (tb[CTA_PROTONAT_PORT_MAX ]); }return ret;
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +10 -10
@@ -340,33 +340,33 @@ static ctl_table nf_ct_ipv6_sysctl_table[] = {static int ipv6_tuple_to_nfattr (struct sk_buff *skb,const struct nf_conntrack_tuple *tuple) { -NFA_PUT (skb,CTA_IP_V6_SRC ,sizeof (u_int32_t) *4 , +NLA_PUT (skb,CTA_IP_V6_SRC ,sizeof (u_int32_t) *4 , &tuple->src.u3.ip6); -NFA_PUT (skb,CTA_IP_V6_DST ,sizeof (u_int32_t) *4 , +NLA_PUT (skb,CTA_IP_V6_DST ,sizeof (u_int32_t) *4 , &tuple->dst.u3.ip6);return 0 ; -nfattr_failure: +nla_put_failure:return -1 ; } -static const size_t cta_min_ip[CTA_IP_MAX ] = { - [CTA_IP_V6_SRC -1 ] =sizeof (u_int32_t)*4 , - [CTA_IP_V6_DST -1 ] =sizeof (u_int32_t)*4 , +static const size_t cta_min_ip[CTA_IP_MAX +1 ] = { + [CTA_IP_V6_SRC ] =sizeof (u_int32_t)*4 , + [CTA_IP_V6_DST ] =sizeof (u_int32_t)*4 , }; -static int ipv6_nfattr_to_tuple (struct nfattr *tb[], +static int ipv6_nfattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *t) { -if (!tb[CTA_IP_V6_SRC -1 ] || !tb[CTA_IP_V6_DST -1 ]) +if (!tb[CTA_IP_V6_SRC ] || !tb[CTA_IP_V6_DST ])return -EINVAL ;if (nfattr_bad_size (tb,CTA_IP_MAX , cta_min_ip))return -EINVAL ; -memcpy (&t->src.u3.ip6,NFA_DATA (tb[CTA_IP_V6_SRC -1 ]), +memcpy (&t->src.u3.ip6,nla_data (tb[CTA_IP_V6_SRC ]),sizeof (u_int32_t) *4 ); -memcpy (&t->dst.u3.ip6,NFA_DATA (tb[CTA_IP_V6_DST -1 ]), +memcpy (&t->dst.u3.ip6,nla_data (tb[CTA_IP_V6_DST ]),sizeof (u_int32_t) *4 );return 0 ;
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +15 -15
@@ -213,42 +213,42 @@ icmpv6_error(struct sk_buff *skb, unsigned int dataoff,static int icmpv6_tuple_to_nfattr (struct sk_buff *skb,const struct nf_conntrack_tuple *t) { -NFA_PUT (skb,CTA_PROTO_ICMPV6_ID ,sizeof (u_int16_t), +NLA_PUT (skb,CTA_PROTO_ICMPV6_ID ,sizeof (u_int16_t), &t->src.u.icmp.id); -NFA_PUT (skb,CTA_PROTO_ICMPV6_TYPE ,sizeof (u_int8_t), +NLA_PUT (skb,CTA_PROTO_ICMPV6_TYPE ,sizeof (u_int8_t), &t->dst.u.icmp.type); -NFA_PUT (skb,CTA_PROTO_ICMPV6_CODE ,sizeof (u_int8_t), +NLA_PUT (skb,CTA_PROTO_ICMPV6_CODE ,sizeof (u_int8_t), &t->dst.u.icmp.code);return 0 ; -nfattr_failure: +nla_put_failure:return -1 ; } -static const size_t cta_min_proto[CTA_PROTO_MAX ] = { - [CTA_PROTO_ICMPV6_TYPE -1 ] =sizeof (u_int8_t), - [CTA_PROTO_ICMPV6_CODE -1 ] =sizeof (u_int8_t), - [CTA_PROTO_ICMPV6_ID -1 ] =sizeof (u_int16_t) +static const size_t cta_min_proto[CTA_PROTO_MAX +1 ] = { + [CTA_PROTO_ICMPV6_TYPE ] =sizeof (u_int8_t), + [CTA_PROTO_ICMPV6_CODE ] =sizeof (u_int8_t), + [CTA_PROTO_ICMPV6_ID ] =sizeof (u_int16_t) }; -static int icmpv6_nfattr_to_tuple (struct nfattr *tb[], +static int icmpv6_nfattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *tuple) { -if (!tb[CTA_PROTO_ICMPV6_TYPE -1 ] - || !tb[CTA_PROTO_ICMPV6_CODE -1 ] - || !tb[CTA_PROTO_ICMPV6_ID -1 ]) +if (!tb[CTA_PROTO_ICMPV6_TYPE ] + || !tb[CTA_PROTO_ICMPV6_CODE ] + || !tb[CTA_PROTO_ICMPV6_ID ])return -EINVAL ;if (nfattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto))return -EINVAL ; tuple->dst.u.icmp.type = - *(u_int8_t *)NFA_DATA (tb[CTA_PROTO_ICMPV6_TYPE -1 ]); + *(u_int8_t *)nla_data (tb[CTA_PROTO_ICMPV6_TYPE ]); tuple->dst.u.icmp.code = - *(u_int8_t *)NFA_DATA (tb[CTA_PROTO_ICMPV6_CODE -1 ]); + *(u_int8_t *)nla_data (tb[CTA_PROTO_ICMPV6_CODE ]); tuple->src.u.icmp.id = - *(__be16 *)NFA_DATA (tb[CTA_PROTO_ICMPV6_ID -1 ]); + *(__be16 *)nla_data (tb[CTA_PROTO_ICMPV6_ID ]);if (tuple->dst.u.icmp.type <128 || tuple->dst.u.icmp.type - 128 >= sizeof(invmap)
net/netfilter/nf_conntrack_core.c +10 -11
@@ -827,40 +827,39 @@ EXPORT_SYMBOL_GPL(__nf_ct_refresh_acct);#include <linux/netfilter/nfnetlink_conntrack.h> #include <linux/mutex.h> -/* Generic function for tcp/udp/sctp/dccp and alike. This needs to be * in ip_conntrack_core, since we don't want the protocols to autoload * or depend on ctnetlink */ int nf_ct_port_tuple_to_nfattr (struct sk_buff *skb,const struct nf_conntrack_tuple *tuple) { -NFA_PUT (skb,CTA_PROTO_SRC_PORT ,sizeof (u_int16_t), +NLA_PUT (skb,CTA_PROTO_SRC_PORT ,sizeof (u_int16_t), &tuple->src.u.tcp.port); -NFA_PUT (skb,CTA_PROTO_DST_PORT ,sizeof (u_int16_t), +NLA_PUT (skb,CTA_PROTO_DST_PORT ,sizeof (u_int16_t), &tuple->dst.u.tcp.port);return 0 ; -nfattr_failure: +nla_put_failure:return -1 ; }EXPORT_SYMBOL_GPL (nf_ct_port_tuple_to_nfattr); -static const size_t cta_min_proto[CTA_PROTO_MAX ] = { - [CTA_PROTO_SRC_PORT -1 ] =sizeof (u_int16_t), - [CTA_PROTO_DST_PORT -1 ] =sizeof (u_int16_t) +static const size_t cta_min_proto[CTA_PROTO_MAX +1 ] = { + [CTA_PROTO_SRC_PORT ] =sizeof (u_int16_t), + [CTA_PROTO_DST_PORT ] =sizeof (u_int16_t) }; -int nf_ct_port_nfattr_to_tuple (struct nfattr *tb[], +int nf_ct_port_nfattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *t) { -if (!tb[CTA_PROTO_SRC_PORT -1 ] || !tb[CTA_PROTO_DST_PORT -1 ]) +if (!tb[CTA_PROTO_SRC_PORT ] || !tb[CTA_PROTO_DST_PORT ])return -EINVAL ;if (nfattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto))return -EINVAL ; - t->src.u.tcp.port = *(__be16 *)NFA_DATA (tb[CTA_PROTO_SRC_PORT -1 ]); - t->dst.u.tcp.port = *(__be16 *)NFA_DATA (tb[CTA_PROTO_DST_PORT -1 ]); + t->src.u.tcp.port = *(__be16 *)nla_data (tb[CTA_PROTO_SRC_PORT ]); + t->dst.u.tcp.port = *(__be16 *)nla_data (tb[CTA_PROTO_DST_PORT ]);return 0 ; }
net/netfilter/nf_conntrack_netlink.c +210 -183
1,009 lines not on this page · raw message
net/netfilter/nf_conntrack_proto_tcp.c +33 -30
126 lines not on this page · raw message
net/netfilter/nfnetlink.c +6 -33
@@ -111,44 +111,17 @@ nfnetlink_find_client(u_int16_t type, const struct nfnetlink_subsystem *ss)return &ss->cb[cb_id]; } -void __nfa_fill (struct sk_buff *skb,int attrtype,int attrlen, -const void *data) -{ -struct nfattr *nfa; -int size =NFA_LENGTH (attrlen); - - nfa = (struct nfattr *)skb_put (skb,NFA_ALIGN (size)); - nfa->nfa_type = attrtype; - nfa->nfa_len = size; -memcpy (NFA_DATA (nfa), data, attrlen); -memset (NFA_DATA (nfa) + attrlen,0 ,NFA_ALIGN (size) - size); -} -EXPORT_SYMBOL_GPL (__nfa_fill); - -void nfattr_parse (struct nfattr *tb[],int maxattr,struct nfattr *nfa,int len) -{ -memset (tb,0 ,sizeof (struct nfattr *) * maxattr); - -while (NFA_OK (nfa, len)) { -unsigned flavor =NFA_TYPE (nfa); -if (flavor && flavor <= maxattr) - tb[flavor-1 ] = nfa; - nfa =NFA_NEXT (nfa, len); - } -} -EXPORT_SYMBOL_GPL (nfattr_parse); -/** * nfnetlink_check_attributes - check and parse nfnetlink attributes * * subsys: nfnl subsystem for which this message is to be parsed * nlmsghdr: netlink message to be checked/parsed -* cda: array of pointers, needs to be at least subsys->attr_count big +* cda: array of pointers, needs to be at least subsys->attr_count+1 big * */ static int nfnetlink_check_attributes (const struct nfnetlink_subsystem *subsys, -struct nlmsghdr *nlh,struct nfattr *cda[]) +struct nlmsghdr *nlh,struct nlattr *cda[]) {int min_len =NLMSG_SPACE (sizeof (struct nfgenmsg ));u_int8_t cb_id =NFNL_MSG_TYPE (nlh->nlmsg_type);
@@ -156,9 +129,9 @@ nfnetlink_check_attributes(const struct nfnetlink_subsystem *subsys,/* check attribute lengths. */ if (likely (nlh->nlmsg_len > min_len)) { -struct nfattr *attr =NFM_NFA (NLMSG_DATA (nlh)); +struct nlattr *attr = (void *)nlh +NLMSG_ALIGN (min_len);int attrlen = nlh->nlmsg_len -NLMSG_ALIGN (min_len); -nfattr_parse (cda, attr_count, attr, attrlen); +nla_parse (cda, attr_count, attr, attrlen,NULL ); }/* implicit: if nlmsg_len == min_len, we return 0, and an empty
@@ -230,9 +203,9 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) {u_int16_t attr_count = ss->cb[NFNL_MSG_TYPE (nlh->nlmsg_type)].attr_count; -struct nfattr *cda[attr_count]; +struct nlattr *cda[attr_count+1 ]; -memset (cda,0 ,sizeof (struct nfattr *) * attr_count); +memset (cda,0 ,sizeof (struct nlattr *) * attr_count); err =nfnetlink_check_attributes (ss, nlh, cda);if (err <0 )
net/netfilter/nfnetlink_log.c +77 -78
341 lines not on this page · raw message
net/netfilter/nfnetlink_queue.c +56 -57
285 lines not on this page · raw message
PATCH 3/9 : nfnetlink: rename functions containing 'nfattr'
In reply to Patrick McHardy[NETFILTER]: nfnetlink: rename functions containing 'nfattr'
There is no struct nfattr anymore, rename functions to 'nlattr'.
---
commit e8efc3dbdb2ca9fc956fe50db54ed4c2d5734b80
tree 2babb4b47a1f76cb3129be07d41b8f7bbe755eea
parent 849e8039365ef524d5b1f64f820122e2c6e0f7d0
author Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:06:39 +0200 committer Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:06:39 +0200
include/linux/netfilter/nfnetlink.h | 2 - include/net/netfilter/nf_conntrack_helper.h | 2 - include/net/netfilter/nf_conntrack_l3proto.h | 4 +- include/net/netfilter/nf_conntrack_l4proto.h | 12 +++--- include/net/netfilter/nf_nat_protocol.h | 8 ++-- net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 10 ++--- net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 10 ++--- net/ipv4/netfilter/nf_nat_core.c | 8 ++-- net/ipv4/netfilter/nf_nat_proto_gre.c | 4 +- net/ipv4/netfilter/nf_nat_proto_icmp.c | 4 +- net/ipv4/netfilter/nf_nat_proto_tcp.c | 4 +- net/ipv4/netfilter/nf_nat_proto_udp.c | 4 +- net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 10 ++--- net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 10 ++--- net/netfilter/nf_conntrack_core.c | 10 ++--- net/netfilter/nf_conntrack_netlink.c | 52 ++++++++++++------------ net/netfilter/nf_conntrack_proto_gre.c | 4 +- net/netfilter/nf_conntrack_proto_tcp.c | 22 +++++----- net/netfilter/nf_conntrack_proto_udp.c | 8 ++-- net/netfilter/nf_conntrack_proto_udplite.c | 8 ++-- net/netfilter/nfnetlink_log.c | 2 - net/netfilter/nfnetlink_queue.c | 4 +- 22 files changed, 101 insertions(+), 101 deletions(-)
include/linux/netfilter/nfnetlink.h +1 -1
@@ -72,7 +72,7 @@ struct nfnetlink_subsystemextern int nfnetlink_subsys_register (const struct nfnetlink_subsystem *n);extern int nfnetlink_subsys_unregister (const struct nfnetlink_subsystem *n); -#define nfattr_bad_size (tb, max, cta_min) \ +#define nlattr_bad_size (tb, max, cta_min) \ ({ int __i, __res = 0; \ for (__i=1; __i <= max; __i++) { \ if (!cta_min[__i]) \
include/net/netfilter/nf_conntrack_helper.h +1 -1
@@ -36,7 +36,7 @@ struct nf_conntrack_helpervoid (*destroy)(struct nf_conn *ct); -int (*to_nfattr)(struct sk_buff *skb,const struct nf_conn *ct); +int (*to_nlattr)(struct sk_buff *skb,const struct nf_conn *ct); }; extern struct nf_conntrack_helper *
include/net/netfilter/nf_conntrack_l3proto.h +2 -2
@@ -63,10 +63,10 @@ struct nf_conntrack_l3protoint (*get_l4proto)(const struct sk_buff *skb,unsigned int nhoff,unsigned int *dataoff,u_int8_t *protonum); -int (*tuple_to_nfattr)(struct sk_buff *skb, +int (*tuple_to_nlattr)(struct sk_buff *skb,const struct nf_conntrack_tuple *t); -int (*nfattr_to_tuple)(struct nlattr *tb[], +int (*nlattr_to_tuple)(struct nlattr *tb[],struct nf_conntrack_tuple *t);#ifdef CONFIG_SYSCTL
include/net/netfilter/nf_conntrack_l4proto.h +6 -6
@@ -65,15 +65,15 @@ struct nf_conntrack_l4proto int pf, unsigned int hooknum);/* convert protoinfo to nfnetink attributes */ -int (*to_nfattr)(struct sk_buff *skb,struct nlattr *nla, +int (*to_nlattr)(struct sk_buff *skb,struct nlattr *nla,const struct nf_conn *ct);/* convert nfnetlink attributes to protoinfo */ -int (*from_nfattr)(struct nlattr *tb[],struct nf_conn *ct); +int (*from_nlattr)(struct nlattr *tb[],struct nf_conn *ct); -int (*tuple_to_nfattr)(struct sk_buff *skb, +int (*tuple_to_nlattr)(struct sk_buff *skb,const struct nf_conntrack_tuple *t); -int (*nfattr_to_tuple)(struct nlattr *tb[], +int (*nlattr_to_tuple)(struct nlattr *tb[],struct nf_conntrack_tuple *t);#ifdef CONFIG_SYSCTL
@@ -111,9 +111,9 @@ extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);extern void nf_conntrack_l4proto_unregister (struct nf_conntrack_l4proto *proto);/* Generic netlink helpers */ -extern int nf_ct_port_tuple_to_nfattr (struct sk_buff *skb, +extern int nf_ct_port_tuple_to_nlattr (struct sk_buff *skb,const struct nf_conntrack_tuple *tuple); -extern int nf_ct_port_nfattr_to_tuple (struct nlattr *tb[], +extern int nf_ct_port_nlattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *t);/* Log invalid packets */
include/net/netfilter/nf_nat_protocol.h +4 -4
@@ -38,10 +38,10 @@ struct nf_nat_protocolenum nf_nat_manip_type maniptype, const struct nf_conn *ct); -int (*range_to_nfattr)(struct sk_buff *skb, +int (*range_to_nlattr)(struct sk_buff *skb,const struct nf_nat_range *range); -int (*nfattr_to_range)(struct nlattr *tb[], +int (*nlattr_to_range)(struct nlattr *tb[],struct nf_nat_range *range); };
@@ -62,9 +62,9 @@ extern int init_protocols(void) __init;extern void cleanup_protocols (void );extern struct nf_nat_protocol *find_nat_proto (u_int16_t protonum); -extern int nf_nat_port_range_to_nfattr (struct sk_buff *skb, +extern int nf_nat_port_range_to_nlattr (struct sk_buff *skb,const struct nf_nat_range *range); -extern int nf_nat_port_nfattr_to_range (struct nlattr *tb[], +extern int nf_nat_port_nlattr_to_range (struct nlattr *tb[],struct nf_nat_range *range);#endif /*_NF_NAT_PROTO_H*/
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +5 -5
@@ -360,7 +360,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)#include <linux/netfilter/nfnetlink.h> #include <linux/netfilter/nfnetlink_conntrack.h> -static int ipv4_tuple_to_nfattr (struct sk_buff *skb, +static int ipv4_tuple_to_nlattr (struct sk_buff *skb,const struct nf_conntrack_tuple *tuple) { NLA_PUT(skb, CTA_IP_V4_SRC, sizeof(u_int32_t),
@@ -378,13 +378,13 @@ static const size_t cta_min_ip[CTA_IP_MAX+1] = { [CTA_IP_V4_DST] = sizeof(u_int32_t), }; -static int ipv4_nfattr_to_tuple (struct nlattr *tb[], +static int ipv4_nlattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *t) {if (!tb[CTA_IP_V4_SRC ] || !tb[CTA_IP_V4_DST ])return -EINVAL ; -if (nfattr_bad_size (tb,CTA_IP_MAX , cta_min_ip)) +if (nlattr_bad_size (tb,CTA_IP_MAX , cta_min_ip))return -EINVAL ; t->src.u3.ip = *(__be32 *)nla_data (tb[CTA_IP_V4_SRC ]);
@@ -411,8 +411,8 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = { .print_conntrack = ipv4_print_conntrack, .get_l4proto = ipv4_get_l4proto,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .tuple_to_nfattr = ipv4_tuple_to_nfattr, - .nfattr_to_tuple = ipv4_nfattr_to_tuple, + .tuple_to_nlattr = ipv4_tuple_to_nlattr, + .nlattr_to_tuple = ipv4_nlattr_to_tuple,#endif #if defined(CONFIG_SYSCTL ) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT ) .ctl_table_path = nf_net_ipv4_netfilter_sysctl_path,
net/ipv4/netfilter/nf_conntrack_proto_icmp.c +5 -5
@@ -232,7 +232,7 @@ icmp_error(struct sk_buff *skb, unsigned int dataoff,#include <linux/netfilter/nfnetlink.h> #include <linux/netfilter/nfnetlink_conntrack.h> -static int icmp_tuple_to_nfattr (struct sk_buff *skb, +static int icmp_tuple_to_nlattr (struct sk_buff *skb,const struct nf_conntrack_tuple *t) { NLA_PUT(skb, CTA_PROTO_ICMP_ID, sizeof(u_int16_t),
@@ -254,7 +254,7 @@ static const size_t cta_min_proto[CTA_PROTO_MAX+1] = { [CTA_PROTO_ICMP_ID ] =sizeof (u_int16_t) }; -static int icmp_nfattr_to_tuple (struct nlattr *tb[], +static int icmp_nlattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *tuple) { if (!tb[CTA_PROTO_ICMP_TYPE]
@@ -262,7 +262,7 @@ static int icmp_nfattr_to_tuple(struct nlattr *tb[], || !tb[CTA_PROTO_ICMP_ID])return -EINVAL ; -if (nfattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto)) +if (nlattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto))return -EINVAL ; tuple->dst.u.icmp.type =
@@ -327,8 +327,8 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp __read_mostly = .destroy = NULL, .me = NULL,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .tuple_to_nfattr = icmp_tuple_to_nfattr, - .nfattr_to_tuple = icmp_nfattr_to_tuple, + .tuple_to_nlattr = icmp_tuple_to_nlattr, + .nlattr_to_tuple = icmp_nlattr_to_tuple,#endif #ifdef CONFIG_SYSCTL .ctl_table_header = &icmp_sysctl_header,
net/ipv4/netfilter/nf_nat_core.c +4 -4
@@ -544,7 +544,7 @@ EXPORT_SYMBOL(nf_nat_protocol_unregister);#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE )int -nf_nat_port_range_to_nfattr (struct sk_buff *skb, +nf_nat_port_range_to_nlattr (struct sk_buff *skb,const struct nf_nat_range *range) { NLA_PUT(skb, CTA_PROTONAT_PORT_MIN, sizeof(__be16),
@@ -557,10 +557,10 @@ nf_nat_port_range_to_nfattr(struct sk_buff *skb, nla_put_failure:return -1 ; } -EXPORT_SYMBOL_GPL (nf_nat_port_nfattr_to_range); +EXPORT_SYMBOL_GPL (nf_nat_port_nlattr_to_range);int -nf_nat_port_nfattr_to_range (struct nlattr *tb[],struct nf_nat_range *range) +nf_nat_port_nlattr_to_range (struct nlattr *tb[],struct nf_nat_range *range) {int ret =0 ;
@@ -583,7 +583,7 @@ nf_nat_port_nfattr_to_range(struct nlattr *tb[], struct nf_nat_range *range) return ret; } -EXPORT_SYMBOL_GPL (nf_nat_port_range_to_nfattr); +EXPORT_SYMBOL_GPL (nf_nat_port_range_to_nlattr);#endif /* Noone using conntrack by the time this called. */
net/ipv4/netfilter/nf_nat_proto_gre.c +2 -2
@@ -142,8 +142,8 @@ static struct nf_nat_protocol gre __read_mostly = { .in_range = gre_in_range, .unique_tuple = gre_unique_tuple,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .range_to_nfattr = nf_nat_port_range_to_nfattr, - .nfattr_to_range = nf_nat_port_nfattr_to_range, + .range_to_nlattr = nf_nat_port_range_to_nlattr, + .nlattr_to_range = nf_nat_port_nlattr_to_range,#endif };
net/ipv4/netfilter/nf_nat_proto_icmp.c +2 -2
@@ -79,7 +79,7 @@ struct nf_nat_protocol nf_nat_protocol_icmp = { .in_range = icmp_in_range, .unique_tuple = icmp_unique_tuple,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .range_to_nfattr = nf_nat_port_range_to_nfattr, - .nfattr_to_range = nf_nat_port_nfattr_to_range, + .range_to_nlattr = nf_nat_port_range_to_nlattr, + .nlattr_to_range = nf_nat_port_nlattr_to_range,#endif };
net/ipv4/netfilter/nf_nat_proto_tcp.c +2 -2
@@ -145,7 +145,7 @@ struct nf_nat_protocol nf_nat_protocol_tcp = { .in_range = tcp_in_range, .unique_tuple = tcp_unique_tuple,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .range_to_nfattr = nf_nat_port_range_to_nfattr, - .nfattr_to_range = nf_nat_port_nfattr_to_range, + .range_to_nlattr = nf_nat_port_range_to_nlattr, + .nlattr_to_range = nf_nat_port_nlattr_to_range,#endif };
net/ipv4/netfilter/nf_nat_proto_udp.c +2 -2
@@ -135,7 +135,7 @@ struct nf_nat_protocol nf_nat_protocol_udp = { .in_range = udp_in_range, .unique_tuple = udp_unique_tuple,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .range_to_nfattr = nf_nat_port_range_to_nfattr, - .nfattr_to_range = nf_nat_port_nfattr_to_range, + .range_to_nlattr = nf_nat_port_range_to_nlattr, + .nlattr_to_range = nf_nat_port_nlattr_to_range,#endif };
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +5 -5
@@ -337,7 +337,7 @@ static ctl_table nf_ct_ipv6_sysctl_table[] = {#include <linux/netfilter/nfnetlink.h> #include <linux/netfilter/nfnetlink_conntrack.h> -static int ipv6_tuple_to_nfattr (struct sk_buff *skb, +static int ipv6_tuple_to_nlattr (struct sk_buff *skb,const struct nf_conntrack_tuple *tuple) { NLA_PUT(skb, CTA_IP_V6_SRC, sizeof(u_int32_t) * 4,
@@ -355,13 +355,13 @@ static const size_t cta_min_ip[CTA_IP_MAX+1] = { [CTA_IP_V6_DST] = sizeof(u_int32_t)*4, }; -static int ipv6_nfattr_to_tuple (struct nlattr *tb[], +static int ipv6_nlattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *t) {if (!tb[CTA_IP_V6_SRC ] || !tb[CTA_IP_V6_DST ])return -EINVAL ; -if (nfattr_bad_size (tb,CTA_IP_MAX , cta_min_ip)) +if (nlattr_bad_size (tb,CTA_IP_MAX , cta_min_ip))return -EINVAL ; memcpy(&t->src.u3.ip6, nla_data(tb[CTA_IP_V6_SRC]),
@@ -382,8 +382,8 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6 __read_mostly = { .print_conntrack = ipv6_print_conntrack, .get_l4proto = ipv6_get_l4proto,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .tuple_to_nfattr = ipv6_tuple_to_nfattr, - .nfattr_to_tuple = ipv6_nfattr_to_tuple, + .tuple_to_nlattr = ipv6_tuple_to_nlattr, + .nlattr_to_tuple = ipv6_nlattr_to_tuple,#endif #ifdef CONFIG_SYSCTL .ctl_table_path = nf_net_netfilter_sysctl_path,
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +5 -5
@@ -210,7 +210,7 @@ icmpv6_error(struct sk_buff *skb, unsigned int dataoff,#include <linux/netfilter/nfnetlink.h> #include <linux/netfilter/nfnetlink_conntrack.h> -static int icmpv6_tuple_to_nfattr (struct sk_buff *skb, +static int icmpv6_tuple_to_nlattr (struct sk_buff *skb,const struct nf_conntrack_tuple *t) { NLA_PUT(skb, CTA_PROTO_ICMPV6_ID, sizeof(u_int16_t),
@@ -232,7 +232,7 @@ static const size_t cta_min_proto[CTA_PROTO_MAX+1] = { [CTA_PROTO_ICMPV6_ID ] =sizeof (u_int16_t) }; -static int icmpv6_nfattr_to_tuple (struct nlattr *tb[], +static int icmpv6_nlattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *tuple) { if (!tb[CTA_PROTO_ICMPV6_TYPE]
@@ -240,7 +240,7 @@ static int icmpv6_nfattr_to_tuple(struct nlattr *tb[], || !tb[CTA_PROTO_ICMPV6_ID])return -EINVAL ; -if (nfattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto)) +if (nlattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto))return -EINVAL ; tuple->dst.u.icmp.type =
@@ -289,8 +289,8 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly = .new = icmpv6_new, .error = icmpv6_error,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .tuple_to_nfattr = icmpv6_tuple_to_nfattr, - .nfattr_to_tuple = icmpv6_nfattr_to_tuple, + .tuple_to_nlattr = icmpv6_tuple_to_nlattr, + .nlattr_to_tuple = icmpv6_nlattr_to_tuple,#endif #ifdef CONFIG_SYSCTL .ctl_table_header = &icmpv6_sysctl_header,
net/netfilter/nf_conntrack_core.c +5 -5
@@ -830,7 +830,7 @@ EXPORT_SYMBOL_GPL(__nf_ct_refresh_acct);/* Generic function for tcp/udp/sctp/dccp and alike. This needs to be * in ip_conntrack_core, since we don't want the protocols to autoload * or depend on ctnetlink */ -int nf_ct_port_tuple_to_nfattr (struct sk_buff *skb, +int nf_ct_port_tuple_to_nlattr (struct sk_buff *skb,const struct nf_conntrack_tuple *tuple) { NLA_PUT(skb, CTA_PROTO_SRC_PORT, sizeof(u_int16_t),
@@ -842,20 +842,20 @@ int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb, nla_put_failure:return -1 ; } -EXPORT_SYMBOL_GPL (nf_ct_port_tuple_to_nfattr); +EXPORT_SYMBOL_GPL (nf_ct_port_tuple_to_nlattr);static const size_t cta_min_proto[CTA_PROTO_MAX +1 ] = { [CTA_PROTO_SRC_PORT ] =sizeof (u_int16_t), [CTA_PROTO_DST_PORT ] =sizeof (u_int16_t) }; -int nf_ct_port_nfattr_to_tuple (struct nlattr *tb[], +int nf_ct_port_nlattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *t) {if (!tb[CTA_PROTO_SRC_PORT ] || !tb[CTA_PROTO_DST_PORT ])return -EINVAL ; -if (nfattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto)) +if (nlattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto))return -EINVAL ; t->src.u.tcp.port = *(__be16 *)nla_data (tb[CTA_PROTO_SRC_PORT ]);
@@ -863,7 +863,7 @@ int nf_ct_port_nfattr_to_tuple(struct nlattr *tb[], return 0; } -EXPORT_SYMBOL_GPL (nf_ct_port_nfattr_to_tuple); +EXPORT_SYMBOL_GPL (nf_ct_port_nlattr_to_tuple);#endif /* Used by ipt_REJECT and ip6t_REJECT. */
net/netfilter/nf_conntrack_netlink.c +26 -26
162 lines not on this page · raw message
net/netfilter/nf_conntrack_proto_gre.c +2 -2
@@ -274,8 +274,8 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_gre4 __read_mostly = { .destroy = gre_destroy, .me = THIS_MODULE,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr, - .nfattr_to_tuple = nf_ct_port_nfattr_to_tuple, + .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, + .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,#endif };
net/netfilter/nf_conntrack_proto_tcp.c +11 -11
@@ -1067,7 +1067,7 @@ static int tcp_new(struct nf_conn *conntrack,#include <linux/netfilter/nfnetlink.h> #include <linux/netfilter/nfnetlink_conntrack.h> -static int tcp_to_nfattr (struct sk_buff *skb,struct nlattr *nla, +static int tcp_to_nlattr (struct sk_buff *skb,struct nlattr *nla,const struct nf_conn *ct) {struct nlattr *nest_parms;
@@ -1113,7 +1113,7 @@ static const size_t cta_min_tcp[CTA_PROTOINFO_TCP_MAX+1] = { [CTA_PROTOINFO_TCP_FLAGS_REPLY] = sizeof(struct nf_ct_tcp_flags) }; -static int nfattr_to_tcp (struct nlattr *cda[],struct nf_conn *ct) +static int nlattr_to_tcp (struct nlattr *cda[],struct nf_conn *ct) {struct nlattr *attr = cda[CTA_PROTOINFO_TCP ];struct nlattr *tb[CTA_PROTOINFO_TCP_MAX +1 ];
@@ -1125,7 +1125,7 @@ static int nfattr_to_tcp(struct nlattr *cda[], struct nf_conn *ct)nla_parse_nested (tb,CTA_PROTOINFO_TCP_MAX , attr,NULL ); -if (nfattr_bad_size (tb,CTA_PROTOINFO_TCP_MAX , cta_min_tcp)) +if (nlattr_bad_size (tb,CTA_PROTOINFO_TCP_MAX , cta_min_tcp))return -EINVAL ;if (!tb[CTA_PROTOINFO_TCP_STATE ])
@@ -1387,10 +1387,10 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4 __read_mostly = .new = tcp_new, .error = tcp_error,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .to_nfattr = tcp_to_nfattr, - .from_nfattr = nfattr_to_tcp, - .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr, - .nfattr_to_tuple = nf_ct_port_nfattr_to_tuple, + .to_nlattr = tcp_to_nlattr, + .from_nlattr = nlattr_to_tcp, + .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, + .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &tcp_sysctl_table_users,
@@ -1416,10 +1416,10 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6 __read_mostly = .new = tcp_new, .error = tcp_error,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .to_nfattr = tcp_to_nfattr, - .from_nfattr = nfattr_to_tcp, - .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr, - .nfattr_to_tuple = nf_ct_port_nfattr_to_tuple, + .to_nlattr = tcp_to_nlattr, + .from_nlattr = nlattr_to_tcp, + .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, + .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &tcp_sysctl_table_users,
net/netfilter/nf_conntrack_proto_udp.c +4 -4
@@ -203,8 +203,8 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4 __read_mostly = .new = udp_new, .error = udp_error,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr, - .nfattr_to_tuple = nf_ct_port_nfattr_to_tuple, + .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, + .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &udp_sysctl_table_users,
@@ -230,8 +230,8 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6 __read_mostly = .new = udp_new, .error = udp_error,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr, - .nfattr_to_tuple = nf_ct_port_nfattr_to_tuple, + .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, + .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &udp_sysctl_table_users,
net/netfilter/nf_conntrack_proto_udplite.c +4 -4
@@ -203,8 +203,8 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_udplite4 __read_mostly = .new = udplite_new, .error = udplite_error,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr, - .nfattr_to_tuple = nf_ct_port_nfattr_to_tuple, + .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, + .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &udplite_sysctl_table_users,
@@ -226,8 +226,8 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_udplite6 __read_mostly = .new = udplite_new, .error = udplite_error,#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) - .tuple_to_nfattr = nf_ct_port_tuple_to_nfattr, - .nfattr_to_tuple = nf_ct_port_nfattr_to_tuple, + .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, + .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &udplite_sysctl_table_users,
net/netfilter/nfnetlink_log.c +1 -1
@@ -768,7 +768,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,UDEBUG ("entering for msg %u\n" ,NFNL_MSG_TYPE (nlh->nlmsg_type)); -if (nfattr_bad_size (nfula,NFULA_CFG_MAX , nfula_cfg_min)) { +if (nlattr_bad_size (nfula,NFULA_CFG_MAX , nfula_cfg_min)) {UDEBUG ("bad attribute size\n" );return -EINVAL ; }
net/netfilter/nfnetlink_queue.c +2 -2
@@ -797,7 +797,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,struct nfqnl_queue_entry *entry;int err; -if (nfattr_bad_size (nfqa,NFQA_MAX , nfqa_verdict_min)) { +if (nlattr_bad_size (nfqa,NFQA_MAX , nfqa_verdict_min)) {QDEBUG ("bad attribute size\n" );return -EINVAL ; }
@@ -877,7 +877,7 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb,QDEBUG ("entering for msg %u\n" ,NFNL_MSG_TYPE (nlh->nlmsg_type)); -if (nfattr_bad_size (nfqa,NFQA_CFG_MAX , nfqa_cfg_min)) { +if (nlattr_bad_size (nfqa,NFQA_CFG_MAX , nfqa_cfg_min)) {QDEBUG ("bad attribute size\n" );return -EINVAL ; }
PATCH 4/9 : nfnetlink: use nlmsg_notify()
In reply to Patrick McHardy[NETFILTER]: nfnetlink: use nlmsg_notify()
---
commit e8e16c2608c3a4ac863db49f3c30cae87c582c45
tree 471f3adb0e0324ef5dcf031c43748c2179419287
parent e8efc3dbdb2ca9fc956fe50db54ed4c2d5734b80
author Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:06:42 +0200 committer Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:06:42 +0200
net/netfilter/nfnetlink.c | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-)
net/netfilter/nfnetlink.c +1 -10
@@ -148,16 +148,7 @@ EXPORT_SYMBOL_GPL(nfnetlink_has_listeners);int nfnetlink_send (struct sk_buff *skb,u32 pid,unsigned group,int echo) { -int err =0 ; - -NETLINK_CB (skb).dst_group = group; -if (echo) -atomic_inc (&skb->users); -netlink_broadcast (nfnl, skb, pid, group,gfp_any ()); -if (echo) - err =netlink_unicast (nfnl, skb, pid,MSG_DONTWAIT ); - -return err; +return nlmsg_notify (nfnl, skb, pid, group, echo,gfp_any ()); }EXPORT_SYMBOL_GPL (nfnetlink_send);
PATCH 5/9 : nfnetlink: support attribute policies
In reply to Patrick McHardy[NETFILTER]: nfnetlink: support attribute policies
Add support for automatic checking of per-callback attribute policies.
Also fix attribute parsing for empty messages, the attribute array wasn't cleared and contained random crap before.
---
commit 5ee4018ae6360a2d6aad8068e7a91c82851dc8ec
tree a99a19c0a6db32a0622443924869b95e21d45ff3
parent e8e16c2608c3a4ac863db49f3c30cae87c582c45
author Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:22:11 +0200 committer Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:22:11 +0200
include/linux/netfilter/nfnetlink.h | 3 +- net/netfilter/nfnetlink.c | 47 +++++++++-------------------------- 2 files changed, 14 insertions(+), 36 deletions(-)
include/linux/netfilter/nfnetlink.h +2 -1
@@ -58,7 +58,8 @@ struct nfnl_callback {int (*call)(struct sock *nl,struct sk_buff *skb,struct nlmsghdr *nlh,struct nlattr *cda[]); -u_int16_t attr_count;/* number of nlattr's */ +const struct nla_policy *policy;/* netlink attribute policy */ +const u_int16_t attr_count;/* number of nlattr's */ };struct nfnetlink_subsystem
net/netfilter/nfnetlink.c +12 -35
69 lines not on this page · raw message
PATCH 6/9 : nfnetlink_log: use netlink policy
In reply to Patrick McHardy[NETFILTER]: nfnetlink_log: use netlink policy
Also remove unused nfula_min array.
---
commit 4436902570bdf8c76f313ddacd3ce643e4727bdb
tree a386be61be1d43907d695204e9f9004f9f47ee9c
parent 5ee4018ae6360a2d6aad8068e7a91c82851dc8ec
author Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:23:54 +0200 committer Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:23:54 +0200
net/netfilter/nfnetlink_log.c | 38 +++++++++----------------------------- 1 files changed, 9 insertions(+), 29 deletions(-)
net/netfilter/nfnetlink_log.c +9 -29
@@ -732,29 +732,13 @@ static struct nf_logger nfulnl_logger = { .me = THIS_MODULE, }; -static const int nfula_min[NFULA_MAX +1 ] = { - [NFULA_PACKET_HDR ] =sizeof (struct nfulnl_msg_packet_hdr ), - [NFULA_MARK ] =sizeof (u_int32_t), - [NFULA_TIMESTAMP ] =sizeof (struct nfulnl_msg_packet_timestamp ), - [NFULA_IFINDEX_INDEV ] =sizeof (u_int32_t), - [NFULA_IFINDEX_OUTDEV ] =sizeof (u_int32_t), - [NFULA_IFINDEX_PHYSINDEV ] =sizeof (u_int32_t), - [NFULA_IFINDEX_PHYSOUTDEV ] =sizeof (u_int32_t), - [NFULA_HWADDR ] =sizeof (struct nfulnl_msg_packet_hw ), - [NFULA_PAYLOAD ] =0 , - [NFULA_PREFIX ] =0 , - [NFULA_UID ] =sizeof (u_int32_t), - [NFULA_SEQ ] =sizeof (u_int32_t), - [NFULA_SEQ_GLOBAL ] =sizeof (u_int32_t), -}; - -static const int nfula_cfg_min[NFULA_CFG_MAX +1 ] = { - [NFULA_CFG_CMD ] =sizeof (struct nfulnl_msg_config_cmd ), - [NFULA_CFG_MODE ] =sizeof (struct nfulnl_msg_config_mode ), - [NFULA_CFG_TIMEOUT ] =sizeof (u_int32_t), - [NFULA_CFG_QTHRESH ] =sizeof (u_int32_t), - [NFULA_CFG_NLBUFSIZ ] =sizeof (u_int32_t), - [NFULA_CFG_FLAGS ] =sizeof (u_int16_t), +static const struct nla_policy nfula_cfg_policy[NFULA_CFG_MAX +1 ] = { + [NFULA_CFG_CMD ] = { .len =sizeof (struct nfulnl_msg_config_cmd ) }, + [NFULA_CFG_MODE ] = { .len =sizeof (struct nfulnl_msg_config_mode ) }, + [NFULA_CFG_TIMEOUT ] = { .type =NLA_U32 }, + [NFULA_CFG_QTHRESH ] = { .type =NLA_U32 }, + [NFULA_CFG_NLBUFSIZ ] = { .type =NLA_U32 }, + [NFULA_CFG_FLAGS ] = { .type =NLA_U16 }, }; static int
@@ -768,11 +752,6 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,UDEBUG ("entering for msg %u\n" ,NFNL_MSG_TYPE (nlh->nlmsg_type)); -if (nlattr_bad_size (nfula,NFULA_CFG_MAX , nfula_cfg_min)) { -UDEBUG ("bad attribute size\n" ); -return -EINVAL ; - } - inst =instance_lookup_get (group_num);if (nfula[NFULA_CFG_CMD ]) {u_int8_t pf = nfmsg->nfgen_family;
@@ -885,7 +864,8 @@ static const struct nfnl_callback nfulnl_cb[NFULNL_MSG_MAX] = { [NFULNL_MSG_PACKET ] = { .call = nfulnl_recv_unsupp, .attr_count = NFULA_MAX, }, [NFULNL_MSG_CONFIG ] = { .call = nfulnl_recv_config, - .attr_count = NFULA_CFG_MAX, }, + .attr_count =NFULA_CFG_MAX , + .policy = nfula_cfg_policy }, };static const struct nfnetlink_subsystem nfulnl_subsys = {
PATCH 7/9 : nfnetlink_queue: use netlink policy
In reply to Patrick McHardy[NETFILTER]: nfnetlink_queue: use netlink policy
---
commit 119806fd9e3c365b7da7290ec5c0d5f68f7d530b
tree c6ce31f7e7b122610a5d29b4523a5bcd899951cc
parent 4436902570bdf8c76f313ddacd3ce643e4727bdb
author Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:27:19 +0200 committer Patrick McHardy <[email protected]> Thu, 27 Sep 2007 14:27:19 +0200
net/netfilter/nfnetlink_queue.c | 30 +++++++++++------------------- 1 files changed, 11 insertions(+), 19 deletions(-)
net/netfilter/nfnetlink_queue.c +11 -19
@@ -778,10 +778,10 @@ static struct notifier_block nfqnl_rtnl_notifier = { .notifier_call = nfqnl_rcv_nl_event, }; -static const int nfqa_verdict_min[NFQA_MAX +1 ] = { - [NFQA_VERDICT_HDR ] =sizeof (struct nfqnl_msg_verdict_hdr ), - [NFQA_MARK ] =sizeof (u_int32_t), - [NFQA_PAYLOAD ] =0 , +static const struct nla_policy nfqa_verdict_policy[NFQA_MAX +1 ] = { + [NFQA_VERDICT_HDR ] = { .len =sizeof (struct nfqnl_msg_verdict_hdr ) }, + [NFQA_MARK ] = { .type =NLA_U32 }, + [NFQA_PAYLOAD ] = { .type =NLA_UNSPEC }, }; static int
@@ -797,11 +797,6 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,struct nfqnl_queue_entry *entry;int err; -if (nlattr_bad_size (nfqa,NFQA_MAX , nfqa_verdict_min)) { -QDEBUG ("bad attribute size\n" ); -return -EINVAL ; - } - queue =instance_lookup_get (queue_num);if (!queue)return -ENODEV ;
@@ -856,9 +851,9 @@ nfqnl_recv_unsupp(struct sock *ctnl, struct sk_buff *skb,return -ENOTSUPP ; } -static const int nfqa_cfg_min[NFQA_CFG_MAX +1 ] = { - [NFQA_CFG_CMD ] =sizeof (struct nfqnl_msg_config_cmd ), - [NFQA_CFG_PARAMS ] =sizeof (struct nfqnl_msg_config_params ), +static const struct nla_policy nfqa_cfg_policy[NFQA_CFG_MAX +1 ] = { + [NFQA_CFG_CMD ] = { .len =sizeof (struct nfqnl_msg_config_cmd ) }, + [NFQA_CFG_PARAMS ] = { .len =sizeof (struct nfqnl_msg_config_params ) }, };static struct nf_queue_handler nfqh = {
@@ -877,11 +872,6 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb,QDEBUG ("entering for msg %u\n" ,NFNL_MSG_TYPE (nlh->nlmsg_type)); -if (nlattr_bad_size (nfqa,NFQA_CFG_MAX , nfqa_cfg_min)) { -QDEBUG ("bad attribute size\n" ); -return -EINVAL ; - } - queue =instance_lookup_get (queue_num);if (nfqa[NFQA_CFG_CMD ]) {struct nfqnl_msg_config_cmd *cmd;
@@ -965,9 +955,11 @@ static const struct nfnl_callback nfqnl_cb[NFQNL_MSG_MAX] = { [NFQNL_MSG_PACKET ] = { .call = nfqnl_recv_unsupp, .attr_count = NFQA_MAX, }, [NFQNL_MSG_VERDICT ] = { .call = nfqnl_recv_verdict, - .attr_count = NFQA_MAX, }, + .attr_count =NFQA_MAX , + .policy = nfqa_verdict_policy }, [NFQNL_MSG_CONFIG ] = { .call = nfqnl_recv_config, - .attr_count = NFQA_CFG_MAX, }, + .attr_count =NFQA_CFG_MAX , + .policy = nfqa_cfg_policy }, };static const struct nfnetlink_subsystem nfqnl_subsys = {
PATCH 8/9 : ctnetlink: use netlink policy
In reply to Patrick McHardy[NETFILTER]: ctnetlink: use netlink policy
---
commit 6aa7455c85e5169b26fabad4f330303325a3b79e
tree 69aabe9ba02ec5889316648d65e6be41fbc43dae
parent 119806fd9e3c365b7da7290ec5c0d5f68f7d530b
author Patrick McHardy <[email protected]> Thu, 27 Sep 2007 15:05:03 +0200 committer Patrick McHardy <[email protected]> Thu, 27 Sep 2007 15:05:03 +0200
include/net/netfilter/nf_conntrack_l3proto.h | 2 include/net/netfilter/nf_conntrack_l4proto.h | 3 + net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 10 +- net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 12 +-- net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 10 +- net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 12 +-- net/netfilter/nf_conntrack_core.c | 10 +- net/netfilter/nf_conntrack_netlink.c | 111 +++++++++++------------- net/netfilter/nf_conntrack_proto_gre.c | 1 net/netfilter/nf_conntrack_proto_tcp.c | 22 +++-- net/netfilter/nf_conntrack_proto_udp.c | 2 net/netfilter/nf_conntrack_proto_udplite.c | 2 12 files changed, 97 insertions(+), 100 deletions(-)
include/net/netfilter/nf_conntrack_l3proto.h +2 -0
@@ -12,6 +12,7 @@#ifndef _NF_CONNTRACK_L3PROTO_H#define _NF_CONNTRACK_L3PROTO_H#include <linux/netlink.h> +#include <net/netlink.h> #include <linux/seq_file.h> #include <net/netfilter/nf_conntrack.h>
@@ -68,6 +69,7 @@ struct nf_conntrack_l3protoint (*nlattr_to_tuple)(struct nlattr *tb[],struct nf_conntrack_tuple *t); +const struct nla_policy *nla_policy;#ifdef CONFIG_SYSCTL struct ctl_table_header *ctl_table_header;
include/net/netfilter/nf_conntrack_l4proto.h +3 -0
@@ -10,6 +10,7 @@#ifndef _NF_CONNTRACK_L4PROTO_H#define _NF_CONNTRACK_L4PROTO_H#include <linux/netlink.h> +#include <net/netlink.h> #include <net/netfilter/nf_conntrack.h> struct seq_file ;
@@ -75,6 +76,7 @@ struct nf_conntrack_l4proto const struct nf_conntrack_tuple *t);int (*nlattr_to_tuple)(struct nlattr *tb[],struct nf_conntrack_tuple *t); +const struct nla_policy *nla_policy;#ifdef CONFIG_SYSCTL struct ctl_table_header **ctl_table_header;
@@ -115,6 +117,7 @@ extern int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb, const struct nf_conntrack_tuple *tuple);extern int nf_ct_port_nlattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *t); +extern const struct nla_policy nf_ct_port_nla_policy[];/* Log invalid packets */ extern unsigned int nf_ct_log_invalid;
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +4 -6
@@ -373,9 +373,9 @@ nla_put_failure:return -1 ; } -static const size_t cta_min_ip[CTA_IP_MAX +1 ] = { - [CTA_IP_V4_SRC ] =sizeof (u_int32_t), - [CTA_IP_V4_DST ] =sizeof (u_int32_t), +static const struct nla_policy ipv4_nla_policy[CTA_IP_MAX +1 ] = { + [CTA_IP_V4_SRC ] = { .type =NLA_U32 }, + [CTA_IP_V4_DST ] = { .type =NLA_U32 }, }; static int ipv4_nlattr_to_tuple(struct nlattr *tb[],
@@ -384,9 +384,6 @@ static int ipv4_nlattr_to_tuple(struct nlattr *tb[],if (!tb[CTA_IP_V4_SRC ] || !tb[CTA_IP_V4_DST ])return -EINVAL ; -if (nlattr_bad_size (tb,CTA_IP_MAX , cta_min_ip)) -return -EINVAL ; - t->src.u3.ip = *(__be32 *)nla_data (tb[CTA_IP_V4_SRC ]); t->dst.u3.ip = *(__be32 *)nla_data (tb[CTA_IP_V4_DST ]);
@@ -413,6 +410,7 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = {#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) .tuple_to_nlattr = ipv4_tuple_to_nlattr, .nlattr_to_tuple = ipv4_nlattr_to_tuple, + .nla_policy = ipv4_nla_policy,#endif #if defined(CONFIG_SYSCTL ) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT ) .ctl_table_path = nf_net_ipv4_netfilter_sysctl_path,
net/ipv4/netfilter/nf_conntrack_proto_icmp.c +5 -7
@@ -248,10 +248,10 @@ nla_put_failure:return -1 ; } -static const size_t cta_min_proto[CTA_PROTO_MAX +1 ] = { - [CTA_PROTO_ICMP_TYPE ] =sizeof (u_int8_t), - [CTA_PROTO_ICMP_CODE ] =sizeof (u_int8_t), - [CTA_PROTO_ICMP_ID ] =sizeof (u_int16_t) +static const struct nla_policy icmp_nla_policy[CTA_PROTO_MAX +1 ] = { + [CTA_PROTO_ICMP_TYPE ] = { .type =NLA_U8 }, + [CTA_PROTO_ICMP_CODE ] = { .type =NLA_U8 }, + [CTA_PROTO_ICMP_ID ] = { .type =NLA_U16 }, }; static int icmp_nlattr_to_tuple(struct nlattr *tb[],
@@ -262,9 +262,6 @@ static int icmp_nlattr_to_tuple(struct nlattr *tb[], || !tb[CTA_PROTO_ICMP_ID])return -EINVAL ; -if (nlattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto)) -return -EINVAL ; - tuple->dst.u.icmp.type = *(u_int8_t *)nla_data (tb[CTA_PROTO_ICMP_TYPE ]); tuple->dst.u.icmp.code =
@@ -329,6 +326,7 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp __read_mostly =#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) .tuple_to_nlattr = icmp_tuple_to_nlattr, .nlattr_to_tuple = icmp_nlattr_to_tuple, + .nla_policy = icmp_nla_policy,#endif #ifdef CONFIG_SYSCTL .ctl_table_header = &icmp_sysctl_header,
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +4 -6
@@ -350,9 +350,9 @@ nla_put_failure:return -1 ; } -static const size_t cta_min_ip[CTA_IP_MAX +1 ] = { - [CTA_IP_V6_SRC ] =sizeof (u_int32_t)*4 , - [CTA_IP_V6_DST ] =sizeof (u_int32_t)*4 , +static const struct nla_policy ipv6_nla_policy[CTA_IP_MAX +1 ] = { + [CTA_IP_V6_SRC ] = { .len =sizeof (u_int32_t)*4 }, + [CTA_IP_V6_DST ] = { .len =sizeof (u_int32_t)*4 }, }; static int ipv6_nlattr_to_tuple(struct nlattr *tb[],
@@ -361,9 +361,6 @@ static int ipv6_nlattr_to_tuple(struct nlattr *tb[],if (!tb[CTA_IP_V6_SRC ] || !tb[CTA_IP_V6_DST ])return -EINVAL ; -if (nlattr_bad_size (tb,CTA_IP_MAX , cta_min_ip)) -return -EINVAL ; -memcpy (&t->src.u3.ip6,nla_data (tb[CTA_IP_V6_SRC ]),sizeof (u_int32_t) *4 ); memcpy(&t->dst.u3.ip6, nla_data(tb[CTA_IP_V6_DST]),
@@ -384,6 +381,7 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6 __read_mostly = {#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) .tuple_to_nlattr = ipv6_tuple_to_nlattr, .nlattr_to_tuple = ipv6_nlattr_to_tuple, + .nla_policy = ipv6_nla_policy,#endif #ifdef CONFIG_SYSCTL .ctl_table_path = nf_net_netfilter_sysctl_path,
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +5 -7
@@ -226,10 +226,10 @@ nla_put_failure:return -1 ; } -static const size_t cta_min_proto[CTA_PROTO_MAX +1 ] = { - [CTA_PROTO_ICMPV6_TYPE ] =sizeof (u_int8_t), - [CTA_PROTO_ICMPV6_CODE ] =sizeof (u_int8_t), - [CTA_PROTO_ICMPV6_ID ] =sizeof (u_int16_t) +static const struct nla_policy icmpv6_nla_policy[CTA_PROTO_MAX +1 ] = { + [CTA_PROTO_ICMPV6_TYPE ] = { .type =NLA_U8 }, + [CTA_PROTO_ICMPV6_CODE ] = { .type =NLA_U8 }, + [CTA_PROTO_ICMPV6_ID ] = { .type =NLA_U16 }, }; static int icmpv6_nlattr_to_tuple(struct nlattr *tb[],
@@ -240,9 +240,6 @@ static int icmpv6_nlattr_to_tuple(struct nlattr *tb[], || !tb[CTA_PROTO_ICMPV6_ID])return -EINVAL ; -if (nlattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto)) -return -EINVAL ; - tuple->dst.u.icmp.type = *(u_int8_t *)nla_data (tb[CTA_PROTO_ICMPV6_TYPE ]); tuple->dst.u.icmp.code =
@@ -291,6 +288,7 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6 __read_mostly =#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) .tuple_to_nlattr = icmpv6_tuple_to_nlattr, .nlattr_to_tuple = icmpv6_nlattr_to_tuple, + .nla_policy = icmpv6_nla_policy,#endif #ifdef CONFIG_SYSCTL .ctl_table_header = &icmpv6_sysctl_header,
net/netfilter/nf_conntrack_core.c +4 -6
@@ -844,10 +844,11 @@ nla_put_failure: }EXPORT_SYMBOL_GPL (nf_ct_port_tuple_to_nlattr); -static const size_t cta_min_proto[CTA_PROTO_MAX +1 ] = { - [CTA_PROTO_SRC_PORT ] =sizeof (u_int16_t), - [CTA_PROTO_DST_PORT ] =sizeof (u_int16_t) +const struct nla_policy nf_ct_port_nla_policy[CTA_PROTO_MAX +1 ] = { + [CTA_PROTO_SRC_PORT ] = { .type =NLA_U16 }, + [CTA_PROTO_DST_PORT ] = { .type =NLA_U16 }, }; +EXPORT_SYMBOL_GPL (nf_ct_port_nla_policy);int nf_ct_port_nlattr_to_tuple (struct nlattr *tb[],struct nf_conntrack_tuple *t)
@@ -855,9 +856,6 @@ int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],if (!tb[CTA_PROTO_SRC_PORT ] || !tb[CTA_PROTO_DST_PORT ])return -EINVAL ; -if (nlattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto)) -return -EINVAL ; - t->src.u.tcp.port = *(__be16 *)nla_data (tb[CTA_PROTO_SRC_PORT ]); t->dst.u.tcp.port = *(__be16 *)nla_data (tb[CTA_PROTO_DST_PORT ]);
net/netfilter/nf_conntrack_netlink.c +53 -58
223 lines not on this page · raw message
net/netfilter/nf_conntrack_proto_gre.c +1 -0
@@ -276,6 +276,7 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_gre4 __read_mostly = {#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple, + .nla_policy = nf_ct_port_nla_policy,#endif };
net/netfilter/nf_conntrack_proto_tcp.c +12 -10
@@ -1105,28 +1105,28 @@ nla_put_failure:return -1 ; } -static const size_t cta_min_tcp[CTA_PROTOINFO_TCP_MAX +1 ] = { - [CTA_PROTOINFO_TCP_STATE ] =sizeof (u_int8_t), - [CTA_PROTOINFO_TCP_WSCALE_ORIGINAL ] =sizeof (u_int8_t), - [CTA_PROTOINFO_TCP_WSCALE_REPLY ] =sizeof (u_int8_t), - [CTA_PROTOINFO_TCP_FLAGS_ORIGINAL ] =sizeof (struct nf_ct_tcp_flags ), - [CTA_PROTOINFO_TCP_FLAGS_REPLY ] =sizeof (struct nf_ct_tcp_flags ) +static const struct nla_policy tcp_nla_policy[CTA_PROTOINFO_TCP_MAX +1 ] = { + [CTA_PROTOINFO_TCP_STATE ] = { .type =NLA_U8 }, + [CTA_PROTOINFO_TCP_WSCALE_ORIGINAL ] = { .type =NLA_U8 }, + [CTA_PROTOINFO_TCP_WSCALE_REPLY ] = { .type =NLA_U8 }, + [CTA_PROTOINFO_TCP_FLAGS_ORIGINAL ] = { .len =sizeof (struct nf_ct_tcp_flags ) }, + [CTA_PROTOINFO_TCP_FLAGS_REPLY ] = { .len =sizeof (struct nf_ct_tcp_flags ) }, };static int nlattr_to_tcp (struct nlattr *cda[],struct nf_conn *ct) {struct nlattr *attr = cda[CTA_PROTOINFO_TCP ];struct nlattr *tb[CTA_PROTOINFO_TCP_MAX +1 ]; +int err;/* updates could not contain anything about the private * protocol info, in that case skip the parsing */ if (!attr)return 0 ; -nla_parse_nested (tb,CTA_PROTOINFO_TCP_MAX , attr,NULL ); - -if (nlattr_bad_size (tb,CTA_PROTOINFO_TCP_MAX , cta_min_tcp)) -return -EINVAL ; + err =nla_parse_nested (tb,CTA_PROTOINFO_TCP_MAX , attr, tcp_nla_policy); +if (err <0 ) +return err;if (!tb[CTA_PROTOINFO_TCP_STATE ])return -EINVAL ;
@@ -1391,6 +1391,7 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4 __read_mostly = .from_nlattr = nlattr_to_tcp, .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple, + .nla_policy = nf_ct_port_nla_policy,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &tcp_sysctl_table_users,
@@ -1420,6 +1421,7 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6 __read_mostly = .from_nlattr = nlattr_to_tcp, .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple, + .nla_policy = nf_ct_port_nla_policy,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &tcp_sysctl_table_users,
net/netfilter/nf_conntrack_proto_udp.c +2 -0
@@ -205,6 +205,7 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4 __read_mostly =#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple, + .nla_policy = nf_ct_port_nla_policy,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &udp_sysctl_table_users,
@@ -232,6 +233,7 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6 __read_mostly =#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple, + .nla_policy = nf_ct_port_nla_policy,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &udp_sysctl_table_users,
net/netfilter/nf_conntrack_proto_udplite.c +2 -0
@@ -205,6 +205,7 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_udplite4 __read_mostly =#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple, + .nla_policy = nf_ct_port_nla_policy,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &udplite_sysctl_table_users,
@@ -228,6 +229,7 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_udplite6 __read_mostly =#if defined(CONFIG_NF_CT_NETLINK ) || defined(CONFIG_NF_CT_NETLINK_MODULE ) .tuple_to_nlattr = nf_ct_port_tuple_to_nlattr, .nlattr_to_tuple = nf_ct_port_nlattr_to_tuple, + .nla_policy = nf_ct_port_nla_policy,#endif #ifdef CONFIG_SYSCTL .ctl_table_users = &udplite_sysctl_table_users,
PATCH 9/9 : nfnetlink: kill nlattr_bad_size
In reply to Patrick McHardy[NETFILTER]: nfnetlink: kill nlattr_bad_size
---
commit c62824a27e1cfc24fdec38395f9bfb83f94ceb55
tree d321b0b3eef9c8653290bb8e7b799ade6d2bd8a6
parent 6aa7455c85e5169b26fabad4f330303325a3b79e
author Patrick McHardy <[email protected]> Thu, 27 Sep 2007 15:05:52 +0200 committer Patrick McHardy <[email protected]> Thu, 27 Sep 2007 15:05:52 +0200
include/linux/netfilter/nfnetlink.h | 13 ------------- 1 files changed, 0 insertions(+), 13 deletions(-)
include/linux/netfilter/nfnetlink.h +0 -13
@@ -73,19 +73,6 @@ struct nfnetlink_subsystemextern int nfnetlink_subsys_register (const struct nfnetlink_subsystem *n);extern int nfnetlink_subsys_unregister (const struct nfnetlink_subsystem *n); -#define nlattr_bad_size (tb, max, cta_min) \ -({ int __i, __res = 0; \ - for (__i=1; __i <= max; __i++) { \ - if (!cta_min[__i]) \ - continue; \ - if (tb[__i] && nla_len(tb[__i]) < cta_min[__i]){ \ - __res = 1; \ - break; \ - } \ - } \ - __res; \ -}) -extern int nfnetlink_has_listeners (unsigned int group);extern int nfnetlink_send (struct sk_buff *skb,u32 pid,unsigned group,int echo);