: nf_conntrack: remove ability to use masks for expectation destinations
Subsystems (2)
[NETFILTER]: nf_conntrack: remove ability to use masks for expectation destinations
Since the expectations currently allow masks for every bit, we can't hash them and have to keep them on a global list that is searched for every new connection. This obviously sucks, so this patch removes the (never used) ability to use masks for the destination part of the expectation tuple.
Signed-off-by Patrick McHardy <[email protected]>
---
commit 873139d6b6e37954fd70dab4fe9362490da3f00b
tree 85d96c06423ce00ff40c5dfc1ff5f50435b2ba5c
parent 9b4fedd621050b1ab63dda01526b2902cd238871
author Patrick McHardy <[email protected]> Tue, 26 Jun 2007 15:42:50 +0200 committer Patrick McHardy <[email protected]> Tue, 26 Jun 2007 15:42:50 +0200
include/net/netfilter/nf_conntrack_expect.h | 9 ++- net/netfilter/nf_conntrack_expect.c | 97 ++++++++++++++------------- net/netfilter/nf_conntrack_netbios_ns.c | 7 +- net/netfilter/nf_conntrack_netlink.c | 15 +++- 4 files changed, 71 insertions(+), 57 deletions(-)
include/net/netfilter/nf_conntrack_expect.h +8 -1
@@ -10,13 +10,20 @@ extern struct list_head nf_conntrack_expect_list;extern struct kmem_cache *nf_conntrack_expect_cachep;extern const struct file_operations exp_file_ops; +struct nf_conntrack_expect_mask +{ +union nf_conntrack_address u3; +union nf_conntrack_man_proto u; +}; +struct nf_conntrack_expect {/* Internal linked list (global expectation list) */ struct list_head list;/* We expect this tuple, with the following mask */ -struct nf_conntrack_tuple tuple, mask; +struct nf_conntrack_tuple tuple; +struct nf_conntrack_expect_mask mask;/* Function to call after setup and insertion */ void (*expectfn)(struct nf_conn *new,
net/netfilter/nf_conntrack_expect.c +50 -47
149 lines not on this page · raw message
net/netfilter/nf_conntrack_netbios_ns.c +2 -5
@@ -81,11 +81,8 @@ static int help(struct sk_buff **pskb, unsigned int protoff, exp->tuple = ct->tuplehash[IP_CT_DIR_REPLY ].tuple; exp->tuple.src.u.udp.port =htons (NMBD_PORT ); - exp->mask.src.u3.ip = mask; - exp->mask.src.u.udp.port =htons (0xFFFF ); - exp->mask.dst.u3.ip =htonl (0xFFFFFFFF ); - exp->mask.dst.u.udp.port =htons (0xFFFF ); - exp->mask.dst.protonum =0xFF ; + exp->mask.u3.ip = mask; + exp->mask.u.udp.port =htons (0xFFFF ); exp->expectfn =NULL ; exp->flags =NF_CT_EXPECT_PERMANENT ;
net/netfilter/nf_conntrack_netlink.c +11 -4
@@ -1094,22 +1094,29 @@ nfattr_failure:static inline int ctnetlink_exp_dump_mask (struct sk_buff *skb,const struct nf_conntrack_tuple *tuple, -const struct nf_conntrack_tuple *mask) +const struct nf_conntrack_expect_mask *mask) {int ret;struct nf_conntrack_l3proto *l3proto;struct nf_conntrack_l4proto *l4proto; -struct nfattr *nest_parms =NFA_NEST (skb,CTA_EXPECT_MASK ); +struct nf_conntrack_tuple m; +struct nfattr *nest_parms; + +memset (&m,0xFF ,sizeof (m)); + m.src.u.all = mask->u.all; +memcpy (&m.src.u3, &mask->u3,sizeof (m.src.u3)); + + nest_parms =NFA_NEST (skb,CTA_EXPECT_MASK ); l3proto =nf_ct_l3proto_find_get (tuple->src.l3num); - ret =ctnetlink_dump_tuples_ip (skb, mask, l3proto); + ret =ctnetlink_dump_tuples_ip (skb, &m, l3proto);nf_ct_l3proto_put (l3proto);if (unlikely (ret <0 )) goto nfattr_failure; l4proto =nf_ct_l4proto_find_get (tuple->src.l3num, tuple->dst.protonum); - ret =ctnetlink_dump_tuples_proto (skb, mask, l4proto); + ret =ctnetlink_dump_tuples_proto (skb, &m, l4proto);nf_ct_l4proto_put (l4proto);if (unlikely (ret <0 )) goto nfattr_failure;