Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6b00a53 authored by Jan Engelhardt's avatar Jan Engelhardt
Browse files

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>

Signed-off-by: default avatarJan Engelhardt <jengelh@medozas.de>
parent bd414ee6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -63,11 +63,11 @@ static int ebt_arpreply_tg_check(const struct xt_tgchk_param *par)
	const struct ebt_entry *e = par->entryinfo;

	if (BASE_CHAIN && info->target == EBT_RETURN)
		return false;
		return -EINVAL;
	if (e->ethproto != htons(ETH_P_ARP) ||
	    e->invflags & EBT_IPROTO)
		return false;
	return true;
		return -EINVAL;
	return 0;
}

static struct xt_target ebt_arpreply_tg_reg __read_mostly = {
+4 −4
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ static int ebt_dnat_tg_check(const struct xt_tgchk_param *par)
	unsigned int hook_mask;

	if (BASE_CHAIN && info->target == EBT_RETURN)
		return false;
		return -EINVAL;

	hook_mask = par->hook_mask & ~(1 << NF_BR_NUMHOOKS);
	if ((strcmp(par->table, "nat") != 0 ||
@@ -40,10 +40,10 @@ static int ebt_dnat_tg_check(const struct xt_tgchk_param *par)
	    (1 << NF_BR_LOCAL_OUT)))) &&
	    (strcmp(par->table, "broute") != 0 ||
	    hook_mask & ~(1 << NF_BR_BROUTING)))
		return false;
		return -EINVAL;
	if (INVALID_TARGET)
		return false;
	return true;
		return -EINVAL;
	return 0;
}

static struct xt_target ebt_dnat_tg_reg __read_mostly = {
+3 −3
Original line number Diff line number Diff line
@@ -29,11 +29,11 @@ static int ebt_log_tg_check(const struct xt_tgchk_param *par)
	struct ebt_log_info *info = par->targinfo;

	if (info->bitmask & ~EBT_LOG_MASK)
		return false;
		return -EINVAL;
	if (info->loglevel >= 8)
		return false;
		return -EINVAL;
	info->prefix[EBT_LOG_PREFIX_SIZE - 1] = '\0';
	return true;
	return 0;
}

struct tcpudphdr
+4 −4
Original line number Diff line number Diff line
@@ -43,14 +43,14 @@ static int ebt_mark_tg_check(const struct xt_tgchk_param *par)

	tmp = info->target | ~EBT_VERDICT_BITS;
	if (BASE_CHAIN && tmp == EBT_RETURN)
		return false;
		return -EINVAL;
	if (tmp < -NUM_STANDARD_TARGETS || tmp >= 0)
		return false;
		return -EINVAL;
	tmp = info->target & ~EBT_VERDICT_BITS;
	if (tmp != MARK_SET_VALUE && tmp != MARK_OR_VALUE &&
	    tmp != MARK_AND_VALUE && tmp != MARK_XOR_VALUE)
		return false;
	return true;
		return -EINVAL;
	return 0;
}
#ifdef CONFIG_COMPAT
struct compat_ebt_mark_t_info {
+2 −2
Original line number Diff line number Diff line
@@ -40,9 +40,9 @@ static int ebt_nflog_tg_check(const struct xt_tgchk_param *par)
	struct ebt_nflog_info *info = par->targinfo;

	if (info->flags & ~EBT_NFLOG_MASK)
		return false;
		return -EINVAL;
	info->prefix[EBT_NFLOG_PREFIX_SIZE - 1] = '\0';
	return true;
	return 0;
}

static struct xt_target ebt_nflog_tg_reg __read_mostly = {
Loading