diff options
| author | David S. Miller <davem@davemloft.net> | 2010-02-16 14:15:13 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2010-02-16 14:15:13 -0500 |
| commit | 749f621e20ab0db35a15ff730088922603c809ba (patch) | |
| tree | 2684d12199b58f2b9e0c5b7e6cc0ea3f002e611a /include/linux | |
| parent | 339c6e99853d2ef1f02ad8a313e079050a300427 (diff) | |
| parent | 3e5e524ffb5fcf2447eb5dd9f8e54ad22dd9baa7 (diff) | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/netfilter.h | 64 | ||||
| -rw-r--r-- | include/linux/netfilter/Kbuild | 1 | ||||
| -rw-r--r-- | include/linux/netfilter/nf_conntrack_common.h | 22 | ||||
| -rw-r--r-- | include/linux/netfilter/nf_conntrack_sip.h | 19 | ||||
| -rw-r--r-- | include/linux/netfilter/nfnetlink.h | 8 | ||||
| -rw-r--r-- | include/linux/netfilter/nfnetlink_conntrack.h | 2 | ||||
| -rw-r--r-- | include/linux/netfilter/x_tables.h | 53 | ||||
| -rw-r--r-- | include/linux/netfilter/xt_CT.h | 17 | ||||
| -rw-r--r-- | include/linux/netfilter_arp/arp_tables.h | 1 | ||||
| -rw-r--r-- | include/linux/netfilter_bridge/ebtables.h | 2 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv4/ip_tables.h | 3 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv6/ip6_tables.h | 3 |
12 files changed, 136 insertions, 59 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 48c54960773..70079454ffd 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
| @@ -114,15 +114,17 @@ struct nf_sockopt_ops { | |||
| 114 | int set_optmin; | 114 | int set_optmin; |
| 115 | int set_optmax; | 115 | int set_optmax; |
| 116 | int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); | 116 | int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); |
| 117 | #ifdef CONFIG_COMPAT | ||
| 117 | int (*compat_set)(struct sock *sk, int optval, | 118 | int (*compat_set)(struct sock *sk, int optval, |
| 118 | void __user *user, unsigned int len); | 119 | void __user *user, unsigned int len); |
| 119 | 120 | #endif | |
| 120 | int get_optmin; | 121 | int get_optmin; |
| 121 | int get_optmax; | 122 | int get_optmax; |
| 122 | int (*get)(struct sock *sk, int optval, void __user *user, int *len); | 123 | int (*get)(struct sock *sk, int optval, void __user *user, int *len); |
| 124 | #ifdef CONFIG_COMPAT | ||
| 123 | int (*compat_get)(struct sock *sk, int optval, | 125 | int (*compat_get)(struct sock *sk, int optval, |
| 124 | void __user *user, int *len); | 126 | void __user *user, int *len); |
| 125 | 127 | #endif | |
| 126 | /* Use the module struct to lock set/get code in place */ | 128 | /* Use the module struct to lock set/get code in place */ |
| 127 | struct module *owner; | 129 | struct module *owner; |
| 128 | }; | 130 | }; |
| @@ -161,11 +163,8 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, | |||
| 161 | struct sk_buff *skb, | 163 | struct sk_buff *skb, |
| 162 | struct net_device *indev, | 164 | struct net_device *indev, |
| 163 | struct net_device *outdev, | 165 | struct net_device *outdev, |
| 164 | int (*okfn)(struct sk_buff *), int thresh, | 166 | int (*okfn)(struct sk_buff *), int thresh) |
| 165 | int cond) | ||
| 166 | { | 167 | { |
| 167 | if (!cond) | ||
| 168 | return 1; | ||
| 169 | #ifndef CONFIG_NETFILTER_DEBUG | 168 | #ifndef CONFIG_NETFILTER_DEBUG |
| 170 | if (list_empty(&nf_hooks[pf][hook])) | 169 | if (list_empty(&nf_hooks[pf][hook])) |
| 171 | return 1; | 170 | return 1; |
| @@ -177,7 +176,7 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, | |||
| 177 | struct net_device *indev, struct net_device *outdev, | 176 | struct net_device *indev, struct net_device *outdev, |
| 178 | int (*okfn)(struct sk_buff *)) | 177 | int (*okfn)(struct sk_buff *)) |
| 179 | { | 178 | { |
| 180 | return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN, 1); | 179 | return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN); |
| 181 | } | 180 | } |
| 182 | 181 | ||
| 183 | /* Activate hook; either okfn or kfree_skb called, unless a hook | 182 | /* Activate hook; either okfn or kfree_skb called, unless a hook |
| @@ -197,36 +196,48 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, | |||
| 197 | coders :) | 196 | coders :) |
| 198 | */ | 197 | */ |
| 199 | 198 | ||
| 200 | /* This is gross, but inline doesn't cut it for avoiding the function | 199 | static inline int |
| 201 | call in fast path: gcc doesn't inline (needs value tracking?). --RR */ | 200 | NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
| 202 | 201 | struct net_device *in, struct net_device *out, | |
| 203 | /* HX: It's slightly less gross now. */ | 202 | int (*okfn)(struct sk_buff *), int thresh) |
| 204 | 203 | { | |
| 205 | #define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ | 204 | int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh); |
| 206 | ({int __ret; \ | 205 | if (ret == 1) |
| 207 | if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, thresh, 1)) == 1)\ | 206 | ret = okfn(skb); |
| 208 | __ret = (okfn)(skb); \ | 207 | return ret; |
| 209 | __ret;}) | 208 | } |
| 210 | 209 | ||
| 211 | #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) \ | 210 | static inline int |
| 212 | ({int __ret; \ | 211 | NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
| 213 | if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, INT_MIN, cond)) == 1)\ | 212 | struct net_device *in, struct net_device *out, |
| 214 | __ret = (okfn)(skb); \ | 213 | int (*okfn)(struct sk_buff *), bool cond) |
| 215 | __ret;}) | 214 | { |
| 215 | int ret = 1; | ||
| 216 | if (cond || | ||
| 217 | (ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN) == 1)) | ||
| 218 | ret = okfn(skb); | ||
| 219 | return ret; | ||
| 220 | } | ||
| 216 | 221 | ||
| 217 | #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ | 222 | static inline int |
| 218 | NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) | 223 | NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
| 224 | struct net_device *in, struct net_device *out, | ||
| 225 | int (*okfn)(struct sk_buff *)) | ||
| 226 | { | ||
| 227 | return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, INT_MIN); | ||
| 228 | } | ||
| 219 | 229 | ||
| 220 | /* Call setsockopt() */ | 230 | /* Call setsockopt() */ |
| 221 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, | 231 | int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
| 222 | unsigned int len); | 232 | unsigned int len); |
| 223 | int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, | 233 | int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, |
| 224 | int *len); | 234 | int *len); |
| 225 | 235 | #ifdef CONFIG_COMPAT | |
| 226 | int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, | 236 | int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, |
| 227 | char __user *opt, unsigned int len); | 237 | char __user *opt, unsigned int len); |
| 228 | int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, | 238 | int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, |
| 229 | char __user *opt, int *len); | 239 | char __user *opt, int *len); |
| 240 | #endif | ||
| 230 | 241 | ||
| 231 | /* Call this before modifying an existing packet: ensures it is | 242 | /* Call this before modifying an existing packet: ensures it is |
| 232 | modifiable and linear to the point you care about (writable_len). | 243 | modifiable and linear to the point you care about (writable_len). |
| @@ -325,8 +336,7 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, | |||
| 325 | struct sk_buff *skb, | 336 | struct sk_buff *skb, |
| 326 | struct net_device *indev, | 337 | struct net_device *indev, |
| 327 | struct net_device *outdev, | 338 | struct net_device *outdev, |
| 328 | int (*okfn)(struct sk_buff *), int thresh, | 339 | int (*okfn)(struct sk_buff *), int thresh) |
| 329 | int cond) | ||
| 330 | { | 340 | { |
| 331 | return okfn(skb); | 341 | return okfn(skb); |
| 332 | } | 342 | } |
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index 2aea50399c0..a5a63e41b8a 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
| @@ -6,6 +6,7 @@ header-y += nfnetlink_queue.h | |||
| 6 | header-y += xt_CLASSIFY.h | 6 | header-y += xt_CLASSIFY.h |
| 7 | header-y += xt_CONNMARK.h | 7 | header-y += xt_CONNMARK.h |
| 8 | header-y += xt_CONNSECMARK.h | 8 | header-y += xt_CONNSECMARK.h |
| 9 | header-y += xt_CT.h | ||
| 9 | header-y += xt_DSCP.h | 10 | header-y += xt_DSCP.h |
| 10 | header-y += xt_LED.h | 11 | header-y += xt_LED.h |
| 11 | header-y += xt_MARK.h | 12 | header-y += xt_MARK.h |
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h index a374787ed9b..c608677dda6 100644 --- a/include/linux/netfilter/nf_conntrack_common.h +++ b/include/linux/netfilter/nf_conntrack_common.h | |||
| @@ -72,6 +72,28 @@ enum ip_conntrack_status { | |||
| 72 | /* Connection has fixed timeout. */ | 72 | /* Connection has fixed timeout. */ |
| 73 | IPS_FIXED_TIMEOUT_BIT = 10, | 73 | IPS_FIXED_TIMEOUT_BIT = 10, |
| 74 | IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), | 74 | IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), |
| 75 | |||
| 76 | /* Conntrack is a template */ | ||
| 77 | IPS_TEMPLATE_BIT = 11, | ||
| 78 | IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT), | ||
| 79 | }; | ||
| 80 | |||
| 81 | /* Connection tracking event types */ | ||
| 82 | enum ip_conntrack_events { | ||
| 83 | IPCT_NEW, /* new conntrack */ | ||
| 84 | IPCT_RELATED, /* related conntrack */ | ||
| 85 | IPCT_DESTROY, /* destroyed conntrack */ | ||
| 86 | IPCT_REPLY, /* connection has seen two-way traffic */ | ||
| 87 | IPCT_ASSURED, /* connection status has changed to assured */ | ||
| 88 | IPCT_PROTOINFO, /* protocol information has changed */ | ||
| 89 | IPCT_HELPER, /* new helper has been set */ | ||
| 90 | IPCT_MARK, /* new mark has been set */ | ||
| 91 | IPCT_NATSEQADJ, /* NAT is doing sequence adjustment */ | ||
| 92 | IPCT_SECMARK, /* new security mark has been set */ | ||
| 93 | }; | ||
| 94 | |||
| 95 | enum ip_conntrack_expect_events { | ||
| 96 | IPEXP_NEW, /* new expectation */ | ||
| 75 | }; | 97 | }; |
| 76 | 98 | ||
| 77 | #ifdef __KERNEL__ | 99 | #ifdef __KERNEL__ |
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 23aa2ec6b7b..ff8cfbcf3b8 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h | |||
| @@ -14,6 +14,7 @@ enum sip_expectation_classes { | |||
| 14 | SIP_EXPECT_SIGNALLING, | 14 | SIP_EXPECT_SIGNALLING, |
| 15 | SIP_EXPECT_AUDIO, | 15 | SIP_EXPECT_AUDIO, |
| 16 | SIP_EXPECT_VIDEO, | 16 | SIP_EXPECT_VIDEO, |
| 17 | SIP_EXPECT_IMAGE, | ||
| 17 | __SIP_EXPECT_MAX | 18 | __SIP_EXPECT_MAX |
| 18 | }; | 19 | }; |
| 19 | #define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1) | 20 | #define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1) |
| @@ -34,10 +35,10 @@ struct sdp_media_type { | |||
| 34 | struct sip_handler { | 35 | struct sip_handler { |
| 35 | const char *method; | 36 | const char *method; |
| 36 | unsigned int len; | 37 | unsigned int len; |
| 37 | int (*request)(struct sk_buff *skb, | 38 | int (*request)(struct sk_buff *skb, unsigned int dataoff, |
| 38 | const char **dptr, unsigned int *datalen, | 39 | const char **dptr, unsigned int *datalen, |
| 39 | unsigned int cseq); | 40 | unsigned int cseq); |
| 40 | int (*response)(struct sk_buff *skb, | 41 | int (*response)(struct sk_buff *skb, unsigned int dataoff, |
| 41 | const char **dptr, unsigned int *datalen, | 42 | const char **dptr, unsigned int *datalen, |
| 42 | unsigned int cseq, unsigned int code); | 43 | unsigned int cseq, unsigned int code); |
| 43 | }; | 44 | }; |
| @@ -84,7 +85,8 @@ enum sip_header_types { | |||
| 84 | SIP_HDR_FROM, | 85 | SIP_HDR_FROM, |
| 85 | SIP_HDR_TO, | 86 | SIP_HDR_TO, |
| 86 | SIP_HDR_CONTACT, | 87 | SIP_HDR_CONTACT, |
| 87 | SIP_HDR_VIA, | 88 | SIP_HDR_VIA_UDP, |
| 89 | SIP_HDR_VIA_TCP, | ||
| 88 | SIP_HDR_EXPIRES, | 90 | SIP_HDR_EXPIRES, |
| 89 | SIP_HDR_CONTENT_LENGTH, | 91 | SIP_HDR_CONTENT_LENGTH, |
| 90 | }; | 92 | }; |
| @@ -100,33 +102,40 @@ enum sdp_header_types { | |||
| 100 | }; | 102 | }; |
| 101 | 103 | ||
| 102 | extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, | 104 | extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, |
| 105 | unsigned int dataoff, | ||
| 103 | const char **dptr, | 106 | const char **dptr, |
| 104 | unsigned int *datalen); | 107 | unsigned int *datalen); |
| 108 | extern void (*nf_nat_sip_seq_adjust_hook)(struct sk_buff *skb, s16 off); | ||
| 105 | extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, | 109 | extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, |
| 110 | unsigned int dataoff, | ||
| 106 | const char **dptr, | 111 | const char **dptr, |
| 107 | unsigned int *datalen, | 112 | unsigned int *datalen, |
| 108 | struct nf_conntrack_expect *exp, | 113 | struct nf_conntrack_expect *exp, |
| 109 | unsigned int matchoff, | 114 | unsigned int matchoff, |
| 110 | unsigned int matchlen); | 115 | unsigned int matchlen); |
| 111 | extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, | 116 | extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, |
| 112 | const char **dptr, | ||
| 113 | unsigned int dataoff, | 117 | unsigned int dataoff, |
| 118 | const char **dptr, | ||
| 114 | unsigned int *datalen, | 119 | unsigned int *datalen, |
| 120 | unsigned int sdpoff, | ||
| 115 | enum sdp_header_types type, | 121 | enum sdp_header_types type, |
| 116 | enum sdp_header_types term, | 122 | enum sdp_header_types term, |
| 117 | const union nf_inet_addr *addr); | 123 | const union nf_inet_addr *addr); |
| 118 | extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, | 124 | extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, |
| 125 | unsigned int dataoff, | ||
| 119 | const char **dptr, | 126 | const char **dptr, |
| 120 | unsigned int *datalen, | 127 | unsigned int *datalen, |
| 121 | unsigned int matchoff, | 128 | unsigned int matchoff, |
| 122 | unsigned int matchlen, | 129 | unsigned int matchlen, |
| 123 | u_int16_t port); | 130 | u_int16_t port); |
| 124 | extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb, | 131 | extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb, |
| 125 | const char **dptr, | ||
| 126 | unsigned int dataoff, | 132 | unsigned int dataoff, |
| 133 | const char **dptr, | ||
| 127 | unsigned int *datalen, | 134 | unsigned int *datalen, |
| 135 | unsigned int sdpoff, | ||
| 128 | const union nf_inet_addr *addr); | 136 | const union nf_inet_addr *addr); |
| 129 | extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb, | 137 | extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb, |
| 138 | unsigned int dataoff, | ||
| 130 | const char **dptr, | 139 | const char **dptr, |
| 131 | unsigned int *datalen, | 140 | unsigned int *datalen, |
| 132 | struct nf_conntrack_expect *rtp_exp, | 141 | struct nf_conntrack_expect *rtp_exp, |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index 49d321f3ccd..53923868c9b 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
| @@ -73,11 +73,11 @@ struct nfnetlink_subsystem { | |||
| 73 | extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); | 73 | extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); |
| 74 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); | 74 | extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); |
| 75 | 75 | ||
| 76 | extern int nfnetlink_has_listeners(unsigned int group); | 76 | extern int nfnetlink_has_listeners(struct net *net, unsigned int group); |
| 77 | extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, | 77 | extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group, |
| 78 | int echo, gfp_t flags); | 78 | int echo, gfp_t flags); |
| 79 | extern void nfnetlink_set_err(u32 pid, u32 group, int error); | 79 | extern void nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); |
| 80 | extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); | 80 | extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); |
| 81 | 81 | ||
| 82 | extern void nfnl_lock(void); | 82 | extern void nfnl_lock(void); |
| 83 | extern void nfnl_unlock(void); | 83 | extern void nfnl_unlock(void); |
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h index ed4ef8d0b11..9ed534c991b 100644 --- a/include/linux/netfilter/nfnetlink_conntrack.h +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
| @@ -40,6 +40,7 @@ enum ctattr_type { | |||
| 40 | CTA_NAT_SEQ_ADJ_ORIG, | 40 | CTA_NAT_SEQ_ADJ_ORIG, |
| 41 | CTA_NAT_SEQ_ADJ_REPLY, | 41 | CTA_NAT_SEQ_ADJ_REPLY, |
| 42 | CTA_SECMARK, | 42 | CTA_SECMARK, |
| 43 | CTA_ZONE, | ||
| 43 | __CTA_MAX | 44 | __CTA_MAX |
| 44 | }; | 45 | }; |
| 45 | #define CTA_MAX (__CTA_MAX - 1) | 46 | #define CTA_MAX (__CTA_MAX - 1) |
| @@ -159,6 +160,7 @@ enum ctattr_expect { | |||
| 159 | CTA_EXPECT_TIMEOUT, | 160 | CTA_EXPECT_TIMEOUT, |
| 160 | CTA_EXPECT_ID, | 161 | CTA_EXPECT_ID, |
| 161 | CTA_EXPECT_HELP_NAME, | 162 | CTA_EXPECT_HELP_NAME, |
| 163 | CTA_EXPECT_ZONE, | ||
| 162 | __CTA_EXPECT_MAX | 164 | __CTA_EXPECT_MAX |
| 163 | }; | 165 | }; |
| 164 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) | 166 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) |
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 378f27ae777..a18119fb88f 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
| @@ -93,8 +93,7 @@ struct _xt_align { | |||
| 93 | __u64 u64; | 93 | __u64 u64; |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | #define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \ | 96 | #define XT_ALIGN(s) ALIGN((s), __alignof__(struct _xt_align)) |
| 97 | & ~(__alignof__(struct _xt_align)-1)) | ||
| 98 | 97 | ||
| 99 | /* Standard return verdict, or do jump. */ | 98 | /* Standard return verdict, or do jump. */ |
| 100 | #define XT_STANDARD_TARGET "" | 99 | #define XT_STANDARD_TARGET "" |
| @@ -205,6 +204,7 @@ struct xt_match_param { | |||
| 205 | * @hook_mask: via which hooks the new rule is reachable | 204 | * @hook_mask: via which hooks the new rule is reachable |
| 206 | */ | 205 | */ |
| 207 | struct xt_mtchk_param { | 206 | struct xt_mtchk_param { |
| 207 | struct net *net; | ||
| 208 | const char *table; | 208 | const char *table; |
| 209 | const void *entryinfo; | 209 | const void *entryinfo; |
| 210 | const struct xt_match *match; | 210 | const struct xt_match *match; |
| @@ -215,6 +215,7 @@ struct xt_mtchk_param { | |||
| 215 | 215 | ||
| 216 | /* Match destructor parameters */ | 216 | /* Match destructor parameters */ |
| 217 | struct xt_mtdtor_param { | 217 | struct xt_mtdtor_param { |
| 218 | struct net *net; | ||
| 218 | const struct xt_match *match; | 219 | const struct xt_match *match; |
| 219 | void *matchinfo; | 220 | void *matchinfo; |
| 220 | u_int8_t family; | 221 | u_int8_t family; |
| @@ -247,6 +248,7 @@ struct xt_target_param { | |||
| 247 | * Other fields see above. | 248 | * Other fields see above. |
| 248 | */ | 249 | */ |
| 249 | struct xt_tgchk_param { | 250 | struct xt_tgchk_param { |
| 251 | struct net *net; | ||
| 250 | const char *table; | 252 | const char *table; |
| 251 | const void *entryinfo; | 253 | const void *entryinfo; |
| 252 | const struct xt_target *target; | 254 | const struct xt_target *target; |
| @@ -257,6 +259,7 @@ struct xt_tgchk_param { | |||
| 257 | 259 | ||
| 258 | /* Target destructor parameters */ | 260 | /* Target destructor parameters */ |
| 259 | struct xt_tgdtor_param { | 261 | struct xt_tgdtor_param { |
| 262 | struct net *net; | ||
| 260 | const struct xt_target *target; | 263 | const struct xt_target *target; |
| 261 | void *targinfo; | 264 | void *targinfo; |
| 262 | u_int8_t family; | 265 | u_int8_t family; |
| @@ -281,11 +284,11 @@ struct xt_match { | |||
| 281 | 284 | ||
| 282 | /* Called when entry of this type deleted. */ | 285 | /* Called when entry of this type deleted. */ |
| 283 | void (*destroy)(const struct xt_mtdtor_param *); | 286 | void (*destroy)(const struct xt_mtdtor_param *); |
| 284 | 287 | #ifdef CONFIG_COMPAT | |
| 285 | /* Called when userspace align differs from kernel space one */ | 288 | /* Called when userspace align differs from kernel space one */ |
| 286 | void (*compat_from_user)(void *dst, void *src); | 289 | void (*compat_from_user)(void *dst, const void *src); |
| 287 | int (*compat_to_user)(void __user *dst, void *src); | 290 | int (*compat_to_user)(void __user *dst, const void *src); |
| 288 | 291 | #endif | |
| 289 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | 292 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
| 290 | struct module *me; | 293 | struct module *me; |
| 291 | 294 | ||
| @@ -294,7 +297,9 @@ struct xt_match { | |||
| 294 | 297 | ||
| 295 | const char *table; | 298 | const char *table; |
| 296 | unsigned int matchsize; | 299 | unsigned int matchsize; |
| 300 | #ifdef CONFIG_COMPAT | ||
| 297 | unsigned int compatsize; | 301 | unsigned int compatsize; |
| 302 | #endif | ||
| 298 | unsigned int hooks; | 303 | unsigned int hooks; |
| 299 | unsigned short proto; | 304 | unsigned short proto; |
| 300 | 305 | ||
| @@ -321,17 +326,19 @@ struct xt_target { | |||
| 321 | 326 | ||
| 322 | /* Called when entry of this type deleted. */ | 327 | /* Called when entry of this type deleted. */ |
| 323 | void (*destroy)(const struct xt_tgdtor_param *); | 328 | void (*destroy)(const struct xt_tgdtor_param *); |
| 324 | 329 | #ifdef CONFIG_COMPAT | |
| 325 | /* Called when userspace align differs from kernel space one */ | 330 | /* Called when userspace align differs from kernel space one */ |
| 326 | void (*compat_from_user)(void *dst, void *src); | 331 | void (*compat_from_user)(void *dst, const void *src); |
| 327 | int (*compat_to_user)(void __user *dst, void *src); | 332 | int (*compat_to_user)(void __user *dst, const void *src); |
| 328 | 333 | #endif | |
| 329 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ | 334 | /* Set this to THIS_MODULE if you are a module, otherwise NULL */ |
| 330 | struct module *me; | 335 | struct module *me; |
| 331 | 336 | ||
| 332 | const char *table; | 337 | const char *table; |
| 333 | unsigned int targetsize; | 338 | unsigned int targetsize; |
| 339 | #ifdef CONFIG_COMPAT | ||
| 334 | unsigned int compatsize; | 340 | unsigned int compatsize; |
| 341 | #endif | ||
| 335 | unsigned int hooks; | 342 | unsigned int hooks; |
| 336 | unsigned short proto; | 343 | unsigned short proto; |
| 337 | 344 | ||
| @@ -353,6 +360,7 @@ struct xt_table { | |||
| 353 | struct module *me; | 360 | struct module *me; |
| 354 | 361 | ||
| 355 | u_int8_t af; /* address/protocol family */ | 362 | u_int8_t af; /* address/protocol family */ |
| 363 | int priority; /* hook order */ | ||
| 356 | 364 | ||
| 357 | /* A unique name... */ | 365 | /* A unique name... */ |
| 358 | const char name[XT_TABLE_MAXNAMELEN]; | 366 | const char name[XT_TABLE_MAXNAMELEN]; |
| @@ -514,6 +522,9 @@ static inline unsigned long ifname_compare_aligned(const char *_a, | |||
| 514 | return ret; | 522 | return ret; |
| 515 | } | 523 | } |
| 516 | 524 | ||
| 525 | extern struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *); | ||
| 526 | extern void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *); | ||
| 527 | |||
| 517 | #ifdef CONFIG_COMPAT | 528 | #ifdef CONFIG_COMPAT |
| 518 | #include <net/compat.h> | 529 | #include <net/compat.h> |
| 519 | 530 | ||
| @@ -554,11 +565,7 @@ struct compat_xt_entry_target { | |||
| 554 | * current task alignment */ | 565 | * current task alignment */ |
| 555 | 566 | ||
| 556 | struct compat_xt_counters { | 567 | struct compat_xt_counters { |
| 557 | #if defined(CONFIG_X86_64) || defined(CONFIG_IA64) | 568 | compat_u64 pcnt, bcnt; /* Packet and byte counters */ |
| 558 | u_int32_t cnt[4]; | ||
| 559 | #else | ||
| 560 | u_int64_t cnt[2]; | ||
| 561 | #endif | ||
| 562 | }; | 569 | }; |
| 563 | 570 | ||
| 564 | struct compat_xt_counters_info { | 571 | struct compat_xt_counters_info { |
| @@ -567,26 +574,32 @@ struct compat_xt_counters_info { | |||
| 567 | struct compat_xt_counters counters[0]; | 574 | struct compat_xt_counters counters[0]; |
| 568 | }; | 575 | }; |
| 569 | 576 | ||
| 570 | #define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ | 577 | struct _compat_xt_align { |
| 571 | & ~(__alignof__(struct compat_xt_counters)-1)) | 578 | __u8 u8; |
| 579 | __u16 u16; | ||
| 580 | __u32 u32; | ||
| 581 | compat_u64 u64; | ||
| 582 | }; | ||
| 583 | |||
| 584 | #define COMPAT_XT_ALIGN(s) ALIGN((s), __alignof__(struct _compat_xt_align)) | ||
| 572 | 585 | ||
| 573 | extern void xt_compat_lock(u_int8_t af); | 586 | extern void xt_compat_lock(u_int8_t af); |
| 574 | extern void xt_compat_unlock(u_int8_t af); | 587 | extern void xt_compat_unlock(u_int8_t af); |
| 575 | 588 | ||
| 576 | extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); | 589 | extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); |
| 577 | extern void xt_compat_flush_offsets(u_int8_t af); | 590 | extern void xt_compat_flush_offsets(u_int8_t af); |
| 578 | extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset); | 591 | extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset); |
| 579 | 592 | ||
| 580 | extern int xt_compat_match_offset(const struct xt_match *match); | 593 | extern int xt_compat_match_offset(const struct xt_match *match); |
| 581 | extern int xt_compat_match_from_user(struct xt_entry_match *m, | 594 | extern int xt_compat_match_from_user(struct xt_entry_match *m, |
| 582 | void **dstptr, unsigned int *size); | 595 | void **dstptr, unsigned int *size); |
| 583 | extern int xt_compat_match_to_user(struct xt_entry_match *m, | 596 | extern int xt_compat_match_to_user(const struct xt_entry_match *m, |
| 584 | void __user **dstptr, unsigned int *size); | 597 | void __user **dstptr, unsigned int *size); |
| 585 | 598 | ||
| 586 | extern int xt_compat_target_offset(const struct xt_target *target); | 599 | extern int xt_compat_target_offset(const struct xt_target *target); |
| 587 | extern void xt_compat_target_from_user(struct xt_entry_target *t, | 600 | extern void xt_compat_target_from_user(struct xt_entry_target *t, |
| 588 | void **dstptr, unsigned int *size); | 601 | void **dstptr, unsigned int *size); |
| 589 | extern int xt_compat_target_to_user(struct xt_entry_target *t, | 602 | extern int xt_compat_target_to_user(const struct xt_entry_target *t, |
| 590 | void __user **dstptr, unsigned int *size); | 603 | void __user **dstptr, unsigned int *size); |
| 591 | 604 | ||
| 592 | #endif /* CONFIG_COMPAT */ | 605 | #endif /* CONFIG_COMPAT */ |
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h new file mode 100644 index 00000000000..1b564106891 --- /dev/null +++ b/include/linux/netfilter/xt_CT.h | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #ifndef _XT_CT_H | ||
| 2 | #define _XT_CT_H | ||
| 3 | |||
| 4 | #define XT_CT_NOTRACK 0x1 | ||
| 5 | |||
| 6 | struct xt_ct_target_info { | ||
| 7 | u_int16_t flags; | ||
| 8 | u_int16_t zone; | ||
| 9 | u_int32_t ct_events; | ||
| 10 | u_int32_t exp_events; | ||
| 11 | char helper[16]; | ||
| 12 | |||
| 13 | /* Used internally by the kernel */ | ||
| 14 | struct nf_conn *ct __attribute__((aligned(8))); | ||
| 15 | }; | ||
| 16 | |||
| 17 | #endif /* _XT_CT_H */ | ||
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h index f2336523a9d..0b33980611b 100644 --- a/include/linux/netfilter_arp/arp_tables.h +++ b/include/linux/netfilter_arp/arp_tables.h | |||
| @@ -258,6 +258,7 @@ struct arpt_error { | |||
| 258 | .target.errorname = "ERROR", \ | 258 | .target.errorname = "ERROR", \ |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | extern void *arpt_alloc_initial_table(const struct xt_table *); | ||
| 261 | extern struct xt_table *arpt_register_table(struct net *net, | 262 | extern struct xt_table *arpt_register_table(struct net *net, |
| 262 | const struct xt_table *table, | 263 | const struct xt_table *table, |
| 263 | const struct arpt_replace *repl); | 264 | const struct arpt_replace *repl); |
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h index 3cc40c131cc..1c6f0c5f530 100644 --- a/include/linux/netfilter_bridge/ebtables.h +++ b/include/linux/netfilter_bridge/ebtables.h | |||
| @@ -289,7 +289,7 @@ struct ebt_table { | |||
| 289 | ~(__alignof__(struct ebt_replace)-1)) | 289 | ~(__alignof__(struct ebt_replace)-1)) |
| 290 | extern struct ebt_table *ebt_register_table(struct net *net, | 290 | extern struct ebt_table *ebt_register_table(struct net *net, |
| 291 | const struct ebt_table *table); | 291 | const struct ebt_table *table); |
| 292 | extern void ebt_unregister_table(struct ebt_table *table); | 292 | extern void ebt_unregister_table(struct net *net, struct ebt_table *table); |
| 293 | extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, | 293 | extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, |
| 294 | const struct net_device *in, const struct net_device *out, | 294 | const struct net_device *in, const struct net_device *out, |
| 295 | struct ebt_table *table); | 295 | struct ebt_table *table); |
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h index 27b3f580730..364973b4213 100644 --- a/include/linux/netfilter_ipv4/ip_tables.h +++ b/include/linux/netfilter_ipv4/ip_tables.h | |||
| @@ -242,7 +242,7 @@ extern void ipt_init(void) __init; | |||
| 242 | extern struct xt_table *ipt_register_table(struct net *net, | 242 | extern struct xt_table *ipt_register_table(struct net *net, |
| 243 | const struct xt_table *table, | 243 | const struct xt_table *table, |
| 244 | const struct ipt_replace *repl); | 244 | const struct ipt_replace *repl); |
| 245 | extern void ipt_unregister_table(struct xt_table *table); | 245 | extern void ipt_unregister_table(struct net *net, struct xt_table *table); |
| 246 | 246 | ||
| 247 | /* Standard entry. */ | 247 | /* Standard entry. */ |
| 248 | struct ipt_standard { | 248 | struct ipt_standard { |
| @@ -282,6 +282,7 @@ struct ipt_error { | |||
| 282 | .target.errorname = "ERROR", \ | 282 | .target.errorname = "ERROR", \ |
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | extern void *ipt_alloc_initial_table(const struct xt_table *); | ||
| 285 | extern unsigned int ipt_do_table(struct sk_buff *skb, | 286 | extern unsigned int ipt_do_table(struct sk_buff *skb, |
| 286 | unsigned int hook, | 287 | unsigned int hook, |
| 287 | const struct net_device *in, | 288 | const struct net_device *in, |
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h index b31050d20ae..8031eb486a1 100644 --- a/include/linux/netfilter_ipv6/ip6_tables.h +++ b/include/linux/netfilter_ipv6/ip6_tables.h | |||
| @@ -297,10 +297,11 @@ ip6t_get_target(struct ip6t_entry *e) | |||
| 297 | #include <linux/init.h> | 297 | #include <linux/init.h> |
| 298 | extern void ip6t_init(void) __init; | 298 | extern void ip6t_init(void) __init; |
| 299 | 299 | ||
| 300 | extern void *ip6t_alloc_initial_table(const struct xt_table *); | ||
| 300 | extern struct xt_table *ip6t_register_table(struct net *net, | 301 | extern struct xt_table *ip6t_register_table(struct net *net, |
| 301 | const struct xt_table *table, | 302 | const struct xt_table *table, |
| 302 | const struct ip6t_replace *repl); | 303 | const struct ip6t_replace *repl); |
| 303 | extern void ip6t_unregister_table(struct xt_table *table); | 304 | extern void ip6t_unregister_table(struct net *net, struct xt_table *table); |
| 304 | extern unsigned int ip6t_do_table(struct sk_buff *skb, | 305 | extern unsigned int ip6t_do_table(struct sk_buff *skb, |
| 305 | unsigned int hook, | 306 | unsigned int hook, |
| 306 | const struct net_device *in, | 307 | const struct net_device *in, |
