aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2011-06-09 15:15:37 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2011-12-27 14:31:38 -0500
commita4c6f9d3636db538025f9622c008192a0835cc23 (patch)
tree725c79a8d16b5c57bb5dadb0e83bd09ce985a0b5 /net
parentd446a8202c81d95f91b1682fc67e7fadd9a31389 (diff)
netfilter: xtables: give xt_ecn its own name
Use the new macro and struct names in xt_ecn.h, and put the old definitions into a definition-forwarding ipt_ecn.h. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/xt_ecn.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/net/netfilter/xt_ecn.c b/net/netfilter/xt_ecn.c
index 2c198f5e3efb..3ebb3dcace65 100644
--- a/net/netfilter/xt_ecn.c
+++ b/net/netfilter/xt_ecn.c
@@ -15,8 +15,8 @@
15#include <linux/tcp.h> 15#include <linux/tcp.h>
16 16
17#include <linux/netfilter/x_tables.h> 17#include <linux/netfilter/x_tables.h>
18#include <linux/netfilter/xt_ecn.h>
18#include <linux/netfilter_ipv4/ip_tables.h> 19#include <linux/netfilter_ipv4/ip_tables.h>
19#include <linux/netfilter_ipv4/ipt_ecn.h>
20 20
21MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); 21MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
22MODULE_DESCRIPTION("Xtables: Explicit Congestion Notification (ECN) flag match for IPv4"); 22MODULE_DESCRIPTION("Xtables: Explicit Congestion Notification (ECN) flag match for IPv4");
@@ -24,14 +24,14 @@ MODULE_LICENSE("GPL");
24MODULE_ALIAS("ipt_ecn"); 24MODULE_ALIAS("ipt_ecn");
25 25
26static inline bool match_ip(const struct sk_buff *skb, 26static inline bool match_ip(const struct sk_buff *skb,
27 const struct ipt_ecn_info *einfo) 27 const struct xt_ecn_info *einfo)
28{ 28{
29 return ((ip_hdr(skb)->tos & IPT_ECN_IP_MASK) == einfo->ip_ect) ^ 29 return ((ip_hdr(skb)->tos & XT_ECN_IP_MASK) == einfo->ip_ect) ^
30 !!(einfo->invert & IPT_ECN_OP_MATCH_IP); 30 !!(einfo->invert & XT_ECN_OP_MATCH_IP);
31} 31}
32 32
33static inline bool match_tcp(const struct sk_buff *skb, 33static inline bool match_tcp(const struct sk_buff *skb,
34 const struct ipt_ecn_info *einfo, 34 const struct xt_ecn_info *einfo,
35 bool *hotdrop) 35 bool *hotdrop)
36{ 36{
37 struct tcphdr _tcph; 37 struct tcphdr _tcph;
@@ -46,8 +46,8 @@ static inline bool match_tcp(const struct sk_buff *skb,
46 return false; 46 return false;
47 } 47 }
48 48
49 if (einfo->operation & IPT_ECN_OP_MATCH_ECE) { 49 if (einfo->operation & XT_ECN_OP_MATCH_ECE) {
50 if (einfo->invert & IPT_ECN_OP_MATCH_ECE) { 50 if (einfo->invert & XT_ECN_OP_MATCH_ECE) {
51 if (th->ece == 1) 51 if (th->ece == 1)
52 return false; 52 return false;
53 } else { 53 } else {
@@ -56,8 +56,8 @@ static inline bool match_tcp(const struct sk_buff *skb,
56 } 56 }
57 } 57 }
58 58
59 if (einfo->operation & IPT_ECN_OP_MATCH_CWR) { 59 if (einfo->operation & XT_ECN_OP_MATCH_CWR) {
60 if (einfo->invert & IPT_ECN_OP_MATCH_CWR) { 60 if (einfo->invert & XT_ECN_OP_MATCH_CWR) {
61 if (th->cwr == 1) 61 if (th->cwr == 1)
62 return false; 62 return false;
63 } else { 63 } else {
@@ -71,13 +71,13 @@ static inline bool match_tcp(const struct sk_buff *skb,
71 71
72static bool ecn_mt(const struct sk_buff *skb, struct xt_action_param *par) 72static bool ecn_mt(const struct sk_buff *skb, struct xt_action_param *par)
73{ 73{
74 const struct ipt_ecn_info *info = par->matchinfo; 74 const struct xt_ecn_info *info = par->matchinfo;
75 75
76 if (info->operation & IPT_ECN_OP_MATCH_IP) 76 if (info->operation & XT_ECN_OP_MATCH_IP)
77 if (!match_ip(skb, info)) 77 if (!match_ip(skb, info))
78 return false; 78 return false;
79 79
80 if (info->operation & (IPT_ECN_OP_MATCH_ECE|IPT_ECN_OP_MATCH_CWR)) { 80 if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR)) {
81 if (!match_tcp(skb, info, &par->hotdrop)) 81 if (!match_tcp(skb, info, &par->hotdrop))
82 return false; 82 return false;
83 } 83 }
@@ -87,16 +87,16 @@ static bool ecn_mt(const struct sk_buff *skb, struct xt_action_param *par)
87 87
88static int ecn_mt_check(const struct xt_mtchk_param *par) 88static int ecn_mt_check(const struct xt_mtchk_param *par)
89{ 89{
90 const struct ipt_ecn_info *info = par->matchinfo; 90 const struct xt_ecn_info *info = par->matchinfo;
91 const struct ipt_ip *ip = par->entryinfo; 91 const struct ipt_ip *ip = par->entryinfo;
92 92
93 if (info->operation & IPT_ECN_OP_MATCH_MASK) 93 if (info->operation & XT_ECN_OP_MATCH_MASK)
94 return -EINVAL; 94 return -EINVAL;
95 95
96 if (info->invert & IPT_ECN_OP_MATCH_MASK) 96 if (info->invert & XT_ECN_OP_MATCH_MASK)
97 return -EINVAL; 97 return -EINVAL;
98 98
99 if (info->operation & (IPT_ECN_OP_MATCH_ECE|IPT_ECN_OP_MATCH_CWR) && 99 if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR) &&
100 (ip->proto != IPPROTO_TCP || ip->invflags & IPT_INV_PROTO)) { 100 (ip->proto != IPPROTO_TCP || ip->invflags & IPT_INV_PROTO)) {
101 pr_info("cannot match TCP bits in rule for non-tcp packets\n"); 101 pr_info("cannot match TCP bits in rule for non-tcp packets\n");
102 return -EINVAL; 102 return -EINVAL;
@@ -109,7 +109,7 @@ static struct xt_match ecn_mt_reg __read_mostly = {
109 .name = "ecn", 109 .name = "ecn",
110 .family = NFPROTO_IPV4, 110 .family = NFPROTO_IPV4,
111 .match = ecn_mt, 111 .match = ecn_mt,
112 .matchsize = sizeof(struct ipt_ecn_info), 112 .matchsize = sizeof(struct xt_ecn_info),
113 .checkentry = ecn_mt_check, 113 .checkentry = ecn_mt_check,
114 .me = THIS_MODULE, 114 .me = THIS_MODULE,
115}; 115};