diff options
| author | David S. Miller <davem@nuts.davemloft.net> | 2004-09-24 00:16:00 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.davemloft.net> | 2004-09-24 00:16:00 -0700 |
| commit | e068209a7c6014017f00c4851c97b80931030565 (patch) | |
| tree | fb863783ba09f2dc1409fd04336269a86483a155 /include/linux | |
| parent | 6caaa7173434c1d3528465cefd54d7693afce384 (diff) | |
| parent | 480a73d51dc5769bb48b03e368d0c19c8bddfee8 (diff) | |
Merge nuts.davemloft.net:/disk1/BK/nf-work-2.6
into nuts.davemloft.net:/disk1/BK/nf-2.6
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/netfilter.h | 2 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv4/ip_conntrack.h | 22 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv4/ip_conntrack_core.h | 10 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv4/ip_conntrack_protocol.h | 12 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv4/ip_nat.h | 15 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv4/ip_nat_core.h | 6 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv4/ip_nat_protocol.h | 16 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv4/ipt_comment.h | 10 | ||||
| -rw-r--r-- | include/linux/skbuff.h | 18 | ||||
| -rw-r--r-- | include/linux/sysctl.h | 1 |
10 files changed, 60 insertions, 52 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 83f9668653ca..a9357be1ae41 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -178,7 +178,7 @@ extern inline struct ip6t_target * ip6t_find_target_lock(const char *name, int *error, struct semaphore *mutex); extern inline struct arpt_target * arpt_find_target_lock(const char *name, int *error, struct semaphore *mutex); -extern void (*ip_ct_attach)(struct sk_buff *, struct nf_ct_info *); +extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *); #ifdef CONFIG_NETFILTER_DEBUG extern void nf_dump_skb(int pf, struct sk_buff *skb); diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h index 8f7953a5e7f6..989f1cf75560 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack.h +++ b/include/linux/netfilter_ipv4/ip_conntrack.h @@ -172,9 +172,6 @@ struct ip_conntrack plus 1 for any connection(s) we are `master' for */ struct nf_conntrack ct_general; - /* These are my tuples; original and reply */ - struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; - /* Have we seen traffic both ways yet? (bitset) */ unsigned long status; @@ -199,12 +196,7 @@ struct ip_conntrack /* Helper, if any. */ struct ip_conntrack_helper *helper; - /* Our various nf_ct_info structs specify *what* relation this - packet has to the conntrack */ - struct nf_ct_info infos[IP_CT_NUMBER]; - /* Storage reserved for other modules: */ - union ip_conntrack_proto proto; union ip_conntrack_help help; @@ -220,6 +212,9 @@ struct ip_conntrack } nat; #endif /* CONFIG_IP_NF_NAT_NEEDED */ + /* Traversed often, so hopefully in different cacheline to top */ + /* These are my tuples; original and reply */ + struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; }; /* get master conntrack via master expectation */ @@ -238,8 +233,12 @@ ip_conntrack_tuple_taken(const struct ip_conntrack_tuple *tuple, const struct ip_conntrack *ignored_conntrack); /* Return conntrack_info and tuple hash for given skb. */ -extern struct ip_conntrack * -ip_conntrack_get(struct sk_buff *skb, enum ip_conntrack_info *ctinfo); +static inline struct ip_conntrack * +ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo) +{ + *ctinfo = skb->nfctinfo; + return (struct ip_conntrack *)skb->nfct; +} /* decrement reference count on a conntrack */ extern inline void ip_conntrack_put(struct ip_conntrack *ct); @@ -306,12 +305,13 @@ struct ip_conntrack_stat unsigned int insert_failed; unsigned int drop; unsigned int early_drop; - unsigned int icmp_error; + unsigned int error; unsigned int expect_new; unsigned int expect_create; unsigned int expect_delete; }; +#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++) /* eg. PROVIDES_CONNTRACK(ftp); */ #define PROVIDES_CONNTRACK(name) \ diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h index 9a31e96b7ab7..bb9b11c680ac 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_core.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_core.h @@ -16,10 +16,6 @@ extern int ip_conntrack_init(void); extern void ip_conntrack_cleanup(void); struct ip_conntrack_protocol; -extern struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol); -/* Like above, but you already have conntrack read lock. */ -extern struct ip_conntrack_protocol *__ip_ct_find_proto(u_int8_t protocol); -extern struct list_head protocol_list; extern int ip_ct_get_tuple(const struct iphdr *iph, @@ -38,14 +34,14 @@ struct ip_conntrack_tuple_hash * ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple, const struct ip_conntrack *ignored_conntrack); -extern int __ip_conntrack_confirm(struct nf_ct_info *nfct); +extern int __ip_conntrack_confirm(struct sk_buff *skb); /* Confirm a connection: returns NF_DROP if packet must be dropped. */ static inline int ip_conntrack_confirm(struct sk_buff *skb) { if (skb->nfct - && !is_confirmed((struct ip_conntrack *)skb->nfct->master)) - return __ip_conntrack_confirm(skb->nfct); + && !is_confirmed((struct ip_conntrack *)skb->nfct)) + return __ip_conntrack_confirm(skb); return NF_ACCEPT; } diff --git a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h index f53a126ade1e..0ff067b3fdb0 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h @@ -7,9 +7,6 @@ struct seq_file; struct ip_conntrack_protocol { - /* Next pointer. */ - struct list_head list; - /* Protocol number. */ u_int8_t proto; @@ -58,14 +55,23 @@ struct ip_conntrack_protocol struct module *me; }; +#define MAX_IP_CT_PROTO 256 +extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO]; + /* Protocol registration. */ extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto); extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto); +static inline struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol) +{ + return ip_ct_protos[protocol]; +} + /* Existing built-in protocols */ extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp; extern struct ip_conntrack_protocol ip_conntrack_protocol_udp; extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp; +extern struct ip_conntrack_protocol ip_conntrack_generic_protocol; extern int ip_conntrack_protocol_tcp_init(void); /* Log invalid packets */ diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h index 1a4e46b2db0f..c4a3622604b7 100644 --- a/include/linux/netfilter_ipv4/ip_nat.h +++ b/include/linux/netfilter_ipv4/ip_nat.h @@ -80,27 +80,18 @@ struct ip_nat_info_manip /* Protects NAT hash tables, and NAT-private part of conntracks. */ DECLARE_RWLOCK_EXTERN(ip_nat_lock); -/* Hashes for by-source and IP/protocol. */ -struct ip_nat_hash -{ - struct list_head list; - - /* conntrack we're embedded in: NULL if not in hash. */ - struct ip_conntrack *conntrack; -}; - /* The structure embedded in the conntrack structure. */ struct ip_nat_info { /* Set to zero when conntrack created: bitmask of maniptypes */ - int initialized; + u_int16_t initialized; - unsigned int num_manips; + u_int16_t num_manips; /* Manipulations to be done on this conntrack. */ struct ip_nat_info_manip manips[IP_NAT_MAX_MANIPS]; - struct ip_nat_hash bysource, byipsproto; + struct list_head bysource, byipsproto; /* Helper (NULL if none). */ struct ip_nat_helper *helper; diff --git a/include/linux/netfilter_ipv4/ip_nat_core.h b/include/linux/netfilter_ipv4/ip_nat_core.h index a8bcdc9874a5..4f01f882f2fc 100644 --- a/include/linux/netfilter_ipv4/ip_nat_core.h +++ b/include/linux/netfilter_ipv4/ip_nat_core.h @@ -14,8 +14,6 @@ extern unsigned int do_bindings(struct ip_conntrack *ct, unsigned int hooknum, struct sk_buff **pskb); -extern struct list_head protos; - extern int icmp_reply_translation(struct sk_buff **pskb, struct ip_conntrack *conntrack, unsigned int hooknum, @@ -26,8 +24,4 @@ extern void replace_in_hashes(struct ip_conntrack *conntrack, extern void place_in_hashes(struct ip_conntrack *conntrack, struct ip_nat_info *info); -/* Built-in protocols. */ -extern struct ip_nat_protocol ip_nat_protocol_tcp; -extern struct ip_nat_protocol ip_nat_protocol_udp; -extern struct ip_nat_protocol ip_nat_protocol_icmp; #endif /* _IP_NAT_CORE_H */ diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h index 998ab2bd325c..e81795806ee3 100644 --- a/include/linux/netfilter_ipv4/ip_nat_protocol.h +++ b/include/linux/netfilter_ipv4/ip_nat_protocol.h @@ -9,8 +9,6 @@ struct ip_nat_range; struct ip_nat_protocol { - struct list_head list; - /* Protocol name */ const char *name; @@ -47,10 +45,24 @@ struct ip_nat_protocol const struct ip_nat_range *range); }; +#define MAX_IP_NAT_PROTO 256 +extern struct ip_nat_protocol *ip_nat_protos[MAX_IP_NAT_PROTO]; + /* Protocol registration. */ extern int ip_nat_protocol_register(struct ip_nat_protocol *proto); extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto); +static inline struct ip_nat_protocol *ip_nat_find_proto(u_int8_t protocol) +{ + return ip_nat_protos[protocol]; +} + +/* Built-in protocols. */ +extern struct ip_nat_protocol ip_nat_protocol_tcp; +extern struct ip_nat_protocol ip_nat_protocol_udp; +extern struct ip_nat_protocol ip_nat_protocol_icmp; +extern struct ip_nat_protocol ip_nat_unknown_protocol; + extern int init_protocols(void) __init; extern void cleanup_protocols(void); extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum); diff --git a/include/linux/netfilter_ipv4/ipt_comment.h b/include/linux/netfilter_ipv4/ipt_comment.h new file mode 100644 index 000000000000..85c1123c29ce --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_comment.h @@ -0,0 +1,10 @@ +#ifndef _IPT_COMMENT_H +#define _IPT_COMMENT_H + +#define IPT_MAX_COMMENT_LEN 256 + +struct ipt_comment_info { + unsigned char comment[IPT_MAX_COMMENT_LEN]; +}; + +#endif /* _IPT_COMMENT_H */ diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index aae68c5017b6..66a56c3d2436 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -97,10 +97,6 @@ struct nf_conntrack { void (*destroy)(struct nf_conntrack *); }; -struct nf_ct_info { - struct nf_conntrack *master; -}; - #ifdef CONFIG_BRIDGE_NETFILTER struct nf_bridge_info { atomic_t use; @@ -186,6 +182,7 @@ struct skb_shared_info { * @nfmark: Can be used for communication between hooks * @nfcache: Cache info * @nfct: Associated connection, if any + * @nfctinfo: Relationship of this skb to the connection * @nf_debug: Netfilter debugging * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c * @private: Data which is private to the HIPPI implementation @@ -253,7 +250,8 @@ struct sk_buff { #ifdef CONFIG_NETFILTER unsigned long nfmark; __u32 nfcache; - struct nf_ct_info *nfct; + struct nf_conntrack *nfct; + __u32 nfctinfo; #ifdef CONFIG_NETFILTER_DEBUG unsigned int nf_debug; #endif @@ -1141,15 +1139,15 @@ extern int skb_iter_next(const struct sk_buff *skb, struct skb_iter *i); extern void skb_iter_abort(const struct sk_buff *skb, struct skb_iter *i); #ifdef CONFIG_NETFILTER -static inline void nf_conntrack_put(struct nf_ct_info *nfct) +static inline void nf_conntrack_put(struct nf_conntrack *nfct) { - if (nfct && atomic_dec_and_test(&nfct->master->use)) - nfct->master->destroy(nfct->master); + if (nfct && atomic_dec_and_test(&nfct->use)) + nfct->destroy(nfct); } -static inline void nf_conntrack_get(struct nf_ct_info *nfct) +static inline void nf_conntrack_get(struct nf_conntrack *nfct) { if (nfct) - atomic_inc(&nfct->master->use); + atomic_inc(&nfct->use); } static inline void nf_reset(struct sk_buff *skb) { diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index bec509e874de..e55ff44180b8 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -424,6 +424,7 @@ enum NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, + NET_IPV4_NF_CONNTRACK_COUNT=27, }; /* /proc/sys/net/ipv6 */ |
