diff options
| author | David S. Miller <davem@davemloft.net> | 2008-04-14 06:50:43 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2008-04-14 06:50:43 -0400 |
| commit | 334f8b2afd9652e20f67ddee4fec483ed860425b (patch) | |
| tree | 35d4fb46a9dc145e831fe5da026f2bfd9ee6657c /include/net | |
| parent | 7477fd2e6b676fcd15861c2a96a7172f71afe0a5 (diff) | |
| parent | ef1a5a50bbd509b8697dcd4d13017e9e0053867b (diff) | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.26
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/netfilter/nf_conntrack.h | 32 | ||||
| -rw-r--r-- | include/net/netfilter/nf_conntrack_core.h | 4 | ||||
| -rw-r--r-- | include/net/netfilter/nf_conntrack_l3proto.h | 19 | ||||
| -rw-r--r-- | include/net/netfilter/nf_conntrack_l4proto.h | 13 | ||||
| -rw-r--r-- | include/net/netfilter/nf_conntrack_tuple.h | 47 | ||||
| -rw-r--r-- | include/net/netfilter/nf_nat_helper.h | 3 | ||||
| -rw-r--r-- | include/net/netfilter/nf_nat_protocol.h | 46 | ||||
| -rw-r--r-- | include/net/netfilter/nf_nat_rule.h | 3 |
8 files changed, 87 insertions, 80 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index a3567a7a6d..2dbd6c015b 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <asm/atomic.h> | 20 | #include <asm/atomic.h> |
| 21 | 21 | ||
| 22 | #include <linux/netfilter/nf_conntrack_tcp.h> | 22 | #include <linux/netfilter/nf_conntrack_tcp.h> |
| 23 | #include <linux/netfilter/nf_conntrack_dccp.h> | ||
| 23 | #include <linux/netfilter/nf_conntrack_sctp.h> | 24 | #include <linux/netfilter/nf_conntrack_sctp.h> |
| 24 | #include <linux/netfilter/nf_conntrack_proto_gre.h> | 25 | #include <linux/netfilter/nf_conntrack_proto_gre.h> |
| 25 | #include <net/netfilter/ipv4/nf_conntrack_icmp.h> | 26 | #include <net/netfilter/ipv4/nf_conntrack_icmp.h> |
| @@ -30,6 +31,7 @@ | |||
| 30 | /* per conntrack: protocol private data */ | 31 | /* per conntrack: protocol private data */ |
| 31 | union nf_conntrack_proto { | 32 | union nf_conntrack_proto { |
| 32 | /* insert conntrack proto private data here */ | 33 | /* insert conntrack proto private data here */ |
| 34 | struct nf_ct_dccp dccp; | ||
| 33 | struct ip_ct_sctp sctp; | 35 | struct ip_ct_sctp sctp; |
| 34 | struct ip_ct_tcp tcp; | 36 | struct ip_ct_tcp tcp; |
| 35 | struct ip_ct_icmp icmp; | 37 | struct ip_ct_icmp icmp; |
| @@ -63,14 +65,7 @@ union nf_conntrack_help { | |||
| 63 | #include <linux/timer.h> | 65 | #include <linux/timer.h> |
| 64 | 66 | ||
| 65 | #ifdef CONFIG_NETFILTER_DEBUG | 67 | #ifdef CONFIG_NETFILTER_DEBUG |
| 66 | #define NF_CT_ASSERT(x) \ | 68 | #define NF_CT_ASSERT(x) WARN_ON(!(x)) |
| 67 | do { \ | ||
| 68 | if (!(x)) \ | ||
| 69 | /* Wooah! I'm tripping my conntrack in a frenzy of \ | ||
| 70 | netplay... */ \ | ||
| 71 | printk("NF_CT_ASSERT: %s:%i(%s)\n", \ | ||
| 72 | __FILE__, __LINE__, __FUNCTION__); \ | ||
| 73 | } while(0) | ||
| 74 | #else | 69 | #else |
| 75 | #define NF_CT_ASSERT(x) | 70 | #define NF_CT_ASSERT(x) |
| 76 | #endif | 71 | #endif |
| @@ -145,6 +140,16 @@ nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash) | |||
| 145 | tuplehash[hash->tuple.dst.dir]); | 140 | tuplehash[hash->tuple.dst.dir]); |
| 146 | } | 141 | } |
| 147 | 142 | ||
| 143 | static inline u_int16_t nf_ct_l3num(const struct nf_conn *ct) | ||
| 144 | { | ||
| 145 | return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num; | ||
| 146 | } | ||
| 147 | |||
| 148 | static inline u_int8_t nf_ct_protonum(const struct nf_conn *ct) | ||
| 149 | { | ||
| 150 | return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum; | ||
| 151 | } | ||
| 152 | |||
| 148 | /* get master conntrack via master expectation */ | 153 | /* get master conntrack via master expectation */ |
| 149 | #define master_ct(conntr) (conntr->master) | 154 | #define master_ct(conntr) (conntr->master) |
| 150 | 155 | ||
| @@ -189,12 +194,11 @@ extern void nf_conntrack_hash_insert(struct nf_conn *ct); | |||
| 189 | 194 | ||
| 190 | extern void nf_conntrack_flush(void); | 195 | extern void nf_conntrack_flush(void); |
| 191 | 196 | ||
| 192 | extern int nf_ct_get_tuplepr(const struct sk_buff *skb, | 197 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, |
| 193 | unsigned int nhoff, | 198 | unsigned int nhoff, u_int16_t l3num, |
| 194 | u_int16_t l3num, | 199 | struct nf_conntrack_tuple *tuple); |
| 195 | struct nf_conntrack_tuple *tuple); | 200 | extern bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, |
| 196 | extern int nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, | 201 | const struct nf_conntrack_tuple *orig); |
| 197 | const struct nf_conntrack_tuple *orig); | ||
| 198 | 202 | ||
| 199 | extern void __nf_ct_refresh_acct(struct nf_conn *ct, | 203 | extern void __nf_ct_refresh_acct(struct nf_conn *ct, |
| 200 | enum ip_conntrack_info ctinfo, | 204 | enum ip_conntrack_info ctinfo, |
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index 9ee26469c7..a817712109 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
| @@ -30,7 +30,7 @@ extern void nf_conntrack_cleanup(void); | |||
| 30 | extern int nf_conntrack_proto_init(void); | 30 | extern int nf_conntrack_proto_init(void); |
| 31 | extern void nf_conntrack_proto_fini(void); | 31 | extern void nf_conntrack_proto_fini(void); |
| 32 | 32 | ||
| 33 | extern int | 33 | extern bool |
| 34 | nf_ct_get_tuple(const struct sk_buff *skb, | 34 | nf_ct_get_tuple(const struct sk_buff *skb, |
| 35 | unsigned int nhoff, | 35 | unsigned int nhoff, |
| 36 | unsigned int dataoff, | 36 | unsigned int dataoff, |
| @@ -40,7 +40,7 @@ nf_ct_get_tuple(const struct sk_buff *skb, | |||
| 40 | const struct nf_conntrack_l3proto *l3proto, | 40 | const struct nf_conntrack_l3proto *l3proto, |
| 41 | const struct nf_conntrack_l4proto *l4proto); | 41 | const struct nf_conntrack_l4proto *l4proto); |
| 42 | 42 | ||
| 43 | extern int | 43 | extern bool |
| 44 | nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, | 44 | nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, |
| 45 | const struct nf_conntrack_tuple *orig, | 45 | const struct nf_conntrack_tuple *orig, |
| 46 | const struct nf_conntrack_l3proto *l3proto, | 46 | const struct nf_conntrack_l3proto *l3proto, |
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index b886e3ae6c..0378676c3d 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
| @@ -28,31 +28,20 @@ struct nf_conntrack_l3proto | |||
| 28 | * Try to fill in the third arg: nhoff is offset of l3 proto | 28 | * Try to fill in the third arg: nhoff is offset of l3 proto |
| 29 | * hdr. Return true if possible. | 29 | * hdr. Return true if possible. |
| 30 | */ | 30 | */ |
| 31 | int (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff, | 31 | bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff, |
| 32 | struct nf_conntrack_tuple *tuple); | 32 | struct nf_conntrack_tuple *tuple); |
| 33 | 33 | ||
| 34 | /* | 34 | /* |
| 35 | * Invert the per-proto part of the tuple: ie. turn xmit into reply. | 35 | * Invert the per-proto part of the tuple: ie. turn xmit into reply. |
| 36 | * Some packets can't be inverted: return 0 in that case. | 36 | * Some packets can't be inverted: return 0 in that case. |
| 37 | */ | 37 | */ |
| 38 | int (*invert_tuple)(struct nf_conntrack_tuple *inverse, | 38 | bool (*invert_tuple)(struct nf_conntrack_tuple *inverse, |
| 39 | const struct nf_conntrack_tuple *orig); | 39 | const struct nf_conntrack_tuple *orig); |
| 40 | 40 | ||
| 41 | /* Print out the per-protocol part of the tuple. */ | 41 | /* Print out the per-protocol part of the tuple. */ |
| 42 | int (*print_tuple)(struct seq_file *s, | 42 | int (*print_tuple)(struct seq_file *s, |
| 43 | const struct nf_conntrack_tuple *); | 43 | const struct nf_conntrack_tuple *); |
| 44 | 44 | ||
| 45 | /* Returns verdict for packet, or -1 for invalid. */ | ||
| 46 | int (*packet)(struct nf_conn *ct, | ||
| 47 | const struct sk_buff *skb, | ||
| 48 | enum ip_conntrack_info ctinfo); | ||
| 49 | |||
| 50 | /* | ||
| 51 | * Called when a new connection for this protocol found; | ||
| 52 | * returns TRUE if it's OK. If so, packet() called next. | ||
| 53 | */ | ||
| 54 | int (*new)(struct nf_conn *ct, const struct sk_buff *skb); | ||
| 55 | |||
| 56 | /* | 45 | /* |
| 57 | * Called before tracking. | 46 | * Called before tracking. |
| 58 | * *dataoff: offset of protocol header (TCP, UDP,...) in skb | 47 | * *dataoff: offset of protocol header (TCP, UDP,...) in skb |
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index efc16eccdd..723df9d1cc 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
| @@ -25,15 +25,14 @@ struct nf_conntrack_l4proto | |||
| 25 | 25 | ||
| 26 | /* Try to fill in the third arg: dataoff is offset past network protocol | 26 | /* Try to fill in the third arg: dataoff is offset past network protocol |
| 27 | hdr. Return true if possible. */ | 27 | hdr. Return true if possible. */ |
| 28 | int (*pkt_to_tuple)(const struct sk_buff *skb, | 28 | bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int dataoff, |
| 29 | unsigned int dataoff, | 29 | struct nf_conntrack_tuple *tuple); |
| 30 | struct nf_conntrack_tuple *tuple); | ||
| 31 | 30 | ||
| 32 | /* Invert the per-proto part of the tuple: ie. turn xmit into reply. | 31 | /* Invert the per-proto part of the tuple: ie. turn xmit into reply. |
| 33 | * Some packets can't be inverted: return 0 in that case. | 32 | * Some packets can't be inverted: return 0 in that case. |
| 34 | */ | 33 | */ |
| 35 | int (*invert_tuple)(struct nf_conntrack_tuple *inverse, | 34 | bool (*invert_tuple)(struct nf_conntrack_tuple *inverse, |
| 36 | const struct nf_conntrack_tuple *orig); | 35 | const struct nf_conntrack_tuple *orig); |
| 37 | 36 | ||
| 38 | /* Returns verdict for packet, or -1 for invalid. */ | 37 | /* Returns verdict for packet, or -1 for invalid. */ |
| 39 | int (*packet)(struct nf_conn *ct, | 38 | int (*packet)(struct nf_conn *ct, |
| @@ -45,8 +44,8 @@ struct nf_conntrack_l4proto | |||
| 45 | 44 | ||
| 46 | /* Called when a new connection for this protocol found; | 45 | /* Called when a new connection for this protocol found; |
| 47 | * returns TRUE if it's OK. If so, packet() called next. */ | 46 | * returns TRUE if it's OK. If so, packet() called next. */ |
| 48 | int (*new)(struct nf_conn *ct, const struct sk_buff *skb, | 47 | bool (*new)(struct nf_conn *ct, const struct sk_buff *skb, |
| 49 | unsigned int dataoff); | 48 | unsigned int dataoff); |
| 50 | 49 | ||
| 51 | /* Called when a conntrack entry is destroyed */ | 50 | /* Called when a conntrack entry is destroyed */ |
| 52 | void (*destroy)(struct nf_conn *ct); | 51 | void (*destroy)(struct nf_conn *ct); |
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index 168c91754d..1bb7087833 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h | |||
| @@ -41,6 +41,9 @@ union nf_conntrack_man_proto | |||
| 41 | } icmp; | 41 | } icmp; |
| 42 | struct { | 42 | struct { |
| 43 | __be16 port; | 43 | __be16 port; |
| 44 | } dccp; | ||
| 45 | struct { | ||
| 46 | __be16 port; | ||
| 44 | } sctp; | 47 | } sctp; |
| 45 | struct { | 48 | struct { |
| 46 | __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */ | 49 | __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */ |
| @@ -79,6 +82,9 @@ struct nf_conntrack_tuple | |||
| 79 | } icmp; | 82 | } icmp; |
| 80 | struct { | 83 | struct { |
| 81 | __be16 port; | 84 | __be16 port; |
| 85 | } dccp; | ||
| 86 | struct { | ||
| 87 | __be16 port; | ||
| 82 | } sctp; | 88 | } sctp; |
| 83 | struct { | 89 | struct { |
| 84 | __be16 key; | 90 | __be16 key; |
| @@ -145,8 +151,6 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t) | |||
| 145 | } | 151 | } |
| 146 | } | 152 | } |
| 147 | 153 | ||
| 148 | #define NF_CT_DUMP_TUPLE(tp) nf_ct_dump_tuple(tp) | ||
| 149 | |||
| 150 | /* If we're the first tuple, it's the original dir. */ | 154 | /* If we're the first tuple, it's the original dir. */ |
| 151 | #define NF_CT_DIRECTION(h) \ | 155 | #define NF_CT_DIRECTION(h) \ |
| 152 | ((enum ip_conntrack_dir)(h)->tuple.dst.dir) | 156 | ((enum ip_conntrack_dir)(h)->tuple.dst.dir) |
| @@ -160,61 +164,64 @@ struct nf_conntrack_tuple_hash | |||
| 160 | 164 | ||
| 161 | #endif /* __KERNEL__ */ | 165 | #endif /* __KERNEL__ */ |
| 162 | 166 | ||
| 163 | static inline int __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, | 167 | static inline bool __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, |
| 164 | const struct nf_conntrack_tuple *t2) | 168 | const struct nf_conntrack_tuple *t2) |
| 165 | { | 169 | { |
| 166 | return (nf_inet_addr_cmp(&t1->src.u3, &t2->src.u3) && | 170 | return (nf_inet_addr_cmp(&t1->src.u3, &t2->src.u3) && |
| 167 | t1->src.u.all == t2->src.u.all && | 171 | t1->src.u.all == t2->src.u.all && |
| 168 | t1->src.l3num == t2->src.l3num); | 172 | t1->src.l3num == t2->src.l3num); |
| 169 | } | 173 | } |
| 170 | 174 | ||
| 171 | static inline int __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, | 175 | static inline bool __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, |
| 172 | const struct nf_conntrack_tuple *t2) | 176 | const struct nf_conntrack_tuple *t2) |
| 173 | { | 177 | { |
| 174 | return (nf_inet_addr_cmp(&t1->dst.u3, &t2->dst.u3) && | 178 | return (nf_inet_addr_cmp(&t1->dst.u3, &t2->dst.u3) && |
| 175 | t1->dst.u.all == t2->dst.u.all && | 179 | t1->dst.u.all == t2->dst.u.all && |
| 176 | t1->dst.protonum == t2->dst.protonum); | 180 | t1->dst.protonum == t2->dst.protonum); |
| 177 | } | 181 | } |
| 178 | 182 | ||
| 179 | static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1, | 183 | static inline bool nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1, |
| 180 | const struct nf_conntrack_tuple *t2) | 184 | const struct nf_conntrack_tuple *t2) |
| 181 | { | 185 | { |
| 182 | return __nf_ct_tuple_src_equal(t1, t2) && | 186 | return __nf_ct_tuple_src_equal(t1, t2) && |
| 183 | __nf_ct_tuple_dst_equal(t1, t2); | 187 | __nf_ct_tuple_dst_equal(t1, t2); |
| 184 | } | 188 | } |
| 185 | 189 | ||
| 186 | static inline int nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1, | 190 | static inline bool |
| 187 | const struct nf_conntrack_tuple_mask *m2) | 191 | nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1, |
| 192 | const struct nf_conntrack_tuple_mask *m2) | ||
| 188 | { | 193 | { |
| 189 | return (nf_inet_addr_cmp(&m1->src.u3, &m2->src.u3) && | 194 | return (nf_inet_addr_cmp(&m1->src.u3, &m2->src.u3) && |
| 190 | m1->src.u.all == m2->src.u.all); | 195 | m1->src.u.all == m2->src.u.all); |
| 191 | } | 196 | } |
| 192 | 197 | ||
| 193 | static inline int nf_ct_tuple_src_mask_cmp(const struct nf_conntrack_tuple *t1, | 198 | static inline bool |
| 194 | const struct nf_conntrack_tuple *t2, | 199 | nf_ct_tuple_src_mask_cmp(const struct nf_conntrack_tuple *t1, |
| 195 | const struct nf_conntrack_tuple_mask *mask) | 200 | const struct nf_conntrack_tuple *t2, |
| 201 | const struct nf_conntrack_tuple_mask *mask) | ||
| 196 | { | 202 | { |
| 197 | int count; | 203 | int count; |
| 198 | 204 | ||
| 199 | for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++) { | 205 | for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++) { |
| 200 | if ((t1->src.u3.all[count] ^ t2->src.u3.all[count]) & | 206 | if ((t1->src.u3.all[count] ^ t2->src.u3.all[count]) & |
| 201 | mask->src.u3.all[count]) | 207 | mask->src.u3.all[count]) |
| 202 | return 0; | 208 | return false; |
| 203 | } | 209 | } |
| 204 | 210 | ||
| 205 | if ((t1->src.u.all ^ t2->src.u.all) & mask->src.u.all) | 211 | if ((t1->src.u.all ^ t2->src.u.all) & mask->src.u.all) |
| 206 | return 0; | 212 | return false; |
| 207 | 213 | ||
| 208 | if (t1->src.l3num != t2->src.l3num || | 214 | if (t1->src.l3num != t2->src.l3num || |
| 209 | t1->dst.protonum != t2->dst.protonum) | 215 | t1->dst.protonum != t2->dst.protonum) |
| 210 | return 0; | 216 | return false; |
| 211 | 217 | ||
| 212 | return 1; | 218 | return true; |
| 213 | } | 219 | } |
| 214 | 220 | ||
| 215 | static inline int nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t, | 221 | static inline bool |
| 216 | const struct nf_conntrack_tuple *tuple, | 222 | nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t, |
| 217 | const struct nf_conntrack_tuple_mask *mask) | 223 | const struct nf_conntrack_tuple *tuple, |
| 224 | const struct nf_conntrack_tuple_mask *mask) | ||
| 218 | { | 225 | { |
| 219 | return nf_ct_tuple_src_mask_cmp(t, tuple, mask) && | 226 | return nf_ct_tuple_src_mask_cmp(t, tuple, mask) && |
| 220 | __nf_ct_tuple_dst_equal(t, tuple); | 227 | __nf_ct_tuple_dst_equal(t, tuple); |
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h index 58dd226879..237a961f40 100644 --- a/include/net/netfilter/nf_nat_helper.h +++ b/include/net/netfilter/nf_nat_helper.h | |||
| @@ -24,6 +24,9 @@ extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, | |||
| 24 | extern int nf_nat_seq_adjust(struct sk_buff *skb, | 24 | extern int nf_nat_seq_adjust(struct sk_buff *skb, |
| 25 | struct nf_conn *ct, | 25 | struct nf_conn *ct, |
| 26 | enum ip_conntrack_info ctinfo); | 26 | enum ip_conntrack_info ctinfo); |
| 27 | extern int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb, | ||
| 28 | struct nf_conn *ct, | ||
| 29 | enum ip_conntrack_info ctinfo); | ||
| 27 | 30 | ||
| 28 | /* Setup NAT on this expected conntrack so it follows master, but goes | 31 | /* Setup NAT on this expected conntrack so it follows master, but goes |
| 29 | * to port ct->master->saved_proto. */ | 32 | * to port ct->master->saved_proto. */ |
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h index 4aa0edbb5b..f3662c4394 100644 --- a/include/net/netfilter/nf_nat_protocol.h +++ b/include/net/netfilter/nf_nat_protocol.h | |||
| @@ -8,9 +8,6 @@ struct nf_nat_range; | |||
| 8 | 8 | ||
| 9 | struct nf_nat_protocol | 9 | struct nf_nat_protocol |
| 10 | { | 10 | { |
| 11 | /* Protocol name */ | ||
| 12 | const char *name; | ||
| 13 | |||
| 14 | /* Protocol number. */ | 11 | /* Protocol number. */ |
| 15 | unsigned int protonum; | 12 | unsigned int protonum; |
| 16 | 13 | ||
| @@ -18,25 +15,25 @@ struct nf_nat_protocol | |||
| 18 | 15 | ||
| 19 | /* Translate a packet to the target according to manip type. | 16 | /* Translate a packet to the target according to manip type. |
| 20 | Return true if succeeded. */ | 17 | Return true if succeeded. */ |
| 21 | int (*manip_pkt)(struct sk_buff *skb, | 18 | bool (*manip_pkt)(struct sk_buff *skb, |
| 22 | unsigned int iphdroff, | 19 | unsigned int iphdroff, |
| 23 | const struct nf_conntrack_tuple *tuple, | 20 | const struct nf_conntrack_tuple *tuple, |
| 24 | enum nf_nat_manip_type maniptype); | 21 | enum nf_nat_manip_type maniptype); |
| 25 | 22 | ||
| 26 | /* Is the manipable part of the tuple between min and max incl? */ | 23 | /* Is the manipable part of the tuple between min and max incl? */ |
| 27 | int (*in_range)(const struct nf_conntrack_tuple *tuple, | 24 | bool (*in_range)(const struct nf_conntrack_tuple *tuple, |
| 28 | enum nf_nat_manip_type maniptype, | 25 | enum nf_nat_manip_type maniptype, |
| 29 | const union nf_conntrack_man_proto *min, | 26 | const union nf_conntrack_man_proto *min, |
| 30 | const union nf_conntrack_man_proto *max); | 27 | const union nf_conntrack_man_proto *max); |
| 31 | 28 | ||
| 32 | /* Alter the per-proto part of the tuple (depending on | 29 | /* Alter the per-proto part of the tuple (depending on |
| 33 | maniptype), to give a unique tuple in the given range if | 30 | maniptype), to give a unique tuple in the given range if |
| 34 | possible; return false if not. Per-protocol part of tuple | 31 | possible; return false if not. Per-protocol part of tuple |
| 35 | is initialized to the incoming packet. */ | 32 | is initialized to the incoming packet. */ |
| 36 | int (*unique_tuple)(struct nf_conntrack_tuple *tuple, | 33 | bool (*unique_tuple)(struct nf_conntrack_tuple *tuple, |
| 37 | const struct nf_nat_range *range, | 34 | const struct nf_nat_range *range, |
| 38 | enum nf_nat_manip_type maniptype, | 35 | enum nf_nat_manip_type maniptype, |
| 39 | const struct nf_conn *ct); | 36 | const struct nf_conn *ct); |
| 40 | 37 | ||
| 41 | int (*range_to_nlattr)(struct sk_buff *skb, | 38 | int (*range_to_nlattr)(struct sk_buff *skb, |
| 42 | const struct nf_nat_range *range); | 39 | const struct nf_nat_range *range); |
| @@ -62,9 +59,20 @@ extern int init_protocols(void) __init; | |||
| 62 | extern void cleanup_protocols(void); | 59 | extern void cleanup_protocols(void); |
| 63 | extern const struct nf_nat_protocol *find_nat_proto(u_int16_t protonum); | 60 | extern const struct nf_nat_protocol *find_nat_proto(u_int16_t protonum); |
| 64 | 61 | ||
| 65 | extern int nf_nat_port_range_to_nlattr(struct sk_buff *skb, | 62 | extern bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple, |
| 66 | const struct nf_nat_range *range); | 63 | enum nf_nat_manip_type maniptype, |
| 67 | extern int nf_nat_port_nlattr_to_range(struct nlattr *tb[], | 64 | const union nf_conntrack_man_proto *min, |
| 68 | struct nf_nat_range *range); | 65 | const union nf_conntrack_man_proto *max); |
| 66 | |||
| 67 | extern bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, | ||
| 68 | const struct nf_nat_range *range, | ||
| 69 | enum nf_nat_manip_type maniptype, | ||
| 70 | const struct nf_conn *ct, | ||
| 71 | u_int16_t *rover); | ||
| 72 | |||
| 73 | extern int nf_nat_proto_range_to_nlattr(struct sk_buff *skb, | ||
| 74 | const struct nf_nat_range *range); | ||
| 75 | extern int nf_nat_proto_nlattr_to_range(struct nlattr *tb[], | ||
| 76 | struct nf_nat_range *range); | ||
| 69 | 77 | ||
| 70 | #endif /*_NF_NAT_PROTO_H*/ | 78 | #endif /*_NF_NAT_PROTO_H*/ |
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h index 75d1825031..e4a18ae361 100644 --- a/include/net/netfilter/nf_nat_rule.h +++ b/include/net/netfilter/nf_nat_rule.h | |||
| @@ -14,7 +14,4 @@ extern int nf_nat_rule_find(struct sk_buff *skb, | |||
| 14 | 14 | ||
| 15 | extern unsigned int | 15 | extern unsigned int |
| 16 | alloc_null_binding(struct nf_conn *ct, unsigned int hooknum); | 16 | alloc_null_binding(struct nf_conn *ct, unsigned int hooknum); |
| 17 | |||
| 18 | extern unsigned int | ||
| 19 | alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum); | ||
| 20 | #endif /* _NF_NAT_RULE_H */ | 17 | #endif /* _NF_NAT_RULE_H */ |
