History

netfilter: xtables: change targets to return error code

Part of the transition of done by this semantic patch: // <smpl> @ rule1 @ struct xt_target ops; identifier check; @@ ops.checkentry = check; @@ identifier rule1.check; @@ check(...) { <... -return true; +return 0; ...> } @@ identifier rule1.check; @@ check(...) { <... -return false; +return -EINVAL; ...> } // </smpl>

Jan Engelhardt committed 16 years ago

Commit d6b00a51 parent bd414ee31 files · +116 −111Browse files

Unified · Split

31 files
  1. net/bridge/netfilter/ebt_arpreply.c +3 −3
  2. net/bridge/netfilter/ebt_dnat.c +4 −4
  3. net/bridge/netfilter/ebt_log.c +3 −3
  4. net/bridge/netfilter/ebt_mark.c +4 −4
  5. net/bridge/netfilter/ebt_nflog.c +2 −2
  6. net/bridge/netfilter/ebt_redirect.c +4 −4
  7. net/bridge/netfilter/ebt_snat.c +4 −4
  8. net/bridge/netfilter/ebt_ulog.c +2 −2
  9. net/ipv4/netfilter/ipt_CLUSTERIP.c +8 −8
  10. net/ipv4/netfilter/ipt_ECN.c +4 −4
  11. net/ipv4/netfilter/ipt_LOG.c +3 −3
  12. net/ipv4/netfilter/ipt_MASQUERADE.c +3 −3
  13. net/ipv4/netfilter/ipt_NETMAP.c +3 −3
  14. net/ipv4/netfilter/ipt_REDIRECT.c +3 −3
  15. net/ipv4/netfilter/ipt_REJECT.c +3 −3
  16. net/ipv4/netfilter/ipt_ULOG.c +3 −3
  17. net/ipv4/netfilter/nf_nat_rule.c +4 −4
  18. net/ipv6/netfilter/ip6t_LOG.c +3 −3
  19. net/ipv6/netfilter/ip6t_REJECT.c +3 −3
  20. net/netfilter/x_tables.c +10 −2
  21. net/netfilter/xt_CONNSECMARK.c +3 −3
  22. net/netfilter/xt_CT.c +3 −3
  23. net/netfilter/xt_DSCP.c +2 −2
  24. net/netfilter/xt_HL.c +5 −5
  25. net/netfilter/xt_LED.c +4 −6
  26. net/netfilter/xt_NFLOG.c +3 −3
  27. net/netfilter/xt_NFQUEUE.c +3 −3
  28. net/netfilter/xt_RATEEST.c +4 −5
  29. net/netfilter/xt_SECMARK.c +5 −5
  30. net/netfilter/xt_TCPMSS.c +6 −6
  31. net/netfilter/xt_TPROXY.c +2 −2
