diff options
author | Jan Engelhardt <jengelh@gmx.de> | 2007-07-08 01:15:35 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 01:16:57 -0400 |
commit | 1d93a9cbad608f6398ba6c5b588c504ccd35a2ca (patch) | |
tree | df02632a70f0438efb0e5baab9900f4f2acf98a1 /net/ipv6 | |
parent | cff533ac12494fa002e2c46acc94d670e5f636a2 (diff) |
[NETFILTER]: x_tables: switch xt_match->match 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/ipv6')
-rw-r--r-- | net/ipv6/netfilter/ip6_tables.c | 42 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_ah.c | 12 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_eui64.c | 8 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_frag.c | 12 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_hbh.c | 18 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_hl.c | 12 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_ipv6header.c | 6 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_mh.c | 17 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_owner.c | 10 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_rt.c | 26 |
10 files changed, 80 insertions, 83 deletions
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 13c66a75c21c..31f42e82184a 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -96,7 +96,7 @@ ip6t_ext_hdr(u8 nexthdr) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | /* Returns whether matches rule or not. */ | 98 | /* Returns whether matches rule or not. */ |
99 | static inline int | 99 | static inline bool |
100 | ip6_packet_match(const struct sk_buff *skb, | 100 | ip6_packet_match(const struct sk_buff *skb, |
101 | const char *indev, | 101 | const char *indev, |
102 | const char *outdev, | 102 | const char *outdev, |
@@ -122,7 +122,7 @@ ip6_packet_match(const struct sk_buff *skb, | |||
122 | dprintf("DST: %u. Mask: %u. Target: %u.%s\n", ip->daddr, | 122 | dprintf("DST: %u. Mask: %u. Target: %u.%s\n", ip->daddr, |
123 | ipinfo->dmsk.s_addr, ipinfo->dst.s_addr, | 123 | ipinfo->dmsk.s_addr, ipinfo->dst.s_addr, |
124 | ipinfo->invflags & IP6T_INV_DSTIP ? " (INV)" : "");*/ | 124 | ipinfo->invflags & IP6T_INV_DSTIP ? " (INV)" : "");*/ |
125 | return 0; | 125 | return false; |
126 | } | 126 | } |
127 | 127 | ||
128 | /* Look for ifname matches; this should unroll nicely. */ | 128 | /* Look for ifname matches; this should unroll nicely. */ |
@@ -136,7 +136,7 @@ ip6_packet_match(const struct sk_buff *skb, | |||
136 | dprintf("VIA in mismatch (%s vs %s).%s\n", | 136 | dprintf("VIA in mismatch (%s vs %s).%s\n", |
137 | indev, ip6info->iniface, | 137 | indev, ip6info->iniface, |
138 | ip6info->invflags&IP6T_INV_VIA_IN ?" (INV)":""); | 138 | ip6info->invflags&IP6T_INV_VIA_IN ?" (INV)":""); |
139 | return 0; | 139 | return false; |
140 | } | 140 | } |
141 | 141 | ||
142 | for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { | 142 | for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { |
@@ -149,7 +149,7 @@ ip6_packet_match(const struct sk_buff *skb, | |||
149 | dprintf("VIA out mismatch (%s vs %s).%s\n", | 149 | dprintf("VIA out mismatch (%s vs %s).%s\n", |
150 | outdev, ip6info->outiface, | 150 | outdev, ip6info->outiface, |
151 | ip6info->invflags&IP6T_INV_VIA_OUT ?" (INV)":""); | 151 | ip6info->invflags&IP6T_INV_VIA_OUT ?" (INV)":""); |
152 | return 0; | 152 | return false; |
153 | } | 153 | } |
154 | 154 | ||
155 | /* ... might want to do something with class and flowlabel here ... */ | 155 | /* ... might want to do something with class and flowlabel here ... */ |
@@ -163,7 +163,7 @@ ip6_packet_match(const struct sk_buff *skb, | |||
163 | if (protohdr < 0) { | 163 | if (protohdr < 0) { |
164 | if (_frag_off == 0) | 164 | if (_frag_off == 0) |
165 | *hotdrop = true; | 165 | *hotdrop = true; |
166 | return 0; | 166 | return false; |
167 | } | 167 | } |
168 | *fragoff = _frag_off; | 168 | *fragoff = _frag_off; |
169 | 169 | ||
@@ -174,17 +174,17 @@ ip6_packet_match(const struct sk_buff *skb, | |||
174 | 174 | ||
175 | if (ip6info->proto == protohdr) { | 175 | if (ip6info->proto == protohdr) { |
176 | if(ip6info->invflags & IP6T_INV_PROTO) { | 176 | if(ip6info->invflags & IP6T_INV_PROTO) { |
177 | return 0; | 177 | return false; |
178 | } | 178 | } |
179 | return 1; | 179 | return true; |
180 | } | 180 | } |
181 | 181 | ||
182 | /* We need match for the '-p all', too! */ | 182 | /* We need match for the '-p all', too! */ |
183 | if ((ip6info->proto != 0) && | 183 | if ((ip6info->proto != 0) && |
184 | !(ip6info->invflags & IP6T_INV_PROTO)) | 184 | !(ip6info->invflags & IP6T_INV_PROTO)) |
185 | return 0; | 185 | return false; |
186 | } | 186 | } |
187 | return 1; | 187 | return true; |
188 | } | 188 | } |
189 | 189 | ||
190 | /* should be ip6 safe */ | 190 | /* should be ip6 safe */ |
@@ -219,20 +219,20 @@ ip6t_error(struct sk_buff **pskb, | |||
219 | } | 219 | } |
220 | 220 | ||
221 | static inline | 221 | static inline |
222 | int do_match(struct ip6t_entry_match *m, | 222 | bool do_match(struct ip6t_entry_match *m, |
223 | const struct sk_buff *skb, | 223 | const struct sk_buff *skb, |
224 | const struct net_device *in, | 224 | const struct net_device *in, |
225 | const struct net_device *out, | 225 | const struct net_device *out, |
226 | int offset, | 226 | int offset, |
227 | unsigned int protoff, | 227 | unsigned int protoff, |
228 | bool *hotdrop) | 228 | bool *hotdrop) |
229 | { | 229 | { |
230 | /* Stop iteration if it doesn't match */ | 230 | /* Stop iteration if it doesn't match */ |
231 | if (!m->u.kernel.match->match(skb, in, out, m->u.kernel.match, m->data, | 231 | if (!m->u.kernel.match->match(skb, in, out, m->u.kernel.match, m->data, |
232 | offset, protoff, hotdrop)) | 232 | offset, protoff, hotdrop)) |
233 | return 1; | 233 | return true; |
234 | else | 234 | else |
235 | return 0; | 235 | return false; |
236 | } | 236 | } |
237 | 237 | ||
238 | static inline struct ip6t_entry * | 238 | static inline struct ip6t_entry * |
@@ -1291,7 +1291,7 @@ icmp6_type_code_match(u_int8_t test_type, u_int8_t min_code, u_int8_t max_code, | |||
1291 | ^ invert; | 1291 | ^ invert; |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | static int | 1294 | static bool |
1295 | icmp6_match(const struct sk_buff *skb, | 1295 | icmp6_match(const struct sk_buff *skb, |
1296 | const struct net_device *in, | 1296 | const struct net_device *in, |
1297 | const struct net_device *out, | 1297 | const struct net_device *out, |
@@ -1306,7 +1306,7 @@ icmp6_match(const struct sk_buff *skb, | |||
1306 | 1306 | ||
1307 | /* Must not be a fragment. */ | 1307 | /* Must not be a fragment. */ |
1308 | if (offset) | 1308 | if (offset) |
1309 | return 0; | 1309 | return false; |
1310 | 1310 | ||
1311 | ic = skb_header_pointer(skb, protoff, sizeof(_icmp), &_icmp); | 1311 | ic = skb_header_pointer(skb, protoff, sizeof(_icmp), &_icmp); |
1312 | if (ic == NULL) { | 1312 | if (ic == NULL) { |
@@ -1314,7 +1314,7 @@ icmp6_match(const struct sk_buff *skb, | |||
1314 | can't. Hence, no choice but to drop. */ | 1314 | can't. Hence, no choice but to drop. */ |
1315 | duprintf("Dropping evil ICMP tinygram.\n"); | 1315 | duprintf("Dropping evil ICMP tinygram.\n"); |
1316 | *hotdrop = true; | 1316 | *hotdrop = true; |
1317 | return 0; | 1317 | return false; |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | return icmp6_type_code_match(icmpinfo->type, | 1320 | return icmp6_type_code_match(icmpinfo->type, |
diff --git a/net/ipv6/netfilter/ip6t_ah.c b/net/ipv6/netfilter/ip6t_ah.c index 27b7bd279c0e..607c2eb1296f 100644 --- a/net/ipv6/netfilter/ip6t_ah.c +++ b/net/ipv6/netfilter/ip6t_ah.c | |||
@@ -30,10 +30,10 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | |||
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | /* Returns 1 if the spi is matched by the range, 0 otherwise */ | 32 | /* Returns 1 if the spi is matched by the range, 0 otherwise */ |
33 | static inline int | 33 | static inline bool |
34 | spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert) | 34 | spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) |
35 | { | 35 | { |
36 | int r=0; | 36 | bool r; |
37 | DEBUGP("ah spi_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', | 37 | DEBUGP("ah spi_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', |
38 | min,spi,max); | 38 | min,spi,max); |
39 | r = (spi >= min && spi <= max) ^ invert; | 39 | r = (spi >= min && spi <= max) ^ invert; |
@@ -41,7 +41,7 @@ spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert) | |||
41 | return r; | 41 | return r; |
42 | } | 42 | } |
43 | 43 | ||
44 | static int | 44 | static bool |
45 | match(const struct sk_buff *skb, | 45 | match(const struct sk_buff *skb, |
46 | const struct net_device *in, | 46 | const struct net_device *in, |
47 | const struct net_device *out, | 47 | const struct net_device *out, |
@@ -61,13 +61,13 @@ match(const struct sk_buff *skb, | |||
61 | if (err < 0) { | 61 | if (err < 0) { |
62 | if (err != -ENOENT) | 62 | if (err != -ENOENT) |
63 | *hotdrop = true; | 63 | *hotdrop = true; |
64 | return 0; | 64 | return false; |
65 | } | 65 | } |
66 | 66 | ||
67 | ah = skb_header_pointer(skb, ptr, sizeof(_ah), &_ah); | 67 | ah = skb_header_pointer(skb, ptr, sizeof(_ah), &_ah); |
68 | if (ah == NULL) { | 68 | if (ah == NULL) { |
69 | *hotdrop = true; | 69 | *hotdrop = true; |
70 | return 0; | 70 | return false; |
71 | } | 71 | } |
72 | 72 | ||
73 | hdrlen = (ah->hdrlen + 2) << 2; | 73 | hdrlen = (ah->hdrlen + 2) << 2; |
diff --git a/net/ipv6/netfilter/ip6t_eui64.c b/net/ipv6/netfilter/ip6t_eui64.c index 69e79e19040e..bebb12a1d0e6 100644 --- a/net/ipv6/netfilter/ip6t_eui64.c +++ b/net/ipv6/netfilter/ip6t_eui64.c | |||
@@ -19,7 +19,7 @@ MODULE_DESCRIPTION("IPv6 EUI64 address checking match"); | |||
19 | MODULE_LICENSE("GPL"); | 19 | MODULE_LICENSE("GPL"); |
20 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | 20 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); |
21 | 21 | ||
22 | static int | 22 | static bool |
23 | match(const struct sk_buff *skb, | 23 | match(const struct sk_buff *skb, |
24 | const struct net_device *in, | 24 | const struct net_device *in, |
25 | const struct net_device *out, | 25 | const struct net_device *out, |
@@ -36,7 +36,7 @@ match(const struct sk_buff *skb, | |||
36 | (skb_mac_header(skb) + ETH_HLEN) <= skb->data) && | 36 | (skb_mac_header(skb) + ETH_HLEN) <= skb->data) && |
37 | offset != 0) { | 37 | offset != 0) { |
38 | *hotdrop = true; | 38 | *hotdrop = true; |
39 | return 0; | 39 | return false; |
40 | } | 40 | } |
41 | 41 | ||
42 | memset(eui64, 0, sizeof(eui64)); | 42 | memset(eui64, 0, sizeof(eui64)); |
@@ -55,11 +55,11 @@ match(const struct sk_buff *skb, | |||
55 | i++; | 55 | i++; |
56 | 56 | ||
57 | if (i == 8) | 57 | if (i == 8) |
58 | return 1; | 58 | return true; |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | return 0; | 62 | return false; |
63 | } | 63 | } |
64 | 64 | ||
65 | static struct xt_match eui64_match = { | 65 | static struct xt_match eui64_match = { |
diff --git a/net/ipv6/netfilter/ip6t_frag.c b/net/ipv6/netfilter/ip6t_frag.c index 740fdcafa5f3..0ed5fbcf1f18 100644 --- a/net/ipv6/netfilter/ip6t_frag.c +++ b/net/ipv6/netfilter/ip6t_frag.c | |||
@@ -29,10 +29,10 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | |||
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | /* Returns 1 if the id is matched by the range, 0 otherwise */ | 31 | /* Returns 1 if the id is matched by the range, 0 otherwise */ |
32 | static inline int | 32 | static inline bool |
33 | id_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert) | 33 | id_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert) |
34 | { | 34 | { |
35 | int r = 0; | 35 | bool r; |
36 | DEBUGP("frag id_match:%c 0x%x <= 0x%x <= 0x%x", invert ? '!' : ' ', | 36 | DEBUGP("frag id_match:%c 0x%x <= 0x%x <= 0x%x", invert ? '!' : ' ', |
37 | min, id, max); | 37 | min, id, max); |
38 | r = (id >= min && id <= max) ^ invert; | 38 | r = (id >= min && id <= max) ^ invert; |
@@ -40,7 +40,7 @@ id_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert) | |||
40 | return r; | 40 | return r; |
41 | } | 41 | } |
42 | 42 | ||
43 | static int | 43 | static bool |
44 | match(const struct sk_buff *skb, | 44 | match(const struct sk_buff *skb, |
45 | const struct net_device *in, | 45 | const struct net_device *in, |
46 | const struct net_device *out, | 46 | const struct net_device *out, |
@@ -59,13 +59,13 @@ match(const struct sk_buff *skb, | |||
59 | if (err < 0) { | 59 | if (err < 0) { |
60 | if (err != -ENOENT) | 60 | if (err != -ENOENT) |
61 | *hotdrop = true; | 61 | *hotdrop = true; |
62 | return 0; | 62 | return false; |
63 | } | 63 | } |
64 | 64 | ||
65 | fh = skb_header_pointer(skb, ptr, sizeof(_frag), &_frag); | 65 | fh = skb_header_pointer(skb, ptr, sizeof(_frag), &_frag); |
66 | if (fh == NULL) { | 66 | if (fh == NULL) { |
67 | *hotdrop = true; | 67 | *hotdrop = true; |
68 | return 0; | 68 | return false; |
69 | } | 69 | } |
70 | 70 | ||
71 | DEBUGP("INFO %04X ", fh->frag_off); | 71 | DEBUGP("INFO %04X ", fh->frag_off); |
diff --git a/net/ipv6/netfilter/ip6t_hbh.c b/net/ipv6/netfilter/ip6t_hbh.c index 5633de160c6d..4b05393faa68 100644 --- a/net/ipv6/netfilter/ip6t_hbh.c +++ b/net/ipv6/netfilter/ip6t_hbh.c | |||
@@ -47,7 +47,7 @@ MODULE_ALIAS("ip6t_dst"); | |||
47 | * 5 -> RTALERT 2 x x | 47 | * 5 -> RTALERT 2 x x |
48 | */ | 48 | */ |
49 | 49 | ||
50 | static int | 50 | static bool |
51 | match(const struct sk_buff *skb, | 51 | match(const struct sk_buff *skb, |
52 | const struct net_device *in, | 52 | const struct net_device *in, |
53 | const struct net_device *out, | 53 | const struct net_device *out, |
@@ -62,7 +62,7 @@ match(const struct sk_buff *skb, | |||
62 | unsigned int temp; | 62 | unsigned int temp; |
63 | unsigned int ptr; | 63 | unsigned int ptr; |
64 | unsigned int hdrlen = 0; | 64 | unsigned int hdrlen = 0; |
65 | unsigned int ret = 0; | 65 | bool ret = false; |
66 | u8 _opttype, *tp = NULL; | 66 | u8 _opttype, *tp = NULL; |
67 | u8 _optlen, *lp = NULL; | 67 | u8 _optlen, *lp = NULL; |
68 | unsigned int optlen; | 68 | unsigned int optlen; |
@@ -72,19 +72,19 @@ match(const struct sk_buff *skb, | |||
72 | if (err < 0) { | 72 | if (err < 0) { |
73 | if (err != -ENOENT) | 73 | if (err != -ENOENT) |
74 | *hotdrop = true; | 74 | *hotdrop = true; |
75 | return 0; | 75 | return false; |
76 | } | 76 | } |
77 | 77 | ||
78 | oh = skb_header_pointer(skb, ptr, sizeof(_optsh), &_optsh); | 78 | oh = skb_header_pointer(skb, ptr, sizeof(_optsh), &_optsh); |
79 | if (oh == NULL) { | 79 | if (oh == NULL) { |
80 | *hotdrop = true; | 80 | *hotdrop = true; |
81 | return 0; | 81 | return false; |
82 | } | 82 | } |
83 | 83 | ||
84 | hdrlen = ipv6_optlen(oh); | 84 | hdrlen = ipv6_optlen(oh); |
85 | if (skb->len - ptr < hdrlen) { | 85 | if (skb->len - ptr < hdrlen) { |
86 | /* Packet smaller than it's length field */ | 86 | /* Packet smaller than it's length field */ |
87 | return 0; | 87 | return false; |
88 | } | 88 | } |
89 | 89 | ||
90 | DEBUGP("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen); | 90 | DEBUGP("IPv6 OPTS LEN %u %u ", hdrlen, oh->hdrlen); |
@@ -123,7 +123,7 @@ match(const struct sk_buff *skb, | |||
123 | DEBUGP("Tbad %02X %02X\n", | 123 | DEBUGP("Tbad %02X %02X\n", |
124 | *tp, | 124 | *tp, |
125 | (optinfo->opts[temp] & 0xFF00) >> 8); | 125 | (optinfo->opts[temp] & 0xFF00) >> 8); |
126 | return 0; | 126 | return false; |
127 | } else { | 127 | } else { |
128 | DEBUGP("Tok "); | 128 | DEBUGP("Tok "); |
129 | } | 129 | } |
@@ -144,7 +144,7 @@ match(const struct sk_buff *skb, | |||
144 | if (spec_len != 0x00FF && spec_len != *lp) { | 144 | if (spec_len != 0x00FF && spec_len != *lp) { |
145 | DEBUGP("Lbad %02X %04X\n", *lp, | 145 | DEBUGP("Lbad %02X %04X\n", *lp, |
146 | spec_len); | 146 | spec_len); |
147 | return 0; | 147 | return false; |
148 | } | 148 | } |
149 | DEBUGP("Lok "); | 149 | DEBUGP("Lok "); |
150 | optlen = *lp + 2; | 150 | optlen = *lp + 2; |
@@ -167,10 +167,10 @@ match(const struct sk_buff *skb, | |||
167 | if (temp == optinfo->optsnr) | 167 | if (temp == optinfo->optsnr) |
168 | return ret; | 168 | return ret; |
169 | else | 169 | else |
170 | return 0; | 170 | return false; |
171 | } | 171 | } |
172 | 172 | ||
173 | return 0; | 173 | return false; |
174 | } | 174 | } |
175 | 175 | ||
176 | /* Called when user tries to insert an entry of this type. */ | 176 | /* Called when user tries to insert an entry of this type. */ |
diff --git a/net/ipv6/netfilter/ip6t_hl.c b/net/ipv6/netfilter/ip6t_hl.c index cbf49cffa067..b933e84a06a4 100644 --- a/net/ipv6/netfilter/ip6t_hl.c +++ b/net/ipv6/netfilter/ip6t_hl.c | |||
@@ -19,10 +19,10 @@ MODULE_AUTHOR("Maciej Soltysiak <solt@dns.toxicfilms.tv>"); | |||
19 | MODULE_DESCRIPTION("IP tables Hop Limit matching module"); | 19 | MODULE_DESCRIPTION("IP tables Hop Limit matching module"); |
20 | MODULE_LICENSE("GPL"); | 20 | MODULE_LICENSE("GPL"); |
21 | 21 | ||
22 | static int match(const struct sk_buff *skb, | 22 | static bool match(const struct sk_buff *skb, |
23 | const struct net_device *in, const struct net_device *out, | 23 | const struct net_device *in, const struct net_device *out, |
24 | const struct xt_match *match, const void *matchinfo, | 24 | const struct xt_match *match, const void *matchinfo, |
25 | int offset, unsigned int protoff, bool *hotdrop) | 25 | int offset, unsigned int protoff, bool *hotdrop) |
26 | { | 26 | { |
27 | const struct ip6t_hl_info *info = matchinfo; | 27 | const struct ip6t_hl_info *info = matchinfo; |
28 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); | 28 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
@@ -43,10 +43,10 @@ static int match(const struct sk_buff *skb, | |||
43 | default: | 43 | default: |
44 | printk(KERN_WARNING "ip6t_hl: unknown mode %d\n", | 44 | printk(KERN_WARNING "ip6t_hl: unknown mode %d\n", |
45 | info->mode); | 45 | info->mode); |
46 | return 0; | 46 | return false; |
47 | } | 47 | } |
48 | 48 | ||
49 | return 0; | 49 | return false; |
50 | } | 50 | } |
51 | 51 | ||
52 | static struct xt_match hl_match = { | 52 | static struct xt_match hl_match = { |
diff --git a/net/ipv6/netfilter/ip6t_ipv6header.c b/net/ipv6/netfilter/ip6t_ipv6header.c index 469dec27c649..3222e8959426 100644 --- a/net/ipv6/netfilter/ip6t_ipv6header.c +++ b/net/ipv6/netfilter/ip6t_ipv6header.c | |||
@@ -26,7 +26,7 @@ MODULE_LICENSE("GPL"); | |||
26 | MODULE_DESCRIPTION("IPv6 headers match"); | 26 | MODULE_DESCRIPTION("IPv6 headers match"); |
27 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | 27 | MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); |
28 | 28 | ||
29 | static int | 29 | static bool |
30 | ipv6header_match(const struct sk_buff *skb, | 30 | ipv6header_match(const struct sk_buff *skb, |
31 | const struct net_device *in, | 31 | const struct net_device *in, |
32 | const struct net_device *out, | 32 | const struct net_device *out, |
@@ -58,7 +58,7 @@ ipv6header_match(const struct sk_buff *skb, | |||
58 | 58 | ||
59 | /* Is there enough space for the next ext header? */ | 59 | /* Is there enough space for the next ext header? */ |
60 | if (len < (int)sizeof(struct ipv6_opt_hdr)) | 60 | if (len < (int)sizeof(struct ipv6_opt_hdr)) |
61 | return 0; | 61 | return false; |
62 | /* No more exthdr -> evaluate */ | 62 | /* No more exthdr -> evaluate */ |
63 | if (nexthdr == NEXTHDR_NONE) { | 63 | if (nexthdr == NEXTHDR_NONE) { |
64 | temp |= MASK_NONE; | 64 | temp |= MASK_NONE; |
@@ -99,7 +99,7 @@ ipv6header_match(const struct sk_buff *skb, | |||
99 | temp |= MASK_DSTOPTS; | 99 | temp |= MASK_DSTOPTS; |
100 | break; | 100 | break; |
101 | default: | 101 | default: |
102 | return 0; | 102 | return false; |
103 | break; | 103 | break; |
104 | } | 104 | } |
105 | 105 | ||
diff --git a/net/ipv6/netfilter/ip6t_mh.c b/net/ipv6/netfilter/ip6t_mh.c index c27647b6c274..ddffe03a8b37 100644 --- a/net/ipv6/netfilter/ip6t_mh.c +++ b/net/ipv6/netfilter/ip6t_mh.c | |||
@@ -31,16 +31,13 @@ MODULE_LICENSE("GPL"); | |||
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | /* Returns 1 if the type is matched by the range, 0 otherwise */ | 33 | /* Returns 1 if the type is matched by the range, 0 otherwise */ |
34 | static inline int | 34 | static inline bool |
35 | type_match(u_int8_t min, u_int8_t max, u_int8_t type, int invert) | 35 | type_match(u_int8_t min, u_int8_t max, u_int8_t type, bool invert) |
36 | { | 36 | { |
37 | int ret; | 37 | return (type >= min && type <= max) ^ invert; |
38 | |||
39 | ret = (type >= min && type <= max) ^ invert; | ||
40 | return ret; | ||
41 | } | 38 | } |
42 | 39 | ||
43 | static int | 40 | static bool |
44 | match(const struct sk_buff *skb, | 41 | match(const struct sk_buff *skb, |
45 | const struct net_device *in, | 42 | const struct net_device *in, |
46 | const struct net_device *out, | 43 | const struct net_device *out, |
@@ -55,7 +52,7 @@ match(const struct sk_buff *skb, | |||
55 | 52 | ||
56 | /* Must not be a fragment. */ | 53 | /* Must not be a fragment. */ |
57 | if (offset) | 54 | if (offset) |
58 | return 0; | 55 | return false; |
59 | 56 | ||
60 | mh = skb_header_pointer(skb, protoff, sizeof(_mh), &_mh); | 57 | mh = skb_header_pointer(skb, protoff, sizeof(_mh), &_mh); |
61 | if (mh == NULL) { | 58 | if (mh == NULL) { |
@@ -63,14 +60,14 @@ match(const struct sk_buff *skb, | |||
63 | can't. Hence, no choice but to drop. */ | 60 | can't. Hence, no choice but to drop. */ |
64 | duprintf("Dropping evil MH tinygram.\n"); | 61 | duprintf("Dropping evil MH tinygram.\n"); |
65 | *hotdrop = true; | 62 | *hotdrop = true; |
66 | return 0; | 63 | return false; |
67 | } | 64 | } |
68 | 65 | ||
69 | if (mh->ip6mh_proto != IPPROTO_NONE) { | 66 | if (mh->ip6mh_proto != IPPROTO_NONE) { |
70 | duprintf("Dropping invalid MH Payload Proto: %u\n", | 67 | duprintf("Dropping invalid MH Payload Proto: %u\n", |
71 | mh->ip6mh_proto); | 68 | mh->ip6mh_proto); |
72 | *hotdrop = true; | 69 | *hotdrop = true; |
73 | return 0; | 70 | return false; |
74 | } | 71 | } |
75 | 72 | ||
76 | return type_match(mhinfo->types[0], mhinfo->types[1], mh->ip6mh_type, | 73 | return type_match(mhinfo->types[0], mhinfo->types[1], mh->ip6mh_type, |
diff --git a/net/ipv6/netfilter/ip6t_owner.c b/net/ipv6/netfilter/ip6t_owner.c index f90f7c32cc9e..cadd0a64fed7 100644 --- a/net/ipv6/netfilter/ip6t_owner.c +++ b/net/ipv6/netfilter/ip6t_owner.c | |||
@@ -23,7 +23,7 @@ MODULE_DESCRIPTION("IP6 tables owner matching module"); | |||
23 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
24 | 24 | ||
25 | 25 | ||
26 | static int | 26 | static bool |
27 | match(const struct sk_buff *skb, | 27 | match(const struct sk_buff *skb, |
28 | const struct net_device *in, | 28 | const struct net_device *in, |
29 | const struct net_device *out, | 29 | const struct net_device *out, |
@@ -36,21 +36,21 @@ match(const struct sk_buff *skb, | |||
36 | const struct ip6t_owner_info *info = matchinfo; | 36 | const struct ip6t_owner_info *info = matchinfo; |
37 | 37 | ||
38 | if (!skb->sk || !skb->sk->sk_socket || !skb->sk->sk_socket->file) | 38 | if (!skb->sk || !skb->sk->sk_socket || !skb->sk->sk_socket->file) |
39 | return 0; | 39 | return false; |
40 | 40 | ||
41 | if (info->match & IP6T_OWNER_UID) { | 41 | if (info->match & IP6T_OWNER_UID) { |
42 | if ((skb->sk->sk_socket->file->f_uid != info->uid) ^ | 42 | if ((skb->sk->sk_socket->file->f_uid != info->uid) ^ |
43 | !!(info->invert & IP6T_OWNER_UID)) | 43 | !!(info->invert & IP6T_OWNER_UID)) |
44 | return 0; | 44 | return false; |
45 | } | 45 | } |
46 | 46 | ||
47 | if (info->match & IP6T_OWNER_GID) { | 47 | if (info->match & IP6T_OWNER_GID) { |
48 | if ((skb->sk->sk_socket->file->f_gid != info->gid) ^ | 48 | if ((skb->sk->sk_socket->file->f_gid != info->gid) ^ |
49 | !!(info->invert & IP6T_OWNER_GID)) | 49 | !!(info->invert & IP6T_OWNER_GID)) |
50 | return 0; | 50 | return false; |
51 | } | 51 | } |
52 | 52 | ||
53 | return 1; | 53 | return true; |
54 | } | 54 | } |
55 | 55 | ||
56 | static int | 56 | static int |
diff --git a/net/ipv6/netfilter/ip6t_rt.c b/net/ipv6/netfilter/ip6t_rt.c index 2bb88214cfda..7966f4a5e9b7 100644 --- a/net/ipv6/netfilter/ip6t_rt.c +++ b/net/ipv6/netfilter/ip6t_rt.c | |||
@@ -31,10 +31,10 @@ MODULE_AUTHOR("Andras Kis-Szabo <kisza@sch.bme.hu>"); | |||
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | /* Returns 1 if the id is matched by the range, 0 otherwise */ | 33 | /* Returns 1 if the id is matched by the range, 0 otherwise */ |
34 | static inline int | 34 | static inline bool |
35 | segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert) | 35 | segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, bool invert) |
36 | { | 36 | { |
37 | int r = 0; | 37 | bool r; |
38 | DEBUGP("rt segsleft_match:%c 0x%x <= 0x%x <= 0x%x", | 38 | DEBUGP("rt segsleft_match:%c 0x%x <= 0x%x <= 0x%x", |
39 | invert ? '!' : ' ', min, id, max); | 39 | invert ? '!' : ' ', min, id, max); |
40 | r = (id >= min && id <= max) ^ invert; | 40 | r = (id >= min && id <= max) ^ invert; |
@@ -42,7 +42,7 @@ segsleft_match(u_int32_t min, u_int32_t max, u_int32_t id, int invert) | |||
42 | return r; | 42 | return r; |
43 | } | 43 | } |
44 | 44 | ||
45 | static int | 45 | static bool |
46 | match(const struct sk_buff *skb, | 46 | match(const struct sk_buff *skb, |
47 | const struct net_device *in, | 47 | const struct net_device *in, |
48 | const struct net_device *out, | 48 | const struct net_device *out, |
@@ -57,7 +57,7 @@ match(const struct sk_buff *skb, | |||
57 | unsigned int temp; | 57 | unsigned int temp; |
58 | unsigned int ptr; | 58 | unsigned int ptr; |
59 | unsigned int hdrlen = 0; | 59 | unsigned int hdrlen = 0; |
60 | unsigned int ret = 0; | 60 | bool ret = false; |
61 | struct in6_addr *ap, _addr; | 61 | struct in6_addr *ap, _addr; |
62 | int err; | 62 | int err; |
63 | 63 | ||
@@ -65,19 +65,19 @@ match(const struct sk_buff *skb, | |||
65 | if (err < 0) { | 65 | if (err < 0) { |
66 | if (err != -ENOENT) | 66 | if (err != -ENOENT) |
67 | *hotdrop = true; | 67 | *hotdrop = true; |
68 | return 0; | 68 | return false; |
69 | } | 69 | } |
70 | 70 | ||
71 | rh = skb_header_pointer(skb, ptr, sizeof(_route), &_route); | 71 | rh = skb_header_pointer(skb, ptr, sizeof(_route), &_route); |
72 | if (rh == NULL) { | 72 | if (rh == NULL) { |
73 | *hotdrop = true; | 73 | *hotdrop = true; |
74 | return 0; | 74 | return false; |
75 | } | 75 | } |
76 | 76 | ||
77 | hdrlen = ipv6_optlen(rh); | 77 | hdrlen = ipv6_optlen(rh); |
78 | if (skb->len - ptr < hdrlen) { | 78 | if (skb->len - ptr < hdrlen) { |
79 | /* Pcket smaller than its length field */ | 79 | /* Pcket smaller than its length field */ |
80 | return 0; | 80 | return false; |
81 | } | 81 | } |
82 | 82 | ||
83 | DEBUGP("IPv6 RT LEN %u %u ", hdrlen, rh->hdrlen); | 83 | DEBUGP("IPv6 RT LEN %u %u ", hdrlen, rh->hdrlen); |
@@ -136,7 +136,7 @@ match(const struct sk_buff *skb, | |||
136 | DEBUGP("Not strict "); | 136 | DEBUGP("Not strict "); |
137 | if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { | 137 | if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { |
138 | DEBUGP("There isn't enough space\n"); | 138 | DEBUGP("There isn't enough space\n"); |
139 | return 0; | 139 | return false; |
140 | } else { | 140 | } else { |
141 | unsigned int i = 0; | 141 | unsigned int i = 0; |
142 | 142 | ||
@@ -164,13 +164,13 @@ match(const struct sk_buff *skb, | |||
164 | if (i == rtinfo->addrnr) | 164 | if (i == rtinfo->addrnr) |
165 | return ret; | 165 | return ret; |
166 | else | 166 | else |
167 | return 0; | 167 | return false; |
168 | } | 168 | } |
169 | } else { | 169 | } else { |
170 | DEBUGP("Strict "); | 170 | DEBUGP("Strict "); |
171 | if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { | 171 | if (rtinfo->addrnr > (unsigned int)((hdrlen - 8) / 16)) { |
172 | DEBUGP("There isn't enough space\n"); | 172 | DEBUGP("There isn't enough space\n"); |
173 | return 0; | 173 | return false; |
174 | } else { | 174 | } else { |
175 | DEBUGP("#%d ", rtinfo->addrnr); | 175 | DEBUGP("#%d ", rtinfo->addrnr); |
176 | for (temp = 0; temp < rtinfo->addrnr; temp++) { | 176 | for (temp = 0; temp < rtinfo->addrnr; temp++) { |
@@ -190,11 +190,11 @@ match(const struct sk_buff *skb, | |||
190 | (temp == (unsigned int)((hdrlen - 8) / 16))) | 190 | (temp == (unsigned int)((hdrlen - 8) / 16))) |
191 | return ret; | 191 | return ret; |
192 | else | 192 | else |
193 | return 0; | 193 | return false; |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | return 0; | 197 | return false; |
198 | } | 198 | } |
199 | 199 | ||
200 | /* Called when user tries to insert an entry of this type. */ | 200 | /* Called when user tries to insert an entry of this type. */ |