aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@gmx.de>2007-07-08 01:16:00 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-11 01:16:58 -0400
commitccb79bdce71f2c04cfa9bfcbaf4d37e2f963d684 (patch)
tree5f41d7d1daade309b96492301a6f973caba3a2a4 /net/ipv4
parent1d93a9cbad608f6398ba6c5b588c504ccd35a2ca (diff)
[NETFILTER]: x_tables: switch xt_match->checkentry to bool
Switch the return type of match functions to boolean Signed-off-by: Jan Engelhardt <jengelh@gmx.de> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/netfilter/ip_tables.c10
-rw-r--r--net/ipv4/netfilter/ipt_ah.c6
-rw-r--r--net/ipv4/netfilter/ipt_ecn.c14
-rw-r--r--net/ipv4/netfilter/ipt_owner.c6
-rw-r--r--net/ipv4/netfilter/ipt_recent.c14
5 files changed, 25 insertions, 25 deletions
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index b9c792dd489..7962306df58 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -152,20 +152,20 @@ ip_packet_match(const struct iphdr *ip,
152 return 1; 152 return 1;
153} 153}
154 154
155static inline int 155static inline bool
156ip_checkentry(const struct ipt_ip *ip) 156ip_checkentry(const struct ipt_ip *ip)
157{ 157{
158 if (ip->flags & ~IPT_F_MASK) { 158 if (ip->flags & ~IPT_F_MASK) {
159 duprintf("Unknown flag bits set: %08X\n", 159 duprintf("Unknown flag bits set: %08X\n",
160 ip->flags & ~IPT_F_MASK); 160 ip->flags & ~IPT_F_MASK);
161 return 0; 161 return false;
162 } 162 }
163 if (ip->invflags & ~IPT_INV_MASK) { 163 if (ip->invflags & ~IPT_INV_MASK) {
164 duprintf("Unknown invflag bits set: %08X\n", 164 duprintf("Unknown invflag bits set: %08X\n",
165 ip->invflags & ~IPT_INV_MASK); 165 ip->invflags & ~IPT_INV_MASK);
166 return 0; 166 return false;
167 } 167 }
168 return 1; 168 return true;
169} 169}
170 170
171static unsigned int 171static unsigned int
@@ -2149,7 +2149,7 @@ icmp_match(const struct sk_buff *skb,
2149} 2149}
2150 2150
2151/* Called when user tries to insert an entry of this type. */ 2151/* Called when user tries to insert an entry of this type. */
2152static int 2152static bool
2153icmp_checkentry(const char *tablename, 2153icmp_checkentry(const char *tablename,
2154 const void *info, 2154 const void *info,
2155 const struct xt_match *match, 2155 const struct xt_match *match,
diff --git a/net/ipv4/netfilter/ipt_ah.c b/net/ipv4/netfilter/ipt_ah.c
index 3da39ee92d8..6b5b7c9f739 100644
--- a/net/ipv4/netfilter/ipt_ah.c
+++ b/net/ipv4/netfilter/ipt_ah.c
@@ -70,7 +70,7 @@ match(const struct sk_buff *skb,
70} 70}
71 71
72/* Called when user tries to insert an entry of this type. */ 72/* Called when user tries to insert an entry of this type. */
73static int 73static bool
74checkentry(const char *tablename, 74checkentry(const char *tablename,
75 const void *ip_void, 75 const void *ip_void,
76 const struct xt_match *match, 76 const struct xt_match *match,
@@ -82,9 +82,9 @@ checkentry(const char *tablename,
82 /* Must specify no unknown invflags */ 82 /* Must specify no unknown invflags */
83 if (ahinfo->invflags & ~IPT_AH_INV_MASK) { 83 if (ahinfo->invflags & ~IPT_AH_INV_MASK) {
84 duprintf("ipt_ah: unknown flags %X\n", ahinfo->invflags); 84 duprintf("ipt_ah: unknown flags %X\n", ahinfo->invflags);
85 return 0; 85 return false;
86 } 86 }
87 return 1; 87 return true;
88} 88}
89 89
90static struct xt_match ah_match = { 90static struct xt_match ah_match = {
diff --git a/net/ipv4/netfilter/ipt_ecn.c b/net/ipv4/netfilter/ipt_ecn.c
index ba3a17e0f84..ba4f5497add 100644
--- a/net/ipv4/netfilter/ipt_ecn.c
+++ b/net/ipv4/netfilter/ipt_ecn.c
@@ -87,27 +87,27 @@ static bool match(const struct sk_buff *skb,
87 return true; 87 return true;
88} 88}
89 89
90static int checkentry(const char *tablename, const void *ip_void, 90static bool checkentry(const char *tablename, const void *ip_void,
91 const struct xt_match *match, 91 const struct xt_match *match,
92 void *matchinfo, unsigned int hook_mask) 92 void *matchinfo, unsigned int hook_mask)
93{ 93{
94 const struct ipt_ecn_info *info = matchinfo; 94 const struct ipt_ecn_info *info = matchinfo;
95 const struct ipt_ip *ip = ip_void; 95 const struct ipt_ip *ip = ip_void;
96 96
97 if (info->operation & IPT_ECN_OP_MATCH_MASK) 97 if (info->operation & IPT_ECN_OP_MATCH_MASK)
98 return 0; 98 return false;
99 99
100 if (info->invert & IPT_ECN_OP_MATCH_MASK) 100 if (info->invert & IPT_ECN_OP_MATCH_MASK)
101 return 0; 101 return false;
102 102
103 if (info->operation & (IPT_ECN_OP_MATCH_ECE|IPT_ECN_OP_MATCH_CWR) 103 if (info->operation & (IPT_ECN_OP_MATCH_ECE|IPT_ECN_OP_MATCH_CWR)
104 && ip->proto != IPPROTO_TCP) { 104 && ip->proto != IPPROTO_TCP) {
105 printk(KERN_WARNING "ipt_ecn: can't match TCP bits in rule for" 105 printk(KERN_WARNING "ipt_ecn: can't match TCP bits in rule for"
106 " non-tcp packets\n"); 106 " non-tcp packets\n");
107 return 0; 107 return false;
108 } 108 }
109 109
110 return 1; 110 return true;
111} 111}
112 112
113static struct xt_match ecn_match = { 113static struct xt_match ecn_match = {
diff --git a/net/ipv4/netfilter/ipt_owner.c b/net/ipv4/netfilter/ipt_owner.c
index 8f441cef550..deea4b8cc05 100644
--- a/net/ipv4/netfilter/ipt_owner.c
+++ b/net/ipv4/netfilter/ipt_owner.c
@@ -51,7 +51,7 @@ match(const struct sk_buff *skb,
51 return true; 51 return true;
52} 52}
53 53
54static int 54static bool
55checkentry(const char *tablename, 55checkentry(const char *tablename,
56 const void *ip, 56 const void *ip,
57 const struct xt_match *match, 57 const struct xt_match *match,
@@ -63,9 +63,9 @@ checkentry(const char *tablename,
63 if (info->match & (IPT_OWNER_PID|IPT_OWNER_SID|IPT_OWNER_COMM)) { 63 if (info->match & (IPT_OWNER_PID|IPT_OWNER_SID|IPT_OWNER_COMM)) {
64 printk("ipt_owner: pid, sid and command matching " 64 printk("ipt_owner: pid, sid and command matching "
65 "not supported anymore\n"); 65 "not supported anymore\n");
66 return 0; 66 return false;
67 } 67 }
68 return 1; 68 return true;
69} 69}
70 70
71static struct xt_match owner_match = { 71static struct xt_match owner_match = {
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
index 2e513ed9b6e..d632e0e6ef1 100644
--- a/net/ipv4/netfilter/ipt_recent.c
+++ b/net/ipv4/netfilter/ipt_recent.c
@@ -235,7 +235,7 @@ out:
235 return ret; 235 return ret;
236} 236}
237 237
238static int 238static bool
239ipt_recent_checkentry(const char *tablename, const void *ip, 239ipt_recent_checkentry(const char *tablename, const void *ip,
240 const struct xt_match *match, void *matchinfo, 240 const struct xt_match *match, void *matchinfo,
241 unsigned int hook_mask) 241 unsigned int hook_mask)
@@ -243,24 +243,24 @@ ipt_recent_checkentry(const char *tablename, const void *ip,
243 const struct ipt_recent_info *info = matchinfo; 243 const struct ipt_recent_info *info = matchinfo;
244 struct recent_table *t; 244 struct recent_table *t;
245 unsigned i; 245 unsigned i;
246 int ret = 0; 246 bool ret = false;
247 247
248 if (hweight8(info->check_set & 248 if (hweight8(info->check_set &
249 (IPT_RECENT_SET | IPT_RECENT_REMOVE | 249 (IPT_RECENT_SET | IPT_RECENT_REMOVE |
250 IPT_RECENT_CHECK | IPT_RECENT_UPDATE)) != 1) 250 IPT_RECENT_CHECK | IPT_RECENT_UPDATE)) != 1)
251 return 0; 251 return false;
252 if ((info->check_set & (IPT_RECENT_SET | IPT_RECENT_REMOVE)) && 252 if ((info->check_set & (IPT_RECENT_SET | IPT_RECENT_REMOVE)) &&
253 (info->seconds || info->hit_count)) 253 (info->seconds || info->hit_count))
254 return 0; 254 return false;
255 if (info->name[0] == '\0' || 255 if (info->name[0] == '\0' ||
256 strnlen(info->name, IPT_RECENT_NAME_LEN) == IPT_RECENT_NAME_LEN) 256 strnlen(info->name, IPT_RECENT_NAME_LEN) == IPT_RECENT_NAME_LEN)
257 return 0; 257 return false;
258 258
259 mutex_lock(&recent_mutex); 259 mutex_lock(&recent_mutex);
260 t = recent_table_lookup(info->name); 260 t = recent_table_lookup(info->name);
261 if (t != NULL) { 261 if (t != NULL) {
262 t->refcnt++; 262 t->refcnt++;
263 ret = 1; 263 ret = true;
264 goto out; 264 goto out;
265 } 265 }
266 266
@@ -287,7 +287,7 @@ ipt_recent_checkentry(const char *tablename, const void *ip,
287 spin_lock_bh(&recent_lock); 287 spin_lock_bh(&recent_lock);
288 list_add_tail(&t->list, &tables); 288 list_add_tail(&t->list, &tables);
289 spin_unlock_bh(&recent_lock); 289 spin_unlock_bh(&recent_lock);
290 ret = 1; 290 ret = true;
291out: 291out:
292 mutex_unlock(&recent_mutex); 292 mutex_unlock(&recent_mutex);
293 return ret; 293 return ret;