net/bridge/netfilter/ebt_arpreply.c+3−3
@@ -63,11 +63,11 @@ static int ebt_arpreply_tg_check(const struct xt_tgchk_param *par) · 62 unmodified lines
6363 const struct ebt_entry *e = par->entryinfo;
6464
6565 if (BASE_CHAIN && info->target == EBT_RETURN)
66− return false;
66+ return -EINVAL;
6767 if (e->ethproto != htons(ETH_P_ARP) ||
6868 e->invflags & EBT_IPROTO)
69− return false;
70− return true;
69+ return -EINVAL;
70+ return 0;
7171 }
7272
7373 static struct xt_target ebt_arpreply_tg_reg __read_mostly = {
net/bridge/netfilter/ebt_dnat.c+4−4
@@ -32,7 +32,7 @@ static int ebt_dnat_tg_check(const struct xt_tgchk_param *par) · 31 unmodified lines
3232 unsigned int hook_mask;
3333
3434 if (BASE_CHAIN && info->target == EBT_RETURN)
35− return false;
35+ return -EINVAL;
3636
3737 hook_mask = par->hook_mask & ~(1 << NF_BR_NUMHOOKS);
3838 if ((strcmp(par->table, "nat") != 0 ||
@@ -40,10 +40,10 @@ static int ebt_dnat_tg_check(const struct xt_tgchk_param *par) · 1 unmodified line
4040 (1 << NF_BR_LOCAL_OUT)))) &&
4141 (strcmp(par->table, "broute") != 0 ||
4242 hook_mask & ~(1 << NF_BR_BROUTING)))
43− return false;
43+ return -EINVAL;
4444 if (INVALID_TARGET)
45− return false;
46− return true;
45+ return -EINVAL;
46+ return 0;
4747 }
4848
4949 static struct xt_target ebt_dnat_tg_reg __read_mostly = {
net/bridge/netfilter/ebt_log.c+3−3
@@ -29,11 +29,11 @@ static int ebt_log_tg_check(const struct xt_tgchk_param *par) · 28 unmodified lines
2929 struct ebt_log_info *info = par->targinfo;
3030
3131 if (info->bitmask & ~EBT_LOG_MASK)
32− return false;
32+ return -EINVAL;
3333 if (info->loglevel >= 8)
34− return false;
34+ return -EINVAL;
3535 info->prefix[EBT_LOG_PREFIX_SIZE - 1] = '\0';
36− return true;
36+ return 0;
3737 }
3838
3939 struct tcpudphdr
net/bridge/netfilter/ebt_mark.c+4−4
@@ -43,14 +43,14 @@ static int ebt_mark_tg_check(const struct xt_tgchk_param *par) · 42 unmodified lines
4343
4444 tmp = info->target | ~EBT_VERDICT_BITS;
4545 if (BASE_CHAIN && tmp == EBT_RETURN)
46− return false;
46+ return -EINVAL;
4747 if (tmp < -NUM_STANDARD_TARGETS || tmp >= 0)
48− return false;
48+ return -EINVAL;
4949 tmp = info->target & ~EBT_VERDICT_BITS;
5050 if (tmp != MARK_SET_VALUE && tmp != MARK_OR_VALUE &&
5151 tmp != MARK_AND_VALUE && tmp != MARK_XOR_VALUE)
52− return false;
53− return true;
52+ return -EINVAL;
53+ return 0;
5454 }
5555 #ifdef CONFIG_COMPAT
5656 struct compat_ebt_mark_t_info {
net/bridge/netfilter/ebt_nflog.c+2−2
@@ -40,9 +40,9 @@ static int ebt_nflog_tg_check(const struct xt_tgchk_param *par) · 39 unmodified lines
4040 struct ebt_nflog_info *info = par->targinfo;
4141
4242 if (info->flags & ~EBT_NFLOG_MASK)
43− return false;
43+ return -EINVAL;
4444 info->prefix[EBT_NFLOG_PREFIX_SIZE - 1] = '\0';
45− return true;
45+ return 0;
4646 }
4747
4848 static struct xt_target ebt_nflog_tg_reg __read_mostly = {
net/bridge/netfilter/ebt_redirect.c+4−4
@@ -38,17 +38,17 @@ static int ebt_redirect_tg_check(const struct xt_tgchk_param *par) · 37 unmodified lines
3838 unsigned int hook_mask;
3939
4040 if (BASE_CHAIN && info->target == EBT_RETURN)
41− return false;
41+ return -EINVAL;
4242
4343 hook_mask = par->hook_mask & ~(1 << NF_BR_NUMHOOKS);
4444 if ((strcmp(par->table, "nat") != 0 ||
4545 hook_mask & ~(1 << NF_BR_PRE_ROUTING)) &&
4646 (strcmp(par->table, "broute") != 0 ||
4747 hook_mask & ~(1 << NF_BR_BROUTING)))
48− return false;
48+ return -EINVAL;
4949 if (INVALID_TARGET)
50− return false;
51− return true;
50+ return -EINVAL;
51+ return 0;
5252 }
5353
5454 static struct xt_target ebt_redirect_tg_reg __read_mostly = {
net/bridge/netfilter/ebt_snat.c+4−4
@@ -49,14 +49,14 @@ static int ebt_snat_tg_check(const struct xt_tgchk_param *par) · 48 unmodified lines
4949
5050 tmp = info->target | ~EBT_VERDICT_BITS;
5151 if (BASE_CHAIN && tmp == EBT_RETURN)
52− return false;
52+ return -EINVAL;
5353
5454 if (tmp < -NUM_STANDARD_TARGETS || tmp >= 0)
55− return false;
55+ return -EINVAL;
5656 tmp = info->target | EBT_VERDICT_BITS;
5757 if ((tmp & ~NAT_ARP_BIT) != ~NAT_ARP_BIT)
58− return false;
59− return true;
58+ return -EINVAL;
59+ return 0;
6060 }
6161
6262 static struct xt_target ebt_snat_tg_reg __read_mostly = {
net/bridge/netfilter/ebt_ulog.c+2−2
@@ -254,14 +254,14 @@ static int ebt_ulog_tg_check(const struct xt_tgchk_param *par) · 253 unmodified lines
254254 struct ebt_ulog_info *uloginfo = par->targinfo;
255255
256256 if (uloginfo->nlgroup > 31)
257− return false;
257+ return -EINVAL;
258258
259259 uloginfo->prefix[EBT_ULOG_PREFIX_LEN - 1] = '\0';
260260
261261 if (uloginfo->qthreshold > EBT_ULOG_MAX_QLEN)
262262 uloginfo->qthreshold = EBT_ULOG_MAX_QLEN;
263263
264− return true;
264+ return 0;
265265 }
266266
267267 static struct xt_target ebt_ulog_tg_reg __read_mostly = {
net/ipv4/netfilter/ipt_CLUSTERIP.c+8−8
@@ -358,13 +358,13 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par) · 357 unmodified lines
358358 cipinfo->hash_mode != CLUSTERIP_HASHMODE_SIP_SPT &&
359359 cipinfo->hash_mode != CLUSTERIP_HASHMODE_SIP_SPT_DPT) {
360360 pr_info("unknown mode %u\n", cipinfo->hash_mode);
361− return false;
361+ return -EINVAL;
362362
363363 }
364364 if (e->ip.dmsk.s_addr != htonl(0xffffffff) ||
365365 e->ip.dst.s_addr == 0) {
366366 pr_info("Please specify destination IP\n");
367− return false;
367+ return -EINVAL;
368368 }
369369
370370 /* FIXME: further sanity checks */
@@ -374,20 +374,20 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par) · 3 unmodified lines
374374 if (!(cipinfo->flags & CLUSTERIP_FLAG_NEW)) {
375375 pr_info("no config found for %pI4, need 'new'\n",
376376 &e->ip.dst.s_addr);
377− return false;
377+ return -EINVAL;
378378 } else {
379379 struct net_device *dev;
380380
381381 if (e->ip.iniface[0] == '\0') {
382382 pr_info("Please specify an interface name\n");
383− return false;
383+ return -EINVAL;
384384 }
385385
386386 dev = dev_get_by_name(&init_net, e->ip.iniface);
387387 if (!dev) {
388388 pr_info("no such interface %s\n",
389389 e->ip.iniface);
390− return false;
390+ return -EINVAL;
391391 }
392392
393393 config = clusterip_config_init(cipinfo,
@@ -395,7 +395,7 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par) · 1 unmodified line
395395 if (!config) {
396396 pr_info("cannot allocate config\n");
397397 dev_put(dev);
398− return false;
398+ return -EINVAL;
399399 }
400400 dev_mc_add(config->dev,config->clustermac, ETH_ALEN, 0);
401401 }
@@ -405,10 +405,10 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par) · 3 unmodified lines
405405 if (nf_ct_l3proto_try_module_get(par->family) < 0) {
406406 pr_info("cannot load conntrack support for proto=%u\n",
407407 par->family);
408− return false;
408+ return -EINVAL;
409409 }
410410
411− return true;
411+ return 0;
412412 }
413413
414414 /* drop reference count of cluster config when rule is deleted */
net/ipv4/netfilter/ipt_ECN.c+4−4
@@ -100,18 +100,18 @@ static int ecn_tg_check(const struct xt_tgchk_param *par) · 99 unmodified lines
100100
101101 if (einfo->operation & IPT_ECN_OP_MASK) {
102102 pr_info("unsupported ECN operation %x\n", einfo->operation);
103− return false;
103+ return -EINVAL;
104104 }
105105 if (einfo->ip_ect & ~IPT_ECN_IP_MASK) {
106106 pr_info("new ECT codepoint %x out of mask\n", einfo->ip_ect);
107− return false;
107+ return -EINVAL;
108108 }
109109 if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
110110 (e->ip.proto != IPPROTO_TCP || (e->ip.invflags & XT_INV_PROTO))) {
111111 pr_info("cannot use TCP operations on a non-tcp rule\n");
112− return false;
112+ return -EINVAL;
113113 }
114− return true;
114+ return 0;
115115 }
116116
117117 static struct xt_target ecn_tg_reg __read_mostly = {
net/ipv4/netfilter/ipt_LOG.c+3−3
@@ -445,13 +445,13 @@ static int log_tg_check(const struct xt_tgchk_param *par) · 444 unmodified lines
445445
446446 if (loginfo->level >= 8) {
447447 pr_debug("level %u >= 8\n", loginfo->level);
448− return false;
448+ return -EINVAL;
449449 }
450450 if (loginfo->prefix[sizeof(loginfo->prefix)-1] != '\0') {
451451 pr_debug("prefix is not null-terminated\n");
452− return false;
452+ return -EINVAL;
453453 }
454− return true;
454+ return 0;
455455 }
456456
457457 static struct xt_target log_tg_reg __read_mostly = {
net/ipv4/netfilter/ipt_MASQUERADE.c+3−3
@@ -34,13 +34,13 @@ static int masquerade_tg_check(const struct xt_tgchk_param *par) · 33 unmodified lines
3434
3535 if (mr->range[0].flags & IP_NAT_RANGE_MAP_IPS) {
3636 pr_debug("bad MAP_IPS.\n");
37− return false;
37+ return -EINVAL;
3838 }
3939 if (mr->rangesize != 1) {
4040 pr_debug("bad rangesize %u\n", mr->rangesize);
41− return false;
41+ return -EINVAL;
4242 }
43− return true;
43+ return 0;
4444 }
4545
4646 static unsigned int
net/ipv4/netfilter/ipt_NETMAP.c+3−3
@@ -28,13 +28,13 @@ static int netmap_tg_check(const struct xt_tgchk_param *par) · 27 unmodified lines
2828
2929 if (!(mr->range[0].flags & IP_NAT_RANGE_MAP_IPS)) {
3030 pr_debug("bad MAP_IPS.\n");
31− return false;
31+ return -EINVAL;
3232 }
3333 if (mr->rangesize != 1) {
3434 pr_debug("bad rangesize %u.\n", mr->rangesize);
35− return false;
35+ return -EINVAL;
3636 }
37− return true;
37+ return 0;
3838 }
3939
4040 static unsigned int
net/ipv4/netfilter/ipt_REDIRECT.c+3−3
@@ -32,13 +32,13 @@ static int redirect_tg_check(const struct xt_tgchk_param *par) · 31 unmodified lines
3232
3333 if (mr->range[0].flags & IP_NAT_RANGE_MAP_IPS) {
3434 pr_debug("bad MAP_IPS.\n");
35− return false;
35+ return -EINVAL;
3636 }
3737 if (mr->rangesize != 1) {
3838 pr_debug("bad rangesize %u.\n", mr->rangesize);
39− return false;
39+ return -EINVAL;
4040 }
41− return true;
41+ return 0;
4242 }
4343
4444 static unsigned int
net/ipv4/netfilter/ipt_REJECT.c+3−3
@@ -181,16 +181,16 @@ static int reject_tg_check(const struct xt_tgchk_param *par) · 180 unmodified lines
181181
182182 if (rejinfo->with == IPT_ICMP_ECHOREPLY) {
183183 pr_info("ECHOREPLY no longer supported.\n");
184− return false;
184+ return -EINVAL;
185185 } else if (rejinfo->with == IPT_TCP_RESET) {
186186 /* Must specify that it's a TCP packet */
187187 if (e->ip.proto != IPPROTO_TCP ||
188188 (e->ip.invflags & XT_INV_PROTO)) {
189189 pr_info("TCP_RESET invalid for non-tcp\n");
190− return false;
190+ return -EINVAL;
191191 }
192192 }
193− return true;
193+ return 0;
194194 }
195195
196196 static struct xt_target reject_tg_reg __read_mostly = {
net/ipv4/netfilter/ipt_ULOG.c+3−3
@@ -313,14 +313,14 @@ static int ulog_tg_check(const struct xt_tgchk_param *par) · 312 unmodified lines
313313
314314 if (loginfo->prefix[sizeof(loginfo->prefix) - 1] != '\0') {
315315 pr_debug("prefix not null-terminated\n");
316− return false;
316+ return -EINVAL;
317317 }
318318 if (loginfo->qthreshold > ULOG_MAX_QLEN) {
319319 pr_debug("queue threshold %Zu > MAX_QLEN\n",
320320 loginfo->qthreshold);
321− return false;
321+ return -EINVAL;
322322 }
323− return true;
323+ return 0;
324324 }
325325
326326 #ifdef CONFIG_COMPAT
net/ipv4/netfilter/nf_nat_rule.c+4−4
@@ -81,9 +81,9 @@ static int ipt_snat_checkentry(const struct xt_tgchk_param *par) · 80 unmodified lines
8181 /* Must be a valid range */
8282 if (mr->rangesize != 1) {
8383 pr_info("SNAT: multiple ranges no longer supported\n");
84− return false;
84+ return -EINVAL;
8585 }
86− return true;
86+ return 0;
8787 }
8888
8989 static int ipt_dnat_checkentry(const struct xt_tgchk_param *par)
@@ -93,9 +93,9 @@ static int ipt_dnat_checkentry(const struct xt_tgchk_param *par) · 3 unmodified lines
9393 /* Must be a valid range */
9494 if (mr->rangesize != 1) {
9595 pr_info("DNAT: multiple ranges no longer supported\n");
96− return false;
96+ return -EINVAL;
9797 }
98− return true;
98+ return 0;
9999 }
100100
101101 unsigned int
net/ipv6/netfilter/ip6t_LOG.c+3−3
@@ -457,13 +457,13 @@ static int log_tg6_check(const struct xt_tgchk_param *par) · 456 unmodified lines
457457
458458 if (loginfo->level >= 8) {
459459 pr_debug("level %u >= 8\n", loginfo->level);
460− return false;
460+ return -EINVAL;
461461 }
462462 if (loginfo->prefix[sizeof(loginfo->prefix)-1] != '\0') {
463463 pr_debug("prefix not null-terminated\n");
464− return false;
464+ return -EINVAL;
465465 }
466− return true;
466+ return 0;
467467 }
468468
469469 static struct xt_target log_tg6_reg __read_mostly = {
net/ipv6/netfilter/ip6t_REJECT.c+3−3
@@ -220,16 +220,16 @@ static int reject_tg6_check(const struct xt_tgchk_param *par) · 219 unmodified lines
220220
221221 if (rejinfo->with == IP6T_ICMP6_ECHOREPLY) {
222222 pr_info("ECHOREPLY is not supported.\n");
223− return false;
223+ return -EINVAL;
224224 } else if (rejinfo->with == IP6T_TCP_RESET) {
225225 /* Must specify that it's a TCP packet */
226226 if (e->ipv6.proto != IPPROTO_TCP ||
227227 (e->ipv6.invflags & XT_INV_PROTO)) {
228228 pr_info("TCP_RESET illegal for non-tcp\n");
229− return false;
229+ return -EINVAL;
230230 }
231231 }
232− return true;
232+ return 0;
233233 }
234234
235235 static struct xt_target reject_tg6_reg __read_mostly = {
net/netfilter/x_tables.c+10−2
@@ -528,6 +528,8 @@ EXPORT_SYMBOL_GPL(xt_compat_match_to_user); · 527 unmodified lines
528528 int xt_check_target(struct xt_tgchk_param *par,
529529 unsigned int size, u_int8_t proto, bool inv_proto)
530530 {
531+ int ret;
532+
531533 if (XT_ALIGN(par->target->targetsize) != size) {
532534 pr_err("%s_tables: %s.%u target: invalid size "
533535 "%u (kernel) != (user) %u\n",
@@ -559,8 +561,14 @@ int xt_check_target(struct xt_tgchk_param *par, · 25 unmodified lines
559561 par->target->proto);
560562 return -EINVAL;
561563 }
562− if (par->target->checkentry != NULL && !par->target->checkentry(par))
563− return -EINVAL;
564+ if (par->target->checkentry != NULL) {
565+ ret = par->target->checkentry(par);
566+ if (ret < 0)
567+ return ret;
568+ else if (ret > 0)
569+ /* Flag up potential errors. */
570+ return -EIO;
571+ }
564572 return 0;
565573 }
566574 EXPORT_SYMBOL_GPL(xt_check_target);
net/netfilter/xt_CONNSECMARK.c+3−3
@@ -92,7 +92,7 @@ static int connsecmark_tg_check(const struct xt_tgchk_param *par) · 91 unmodified lines
9292 strcmp(par->table, "security") != 0) {
9393 pr_info("target only valid in the \'mangle\' "
9494 "or \'security\' tables, not \'%s\'.\n", par->table);
95− return false;
95+ return -EINVAL;
9696 }
9797
9898 switch (info->mode) {
@@ -108,9 +108,9 @@ static int connsecmark_tg_check(const struct xt_tgchk_param *par) · 9 unmodified lines
108108 if (nf_ct_l3proto_try_module_get(par->family) < 0) {
109109 pr_info("cannot load conntrack support for proto=%u\n",
110110 par->family);
111− return false;
111+ return -EINVAL;
112112 }
113− return true;
113+ return 0;
114114 }
115115
116116 static void connsecmark_tg_destroy(const struct xt_tgdtor_param *par)
net/netfilter/xt_CT.c+3−3
@@ -62,7 +62,7 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par) · 61 unmodified lines
6262 u8 proto;
6363
6464 if (info->flags & ~XT_CT_NOTRACK)
65− return false;
65+ return -EINVAL;
6666
6767 if (info->flags & XT_CT_NOTRACK) {
6868 ct = &nf_conntrack_untracked;
@@ -108,14 +108,14 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par) · 39 unmodified lines
108108 __set_bit(IPS_CONFIRMED_BIT, &ct->status);
109109 out:
110110 info->ct = ct;
111− return true;
111+ return 0;
112112
113113 err3:
114114 nf_conntrack_free(ct);
115115 err2:
116116 nf_ct_l3proto_module_put(par->family);
117117 err1:
118− return false;
118+ return -EINVAL;
119119 }
120120
121121 static void xt_ct_tg_destroy(const struct xt_tgdtor_param *par)
net/netfilter/xt_DSCP.c+2−2
@@ -66,9 +66,9 @@ static int dscp_tg_check(const struct xt_tgchk_param *par) · 65 unmodified lines
6666
6767 if (info->dscp > XT_DSCP_MAX) {
6868 pr_info("dscp %x out of range\n", info->dscp);
69− return false;
69+ return -EINVAL;
7070 }
71− return true;
71+ return 0;
7272 }
7373
7474 static unsigned int
net/netfilter/xt_HL.c+5−5
@@ -110,8 +110,8 @@ static int ttl_tg_check(const struct xt_tgchk_param *par) · 109 unmodified lines
110110 return false;
111111 }
112112 if (info->mode != IPT_TTL_SET && info->ttl == 0)
113− return false;
114− return true;
113+ return -EINVAL;
114+ return 0;
115115 }
116116
117117 static int hl_tg6_check(const struct xt_tgchk_param *par)
@@ -120,14 +120,14 @@ static int hl_tg6_check(const struct xt_tgchk_param *par) · 2 unmodified lines
120120
121121 if (info->mode > IP6T_HL_MAXMODE) {
122122 pr_info("invalid or unknown mode %u\n", info->mode);
123− return false;
123+ return -EINVAL;
124124 }
125125 if (info->mode != IP6T_HL_SET && info->hop_limit == 0) {
126126 pr_info("increment/decrement does not "
127127 "make sense with value 0\n");
128− return false;
128+ return -EINVAL;
129129 }
130− return true;
130+ return 0;
131131 }
132132
133133 static struct xt_target hl_tg_reg[] __read_mostly = {
net/netfilter/xt_LED.c+4−6
@@ -88,12 +88,12 @@ static int led_tg_check(const struct xt_tgchk_param *par) · 87 unmodified lines
8888
8989 if (ledinfo->id[0] == '\0') {
9090 pr_info("No 'id' parameter given.\n");
91− return false;
91+ return -EINVAL;
9292 }
9393
9494 ledinternal = kzalloc(sizeof(struct xt_led_info_internal), GFP_KERNEL);
9595 if (!ledinternal)
96− return false;
96+ return -EINVAL;
9797
9898 ledinternal->netfilter_led_trigger.name = ledinfo->id;
9999
@@ -111,13 +111,11 @@ static int led_tg_check(const struct xt_tgchk_param *par) · 11 unmodified lines
111111 (unsigned long)ledinfo);
112112
113113 ledinfo->internal_data = ledinternal;
114−
115− return true;
114+ return 0;
116115
117116 exit_alloc:
118117 kfree(ledinternal);
119−
120− return false;
118+ return -EINVAL;
121119 }
122120
123121 static void led_tg_destroy(const struct xt_tgdtor_param *par)
net/netfilter/xt_NFLOG.c+3−3
@@ -42,10 +42,10 @@ static int nflog_tg_check(const struct xt_tgchk_param *par) · 41 unmodified lines
4242 const struct xt_nflog_info *info = par->targinfo;
4343
4444 if (info->flags & ~XT_NFLOG_MASK)
45− return false;
45+ return -EINVAL;
4646 if (info->prefix[sizeof(info->prefix) - 1] != '\0')
47− return false;
48− return true;
47+ return -EINVAL;
48+ return 0;
4949 }
5050
5151 static struct xt_target nflog_tg_reg __read_mostly = {
net/netfilter/xt_NFQUEUE.c+3−3
@@ -92,15 +92,15 @@ static int nfqueue_tg_v1_check(const struct xt_tgchk_param *par) · 91 unmodified lines
9292 }
9393 if (info->queues_total == 0) {
9494 pr_err("NFQUEUE: number of total queues is 0\n");
95− return false;
95+ return -EINVAL;
9696 }
9797 maxid = info->queues_total - 1 + info->queuenum;
9898 if (maxid > 0xffff) {
9999 pr_err("NFQUEUE: number of queues (%u) out of range (got %u)\n",
100100 info->queues_total, maxid);
101− return false;
101+ return -EINVAL;
102102 }
103− return true;
103+ return 0;
104104 }
105105
106106 static struct xt_target nfqueue_tg_reg[] __read_mostly = {
net/netfilter/xt_RATEEST.c+4−5
@@ -109,10 +109,10 @@ static int xt_rateest_tg_checkentry(const struct xt_tgchk_param *par) · 108 unmodified lines
109109 (info->interval != est->params.interval ||
110110 info->ewma_log != est->params.ewma_log)) {
111111 xt_rateest_put(est);
112− return false;
112+ return -EINVAL;
113113 }
114114 info->est = est;
115− return true;
115+ return 0;
116116 }
117117
118118 est = kzalloc(sizeof(*est), GFP_KERNEL);
@@ -136,13 +136,12 @@ static int xt_rateest_tg_checkentry(const struct xt_tgchk_param *par) · 17 unmodified lines
136136
137137 info->est = est;
138138 xt_rateest_hash_insert(est);
139−
140− return true;
139+ return 0;
141140
142141 err2:
143142 kfree(est);
144143 err1:
145− return false;
144+ return -EINVAL;
146145 }
147146
148147 static void xt_rateest_tg_destroy(const struct xt_tgdtor_param *par)
net/netfilter/xt_SECMARK.c+5−5
@@ -88,29 +88,29 @@ static int secmark_tg_check(const struct xt_tgchk_param *par) · 87 unmodified lines
8888 strcmp(par->table, "security") != 0) {
8989 pr_info("target only valid in the \'mangle\' "
9090 "or \'security\' tables, not \'%s\'.\n", par->table);
91− return false;
91+ return -EINVAL;
9292 }
9393
9494 if (mode && mode != info->mode) {
9595 pr_info("mode already set to %hu cannot mix with "
9696 "rules for mode %hu\n", mode, info->mode);
97− return false;
97+ return -EINVAL;
9898 }
9999
100100 switch (info->mode) {
101101 case SECMARK_MODE_SEL:
102102 if (!checkentry_selinux(info))
103− return false;
103+ return -EINVAL;
104104 break;
105105
106106 default:
107107 pr_info("invalid mode: %hu\n", info->mode);
108− return false;
108+ return -EINVAL;
109109 }
110110
111111 if (!mode)
112112 mode = info->mode;
113− return true;
113+ return 0;
114114 }
115115
116116 static void secmark_tg_destroy(const struct xt_tgdtor_param *par)
net/netfilter/xt_TCPMSS.c+6−6
@@ -246,13 +246,13 @@ static int tcpmss_tg4_check(const struct xt_tgchk_param *par) · 245 unmodified lines
246246 (1 << NF_INET_POST_ROUTING))) != 0) {
247247 pr_info("path-MTU clamping only supported in "
248248 "FORWARD, OUTPUT and POSTROUTING hooks\n");
249− return false;
249+ return -EINVAL;
250250 }
251251 xt_ematch_foreach(ematch, e)
252252 if (find_syn_match(ematch))
253− return true;
253+ return 0;
254254 pr_info("Only works on TCP SYN packets\n");
255− return false;
255+ return -EINVAL;
256256 }
257257
258258 #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
@@ -268,13 +268,13 @@ static int tcpmss_tg6_check(const struct xt_tgchk_param *par) · 9 unmodified lines
268268 (1 << NF_INET_POST_ROUTING))) != 0) {
269269 pr_info("path-MTU clamping only supported in "
270270 "FORWARD, OUTPUT and POSTROUTING hooks\n");
271− return false;
271+ return -EINVAL;
272272 }
273273 xt_ematch_foreach(ematch, e)
274274 if (find_syn_match(ematch))
275− return true;
275+ return 0;
276276 pr_info("Only works on TCP SYN packets\n");
277− return false;
277+ return -EINVAL;
278278 }
279279 #endif
280280
net/netfilter/xt_TPROXY.c+2−2
@@ -65,11 +65,11 @@ static int tproxy_tg_check(const struct xt_tgchk_param *par) · 64 unmodified lines
6565
6666 if ((i->proto == IPPROTO_TCP || i->proto == IPPROTO_UDP)
6767 && !(i->invflags & IPT_INV_PROTO))
68− return true;
68+ return 0;
6969
7070 pr_info("Can be used only in combination with "
7171 "either -p tcp or -p udp\n");
72− return false;
72+ return -EINVAL;
7373 }
7474
7575 static struct xt_target tproxy_tg_reg __read_mostly = {